Re: r8169.c

14 messages, 2 authors, 2004-12-07 · open the first message on its own page

Re: r8169.c

From: Dorn Hetzel <hidden>
Date: 2004-11-22 16:55:36

On Sat, Nov 20, 2004 at 01:29:46AM +0100, Francois Romieu wrote:
Dorn Hetzel [off-list ref] :

You have two options (or more) on top of 2.6.10-rc2:
- ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.10-rc2/2.6.10-rc2-mm2/2.6.10-rc2-mm2.bz2
- http://www.kernel.org/pub/linux/kernel/people/jgarzik/patchkits/2.6/2.6.10-rc2-netdev1.patch.bz2
I have gotten as far as rc2-mm2, which was a fairly complete failure.  After
just a couple of pings on the interface, the whole system started to freeze
up fairly hard.  Please see   http://www.hetzel.org/8169/rc2-mm2/   for a
set of information on the system state this time around.  The last two
lines in messages.txt are:

illyria kernel: NETDEV WATCHDOG: eth0: transmit timed out
illyria kernel: eth0: interrupt 0001 taken in poll

Then things go south pretty hard and fast...

I'll try the other patches on top of rc2-mm2 tonight and see if that turns
out any better :)
Once you have applied one of the patch above, the patch below will improve
your "transmit timed out" (please apply in order and enable NAPI):
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.10-rc2-mm1/r8169-250.patch
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.10-rc2-mm1/r8169-255.patch

If things perform better you may want to use bigger frames and apply as
well r8169-260.patch and r8169-265.patch.
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.10-rc2-mm1/r8169-260.patch
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.10-rc2-mm1/r8169-265.patch
Thanks again for all your help!

-Dorn
 

Re: r8169.c

From: Dorn Hetzel <hidden>
Date: 2004-11-23 13:27:25

On Sat, Nov 20, 2004 at 01:29:46AM +0100, Francois Romieu wrote:
quoted
Once you have applied one of the patch above, the patch below will improve
your "transmit timed out" (please apply in order and enable NAPI):
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.10-rc2-mm1/r8169-250.patch
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.10-rc2-mm1/r8169-255.patch

If things perform better you may want to use bigger frames and apply as
well r8169-260.patch and r8169-265.patch.
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.10-rc2-mm1/r8169-260.patch
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.10-rc2-mm1/r8169-265.patch
Stacked on these 4 patches and things seem much better :)

This is on an Abit AA8 Duramax motherboard.

-Dorn
 

Re: r8169.c

From: Francois Romieu <romieu@fr.zoreil.com>
Date: 2004-11-23 20:24:49

Dorn Hetzel [off-list ref] :
[...]
[...]
[...]
[...]
[...]
[...]
[...]
[...]
[...]
Stacked on these 4 patches and things seem much better :)
Did you change the compiler as well ?

If yes, it would be nice to know if the system performs correctly when built with
the previous compiler (feel free to answer #1 only if you are busy :o) ).

--
Ueimor

Re: r8169.c

From: Dorn Hetzel <hidden>
Date: 2004-11-26 19:55:07

On Tue, Nov 23, 2004 at 08:47:40PM +0100, Francois Romieu wrote:
Dorn Hetzel [off-list ref] :
[...]
quoted
Stacked on these 4 patches and things seem much better :)
Did you change the compiler as well ?

If yes, it would be nice to know if the system performs correctly when built with
the previous compiler (feel free to answer #1 only if you are busy :o) ).
Yes, I moved to gcc 3.4.3.

I'm out of town for the Thanksgiving holiday, but I will revert the compiler
and test again as soon as I get home (early next week).

Do you know when the 250-265 patches will be merged and into which train?

Best Regards,

-Dorn
 
--
Ueimor
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Re: r8169.c

From: Dorn Hetzel <hidden>
Date: 2004-11-26 19:55:08

On Tue, Nov 23, 2004 at 08:47:40PM +0100, Francois Romieu wrote:
Dorn Hetzel [off-list ref] :
quoted
Stacked on these 4 patches and things seem much better :)
Did you change the compiler as well ?

