netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch: netif_carrier_on()/off() for xircom_tulip_cb
@ 2004-02-15 14:04 Stefan Rompf
  2004-02-18 23:53 ` Jeff Garzik
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Rompf @ 2004-02-15 14:04 UTC (permalink / raw)
  To: netdev; +Cc: jgarzik, ionut

[-- Attachment #1: Type: text/plain, Size: 206 bytes --]

Hi,

the attached patch against 2.6.3rc2 enables link state notification for 
xircom_tulip_cb. Tested together with my suspend/resume patch, but should be 
independant. Please apply if it looks ok.

Stefan

[-- Attachment #2: xircom_tulip_cb_lw.diff --]
[-- Type: text/x-diff, Size: 1508 bytes --]

--- drivers/net/tulip/xircom_tulip_cb.c.pm	2004-02-15 13:07:49.000000000 +0100
+++ drivers/net/tulip/xircom_tulip_cb.c	2004-02-15 13:58:06.000000000 +0100
@@ -343,6 +343,7 @@ static void xircom_tx_timeout(struct net
 static void xircom_init_ring(struct net_device *dev);
 static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev);
 static int xircom_rx(struct net_device *dev);
+static void xircom_media_change(struct net_device *dev);
 static irqreturn_t xircom_interrupt(int irq, void *dev_instance, struct pt_regs *regs);
 static int xircom_close(struct net_device *dev);
 static struct net_device_stats *xircom_get_stats(struct net_device *dev);
@@ -789,6 +790,9 @@ xircom_up(struct net_device *dev)
 	/* Tell the net layer we're ready */
 	netif_start_queue (dev);
 
+	/* Check current media state */
+	xircom_media_change(dev);
+
 	if (xircom_debug > 2) {
 		printk(KERN_DEBUG "%s: Done xircom_up(), CSR0 %8.8x, CSR5 %8.8x CSR6 %8.8x.\n",
 			   dev->name, inl(ioaddr + CSR0), inl(ioaddr + CSR5),
@@ -1013,6 +1017,7 @@ static void xircom_media_change(struct n
 		       dev->name,
 		       tp->speed100 ? "100" : "10",
 		       tp->full_duplex ? "full" : "half");
+		netif_carrier_on(dev);
 		newcsr6 = csr6 & ~FullDuplexBit;
 		if (tp->full_duplex)
 			newcsr6 |= FullDuplexBit;
@@ -1020,6 +1025,7 @@ static void xircom_media_change(struct n
 			outl_CSR6(newcsr6, ioaddr + CSR6);
 	} else {
 		printk(KERN_DEBUG "%s: Link is down\n", dev->name);
+		netif_carrier_off(dev);
 	}
 }
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Patch: netif_carrier_on()/off() for xircom_tulip_cb
  2004-02-15 14:04 Patch: netif_carrier_on()/off() for xircom_tulip_cb Stefan Rompf
@ 2004-02-18 23:53 ` Jeff Garzik
  2004-02-20 16:21   ` Stefan Rompf
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jeff Garzik @ 2004-02-18 23:53 UTC (permalink / raw)
  To: Stefan Rompf; +Cc: netdev, ionut

Your two patches look OK to me, but they break my scripts.

Please resend patches that may be applied with "patch -p1",
not "patch -p0".

	Jeff

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Patch: netif_carrier_on()/off() for xircom_tulip_cb
  2004-02-18 23:53 ` Jeff Garzik
@ 2004-02-20 16:21   ` Stefan Rompf
  2004-02-25  1:01     ` Jeff Garzik
  2004-02-20 16:21   ` Stefan Rompf
  2004-02-20 16:23   ` Stefan Rompf
  2 siblings, 1 reply; 6+ messages in thread
From: Stefan Rompf @ 2004-02-20 16:21 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 125 bytes --]

Hi,

> Please resend patches that may be applied with "patch -p1",
> not "patch -p0".

ok., here's the first, suspend/resume

