netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFT] Realtek 8168 ethernet support
@ 2006-06-01 20:02 Daniel Drake
  2006-06-01 22:24 ` Francois Romieu
  2006-06-08 21:31 ` Randy.Dunlap
  0 siblings, 2 replies; 18+ messages in thread
From: Daniel Drake @ 2006-06-01 20:02 UTC (permalink / raw)
  To: netdev

I've produced this patch which should allow the r8169 driver to work with the
new Realtek 8168 chips. These are found in PCI-Express form and onboard some
newer motherboards.

Does anyone own this hardware? I'm looking for someone to test it before I
send it on.

Signed-off-by: Daniel Drake <dsd@gentoo.org>

Index: linux/drivers/net/r8169.c
===================================================================
--- linux.orig/drivers/net/r8169.c
+++ linux/drivers/net/r8169.c
@@ -184,6 +184,7 @@ static const struct {
 
 static struct pci_device_id rtl8169_pci_tbl[] = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK,	0x8169), },
+	{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK,	0x8168), },
 	{ PCI_DEVICE(PCI_VENDOR_ID_DLINK,	0x4300), },
 	{ PCI_DEVICE(0x16ec,			0x0116), },
 	{ PCI_VENDOR_ID_LINKSYS,		0x1032, PCI_ANY_ID, 0x0024, },
@@ -1398,6 +1399,7 @@ rtl8169_init_board(struct pci_dev *pdev,
 	struct net_device *dev;
 	struct rtl8169_private *tp;
 	int rc = -ENOMEM, i, acpi_idle_state = 0, pm_cap;
+	u32 mmio_base = 0;
 
 	assert(ioaddr_out != NULL);
 
@@ -1442,20 +1444,24 @@ rtl8169_init_board(struct pci_dev *pdev,
 		}
 	}
 
-	/* make sure PCI base addr 1 is MMIO */
-	if (!(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) {
-		if (netif_msg_probe(tp)) {
-			printk(KERN_ERR PFX
-			       "region #1 not an MMIO resource, aborting\n");
-		}
-		rc = -ENODEV;
-		goto err_out_mwi;
+	/* find MMIO resource: this varies between 8168 and 8169 */
+	for (i = 0; i < 5; i++) {
+		/* check resource type */
+		if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM))
+			continue;
+
+		/* check for weird/broken PCI region reporting */
+		if (pci_resource_len(pdev, i) < R8169_REGS_SIZE)
+			continue;
+
+		mmio_base = pci_resource_start(pdev, i);
+		break;
 	}