If yes, it would be nice to know if the system performs correctly when built with
the previous compiler (feel free to answer #1 only if you are busy :o) ).
I went ahead and remotely rebuilt using gcc 2.95.4 and upon reboot it
worked long enough to ssh in and then it failed.  So it sounds like the
version of gcc DOES make a difference :)

I will report further details when I get home and can access the box
again ;)

-Dorn
 
--
Ueimor
-

Re: r8169.c

From: Francois Romieu <romieu@fr.zoreil.com>
Date: 2004-11-26 23:23:03

Dorn Hetzel [off-list ref] :
[...]
I went ahead and remotely rebuilt using gcc 2.95.4 and upon reboot it
worked long enough to ssh in and then it failed.  So it sounds like the
version of gcc DOES make a difference :)
Ok, I'll have to audit the driver for the typical inline assembler +
arithmetic ops which 2.95.x dislikes.

--
Ueimor

Re: r8169.c

From: Dorn Hetzel <hidden>
Date: 2004-11-27 02:02:51

It did *build* well enough not to blow up the kernel build with 2.95.4,
it just failed in use...

On Thu, Nov 25, 2004 at 09:54:11PM +0100, Francois Romieu wrote:
Dorn Hetzel [off-list ref] :
[...]
quoted
I went ahead and remotely rebuilt using gcc 2.95.4 and upon reboot it
worked long enough to ssh in and then it failed.  So it sounds like the
version of gcc DOES make a difference :)
Ok, I'll have to audit the driver for the typical inline assembler +
arithmetic ops which 2.95.x dislikes.

--
Ueimor

Re: r8169.c

From: Dorn Hetzel <hidden>
Date: 2004-12-05 22:32:04

On Mon, Nov 22, 2004 at 01:13:07PM -0500, Dorn Hetzel wrote:
On Sat, Nov 20, 2004 at 01:29:46AM +0100, Francois Romieu wrote:
quoted
Once you have applied one of the patch above, the patch below will improve
your "transmit timed out" (please apply in order and enable NAPI):
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.10-rc2-mm1/r8169-250.patch
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.10-rc2-mm1/r8169-255.patch

If things perform better you may want to use bigger frames and apply as
well r8169-260.patch and r8169-265.patch.
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.10-rc2-mm1/r8169-260.patch
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.10-rc2-mm1/r8169-265.patch
I was wondering if the above 4 patches have made it into one of the
rc? releases, or at least a rc?-mm?  ?

Regards,

-Dorn

Re: r8169.c

From: Francois Romieu <romieu@fr.zoreil.com>
Date: 2004-12-05 23:38:58

Dorn Hetzel [off-list ref] :
[...]
I was wondering if the above 4 patches have made it into one of the
rc? releases, or at least a rc?-mm?  ?
They need to apply on top of -netdev which is included in -mm.
I'll send the patch for inclusion in -mm so there is no need for
Jeff to hurry.

--
Ueimor

[patch 1/5] r8169: missing netif_poll_enable and irq ack

From: Francois Romieu <romieu@fr.zoreil.com>
Date: 2004-12-07 00:14:19

- (noticed by Jon D. Mason) rtl8169_wait_for_quiescence() needs to disable
  the NAPI processing but it has no reason to lock any part of the driver
  which would try to do the same at a later time. Let's reenable NAPI
  processing as soon as possible.
- properly ack any aborted interruption: a reset of the device is not
  always enough.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>