[-- Attachment #2: xircom_tulip_cb_pm.diff --]
[-- Type: text/x-diff, Size: 1519 bytes --]

--- jeffdir/drivers/net/tulip/xircom_tulip_cb.c.old	2004-02-14 14:33:03.000000000 +0100
+++ jeffdir/drivers/net/tulip/xircom_tulip_cb.c	2004-02-15 13:07:49.000000000 +0100
@@ -329,6 +329,9 @@ struct xircom_private {
 	int saved_if_port;
 	struct pci_dev *pdev;
 	spinlock_t lock;
+#ifdef CONFIG_PM
+	u32 pci_state[16];
+#endif
 };
 
 static int mdio_read(struct net_device *dev, int phy_id, int location);
@@ -749,6 +752,7 @@ xircom_up(struct net_device *dev)
 	long ioaddr = dev->base_addr;
 	int i;
 
+	xircom_init_ring(dev);
 	/* Clear the tx ring */
 	for (i = 0; i < TX_RING_SIZE; i++) {
 		tp->tx_skbuff[i] = 0;
@@ -801,8 +805,6 @@ xircom_open(struct net_device *dev)
 	if (request_irq(dev->irq, &xircom_interrupt, SA_SHIRQ, dev->name, dev))
 		return -EAGAIN;
 
-	xircom_init_ring(dev);
-
 	xircom_up(dev);
 	tp->open = 1;
 
@@ -1668,6 +1670,11 @@ static int xircom_suspend(struct pci_dev
 	printk(KERN_INFO "xircom_suspend(%s)\n", dev->name);
 	if (tp->open)
 		xircom_down(dev);
+
+	pci_save_state(pdev, tp->pci_state);
+	pci_disable_device(pdev);
+	pci_set_power_state(pdev, 3);
+
 	return 0;
 }
 
@@ -1678,6 +1685,10 @@ static int xircom_resume(struct pci_dev 
 	struct xircom_private *tp = dev->priv;
 	printk(KERN_INFO "xircom_resume(%s)\n", dev->name);
 
+	pci_set_power_state(pdev,0);
+	pci_enable_device(pdev);
+	pci_restore_state(pdev, tp->pci_state);
+
 	/* Bring the chip out of sleep mode.
 	   Caution: Snooze mode does not work with some boards! */
 	if (xircom_tbl[tp->chip_id].flags & HAS_ACPI)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Patch: netif_carrier_on()/off() for xircom_tulip_cb
  2004-02-18 23:53 ` Jeff Garzik
  2004-02-20 16:21   ` Stefan Rompf
@ 2004-02-20 16:21   ` Stefan Rompf
  2004-02-20 16:23   ` Stefan Rompf
  2 siblings, 0 replies; 6+ messages in thread
From: Stefan Rompf @ 2004-02-20 16:21 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev


> Please resend patches that may be applied with "patch -p1",
> not "patch -p0".

and here the netif_carrier stuff

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Patch: netif_carrier_on()/off() for xircom_tulip_cb
  2004-02-18 23:53 ` Jeff Garzik
  2004-02-20 16:21   ` Stefan Rompf
  2004-02-20 16:21   ` Stefan Rompf
@ 2004-02-20 16:23   ` Stefan Rompf
  2 siblings, 0 replies; 6+ messages in thread
From: Stefan Rompf @ 2004-02-20 16:23 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 152 bytes --]


> Please resend patches that may be applied with "patch -p1",
> not "patch -p0".

and here the netif_carrier-stuff, this time with attachment.

Stefan

[-- Attachment #2: xircom_tulip_cb_lw.diff --]
[-- Type: text/x-diff, Size: 1524 bytes --]

--- jeffdir/drivers/net/tulip/xircom_tulip_cb.c.pm	2004-02-15 13:07:49.000000000 +0100
+++ jeffdir/drivers/net/tulip/xircom_tulip_cb.c	2004-02-15 13:58:06.000000000 +0100
@@ -343,6 +343,7 @@ static void xircom_tx_timeout(struct net
 static void xircom_init_ring(struct net_device *dev);
 static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev);
 static int xircom_rx(struct net_device *dev);
+static void xircom_media_change(struct net_device *dev);
 static irqreturn_t xircom_interrupt(int irq, void *dev_instance, struct pt_regs *regs);
 static int xircom_close(struct net_device *dev);
 static struct net_device_stats *xircom_get_stats(struct net_device *dev);
@@ -789,6 +790,9 @@ xircom_up(struct net_device *dev)
 	/* Tell the net layer we're ready */
 	netif_start_queue (dev);
 
+	/* Check current media state */
+	xircom_media_change(dev);
+
 	if (xircom_debug > 2) {
 		printk(KERN_DEBUG "%s: Done xircom_up(), CSR0 %8.8x, CSR5 %8.8x CSR6 %8.8x.\n",
 			   dev->name, inl(ioaddr + CSR0), inl(ioaddr + CSR5),
@@ -1013,6 +1017,7 @@ static void xircom_media_change(struct n
 		       dev->name,
 		       tp->speed100 ? "100" : "10",
 		       tp->full_duplex ? "full" : "half");
+		netif_carrier_on(dev);
 		newcsr6 = csr6 & ~FullDuplexBit;
 		if (tp->full_duplex)
 			newcsr6 |= FullDuplexBit;
@@ -1020,6 +1025,7 @@ static void xircom_media_change(struct n
 			outl_CSR6(newcsr6, ioaddr + CSR6);
 	} else {
 		printk(KERN_DEBUG "%s: Link is down\n", dev->name);
+		netif_carrier_off(dev);
 	}
 }
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Patch: netif_carrier_on()/off() for xircom_tulip_cb
  2004-02-20 16:21   ` Stefan Rompf
@ 2004-02-25  1:01     ` Jeff Garzik
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff Garzik @ 2004-02-25  1:01 UTC (permalink / raw)
  To: Stefan Rompf; +Cc: netdev

applied both patches

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-02-25  1:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-15 14:04 Patch: netif_carrier_on()/off() for xircom_tulip_cb Stefan Rompf
2004-02-18 23:53 ` Jeff Garzik
2004-02-20 16:21   ` Stefan Rompf
2004-02-25  1:01     ` Jeff Garzik
2004-02-20 16:21   ` Stefan Rompf
2004-02-20 16:23   ` Stefan Rompf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).