-	/* check for weird/broken PCI region reporting */
-	if (pci_resource_len(pdev, 1) < R8169_REGS_SIZE) {
+
+	if (mmio_base == 0) {
 		if (netif_msg_probe(tp)) {
 			printk(KERN_ERR PFX
-			       "Invalid PCI region size(s), aborting\n");
+			       "couldn't find valid MMIO resource, aborting\n");
 		}
 		rc = -ENODEV;
 		goto err_out_mwi;
@@ -1490,7 +1496,7 @@ rtl8169_init_board(struct pci_dev *pdev,
 	pci_set_master(pdev);
 
 	/* ioremap MMIO region */
-	ioaddr = ioremap(pci_resource_start(pdev, 1), R8169_REGS_SIZE);
+	ioaddr = ioremap(mmio_base, R8169_REGS_SIZE);
 	if (ioaddr == NULL) {
 		if (netif_msg_probe(tp))
 			printk(KERN_ERR PFX "cannot remap MMIO, aborting\n");

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

* Re: [RFT] Realtek 8168 ethernet support
  2006-06-01 20:02 [RFT] Realtek 8168 ethernet support Daniel Drake
@ 2006-06-01 22:24 ` Francois Romieu
  2006-06-02  1:38   ` Jeff Garzik
  2006-06-08 21:31 ` Randy.Dunlap
  1 sibling, 1 reply; 18+ messages in thread
From: Francois Romieu @ 2006-06-01 22:24 UTC (permalink / raw)
  To: Daniel Drake; +Cc: netdev

Daniel Drake <dsd@gentoo.org> :
[...]
> @@ -1442,20 +1444,24 @@ rtl8169_init_board(struct pci_dev *pdev,
>  		}
>  	}
>  
> -	/* make sure PCI base addr 1 is MMIO */
> -	if (!(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) {
> -		if (netif_msg_probe(tp)) {
> -			printk(KERN_ERR PFX
> -			       "region #1 not an MMIO resource, aborting\n");
> -		}
> -		rc = -ENODEV;
> -		goto err_out_mwi;
> +	/* find MMIO resource: this varies between 8168 and 8169 */
> +	for (i = 0; i < 5; i++) {

I'd rather use pci_device_id->driver_data but it's an option.

Btw a 0x8167 may be encountered too.

A diff between latest versions of Realtek's code suggests that 
rtl_chip_info and mac_info need an update as well.

-- 
Ueimor

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

* Re: [RFT] Realtek 8168 ethernet support
  2006-06-01 22:24 ` Francois Romieu
@ 2006-06-02  1:38   ` Jeff Garzik
  0 siblings, 0 replies; 18+ messages in thread
From: Jeff Garzik @ 2006-06-02  1:38 UTC (permalink / raw)
  To: Francois Romieu; +Cc: Daniel Drake, netdev

On Fri, Jun 02, 2006 at 12:24:37AM +0200, Francois Romieu wrote:
> I'd rather use pci_device_id->driver_data but it's an option.

I would prefer this, too.

	Jeff




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

* Re: [RFT] Realtek 8168 ethernet support
  2006-06-01 20:02 [RFT] Realtek 8168 ethernet support Daniel Drake
  2006-06-01 22:24 ` Francois Romieu
@ 2006-06-08 21:31 ` Randy.Dunlap
  2006-06-08 23:41   ` Francois Romieu
  2006-06-09  2:40   ` Jeff Garzik
  1 sibling, 2 replies; 18+ messages in thread
From: Randy.Dunlap @ 2006-06-08 21:31 UTC (permalink / raw)
  To: Daniel Drake; +Cc: netdev

On Thu,  1 Jun 2006 21:02:00 +0100 (BST) Daniel Drake wrote:

> I've produced this patch which should allow the r8169 driver to work with the
> new Realtek 8168 chips. These are found in PCI-Express form and onboard some
> newer motherboards.
> 
> Does anyone own this hardware? I'm looking for someone to test it before I
> send it on.
> 
> Signed-off-by: Daniel Drake <dsd@gentoo.org>
> 
> Index: linux/drivers/net/r8169.c
> ===================================================================
> --- linux.orig/drivers/net/r8169.c
> +++ linux/drivers/net/r8169.c
> @@ -184,6 +184,7 @@ static const struct {
>  
>  static struct pci_device_id rtl8169_pci_tbl[] = {
>  	{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK,	0x8169), },
> +	{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK,	0x8168), },
>  	{ PCI_DEVICE(PCI_VENDOR_ID_DLINK,	0x4300), },
>  	{ PCI_DEVICE(0x16ec,			0x0116), },
>  	{ PCI_VENDOR_ID_LINKSYS,		0x1032, PCI_ANY_ID, 0x0024, },


The (GPL) RealTek driver (from
http://www.realtek.com.tw/downloads/downloads1-3.aspx?lineid=1&famid=4&series=2003072&Software=True)
contains this PCI device table:

static struct pci_device_id r1000_pci_tbl[] __devinitdata = {
	{ 0x10ec, 0x8169, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
	{ 0x10ec, 0x8167, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
	{ 0x10ec, 0x8168, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
	{ 0x10ec, 0x8136, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
	{0,}
};

Any reason not to include all of those?
Conversely, any reason to use the RealTek r1000 driver?


> @@ -1398,6 +1399,7 @@ rtl8169_init_board(struct pci_dev *pdev,
>  	struct net_device *dev;
>  	struct rtl8169_private *tp;
>  	int rc = -ENOMEM, i, acpi_idle_state = 0, pm_cap;
> +	u32 mmio_base = 0;
>  
>  	assert(ioaddr_out != NULL);
>  
> @@ -1442,20 +1444,24 @@ rtl8169_init_board(struct pci_dev *pdev,
>  		}
>  	}
>  
> -	/* make sure PCI base addr 1 is MMIO */
> -	if (!(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) {
> -		if (netif_msg_probe(tp)) {
> -			printk(KERN_ERR PFX
> -			       "region #1 not an MMIO resource, aborting\n");
> -		}
> -		rc = -ENODEV;
> -		goto err_out_mwi;
> +	/* find MMIO resource: this varies between 8168 and 8169 */
> +	for (i = 0; i < 5; i++) {
> +		/* check resource type */
> +		if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM))
> +			continue;
> +
> +		/* check for weird/broken PCI region reporting */
> +		if (pci_resource_len(pdev, i) < R8169_REGS_SIZE)
> +			continue;
> +
> +		mmio_base = pci_resource_start(pdev, i);
> +		break;
>  	}
> -	/* check for weird/broken PCI region reporting */
> -	if (pci_resource_len(pdev, 1) < R8169_REGS_SIZE) {
> +
> +	if (mmio_base == 0) {
>  		if (netif_msg_probe(tp)) {
>  			printk(KERN_ERR PFX
> -			       "Invalid PCI region size(s), aborting\n");
> +			       "couldn't find valid MMIO resource, aborting\n");
>  		}
>  		rc = -ENODEV;
>  		goto err_out_mwi;
> @@ -1490,7 +1496,7 @@ rtl8169_init_board(struct pci_dev *pdev,
>  	pci_set_master(pdev);
>  
>  	/* ioremap MMIO region */
> -	ioaddr = ioremap(pci_resource_start(pdev, 1), R8169_REGS_SIZE);
> +	ioaddr = ioremap(mmio_base, R8169_REGS_SIZE);
>  	if (ioaddr == NULL) {
>  		if (netif_msg_probe(tp))
>  			printk(KERN_ERR PFX "cannot remap MMIO, aborting\n");
> -

---
~Randy

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

* Re: [RFT] Realtek 8168 ethernet support
  2006-06-08 21:31 ` Randy.Dunlap
@ 2006-06-08 23:41   ` Francois Romieu
  2006-06-09  2:40   ` Jeff Garzik
  1 sibling, 0 replies; 18+ messages in thread
From: Francois Romieu @ 2006-06-08 23:41 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: Daniel Drake, netdev

Randy.Dunlap <rdunlap@xenotime.net> :
[...]
> static struct pci_device_id r1000_pci_tbl[] __devinitdata = {
> 	{ 0x10ec, 0x8169, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
> 	{ 0x10ec, 0x8167, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
> 	{ 0x10ec, 0x8168, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
> 	{ 0x10ec, 0x8136, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
> 	{0,}
> };
> 
> Any reason not to include all of those?

Nothing worrying:
- 0x8167 and 0x8168 use a different PCI region;
- some phy differences. They appear when the r1000 driver is
  compared to the previous r8169 driver from realtek.

I'll pack it with other changes.

> Conversely, any reason to use the RealTek r1000 driver?

Feel free to read it and make your own mind.

-- 
Ueimor

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

* Re: [RFT] Realtek 8168 ethernet support
  2006-06-08 21:31 ` Randy.Dunlap
  2006-06-08 23:41   ` Francois Romieu
@ 2006-06-09  2:40   ` Jeff Garzik
  2006-06-09  2:49     ` Randy.Dunlap
  2006-06-09 18:33     ` Francois Romieu
  1 sibling, 2 replies; 18+ messages in thread
From: Jeff Garzik @ 2006-06-09  2:40 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: Daniel Drake, netdev

Randy.Dunlap wrote:
> Conversely, any reason to use the RealTek r1000 driver?

FWIW, RealTek emailed me about merging r1000.  I suggested that, if the 
register sets were similar, that r8169 should be updated instead, to 
preserve compatibility with existing users (and not lose existing work).

	Jeff



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

* Re: [RFT] Realtek 8168 ethernet support
  2006-06-09  2:40   ` Jeff Garzik
@ 2006-06-09  2:49     ` Randy.Dunlap
  2006-06-09 18:33     ` Francois Romieu
  1 sibling, 0 replies; 18+ messages in thread
From: Randy.Dunlap @ 2006-06-09  2:49 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: dsd, netdev

On Thu, 08 Jun 2006 22:40:05 -0400 Jeff Garzik wrote:

> Randy.Dunlap wrote:
> > Conversely, any reason to use the RealTek r1000 driver?
> 
> FWIW, RealTek emailed me about merging r1000.  I suggested that, if the 
> register sets were similar, that r8169 should be updated instead, to 
> preserve compatibility with existing users (and not lose existing work).

Sounds good to me.  I'm not terribly interested in seeing
multiple drivers for the same hardware in the kernel tree.

---
~Randy

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

* Re: [RFT] Realtek 8168 ethernet support
  2006-06-09  2:40   ` Jeff Garzik
  2006-06-09  2:49     ` Randy.Dunlap
@ 2006-06-09 18:33     ` Francois Romieu
  2006-06-09 18:48       ` Jeff Garzik
  1 sibling, 1 reply; 18+ messages in thread
From: Francois Romieu @ 2006-06-09 18:33 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Randy.Dunlap, Daniel Drake, netdev

Jeff Garzik <jeff@garzik.org> :
> Randy.Dunlap wrote:
> >Conversely, any reason to use the RealTek r1000 driver?
> 
> FWIW, RealTek emailed me about merging r1000.  I suggested that, if the 

Which one ?

r1000_n.c where #define RELEASE_DATE "2006/02/23"

-- 
Ueimor

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

* Re: [RFT] Realtek 8168 ethernet support
  2006-06-09 18:33     ` Francois Romieu
@ 2006-06-09 18:48       ` Jeff Garzik
  2006-06-10 12:05         ` Francois Romieu
  0 siblings, 1 reply; 18+ messages in thread
From: Jeff Garzik @ 2006-06-09 18:48 UTC (permalink / raw)
  To: Francois Romieu; +Cc: Randy.Dunlap, Daniel Drake, netdev

Francois Romieu wrote:
> Jeff Garzik <jeff@garzik.org> :
>> Randy.Dunlap wrote:
>>> Conversely, any reason to use the RealTek r1000 driver?
>> FWIW, RealTek emailed me about merging r1000.  I suggested that, if the 
> 
> Which one ?
> 
> r1000_n.c where #define RELEASE_DATE "2006/02/23"

They didn't say.  Just "r1000"

	Jeff




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

* Re: [RFT] Realtek 8168 ethernet support
  2006-06-09 18:48       ` Jeff Garzik
@ 2006-06-10 12:05         ` Francois Romieu
  2006-06-10 22:48           ` Francois Romieu
  0 siblings, 1 reply; 18+ messages in thread
From: Francois Romieu @ 2006-06-10 12:05 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Randy.Dunlap, Daniel Drake, netdev

Jeff Garzik <jeff@garzik.org> :
> Francois Romieu wrote:
> >Jeff Garzik <jeff@garzik.org> :
> >>Randy.Dunlap wrote:
> >>>Conversely, any reason to use the RealTek r1000 driver?
> >>FWIW, RealTek emailed me about merging r1000.  I suggested that, if the 
> >
> >Which one ?
> >
> >r1000_n.c where #define RELEASE_DATE "2006/02/23"
> 
> They didn't say.  Just "r1000"

Can you ask your Realtek person if he is really sure about the following
snippet in r1000_n.c::r1000_init_one:

		if((priv->mcfg!=MCFG_METHOD_13)&&(priv->mcfg!=MCFG_METHOD_14)&&(priv->mcfg!=MCFG_METHOD_15))
			printk("This Realtek NIC doesn't support 1000Mbps\n");
		else
			Cap1000 = PHY_Cap_1000_Full|PHY_Cap_1000_Half;

-> in forced 1000 mode, 1000_{Half/Full} would only be written to the
   advertisement register for MCFG_METHOD_1{3/4/5}. It excludes all
   the adapters that the in-kernel driver support (huh ?).

Later in the same function:
[...]
	if(( priv->mcfg == MCFG_METHOD_11 )||( priv->mcfg == MCFG_METHOD_12 ))
		printk("Realtek RTL8168/8111 Family PCI-E Gigabit Ethernet Network Adapter\n");
	else if((priv->mcfg==MCFG_METHOD_13)||(priv->mcfg==MCFG_METHOD_14)||(priv->mcfg==MCFG_METHOD_15))
		printk("Realtek RTL8139/810x Family Fast Ethernet Network Adapter\n");

-> the != ... && ... != test above seems inverted.

Btw, it would be nice if he could confirm that the 0x10ec/0x8129 ID
sent by Yoichi Yuasa is really allowed (and not a random bitflip).

-- 
Ueimor

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

* Re: [RFT] Realtek 8168 ethernet support
  2006-06-10 12:05         ` Francois Romieu
@ 2006-06-10 22:48           ` Francois Romieu
  2006-06-11 23:30             ` Francois Romieu
  0 siblings, 1 reply; 18+ messages in thread
From: Francois Romieu @ 2006-06-10 22:48 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Randy.Dunlap, Daniel Drake, netdev

Francois Romieu <romieu@fr.zoreil.com> :
[...]
> -> the != ... && ... != test above seems inverted.

Answering to myself: yes, it is. The 8100 and 8101 are PCI Express
fast ethernet only (but they should do 802.1q, go figure).

-- 
Ueimor

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

* Re: [RFT] Realtek 8168 ethernet support
  2006-06-10 22:48           ` Francois Romieu
@ 2006-06-11 23:30             ` Francois Romieu
  2006-06-12 10:30               ` Mourad De Clerck
  2006-07-18 22:14               ` Francois Romieu
  0 siblings, 2 replies; 18+ messages in thread
From: Francois Romieu @ 2006-06-11 23:30 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Randy.Dunlap, Daniel Drake, netdev

The patch below agaisnt 2.6.17-rc6 includes the following changes:

commit 3072cc0aba3ac0c944e196a63c4154ca5746ec0b

    r8169: sync with vendor's driver
    
    - add several PCI ID for the PCI-E adapters ;
    - new identification strings ;
    - the RTL_GIGA_MAC_VER_ defines have been renamed to closely match the
      out-of-tree driver. It makes the comparison less hairy ;
    - various magic ;
    - the PCI region for the device with PCI ID 0x8136 is guessed.
      Explanation: the in-kernel Linux driver is written to allow MM register
      accesses and avoid the IO tax. The relevant BAR register was found at
      base address 1 for the plain-old PCI 8169. User reported lspci show that
      it is found at base address 2 for the new Gigabit PCI-E 816{8/9}.
      Typically:
      01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.: Unknown device 8168 (rev 01)
              Subsystem: Unknown device 1631:e015
              Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
              Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
              Latency: 0, cache line size 20
              Interrupt: pin A routed to IRQ 16
              Region 0: I/O ports at b800 [size=256]
              Region 2: Memory at ff7ff000 (64-bit, non-prefetchable) [size=4K]
              ^^^^^^^^
      So far I have not received any lspci report for the 0x8136 and
      Realtek's driver do not help: be it under BSD or Linux, their r1000 driver
      include a USE_IO_SPACE #define but the bar address is always hardcoded
      to 1 in the MM case. :o/
    
    Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>

commit 33857396c4f7d171f4ccaca86356df5fe2fdd304

    r8169: remove rtl8169_init_board
    
    Rationale:
    - its signature is not exactly pretty;
    - it has no knowledge of pci_device_id;
    - kiss 23 lines good bye.
    
    Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>

commit af50f4372644c3c18c2af697a933c90f2a96be77

    r8169: hardware flow control
    
    The datasheet suggests that the device handles the hardware flow
    control almost automagically. User report a different story, so
    let's try to twiddle the mii registers.
    
    Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>

commit d1e6ebbea2297df970e52823e1d8c9af62b0548d

    r8169: RX fifo overflow recovery
    
    Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>

commit 17fb3bf33149eb2cb1a37ff94ab236ab01f91a40

    r8169: mac address change support
    
    Fix for http://bugzilla.kernel.org/show_bug.cgi?id=6032.
    
    Cc: Tim Mattox <tmattox@gmail.com>
    Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>

The patch is for review only: mac address change apart, I need to
test it and it will surely conflict with jeff#netdev because of a
recently added PCI ID.

The patches are available at:
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.17-rc6/r8169

or:

git://electric-eye.fr.zoreil.com/home/romieu/linux-2.6.git r8169

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 0ad3310..53a33c5 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -150,11 +150,16 @@ #define RTL_R16(reg)		readw (ioaddr + (r
 #define RTL_R32(reg)		((unsigned long) readl (ioaddr + (reg)))
 
 enum mac_version {
-	RTL_GIGA_MAC_VER_B = 0x00,
-	/* RTL_GIGA_MAC_VER_C = 0x03, */
-	RTL_GIGA_MAC_VER_D = 0x01,
-	RTL_GIGA_MAC_VER_E = 0x02,
-	RTL_GIGA_MAC_VER_X = 0x04	/* Greater than RTL_GIGA_MAC_VER_E */
+	RTL_GIGA_MAC_VER_01 = 0x00,
+	RTL_GIGA_MAC_VER_02 = 0x01,
+	RTL_GIGA_MAC_VER_03 = 0x02,
+	RTL_GIGA_MAC_VER_04 = 0x03,
+	RTL_GIGA_MAC_VER_05 = 0x04,
+	RTL_GIGA_MAC_VER_11 = 0x0b,
+	RTL_GIGA_MAC_VER_12 = 0x0c,
+	RTL_GIGA_MAC_VER_13 = 0x0d,
+	RTL_GIGA_MAC_VER_14 = 0x0e,
+	RTL_GIGA_MAC_VER_15 = 0x0f
 };
 
 enum phy_version {
@@ -166,7 +171,6 @@ enum phy_version {
 	RTL_GIGA_PHY_VER_H = 0x08, /* PHY Reg 0x03 bit0-3 == 0x0003 */
 };
 
-
 #define _R(NAME,MAC,MASK) \
 	{ .name = NAME, .mac_version = MAC, .RxConfigMask = MASK }
 
@@ -175,18 +179,28 @@ static const struct {
 	u8 mac_version;
 	u32 RxConfigMask;	/* Clears the bits supported by this chip */
 } rtl_chip_info[] = {
-	_R("RTL8169",		RTL_GIGA_MAC_VER_B, 0xff7e1880),
-	_R("RTL8169s/8110s",	RTL_GIGA_MAC_VER_D, 0xff7e1880),
-	_R("RTL8169s/8110s",	RTL_GIGA_MAC_VER_E, 0xff7e1880),
-	_R("RTL8169s/8110s",	RTL_GIGA_MAC_VER_X, 0xff7e1880),
+	_R("RTL8169",		RTL_GIGA_MAC_VER_01, 0xff7e1880),
+	_R("RTL8169s/8110s",	RTL_GIGA_MAC_VER_02, 0xff7e1880),
+	_R("RTL8169s/8110s",	RTL_GIGA_MAC_VER_03, 0xff7e1880),
+	_R("RTL8169sb/8110sb",	RTL_GIGA_MAC_VER_04, 0xff7e1880),
+	_R("RTL8169sc/8110sc",	RTL_GIGA_MAC_VER_05, 0xff7e1880),
+	_R("RTL8168b/8111b",	RTL_GIGA_MAC_VER_11, 0xff7e1880), // PCI-E
+	_R("RTL8168b/8111b",	RTL_GIGA_MAC_VER_12, 0xff7e1880), // PCI-E
+	_R("RTL8101e",		RTL_GIGA_MAC_VER_13, 0xff7e1880), // PCI-E 8139
+	_R("RTL8100e",		RTL_GIGA_MAC_VER_14, 0xff7e1880), // PCI-E 8139
+	_R("RTL8100e",		RTL_GIGA_MAC_VER_15, 0xff7e1880)  // PCI-E 8139
 };
 #undef _R
 
 static struct pci_device_id rtl8169_pci_tbl[] = {
-	{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK,	0x8169), },
-	{ PCI_DEVICE(PCI_VENDOR_ID_DLINK,	0x4300), },
-	{ PCI_DEVICE(0x16ec,			0x0116), },
-	{ PCI_VENDOR_ID_LINKSYS,		0x1032, PCI_ANY_ID, 0x0024, },
+	{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK,	0x8136), 0, 0, 2 },
+	{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK,	0x8167), 0, 0, 2 },
+	{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK,	0x8168), 0, 0, 2 },
+	{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK,	0x8169), 0, 0, 1 },
+	{ PCI_DEVICE(PCI_VENDOR_ID_DLINK,	0x4300), 0, 0, 1 },
+	{ PCI_DEVICE(0x16ec,			0x0116), 0, 0, 1 },
+	{ PCI_VENDOR_ID_LINKSYS,		0x1032,
+		PCI_ANY_ID, 0x0024, 0, 0, 1 },
 	{0,},
 };
 
@@ -256,10 +270,11 @@ enum RTL8169_register_content {
 	RxOK = 0x01,
 
 	/* RxStatusDesc */
-	RxRES = 0x00200000,
-	RxCRC = 0x00080000,
-	RxRUNT = 0x00100000,
-	RxRWT = 0x00400000,
+	RxFOVF	= (1 << 23),
+	RxRWT	= (1 << 22),
+	RxRES	= (1 << 21),
+	RxRUNT	= (1 << 20),
+	RxCRC	= (1 << 19),
 
 	/* ChipCmdBits */
 	CmdReset = 0x10,
@@ -345,6 +360,7 @@ enum RTL8169_register_content {
 	PHY_Cap_100_Full = 0x0100,
 
 	/* PHY_1000_CTRL_REG = 9 */
+	PHY_Cap_1000_Half = 0x0100,
 	PHY_Cap_1000_Full = 0x0200,
 
 	PHY_Cap_Null = 0x0,
@@ -748,27 +764,47 @@ static int rtl8169_set_speed_xmii(struct
 	auto_nego &= ~(PHY_Cap_10_Half | PHY_Cap_10_Full |
 		       PHY_Cap_100_Half | PHY_Cap_100_Full);
 	giga_ctrl = mdio_read(ioaddr, PHY_1000_CTRL_REG);
-	giga_ctrl &= ~(PHY_Cap_1000_Full | PHY_Cap_Null);
+	giga_ctrl &= ~(PHY_Cap_1000_Full | PHY_Cap_1000_Half | PHY_Cap_Null);
 
 	if (autoneg == AUTONEG_ENABLE) {
 		auto_nego |= (PHY_Cap_10_Half | PHY_Cap_10_Full |
 			      PHY_Cap_100_Half | PHY_Cap_100_Full);
-		giga_ctrl |= PHY_Cap_1000_Full;
+		giga_ctrl |= PHY_Cap_1000_Full | PHY_Cap_1000_Half;
 	} else {
 		if (speed == SPEED_10)
 			auto_nego |= PHY_Cap_10_Half | PHY_Cap_10_Full;
 		else if (speed == SPEED_100)
 			auto_nego |= PHY_Cap_100_Half | PHY_Cap_100_Full;
 		else if (speed == SPEED_1000)
-			giga_ctrl |= PHY_Cap_1000_Full;
+			giga_ctrl |= PHY_Cap_1000_Full | PHY_Cap_1000_Half;
 
 		if (duplex == DUPLEX_HALF)
 			auto_nego &= ~(PHY_Cap_10_Full | PHY_Cap_100_Full);
 
 		if (duplex == DUPLEX_FULL)
 			auto_nego &= ~(PHY_Cap_10_Half | PHY_Cap_100_Half);
+
+		/* This tweak comes straight from Realtek's driver. */
+		if ((speed == SPEED_100) && (duplex == DUPLEX_HALF) &&
+		    (tp->mac_version == RTL_GIGA_MAC_VER_13)) {
+			auto_nego = PHY_Cap_100_Half | 0x01;
+		}
 	}
 
+	/* The 8100e/8101e do Fast Ethernet only. */
+	if ((tp->mac_version == RTL_GIGA_MAC_VER_13) ||
+	    (tp->mac_version == RTL_GIGA_MAC_VER_14) ||
+	    (tp->mac_version == RTL_GIGA_MAC_VER_15)) {
+		if ((giga_ctrl & (PHY_Cap_1000_Full | PHY_Cap_1000_Half)) &&
+		    netif_msg_link(tp)) {
+			printk(KERN_INFO "%s: PHY does not support 1000Mbps.\n",
+			       dev->name);
+		}
+		giga_ctrl &= ~(PHY_Cap_1000_Full | PHY_Cap_1000_Half);
+	}
+
+	auto_nego |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
+
 	tp->phy_auto_nego_reg = auto_nego;
 	tp->phy_1000_ctrl_reg = giga_ctrl;
 
@@ -960,6 +996,11 @@ static void rtl8169_gset_xmii(struct net
 	else if (status & _10bps)
 		cmd->speed = SPEED_10;
 
+	if (status & TxFlowCtrl)
+		cmd->advertising |= ADVERTISED_Asym_Pause;
+	if (status & RxFlowCtrl)
+		cmd->advertising |= ADVERTISED_Pause;
+
 	cmd->duplex = ((status & _1000bpsF) || (status & FullDup)) ?
 		      DUPLEX_FULL : DUPLEX_HALF;
 }
@@ -1139,10 +1180,16 @@ static void rtl8169_get_mac_version(stru
 		u32 mask;
 		int mac_version;
 	} mac_info[] = {
-		{ 0x1 << 28,	RTL_GIGA_MAC_VER_X },
-		{ 0x1 << 26,	RTL_GIGA_MAC_VER_E },
-		{ 0x1 << 23,	RTL_GIGA_MAC_VER_D }, 
-		{ 0x00000000,	RTL_GIGA_MAC_VER_B } /* Catch-all */
+		{ 0x38800000,	RTL_GIGA_MAC_VER_15 },
+		{ 0x38000000,	RTL_GIGA_MAC_VER_12 },
+		{ 0x34000000,	RTL_GIGA_MAC_VER_13 },
+		{ 0x30800000,	RTL_GIGA_MAC_VER_14 },
+		{ 0x30000000,   RTL_GIGA_MAC_VER_11 },
+		{ 0x18000000,	RTL_GIGA_MAC_VER_05 },
+		{ 0x10000000,	RTL_GIGA_MAC_VER_04 },
+		{ 0x04000000,	RTL_GIGA_MAC_VER_03 },
+		{ 0x00800000,	RTL_GIGA_MAC_VER_02 },
+		{ 0x00000000,	RTL_GIGA_MAC_VER_01 }	/* Catch-all */
 	}, *p = mac_info;
 	u32 reg;
 
@@ -1154,24 +1201,7 @@ static void rtl8169_get_mac_version(stru
 
 static void rtl8169_print_mac_version(struct rtl8169_private *tp)
 {
-	struct {
-		int version;
-		char *msg;
-	} mac_print[] = {
-		{ RTL_GIGA_MAC_VER_E, "RTL_GIGA_MAC_VER_E" },
-		{ RTL_GIGA_MAC_VER_D, "RTL_GIGA_MAC_VER_D" },
-		{ RTL_GIGA_MAC_VER_B, "RTL_GIGA_MAC_VER_B" },
-		{ 0, NULL }
-	}, *p;
-
-	for (p = mac_print; p->msg; p++) {
-		if (tp->mac_version == p->version) {
-			dprintk("mac_version == %s (%04d)\n", p->msg,
-				  p->version);
-			return;
-		}
-	}
-	dprintk("mac_version == Unknown\n");
+	dprintk("mac_version = 0x%02x\n", tp->mac_version);
 }
 
 static void rtl8169_get_phy_version(struct rtl8169_private *tp, void __iomem *ioaddr)
@@ -1256,7 +1286,7 @@ static void rtl8169_hw_phy_config(struct
 	rtl8169_print_mac_version(tp);
 	rtl8169_print_phy_version(tp);
 
-	if (tp->mac_version <= RTL_GIGA_MAC_VER_B)
+	if (tp->mac_version <= RTL_GIGA_MAC_VER_01)
 		return;
 	if (tp->phy_version >= RTL_GIGA_PHY_VER_H)
 		return;
@@ -1266,7 +1296,7 @@ static void rtl8169_hw_phy_config(struct
 
 	/* Shazam ! */
 
-	if (tp->mac_version == RTL_GIGA_MAC_VER_X) {
+	if (tp->mac_version == RTL_GIGA_MAC_VER_04) {
 		mdio_write(ioaddr, 31, 0x0001);
 		mdio_write(ioaddr,  9, 0x273a);
 		mdio_write(ioaddr, 14, 0x7bfb);
@@ -1305,7 +1335,7 @@ static void rtl8169_phy_timer(unsigned l
 	void __iomem *ioaddr = tp->mmio_addr;
 	unsigned long timeout = RTL8169_PHY_TIMEOUT;
 
-	assert(tp->mac_version > RTL_GIGA_MAC_VER_B);
+	assert(tp->mac_version > RTL_GIGA_MAC_VER_01);
 	assert(tp->phy_version < RTL_GIGA_PHY_VER_H);
 
 	if (!(tp->phy_1000_ctrl_reg & PHY_Cap_1000_Full))
@@ -1341,7 +1371,7 @@ static inline void rtl8169_delete_timer(
 	struct rtl8169_private *tp = netdev_priv(dev);
 	struct timer_list *timer = &tp->timer;
 
-	if ((tp->mac_version <= RTL_GIGA_MAC_VER_B) ||
+	if ((tp->mac_version <= RTL_GIGA_MAC_VER_01) ||
 	    (tp->phy_version >= RTL_GIGA_PHY_VER_H))
 		return;
 
@@ -1353,7 +1383,7 @@ static inline void rtl8169_request_timer
 	struct rtl8169_private *tp = netdev_priv(dev);
 	struct timer_list *timer = &tp->timer;
 
-	if ((tp->mac_version <= RTL_GIGA_MAC_VER_B) ||
+	if ((tp->mac_version <= RTL_GIGA_MAC_VER_01) ||
 	    (tp->phy_version >= RTL_GIGA_PHY_VER_H))
 		return;
 
@@ -1381,6 +1411,41 @@ static void rtl8169_netpoll(struct net_d
 }
 #endif
 
+static void __rtl8169_set_mac_addr(struct net_device *dev, void __iomem *ioaddr)
+{
+	unsigned int i, j;
+
+	RTL_W8(Cfg9346, Cfg9346_Unlock);
+	for (i = 0; i < 2; i++) {
+		__le32 l = 0;
+
+		for (j = 0; j < 4; j++) {
+			l <<= 8;
+			l |= dev->dev_addr[4*i + j];
+		}
+		RTL_W32(MAC0 + 4*i, cpu_to_be32(l));
+	}
+	RTL_W8(Cfg9346, Cfg9346_Lock);
+}
+
+static int rtl8169_set_mac_addr(struct net_device *dev, void *p)
+{
+	struct rtl8169_private *tp = netdev_priv(dev);
+	struct sockaddr *addr = p;
+
+	if (!is_valid_ether_addr(addr->sa_data))
+		return -EINVAL;
+
+	memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
+
+	if (netif_running(dev)) {
+		spin_lock_irq(&tp->lock);
+		__rtl8169_set_mac_addr(dev, tp->mmio_addr);
+		spin_unlock_irq(&tp->lock);
+	}
+	return 0;
+}
+
 static void rtl8169_release_board(struct pci_dev *pdev, struct net_device *dev,
 				  void __iomem *ioaddr)
 {
@@ -1390,23 +1455,61 @@ static void rtl8169_release_board(struct
 	free_netdev(dev);
 }
 
+static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
+{
+	void __iomem *ioaddr = tp->mmio_addr;
+	static int board_idx = -1;
+	u8 autoneg, duplex;
+	u16 speed;
+
+	board_idx++;
+
+	rtl8169_hw_phy_config(dev);
+
+	dprintk("Set MAC Reg C+CR Offset 0x82h = 0x01h\n");
+	RTL_W8(0x82, 0x01);
+
+	if (tp->mac_version < RTL_GIGA_MAC_VER_03) {
+		dprintk("Set PCI Latency=0x40\n");
+		pci_write_config_byte(tp->pci_dev, PCI_LATENCY_TIMER, 0x40);
+	}
+
+	if (tp->mac_version == RTL_GIGA_MAC_VER_02) {
+		dprintk("Set MAC Reg C+CR Offset 0x82h = 0x01h\n");
+		RTL_W8(0x82, 0x01);
+		dprintk("Set PHY Reg 0x0bh = 0x00h\n");
+		mdio_write(ioaddr, 0x0b, 0x0000); //w 0x0b 15 0 0
+	}
+
+	rtl8169_link_option(board_idx, &autoneg, &speed, &duplex);
+
+	rtl8169_set_speed(dev, autoneg, speed, duplex);
+
+	if ((RTL_R8(PHYstatus) & TBI_Enable) && netif_msg_link(tp))
+		printk(KERN_INFO PFX "%s: TBI auto-negotiating\n", dev->name);
+}
+
 static int __devinit
-rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out,
-		   void __iomem **ioaddr_out)
+rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
-	void __iomem *ioaddr;
-	struct net_device *dev;
+	const unsigned int region = ent->driver_data;
 	struct rtl8169_private *tp;
-	int rc = -ENOMEM, i, acpi_idle_state = 0, pm_cap;
+	struct net_device *dev;
+	void __iomem *ioaddr;
+	unsigned int i, pm_cap;
+	int rc;
 
-	assert(ioaddr_out != NULL);
+	if (netif_msg_drv(&debug)) {
+		printk(KERN_INFO "%s Gigabit Ethernet driver %s loaded\n",
+		       MODULENAME, RTL8169_VERSION);
+	}
 
-	/* dev zeroed in alloc_etherdev */
 	dev = alloc_etherdev(sizeof (*tp));
-	if (dev == NULL) {
+	if (!dev) {
 		if (netif_msg_drv(&debug))
 			printk(KERN_ERR PFX "unable to alloc new ethernet\n");
-		goto err_out;
+		rc = -ENOMEM;
+		goto out;
 	}
 
 	SET_MODULE_OWNER(dev);
@@ -1421,17 +1524,17 @@ rtl8169_init_board(struct pci_dev *pdev,
 			printk(KERN_ERR PFX "%s: enable failure\n",
 			       pci_name(pdev));
 		}
-		goto err_out_free_dev;
+		goto err_out_free_dev_1;
 	}
 
 	rc = pci_set_mwi(pdev);
 	if (rc < 0)
-		goto err_out_disable;
+		goto err_out_disable_2;
 
 	/* save power state before pci_enable_device overwrites it */
 	pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
 	if (pm_cap) {
-		u16 pwr_command;
+		u16 pwr_command, acpi_idle_state;
 
 		pci_read_config_word(pdev, pm_cap + PCI_PM_CTRL, &pwr_command);
 		acpi_idle_state = pwr_command & PCI_PM_CTRL_STATE_MASK;
@@ -1443,22 +1546,24 @@ rtl8169_init_board(struct pci_dev *pdev,
 	}
 
 	/* make sure PCI base addr 1 is MMIO */
-	if (!(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) {
+	if (!(pci_resource_flags(pdev, region) & IORESOURCE_MEM)) {
 		if (netif_msg_probe(tp)) {
 			printk(KERN_ERR PFX
-			       "region #1 not an MMIO resource, aborting\n");
+			       "region #%d not an MMIO resource, aborting\n",
+			       region);
 		}
 		rc = -ENODEV;
-		goto err_out_mwi;
+		goto err_out_mwi_3;
 	}
+
 	/* check for weird/broken PCI region reporting */
-	if (pci_resource_len(pdev, 1) < R8169_REGS_SIZE) {
+	if (pci_resource_len(pdev, region) < R8169_REGS_SIZE) {
 		if (netif_msg_probe(tp)) {
 			printk(KERN_ERR PFX
 			       "Invalid PCI region size(s), aborting\n");
 		}
 		rc = -ENODEV;
-		goto err_out_mwi;
+		goto err_out_mwi_3;
 	}
 
 	rc = pci_request_regions(pdev, MODULENAME);
@@ -1467,7 +1572,7 @@ rtl8169_init_board(struct pci_dev *pdev,
 			printk(KERN_ERR PFX "%s: could not request regions.\n",
 			       pci_name(pdev));
 		}
-		goto err_out_mwi;
+		goto err_out_mwi_3;
 	}
 
 	tp->cp_cmd = PCIMulRW | RxChkSum;
@@ -1483,19 +1588,19 @@ rtl8169_init_board(struct pci_dev *pdev,
 				printk(KERN_ERR PFX
 				       "DMA configuration failed.\n");
 			}
-			goto err_out_free_res;
+			goto err_out_free_res_4;
 		}
 	}
 
 	pci_set_master(pdev);
 
 	/* ioremap MMIO region */
-	ioaddr = ioremap(pci_resource_start(pdev, 1), R8169_REGS_SIZE);
-	if (ioaddr == NULL) {
+	ioaddr = ioremap(pci_resource_start(pdev, region), R8169_REGS_SIZE);
+	if (!ioaddr) {
 		if (netif_msg_probe(tp))
 			printk(KERN_ERR PFX "cannot remap MMIO, aborting\n");
 		rc = -EIO;
-		goto err_out_free_res;
+		goto err_out_free_res_4;
 	}
 
 	/* Unneeded ? Don't mess with Mrs. Murphy. */
@@ -1538,56 +1643,6 @@ rtl8169_init_board(struct pci_dev *pdev,
 	RTL_W8(Config5, RTL_R8(Config5) & PMEStatus);
 	RTL_W8(Cfg9346, Cfg9346_Lock);
 
-	*ioaddr_out = ioaddr;
-	*dev_out = dev;
-out:
-	return rc;
-
-err_out_free_res:
-	pci_release_regions(pdev);
-
-err_out_mwi:
-	pci_clear_mwi(pdev);
-
-err_out_disable:
-	pci_disable_device(pdev);
-
-err_out_free_dev:
-	free_netdev(dev);
-err_out:
-	*ioaddr_out = NULL;
-	*dev_out = NULL;
-	goto out;
-}
-
-static int __devinit
-rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
-{
-	struct net_device *dev = NULL;
-	struct rtl8169_private *tp;
-	void __iomem *ioaddr = NULL;
-	static int board_idx = -1;
-	u8 autoneg, duplex;
-	u16 speed;
-	int i, rc;
-
-	assert(pdev != NULL);
-	assert(ent != NULL);
-
-	board_idx++;
-
-	if (netif_msg_drv(&debug)) {
-		printk(KERN_INFO "%s Gigabit Ethernet driver %s loaded\n",
-		       MODULENAME, RTL8169_VERSION);
-	}
-
-	rc = rtl8169_init_board(pdev, &dev, &ioaddr);
-	if (rc)
-		return rc;
-
-	tp = netdev_priv(dev);
-	assert(ioaddr != NULL);
-
 	if (RTL_R8(PHYstatus) & TBI_Enable) {
 		tp->set_speed = rtl8169_set_speed_tbi;
 		tp->get_settings = rtl8169_gset_tbi;
@@ -1616,6 +1671,7 @@ rtl8169_init_one(struct pci_dev *pdev, c
 	dev->stop = rtl8169_close;
 	dev->tx_timeout = rtl8169_tx_timeout;
 	dev->set_multicast_list = rtl8169_set_rx_mode;
+	dev->set_mac_address = rtl8169_set_mac_addr;
 	dev->watchdog_timeo = RTL8169_TX_TIMEOUT;
 	dev->irq = pdev->irq;
 	dev->base_addr = (unsigned long) ioaddr;
@@ -1643,15 +1699,8 @@ #endif
 	spin_lock_init(&tp->lock);
 
 	rc = register_netdev(dev);
-	if (rc) {
-		rtl8169_release_board(pdev, dev, ioaddr);
-		return rc;
-	}
-
-	if (netif_msg_probe(tp)) {
-		printk(KERN_DEBUG "%s: Identified chip type is '%s'.\n",
-		       dev->name, rtl_chip_info[tp->chipset].name);
-	}
+	if (rc < 0)
+		goto err_out_unmap_5;
 
 	pci_set_drvdata(pdev, dev);
 
@@ -1660,38 +1709,29 @@ #endif
 		       "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x, "
 		       "IRQ %d\n",
 		       dev->name,
-		       rtl_chip_info[ent->driver_data].name,
+		       rtl_chip_info[tp->chipset].name,
 		       dev->base_addr,
 		       dev->dev_addr[0], dev->dev_addr[1],
 		       dev->dev_addr[2], dev->dev_addr[3],
 		       dev->dev_addr[4], dev->dev_addr[5], dev->irq);
 	}
 
-	rtl8169_hw_phy_config(dev);
-
-	dprintk("Set MAC Reg C+CR Offset 0x82h = 0x01h\n");
-	RTL_W8(0x82, 0x01);
-
-	if (tp->mac_version < RTL_GIGA_MAC_VER_E) {
-		dprintk("Set PCI Latency=0x40\n");
-		pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x40);
-	}
+	rtl8169_init_phy(dev, tp);
 
-	if (tp->mac_version == RTL_GIGA_MAC_VER_D) {
-		dprintk("Set MAC Reg C+CR Offset 0x82h = 0x01h\n");
-		RTL_W8(0x82, 0x01);
-		dprintk("Set PHY Reg 0x0bh = 0x00h\n");
-		mdio_write(ioaddr, 0x0b, 0x0000); //w 0x0b 15 0 0
-	}
-
-	rtl8169_link_option(board_idx, &autoneg, &speed, &duplex);
-
-	rtl8169_set_speed(dev, autoneg, speed, duplex);
-	
-	if ((RTL_R8(PHYstatus) & TBI_Enable) && netif_msg_link(tp))
-		printk(KERN_INFO PFX "%s: TBI auto-negotiating\n", dev->name);
+out:
+	return rc;
 
-	return 0;
+err_out_unmap_5:
+	iounmap(ioaddr);
+err_out_free_res_4:
+	pci_release_regions(pdev);
+err_out_mwi_3:
+	pci_clear_mwi(pdev);
+err_out_disable_2:
+	pci_disable_device(pdev);
+err_out_free_dev_1:
+	free_netdev(dev);
+	goto out;
 }
 
 static void __devexit
@@ -1787,6 +1827,7 @@ rtl8169_hw_start(struct net_device *dev)
 {
 	struct rtl8169_private *tp = netdev_priv(dev);
 	void __iomem *ioaddr = tp->mmio_addr;
+	struct pci_dev *pdev = tp->pci_dev;
 	u32 i;
 
 	/* Soft reset the chip. */
@@ -1799,8 +1840,28 @@ rtl8169_hw_start(struct net_device *dev)
 		udelay(10);
 	}
 
+	if (tp->mac_version == RTL_GIGA_MAC_VER_13) {
+		pci_write_config_word(pdev, 0x68, 0x00);
+		pci_write_config_word(pdev, 0x69, 0x08);
+	}
+
+	/* Undocumented stuff. */
+	if (tp->mac_version == RTL_GIGA_MAC_VER_05) {
+		u16 cmd;
+
+		/* Realtek's r1000_n.c driver uses '&& 0x01' here. Well... */
+		if ((RTL_R8(Config2) & 0x07) & 0x01)
+			RTL_W32(0x7c, 0x0007ffff);
+
+		RTL_W32(0x7c, 0x0007ff00);
+
+		pci_read_config_word(pdev, PCI_COMMAND, &cmd);
+		cmd = cmd & 0xef;
+		pci_write_config_word(pdev, PCI_COMMAND, cmd);
+	}
+
+
 	RTL_W8(Cfg9346, Cfg9346_Unlock);
-	RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
 	RTL_W8(EarlyTxThres, EarlyTxThld);
 
 	/* Low hurts. Let's disable the filtering. */
@@ -1815,17 +1876,18 @@ rtl8169_hw_start(struct net_device *dev)
 	RTL_W32(TxConfig,
 		(TX_DMA_BURST << TxDMAShift) | (InterFrameGap <<
 						TxInterFrameGapShift));
-	tp->cp_cmd |= RTL_R16(CPlusCmd);
-	RTL_W16(CPlusCmd, tp->cp_cmd);
 
-	if ((tp->mac_version == RTL_GIGA_MAC_VER_D) ||
-	    (tp->mac_version == RTL_GIGA_MAC_VER_E)) {
+	tp->cp_cmd |= RTL_R16(CPlusCmd) | PCIMulRW;
+
+	if ((tp->mac_version == RTL_GIGA_MAC_VER_02) ||
+	    (tp->mac_version == RTL_GIGA_MAC_VER_03)) {
 		dprintk(KERN_INFO PFX "Set MAC Reg C+CR Offset 0xE0. "
 			"Bit-3 and bit-14 MUST be 1\n");
-		tp->cp_cmd |= (1 << 14) | PCIMulRW;
-		RTL_W16(CPlusCmd, tp->cp_cmd);
+		tp->cp_cmd |= (1 << 14);
 	}
 
+	RTL_W16(CPlusCmd, tp->cp_cmd);
+
 	/*
 	 * Undocumented corner. Supposedly:
 	 * (TxTimer << 12) | (TxPackets << 8) | (RxTimer << 4) | RxPackets
@@ -1836,6 +1898,7 @@ rtl8169_hw_start(struct net_device *dev)
 	RTL_W32(TxDescStartAddrHigh, ((u64) tp->TxPhyAddr >> 32));
 	RTL_W32(RxDescAddrLow, ((u64) tp->RxPhyAddr & DMA_32BIT_MASK));
 	RTL_W32(RxDescAddrHigh, ((u64) tp->RxPhyAddr >> 32));
+	RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
 	RTL_W8(Cfg9346, Cfg9346_Lock);
 	udelay(10);
 
@@ -1849,6 +1912,8 @@ rtl8169_hw_start(struct net_device *dev)
 	/* Enable all known interrupts by setting the interrupt mask. */
 	RTL_W16(IntrMask, rtl8169_intr_mask);
 
+	__rtl8169_set_mac_addr(dev, ioaddr);
+
 	netif_start_queue(dev);
 }
 
@@ -2435,6 +2500,10 @@ rtl8169_rx_interrupt(struct net_device *
 				tp->stats.rx_length_errors++;
 			if (status & RxCRC)
 				tp->stats.rx_crc_errors++;
+			if (status & RxFOVF) {
+				rtl8169_schedule_work(dev, rtl8169_reset_task);
+				tp->stats.rx_fifo_errors++;
+			}
 			rtl8169_mark_to_asic(desc, tp->rx_buf_sz);
 		} else {
 			struct sk_buff *skb = tp->Rx_skbuff[entry];
@@ -2724,6 +2793,15 @@ rtl8169_set_rx_mode(struct net_device *d
 	tmp = rtl8169_rx_config | rx_mode |
 	      (RTL_R32(RxConfig) & rtl_chip_info[tp->chipset].RxConfigMask);
 
+	if ((tp->mac_version == RTL_GIGA_MAC_VER_11) ||
+	    (tp->mac_version == RTL_GIGA_MAC_VER_12) ||
+	    (tp->mac_version == RTL_GIGA_MAC_VER_13) ||
+	    (tp->mac_version == RTL_GIGA_MAC_VER_14) ||
+	    (tp->mac_version == RTL_GIGA_MAC_VER_15)) {
+		mc_filter[0] = 0xffffffff;
+		mc_filter[1] = 0xffffffff;
+	}
+
 	RTL_W32(RxConfig, tmp);
 	RTL_W32(MAR0 + 0, mc_filter[0]);
 	RTL_W32(MAR0 + 4, mc_filter[1]);

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

* Re: [RFT] Realtek 8168 ethernet support
  2006-06-11 23:30             ` Francois Romieu
@ 2006-06-12 10:30               ` Mourad De Clerck
  2006-06-12 18:49                 ` Francois Romieu
  2006-07-18 22:14               ` Francois Romieu
  1 sibling, 1 reply; 18+ messages in thread
From: Mourad De Clerck @ 2006-06-12 10:30 UTC (permalink / raw)
  To: Francois Romieu; +Cc: netdev

On 12/06/06 01:30, Francois Romieu wrote:
> The patch below agaisnt 2.6.17-rc6 includes the following changes:

Just FYI:

I just tried this patch set, but it doesn't do anything for the "freeze
at high speed" I mentioned on 2006-06-09. It still locks up. (As an
additional data point: I installed win2k on this machine, and it seems
to have no problems transferring at high speeds. Just wanted to try to
rule out faulty hardware.)

Thanks,

-- Mourad DC

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

* Re: [RFT] Realtek 8168 ethernet support
  2006-06-12 10:30               ` Mourad De Clerck
@ 2006-06-12 18:49                 ` Francois Romieu
       [not found]                   ` <448DE38D.8070503@aquazul.com>
  0 siblings, 1 reply; 18+ messages in thread
From: Francois Romieu @ 2006-06-12 18:49 UTC (permalink / raw)
  To: Mourad De Clerck; +Cc: netdev

Mourad De Clerck <mourad@aquazul.com> :
[...]
> I just tried this patch set, but it doesn't do anything for the "freeze
> at high speed" I mentioned on 2006-06-09. It still locks up. (As an
> additional data point: I installed win2k on this machine, and it seems
> to have no problems transferring at high speeds. Just wanted to try to
> rule out faulty hardware.)

Please send .config and complete dmesg (starting with 'Linux version ...').
The output of a 'vmstat 1' until it freezes could give some hint.
So could trying a different PCI slot. How do you generate traffic ?

15Mo/s of usual traffic means roughly 1000pps. It is not really high speed.

Unrelated: have you checked the link setting ?

-- 
Ueimor

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

* Re: [RFT] Realtek 8168 ethernet support
       [not found]                   ` <448DE38D.8070503@aquazul.com>
@ 2006-06-12 22:29                     ` Francois Romieu
  2006-06-18 17:25                       ` Mourad De Clerck
  0 siblings, 1 reply; 18+ messages in thread
From: Francois Romieu @ 2006-06-12 22:29 UTC (permalink / raw)
  To: Mourad De Clerck; +Cc: netdev

Mourad De Clerck <mourad@aquazul.com> :
[...]
> I do notice a pattern with more and less "complicated"/cpu intensive
> traffic: using http (wget) I manage to finish doing the transfer of the
> same reasonably big file. With scp I only manage to get to 90% of that
> file before it freezes - I should still test whether I can get a http
> transfer to lock up if I use a (much) bigger file.

wget goes faster, right ? Do you have some vmstat 1 output at hand
for it ?

[...]
> > Unrelated: have you checked the link setting ?
> 
> ethtool reports "Link detected: yes" and so does my switch.

Ok but can you set correctly the link with the command which was told
to fail in you first mail ? The patch could fix it.

[...]
> shuttle:~# scp hell:/srv/bigfile.bin .
> bigfile.bin                                   90%  155MB  17.5MB/s   00:00 ETA

Can you try something like:
dd if=/dev/zero bs=1024k count=1000 | ssh -c blowfish hell dd of=/tmp/1000m.bin 

May I assume that the freeze locks everything (keyboard, mouse, led) beyond
the scp command itself ?

-- 
Ueimor

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

* Re: [RFT] Realtek 8168 ethernet support
  2006-06-12 22:29                     ` Francois Romieu
@ 2006-06-18 17:25                       ` Mourad De Clerck
  0 siblings, 0 replies; 18+ messages in thread
From: Mourad De Clerck @ 2006-06-18 17:25 UTC (permalink / raw)
  To: Francois Romieu; +Cc: netdev

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

Hi,

sorry for the delayed response...

On 13/06/06 00:29, Francois Romieu wrote:
> wget goes faster, right ? Do you have some vmstat 1 output at hand
> for it ?

It does indeed go faster, and it seems a little bit more reliable, but
with big enough transfers it locks up too. See commandline-2.txt and
vmstat-2.txt - it gets through around 600-700MB before locking up. I
also noticed that at 3-4 points during the transfer it seemed to
"pause", and then continue.

> Ok but can you set correctly the link with the command which was told
> to fail in you first mail ? The patch could fix it.

Yes, indeed: doing "ethtool -s eth0 speed 10 autoneg off" switches it to
the slow speed, and keeps it there too (at 10Mb/s).

"ethtool eth0" still reports "Advertised auto-negotiation: Yes" and
"Auto-negotiation: on", which is probably not right. It also reports
"Advertised link modes:  10baseT/Full" only, which is probably correct.

It only actually restarts auto-negotiation when I issue the command
"ethtool -s eth0 autoneg on", at which point the speeds goes back up to
1000Mb/s - the expected behaviour. So it seems ethtool works better than
before wrt auto-negotiation.

> Can you try something like:
> dd if=/dev/zero bs=1024k count=1000 | ssh -c blowfish hell dd of=/tmp/1000m.bin 

Well this transfer (from shuttle -> hell) completed successfully. See
commandline-3.txt and vmstat-3.txt; However I noticed the speed was only
around 7 MB/s and wondered if the link speed was maybe set to 100Mb/s,
so I immediately afterwards did a "wget"-test again, which locked up
after only 5%. The wget test however did confirm the link speed to be
1000Mb/s. See commandline-4.txt and vmstat-4.txt for that last, short test.

> May I assume that the freeze locks everything (keyboard, mouse, led) beyond
> the scp command itself ?

Yes indeed. My (usb) keyboard doesn't respond at all anymore, networking
is completely out, (usb) mouse freezes too. SysRq doesn't seem to help
much either.


-- Mourad

[-- Attachment #2: commandline-2.txt --]
[-- Type: text/plain, Size: 390 bytes --]

shuttle:~# wget http://hell/testfile.bin
--18:39:21--  http://hell/testfile.bin
           => `testfile.bin'
Resolving hell... 10.10.1.1
Connecting to hell|10.10.1.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1,073,741,824 (1.0G) [application/octet-stream]

56% [================================>                          ] 602,018,040   27.70M/s    ETA 00:17

[-- Attachment #3: commandline-3.txt --]
[-- Type: text/plain, Size: 313 bytes --]

shuttle:~# dd if=/dev/zero bs=1024k count=1000 | ssh -c blowfish hell dd of=/tmp/1000m.bin
Password:
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB) copied, 155.971 seconds, 6.7 MB/s
2047951+99 records in
2048000+0 records out
1048576000 bytes (1.0 GB) copied, 140.689 seconds, 7.5 MB/s
shuttle:~#

[-- Attachment #4: commandline-4.txt --]
[-- Type: text/plain, Size: 355 bytes --]

shuttle:~# wget http://hell/testfile.bin
--18:57:26--  http://hell/testfile.bin
           => `testfile.bin'
Resolving hell... 10.10.1.1
Connecting to hell|10.10.1.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1,073,741,824 (1.0G) [application/octet-stream]

 5% [>                                    ] 57,266,176    30.30M/s

[-- Attachment #5: vmstat-2.txt --]
[-- Type: text/plain, Size: 2170 bytes --]

shuttle:~# vmstat 1
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
 0  0      0 983108   4672  29140    0    0    33    11  452    64  1  6 92  1
 0  0      0 983108   4672  29140    0    0     0     0  458    18  0  2 98  0
 0  0      0 982556   4688  29588    0    0   464     0  492    65  1  2 90  7
 0  0      0 981316   4692  30720    0    0     0     0 2029   162  0  2 98  0
 0  0      0 951804   4724  59324    0    0     0     0 38927  3128  1 42 57  0
 0  1      0 911380   4764  96528    0    0     4 66940 50360 10405  3 63 33  1
 0  1      0 875916   4796 131716    0    0     0     0 41138  4251  5 69  0 26
 1  1      0 842684   4828 164804    0    0     0     0 38724  4368  3 66  0 31
 1  1      0 807468   4872 199296    0    0     0   204 43170  4254  4 59  9 28
 1  0      0 772748   4908 232772    0    0     4 32516 39246  4071  3 67 22  8
 0  2      0 737656   4940 266256    0    0     0 97720 38868  4612  4 66 30  0
 0  2      0 737532   4940 266256    0    0     0 32768  663    23  0  5  0 95
 0  2      0 738772   4940 266256    0    0     0  6724  551    19  0  3  0 97
 1  1      0 718436   4972 288608    0    0     0   196 26291  2494  3 47  1 49
 0  0      0 676276   5012 329108    0    0     0     0 54791  4380  3 59  2 36
 0  2      0 639944   5048 362376    0    0     4 81856 44893  7185  2 54  9 35
 0  2      0 640564   5048 362376    0    0     0 14268  618    19  0  2  0 98
 0  2      0 641928   5048 362376    0    0     0    24  553    18  0  2  0 98
 0  1      0 608944   5088 396016    0    0     0   128 45004  9135  4 52  6 38
 0  1      0 571868   5124 431544    0    0     0     0 47833  9603  2 59 12 27
 1  1      0 529212   5160 471104    0    0     0 84548 52399  4222  2 61  5 32
 1  3      0 493500   5200 506492    0    0     4 16384 40790  4236  6 74  0 20
 0  3      0 459276   5232 540684    0    0     0  7208 39859  4816  4 68  0 28
 1  5      0 426400   5264 572964    0    0     0   276 37415  4565  6 61  0 33
 0  2      0 400980   5296 598496    0    0     0  2672 30845  4263  4 50  1 45

[-- Attachment #6: vmstat-3.txt --]
[-- Type: text/plain, Size: 14231 bytes --]

shuttle:~# vmstat 1
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
 0  0      0 979352  11984  26012    0    0   123    29  437   118  2  3 92  3
 0  0      0 979352  11984  26012    0    0     0    52  461    26  0  0 100  0
 0  0      0 978540  11988  26316    0    0   308     0  471    53  0  1 95  4
 0  0      0 978416  11988  26316    0    0     0     0  468    26  0  0 100  0
 0  0      0 978416  11988  26328    0    0    12     0  466    25  1  0 98  1
 0  0      0 978416  11988  26328    0    0     0     0  454    17  0  0 100  0
 0  0      0 978416  11988  26328    0    0     0     0  454    15  0  0 100  0
 0  0      0 978416  11988  26328    0    0     0   116  455    25  0  0 100  0
 0  0      0 978416  11988  26328    0    0     0     0  455    15  0  0 100  0
 0  0      0 978416  11988  26328    0    0     0     0  460    24  0  0 100  0
 0  0      0 978416  11988  26328    0    0     0     0  472    27  0  0 100  0
 0  0      0 978416  11988  26328    0    0     0     0  466    46  0  0 100  0
 0  0      0 978416  11988  26328    0    0     0     0  453    17  0  0 100  0
 0  0      0 978416  11988  26328    0    0     0     0  455    17  0  0 100  0
 0  0      0 978416  11988  26328    0    0     0     0  464    24  0  0 100  0
 0  0      0 978416  11988  26328    0    0     0     0  469    27  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  622    79  1  0 99  0
 0  0      0 978168  11988  26328    0    0     0     0 7304   808  3  3 94  0
 0  0      0 978168  11988  26328    0    0     0     0 10653  1181 10  5 85  0
 0  0      0 978168  11988  26328    0    0     0     0 10648  1223 29  7 64  0
 0  0      0 978168  11988  26328    0    0     0     0 10474  1192  0  1 99  0
 0  0      0 978168  11988  26328    0    0     0     0 10348  1172 24  4 73  0
 0  0      0 978168  11988  26328    0    0     0     0 5704   625  9  2 89  0
 1  0      0 978168  11988  26328    0    0     0     0 10385  1136 15  8 77  0
 0  0      0 978168  11988  26328    0    0     0     0 10571  1182 15  4 81  0
 0  0      0 978168  11988  26328    0    0     0     0 10443  1194  8  6 86  0
 0  0      0 978168  11988  26328    0    0     0     0 10623  1205 20  2 78  0
 0  0      0 978168  11988  26328    0    0     0   140 10600  1149 35  9 56  0
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
 1  0      0 978168  11988  26328    0    0     0     0 10441  1217 21  7 72  0
 0  0      0 978168  11988  26328    0    0     0     0 10424  1162 17  2 81  0
 0  0      0 978168  11988  26328    0    0     0     0 10433  1146  5  1 94  0
 0  0      0 978168  11988  26328    0    0     0     0 10576  1203 39  8 53  0
 0  0      0 978168  11988  26328    0    0     0     0 10627  1217 44  4 52  0
 0  0      0 978168  11988  26328    0    0     0     0 10529  1163 39 13 48  0
 0  0      0 978168  11988  26328    0    0     0     0 10552  1215 18  5 77  0
 1  0      0 978168  11988  26328    0    0     0     0 10459  1146 34  6 60  0
 0  0      0 978168  11988  26328    0    0     0     0 10339  1127  3  6 91  0
 0  0      0 978168  11988  26328    0    0     0     0 6178   673 13  4 83  0
 0  0      0 978168  11988  26328    0    0     0     0 9142  1018  1  4 95  0
 1  0      0 978168  11988  26328    0    0     0     0 6335   697  8  0 92  0
 0  0      0 978168  11988  26328    0    0     0     0 5565   632 21  1 78  0
 0  0      0 978168  11988  26328    0    0     0     0  454    17  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  455    17  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  453    17  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  458    17  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  454    17  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  453    15  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  455    19  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  453    15  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  454    19  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0 2636   272  7  3 90  0
 0  0      0 978168  11988  26328    0    0     0     0 10321  1159 14  2 84  0
 0  0      0 978168  11988  26328    0    0     0     0 10597  1277  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0 10545  1184 32  8 60  0
 1  0      0 978168  11988  26328    0    0     0     0 9922  1104 19  6 75  0
 0  0      0 978168  11988  26328    0    0     0     0 10417  1177 26 10 64  0
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
 1  0      0 978168  11988  26328    0    0     0     0 10487  1200 15 17 68  0
 0  0      0 978168  11988  26328    0    0     0     0 10436  1203 30 10 60  0
 0  0      0 978168  11988  26328    0    0     0     0 10413  1191 12  3 85  0
 0  0      0 978168  11988  26328    0    0     0     0 10496  1162 14  8 78  0
 2  0      0 978168  11988  26328    0    0     0     0 10528  1164 20 11 69  0
 0  0      0 978168  11988  26328    0    0     0     0 10586  1185 10  5 85  0
 0  0      0 978168  11988  26328    0    0     0     0 10565  1163  1  4 95  0
 0  0      0 978168  11988  26328    0    0     0     0 10610  1204  7  1 92  0
 0  0      0 978168  11988  26328    0    0     0     0 10550  1170 25  5 70  0
 1  0      0 978168  11988  26328    0    0     0     0 10530  1189 25 15 60  0
 0  0      0 978168  11988  26328    0    0     0     0 8300   948  6  3 91  0
 0  0      0 978168  11988  26328    0    0     0     0 8750  1036  4 15 81  0
 1  0      0 978168  11988  26328    0    0     0     0 10626  1209 29  7 64  0
 1  0      0 978168  11988  26328    0    0     0     0 10496  1170 16 10 74  0
 0  0      0 978168  11988  26328    0    0     0     0 10455  1239 17  6 77  0
 1  0      0 978168  11988  26328    0    0     0     0 9955  1105 10  2 88  0
 0  0      0 978168  11988  26328    0    0     0     0 10361  1214 20  2 78  0
 1  0      0 978168  11988  26328    0    0     0     0 10572  1192 14  3 83  0
 0  0      0 978168  11988  26328    0    0     0     0 10490  1194 27  1 72  0
 0  0      0 978168  11988  26328    0    0     0     0 10558  1308  2  3 95  0
 0  0      0 978168  11988  26328    0    0     0     0 10543  1305  1  2 97  0
 0  0      0 978168  11988  26328    0    0     0     0 9489  1084 10  2 88  0
 1  0      0 978168  11988  26328    0    0     0     0 10428  1228 12  8 80  0
 0  0      0 978168  11988  26328    0    0     0     0 10555  1200 12  3 85  0
 0  0      0 978168  11988  26328    0    0     0     0 10477  1159 37  2 61  0
 0  0      0 978168  11988  26328    0    0     0     0 10474  1175 38  6 56  0
 0  0      0 978168  11988  26328    0    0     0     0 10544  1193 16  5 79  0
 0  0      0 978168  11988  26328    0    0     0     0 10527  1157 18  2 80  0
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
 1  0      0 978168  11988  26328    0    0     0     0 9445  1068 17  2 81  0
 0  0      0 978168  11988  26328    0    0     0     0 10513  1209 36  4 60  0
 0  0      0 978168  11988  26328    0    0     0     0 10530  1190 27  2 71  0
 0  0      0 978168  11988  26328    0    0     0     0 7100   796 24  2 74  0
 0  0      0 978168  11988  26328    0    0     0     0 9832  1109 15 14 71  0
 0  0      0 978168  11988  26328    0    0     0     0 10455  1267  8  8 84  0
 0  0      0 978168  11988  26328    0    0     0     0 10414  1224  2  3 95  0
 0  0      0 978168  11988  26328    0    0     0     0 10336  1217  4  2 94  0
 0  0      0 978168  11988  26328    0    0     0     0 10428  1176  9  5 86  0
 1  0      0 978168  11988  26328    0    0     0     0 10411  1166 23  2 75  0
 0  0      0 978168  11988  26328    0    0     0     0 7818   863  7  3 90  0
 0  0      0 978168  11988  26328    0    0     0     0  454    17  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  454    15  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  453    19  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  455    15  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  453    19  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  454    15  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  455    17  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  453    17  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  455    16  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  453    17  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  454    17  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  454    15  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  454    19  0  0 100  0
 1  0      0 978168  11988  26328    0    0     0     0 2096   211  7  2 91  0
 0  0      0 978168  11988  26328    0    0     0     0 10167  1170  3  4 93  0
 0  0      0 978168  11988  26328    0    0     0     0 10615  1197  3  2 95  0
 0  0      0 978168  11988  26328    0    0     0     0 10404  1218  6  3 91  0
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
 1  0      0 978168  11988  26328    0    0     0     0 10456  1153 35  8 57  0
 0  0      0 978168  11988  26328    0    0     0     0 10497  1168 15  3 82  0
 0  0      0 978168  11988  26328    0    0     0     0 10103  1146 19  8 73  0
 1  0      0 978168  11988  26328    0    0     0     0 10472  1166 37 12 51  0
 0  0      0 978168  11988  26328    0    0     0     0 10557  1163 44  2 54  0
 1  0      0 978168  11988  26328    0    0     0     0 10531  1186 42  8 50  0
 0  0      0 978168  11988  26328    0    0     0     0 10444  1191 41  9 50  0
 1  0      0 978168  11988  26328    0    0     0     0 10562  1233 44  6 49  0
 0  0      0 978168  11988  26328    0    0     0     0 10571  1205 16  4 80  0
 0  0      0 978168  11988  26328    0    0     0     0 10582  1183 28  4 68  0
 0  0      0 978168  11988  26328    0    0     0     0 10622  1179 22  8 70  0
 0  0      0 978168  11988  26328    0    0     0     0 10615  1183 16  9 75  0
 0  0      0 978168  11988  26328    0    0     0     0 10514  1180 15  4 81  0
 1  0      0 978168  11988  26328    0    0     0     0 10371  1176 22  5 73  0
 0  0      0 978168  11988  26328    0    0     0     0 9910  1088 23  6 71  0
 0  0      0 978168  11988  26328    0    0     0     0 10480  1256  6  5 89  0
 0  0      0 978168  11988  26328    0    0     0     0 10387  1278  0  1 99  0
 1  0      0 978168  11988  26328    0    0     0     0 10572  1203  2  2 96  0
 0  0      0 978168  11988  26328    0    0     0     0 10312  1200  8  0 92  0
 0  0      0 978168  11988  26328    0    0     0     0 10462  1175  1  3 96  0
 0  0      0 978168  11988  26328    0    0     0     0 10402  1225  1  1 98  0
 1  0      0 978168  11988  26328    0    0     0     0 9556  1040 24  4 72  0
 0  0      0 978168  11988  26328    0    0     0     0 10542  1184 10  8 82  0
 0  0      0 978168  11988  26328    0    0     0     0 10575  1188  3  7 90  0
 1  0      0 978168  11988  26328    0    0     0     0 10399  1166 15  0 85  0
 0  0      0 978168  11988  26328    0    0     0     0 9151  1016  2  1 97  0
 0  0      0 978168  11988  26328    0    0     0     0 7011   765 14  0 86  0
 1  0      0 978168  11988  26328    0    0     0     0 10451  1171 22  5 73  0
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
 1  0      0 978168  11988  26328    0    0     0     0 9359  1037 32  6 62  0
 1  0      0 978168  11988  26328    0    0     0     0 9566  1071 34 11 55  0
 2  0      0 978168  11988  26328    0    0     0     0 9284  1125 40  3 57  0
 0  0      0 978168  11988  26328    0    0     0     0 6798   759 14  3 83  0
 0  0      0 978168  11988  26328    0    0     0     0  455    17  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  454    17  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  454    15  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  454    19  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  453    15  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  454    19  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  454    15  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  455    19  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0  455    17  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0 6911   794  0  0 100  0
 0  0      0 978168  11988  26328    0    0     0     0 10410  1149 32  2 66  0
 0  0      0 978168  11988  26328    0    0     0     0 10557  1182 47  3 50  0
 0  0      0 978168  11988  26328    0    0     0     0 10220  1164 12  6 82  0
 0  0      0 978292  11988  26328    0    0     0     0 4756   521  5  9 86  0
 0  0      0 978292  11988  26328    0    0     0     0  453    15  0  0 100  0
 0  0      0 978308  11988  26328    0    0     0     0  455    19  0  0 100  0
 0  0      0 978308  11988  26328    0    0     0     0  453    15  0  0 100  0
 0  0      0 978432  11988  26328    0    0     0     0  455    17  0  0 100  0
 0  0      0 978432  11988  26328    0    0     0     0  454    17  0  0 100  0
 0  0      0 978432  11988  26328    0    0     0     0  454    17  0  0 100  0
 0  0      0 978432  11988  26328    0    0     0     0  457    17  0  0 100  0
 0  0      0 978432  11988  26328    0    0     0     0  453    17  0  0 100  0

shuttle:~#

[-- Attachment #7: vmstat-4.txt --]
[-- Type: text/plain, Size: 656 bytes --]

shuttle:~# vmstat 1
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
 1  0      0 978500  12136  26496    0    0    44    12 1629   191  3  2 94  1
 0  0      0 977888  12144  26944    0    0   456     0  476    59  0  0 95  5
 0  0      0 977888  12144  26944    0    0     0     0  456    17  0  0 100  0
 0  0      0 977888  12144  26944    0    0     0     0  463    27  0  0 100  0
 1  0      0 962140  12164  42048    0    0     0     0 20379  1810  2 23 75  0
 1  1      0 919360  12204  81948    0    0     0 54492 52864  9317  2 62 36  0

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

* Re: [RFT] Realtek 8168 ethernet support
  2006-06-11 23:30             ` Francois Romieu
  2006-06-12 10:30               ` Mourad De Clerck
@ 2006-07-18 22:14               ` Francois Romieu
  2006-07-21 13:02                 ` Daniel Drake
  1 sibling, 1 reply; 18+ messages in thread
From: Francois Romieu @ 2006-07-18 22:14 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Randy.Dunlap, Daniel Drake, netdev

Francois Romieu <romieu@fr.zoreil.com> :
> The patch below agaisnt 2.6.17-rc6 includes the following changes:
> 
> commit 3072cc0aba3ac0c944e196a63c4154ca5746ec0b
> 
>     r8169: sync with vendor's driver
>     
>     - add several PCI ID for the PCI-E adapters ;
>     - new identification strings ;
>     - the RTL_GIGA_MAC_VER_ defines have been renamed to closely match the
>       out-of-tree driver. It makes the comparison less hairy ;
>     - various magic ;
>     - the PCI region for the device with PCI ID 0x8136 is guessed.
>       Explanation: the in-kernel Linux driver is written to allow MM register
>       accesses and avoid the IO tax. The relevant BAR register was found at
>       base address 1 for the plain-old PCI 8169. User reported lspci show that
>       it is found at base address 2 for the new Gigabit PCI-E 816{8/9}.

Despite the fact that the newer 8168 has been reported to only work with an
extra alignment (gross hack: s/NET_IP_ALIGN/8/), the serie seems otherwise
fine.

I'll submit an updated serie to correctly support the 8168.

-- 
Ueimor

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

* Re: [RFT] Realtek 8168 ethernet support
  2006-07-18 22:14               ` Francois Romieu
@ 2006-07-21 13:02                 ` Daniel Drake
  0 siblings, 0 replies; 18+ messages in thread
From: Daniel Drake @ 2006-07-21 13:02 UTC (permalink / raw)
  To: Francois Romieu; +Cc: Jeff Garzik, Randy.Dunlap, netdev

Hi Francois,

Francois Romieu wrote:
> Despite the fact that the newer 8168 has been reported to only work with an
> extra alignment (gross hack: s/NET_IP_ALIGN/8/), the serie seems otherwise
> fine.
> 
> I'll submit an updated serie to correctly support the 8168.


Any word on the updated 8168 patch? Would love to get that supported in 
Gentoo's upcoming release media, if the patch is ready.

Thanks!
Daniel

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

end of thread, other threads:[~2006-07-21 13:02 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-01 20:02 [RFT] Realtek 8168 ethernet support Daniel Drake
2006-06-01 22:24 ` Francois Romieu
2006-06-02  1:38   ` Jeff Garzik
2006-06-08 21:31 ` Randy.Dunlap
2006-06-08 23:41   ` Francois Romieu
2006-06-09  2:40   ` Jeff Garzik
2006-06-09  2:49     ` Randy.Dunlap
2006-06-09 18:33     ` Francois Romieu
2006-06-09 18:48       ` Jeff Garzik
2006-06-10 12:05         ` Francois Romieu
2006-06-10 22:48           ` Francois Romieu
2006-06-11 23:30             ` Francois Romieu
2006-06-12 10:30               ` Mourad De Clerck
2006-06-12 18:49                 ` Francois Romieu
     [not found]                   ` <448DE38D.8070503@aquazul.com>
2006-06-12 22:29                     ` Francois Romieu
2006-06-18 17:25                       ` Mourad De Clerck
2006-07-18 22:14               ` Francois Romieu
2006-07-21 13:02                 ` Daniel Drake

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).