diff -puN drivers/net/r8169.c~r8169-250 drivers/net/r8169.c
--- linux-2.6.10-rc2/drivers/net/r8169.c~r8169-250	2004-12-05 22:36:14.592843434 +0100
+++ linux-2.6.10-rc2-fr/drivers/net/r8169.c	2004-12-05 22:36:14.596842782 +0100
@@ -1742,10 +1742,19 @@ static void rtl8169_schedule_work(struct
 
 static void rtl8169_wait_for_quiescence(struct net_device *dev)
 {
+	struct rtl8169_private *tp = netdev_priv(dev);
+	void __iomem *ioaddr = tp->mmio_addr;
+
 	synchronize_irq(dev->irq);
 
 	/* Wait for any pending NAPI task to complete */
 	netif_poll_disable(dev);
+
+	RTL_W16(IntrMask, 0x0000);
+
+	RTL_W16(IntrStatus, 0xffff);
+
+	netif_poll_enable(dev);
 }
 
 static void rtl8169_reinit_task(void *_data)
_

[patch 2/5] r8169: C 101

From: Francois Romieu <romieu@fr.zoreil.com>
Date: 2004-12-07 00:15:35

Back to C101 and code which gives the expected result.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>

diff -puN drivers/net/r8169.c~r8169-255 drivers/net/r8169.c
--- linux-2.6.10-rc2/drivers/net/r8169.c~r8169-255	2004-12-05 22:36:19.717006983 +0100
+++ linux-2.6.10-rc2-fr/drivers/net/r8169.c	2004-12-05 22:36:19.721006330 +0100
@@ -1978,7 +1978,7 @@ static void rtl8169_pcierr_interrupt(str
 		PCI_STATUS_REC_TARGET_ABORT | PCI_STATUS_SIG_TARGET_ABORT));
 
 	/* The infamous DAC f*ckup only happens at boot time */
-	if ((tp->cp_cmd & PCIDAC) && (tp->dirty_rx == tp->cur_rx == 0)) {
+	if ((tp->cp_cmd & PCIDAC) && !tp->dirty_rx && !tp->cur_rx) {
 		printk(KERN_INFO PFX "%s: disabling PCI DAC.\n", dev->name);
 		tp->cp_cmd &= ~PCIDAC;
 		RTL_W16(CPlusCmd, tp->cp_cmd);
_

[patch 3/5] r8169: Large Send enablement

From: Francois Romieu <romieu@fr.zoreil.com>
Date: 2004-12-07 00:16:21

Large Send enablement.

Acked-by: Francois Romieu <romieu@fr.zoreil.com>
Signed-off-by: Jon Mason <redacted>

diff -puN drivers/net/r8169.c~r8169-260 drivers/net/r8169.c
--- linux-2.6.10-rc2/drivers/net/r8169.c~r8169-260	2004-12-05 22:36:22.079621298 +0100
+++ linux-2.6.10-rc2-fr/drivers/net/r8169.c	2004-12-05 22:36:22.084620482 +0100
@@ -112,7 +112,7 @@ static int multicast_filter_limit = 32;
 #define RX_DMA_BURST	6	/* Maximum PCI burst, '6' is 1024 */
 #define TX_DMA_BURST	6	/* Maximum PCI burst, '6' is 1024 */
 #define EarlyTxThld 	0x3F	/* 0x3F means NO early transmit */
-#define RxPacketMaxSize	0x0800	/* Maximum size supported is 16K-1 */
+#define RxPacketMaxSize	0x3FE8	/* 16K - 1 - ETH_HLEN - VLAN - CRC */
 #define InterFrameGap	0x03	/* 3 means InterFrameGap = the shortest one */
 
 #define R8169_REGS_SIZE		256
@@ -426,6 +426,9 @@ static void rtl8169_tx_timeout(struct ne
 static struct net_device_stats *rtl8169_get_stats(struct net_device *netdev);
 static int rtl8169_rx_interrupt(struct net_device *, struct rtl8169_private *,
 				void __iomem *);
+static int rtl8169_change_mtu(struct net_device *netdev, int new_mtu);
+static void rtl8169_down(struct net_device *dev);
+
 #ifdef CONFIG_R8169_NAPI
 static int rtl8169_poll(struct net_device *dev, int *budget);
 #endif
@@ -1237,8 +1240,6 @@ rtl8169_init_board(struct pci_dev *pdev,
 	}
 	tp->chipset = i;
 
-	tp->rx_buf_sz = RX_BUF_SIZE;
-
 	*ioaddr_out = ioaddr;
 	*dev_out = dev;
 out:
@@ -1320,6 +1321,7 @@ rtl8169_init_one(struct pci_dev *pdev, c
 	dev->watchdog_timeo = RTL8169_TX_TIMEOUT;
 	dev->irq = pdev->irq;
 	dev->base_addr = (unsigned long) ioaddr;
+	dev->change_mtu = rtl8169_change_mtu;
 
 #ifdef CONFIG_R8169_NAPI
 	dev->poll = rtl8169_poll;
@@ -1448,13 +1450,22 @@ static int rtl8169_resume(struct pci_dev
                                                                                 
 #endif /* CONFIG_PM */
 
-static int
-rtl8169_open(struct net_device *dev)
+static void rtl8169_set_rxbufsize(struct rtl8169_private *tp,
+				  struct net_device *dev)
+{
+	unsigned int mtu = dev->mtu;
+
+	tp->rx_buf_sz = (mtu > RX_BUF_SIZE) ? mtu + ETH_HLEN + 8 : RX_BUF_SIZE;
+}
+
+static int rtl8169_open(struct net_device *dev)
 {
 	struct rtl8169_private *tp = netdev_priv(dev);
 	struct pci_dev *pdev = tp->pci_dev;
 	int retval;
 
+	rtl8169_set_rxbufsize(tp, dev);
+
 	retval =
 	    request_irq(dev->irq, rtl8169_interrupt, SA_SHIRQ, dev->name, dev);
 	if (retval < 0)
@@ -1534,8 +1545,8 @@ rtl8169_hw_start(struct net_device *dev)
 	RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
 	RTL_W8(EarlyTxThres, EarlyTxThld);
 
-	// For gigabit rtl8169
-	RTL_W16(RxMaxSize, RxPacketMaxSize);
+	// For gigabit rtl8169, MTU + header + CRC + VLAN
+	RTL_W16(RxMaxSize, tp->rx_buf_sz);
 
 	// Set Rx Config register
 	i = rtl8169_rx_config |
@@ -1576,6 +1587,37 @@ rtl8169_hw_start(struct net_device *dev)
 	netif_start_queue(dev);
 }
 
+static int rtl8169_change_mtu(struct net_device *dev, int new_mtu)
+{
+	struct rtl8169_private *tp = netdev_priv(dev);
+	int ret = 0;
+
+	if (new_mtu < ETH_ZLEN || new_mtu > RxPacketMaxSize)
+		return -EINVAL;
+	
+	dev->mtu = new_mtu;
+
+	if (!netif_running(dev)) 
+		goto out;
+
+	rtl8169_down(dev);
+	
+	rtl8169_set_rxbufsize(tp, dev);
+	
+	ret = rtl8169_init_ring(dev);
+	if (ret < 0)
+		goto out;
+
+	rtl8169_hw_start(dev);
+	
+	netif_poll_enable(dev);
+
+	rtl8169_request_timer(dev);
+
+out:
+	return ret;
+}
+
 static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc)
 {
 	desc->addr = 0x0badbadbadbadbadull;
@@ -2264,19 +2306,17 @@ static int rtl8169_poll(struct net_devic
 }
 #endif
 
-static int
-rtl8169_close(struct net_device *dev)
+static void rtl8169_down(struct net_device *dev)
 {
 	struct rtl8169_private *tp = netdev_priv(dev);
-	struct pci_dev *pdev = tp->pci_dev;
 	void __iomem *ioaddr = tp->mmio_addr;
 
+	rtl8169_delete_timer(dev);
+
 	netif_stop_queue(dev);
 
 	flush_scheduled_work();
 
-	rtl8169_delete_timer(dev);
-
 	spin_lock_irq(&tp->lock);
 
 	/* Stop the chip's Tx and Rx DMA processes. */
@@ -2291,13 +2331,27 @@ rtl8169_close(struct net_device *dev)
 
 	spin_unlock_irq(&tp->lock);
 
-	free_irq(dev->irq, dev);
+	synchronize_irq(dev->irq);
 
 	netif_poll_disable(dev);
 
+	/* Give a racing hard_start_xmit a few cycles to complete. */
+	set_current_state(TASK_UNINTERRUPTIBLE);
+	schedule_timeout(1);
+
 	rtl8169_tx_clear(tp);
 
 	rtl8169_rx_clear(tp);
+}
+
+static int rtl8169_close(struct net_device *dev)
+{
+	struct rtl8169_private *tp = netdev_priv(dev);
+	struct pci_dev *pdev = tp->pci_dev;
+
+	rtl8169_down(dev);
+	
+	free_irq(dev->irq, dev);
 
 	pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray,
 			    tp->RxPhyAddr);
_

[patch 4/5] r8169: reduce max MTU for large frames

From: Francois Romieu <romieu@fr.zoreil.com>
Date: 2004-12-07 00:17:22

The device does not support the whole mtu range it claims. Experimenting
with the Tx threshold and/or the PCI burst size does not seem to improve
the behavior.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>

diff -puN drivers/net/r8169.c~r8169-265 drivers/net/r8169.c
--- linux-2.6.10-rc2/drivers/net/r8169.c~r8169-265	2004-12-05 22:36:25.000000000 +0100
+++ linux-2.6.10-rc2-fr/drivers/net/r8169.c	2004-12-07 00:54:48.313082500 +0100
@@ -112,7 +112,8 @@ static int multicast_filter_limit = 32;
 #define RX_DMA_BURST	6	/* Maximum PCI burst, '6' is 1024 */
 #define TX_DMA_BURST	6	/* Maximum PCI burst, '6' is 1024 */
 #define EarlyTxThld 	0x3F	/* 0x3F means NO early transmit */
-#define RxPacketMaxSize	0x3FE8	/* 16K - 1 - ETH_HLEN - VLAN - CRC */
+#define RxPacketMaxSize	0x3FE8	/* 16K - 1 - ETH_HLEN - VLAN - CRC... */
+#define SafeMtu		0x1c20	/* ... actually life sucks beyond ~7k */
 #define InterFrameGap	0x03	/* 3 means InterFrameGap = the shortest one */
 
 #define R8169_REGS_SIZE		256
@@ -1592,9 +1593,9 @@ static int rtl8169_change_mtu(struct net
 	struct rtl8169_private *tp = netdev_priv(dev);
 	int ret = 0;
 
-	if (new_mtu < ETH_ZLEN || new_mtu > RxPacketMaxSize)
+	if (new_mtu < ETH_ZLEN || new_mtu > SafeMtu)
 		return -EINVAL;
-	
+
 	dev->mtu = new_mtu;
 
 	if (!netif_running(dev)) 
_

[patch 5/5] r8169: oversized driver field for ethtool

From: Francois Romieu <romieu@fr.zoreil.com>
Date: 2004-12-07 00:22:08

Reported by Richard Dawe [off-list ref]:
- RTL8169_DRIVER_NAME contains more than the 32 characters allowed for the
  driver field;
- remove RTL8169_DRIVER_NAME as it is only used once.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>

diff -puN drivers/net/r8169.c~r8169-280 drivers/net/r8169.c
--- linux-2.6.10-rc2/drivers/net/r8169.c~r8169-280	2004-12-07 00:56:46.864676094 +0100
+++ linux-2.6.10-rc2-fr/drivers/net/r8169.c	2004-12-07 00:57:11.031721347 +0100
@@ -63,7 +63,6 @@ VERSION 1.6LK	<2004/04/14>
 
 #define RTL8169_VERSION "1.6LK"
 #define MODULENAME "r8169"
-#define RTL8169_DRIVER_NAME   MODULENAME " Gigabit Ethernet driver " RTL8169_VERSION
 #define PFX MODULENAME ": "
 
 #ifdef RTL8169_DEBUG
@@ -564,8 +563,8 @@ static void rtl8169_get_drvinfo(struct n
 {
 	struct rtl8169_private *tp = netdev_priv(dev);
 
-	strcpy(info->driver, RTL8169_DRIVER_NAME);
-	strcpy(info->version, RTL8169_VERSION );
+	strcpy(info->driver, MODULENAME);
+	strcpy(info->version, RTL8169_VERSION);
 	strcpy(info->bus_info, pci_name(tp->pci_dev));
 }
 
@@ -1282,7 +1281,8 @@ rtl8169_init_one(struct pci_dev *pdev, c
 	board_idx++;
 
 	if (!printed_version) {
-		printk(KERN_INFO RTL8169_DRIVER_NAME " loaded\n");
+		printk(KERN_INFO "%s Gigabit Ethernet driver %s loaded\n",
+		       MODULENAME, RTL8169_VERSION);
 		printed_version = 1;
 	}
 
_
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help