RTL8169 Suspend and Resume Stuff
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): 1070212415.1607.17.camel@oxygenium
I have queued it with the following modifications (mostly to keep the style of the driver consistent):
- no whitespace before parenthesis for functions;
- s/ethernet_device/dev/ (like other drivers in drivers/net);
- write{b/w/l} -> RTL_W{8/16/32};
- netif_start_queue() done in rtl8169_hw_start().
See http://www.fr.zoreil.com/people/francois/misc/r8169/r8169-suspend.patch
for patch.
Btw, there is a flaw in r8169-dma-api-rx-buffers.patch so don't bother testing it. I'll do it again tomorrow.
--
Ueimor
PATCH 1/1 2.6.0-test11 - more rtl8169
Francois Romieu <[email protected]> :
[...]
Quoted 2 lines
Btw, there is a flaw in r8169-dma-api-rx-buffers.patch so don't bother testing it. I'll do it again tomorrow.
Attached patch should fix it.
Executive summary:
o Pure 2.6.0-test11:
Get:
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.0-test11/r8169-blob.tar.bz2
debuntarzipe and apply/compile/test in following order:
r8169-dma-api-tx.patch
r8169-dma-api-rx-buffers.patch <-+ Do not test these two patches
r8169-dma-api-rx-buffers-ahum.patch <-+ separately r8169-start-xmit-fixes.patch r8169-dma-api-tx-buffers.patch r8169-rx_copybreak.patch r8169-mac-phy-version.patch r8169-init_one.patch
r8169-timer.patch
r8169-hw_start.patch r8169-missing-tx-stats.patch r8169-intr_mask.patch
r8169-suspend.patch
The same directory contains each patch alone as well.
o 2.6.0-test11 + 2.6.0-test9-bk25-netdrvr-exp1
Get:
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.0-test11-netdrv/r8169-blob.tar.bz2
Same thing as above with:
r8169-mac-phy-version.patch
r8169-init_one.patch
r8169-timer.patch
r8169-hw_start.patch
r8169-missing-tx-stats.patch
r8169-intr_mask.patch
r8169-suspend.patch
r8169-dma-api-rx-buffers-ahum.patch
Applying r8169-dma-api-rx-buffers-ahum.patch before r8169-mac-phy-version.patch generates a few offsets but works as well.
--
Ueimor
Brown paper bag time: the Rx descriptors are contiguous and EORbit only marks the last descriptor in the array. OWNbit implicitly marks the end of the Rx descriptors segment which is owned by the nic.
drivers/net/r8169.c | 20 ++++++-------------- 1 files changed, 6 insertions(+), 14 deletions(-)
drivers/net/r8169.c renamed from drivers/net/r8169.c~r8169-dma-api-rx-buffers-ahum +6 -14
@@ -283,6 +283,8 @@ enum _DescStatusBit { LSbit = 0x10000000, }; +#define RsvdMask 0x3fffc000 +struct TxDesc {u32 status;u32 vlan_tag;
@@ -1121,7 +1123,7 @@ rtl8169_hw_start(struct net_device *dev)static inline void rtl8169_make_unusable_by_asic (struct RxDesc *desc) { desc->buf_addr =0xdeadbeef ; - desc->status = EORbit; + desc->status &= ~(OWNbit | RsvdMask); } static void rtl8169_free_rx_skb(struct pci_dev *pdev, struct sk_buff **sk_buff,
@@ -1141,7 +1143,7 @@ static inline void rtl8169_return_to_asistatic inline void rtl8169_give_to_asic (struct RxDesc *desc,dma_addr_t mapping) { desc->buf_addr = mapping; - desc->status = OWNbit +RX_BUF_SIZE ; + desc->status |= OWNbit +RX_BUF_SIZE ; } static int rtl8169_alloc_rx_skb(struct pci_dev *pdev, struct net_device *dev,
@@ -1209,11 +1211,6 @@ static inline void rtl8169_mark_as_last_ desc->status |= EORbit; } -static inline void rtl8169_unmark_as_last_descriptor (struct RxDesc *desc) -{ - desc->status &= ~EORbit; -} -static int rtl8169_init_ring (struct net_device *dev) {struct rtl8169_private *tp = dev->priv;
@@ -1460,14 +1457,9 @@ rtl8169_rx_interrupt(struct net_device * } delta =rtl8169_rx_fill (tp, dev, tp->dirty_rx, tp->cur_rx); -if (delta >0 ) { -u32 old_last = (tp->dirty_rx -1 ) %NUM_RX_DESC ; - +if (delta >0 ) tp->dirty_rx += delta; -rtl8169_mark_as_last_descriptor (tp->RxDescArray + - (tp->dirty_rx -1 )%NUM_RX_DESC ); -rtl8169_unmark_as_last_descriptor (tp->RxDescArray + old_last); - }else if (delta <0 ) +else if (delta <0 )printk (KERN_INFO "%s: no Rx buffer allocated\n" , dev->name);/*
_
PATCH 1/1 Realtek RTL-8169 RX/TX Statistics
Hello Francois
It's a simple and small patch.
This patch add stats improvements and fixes.
Cheers!
Signature · 8 lines
Fernando Alencar Maróstica
Graduate Student, Computer Science
Linux Register User Id #281457
University Methodist of Piracicaba
Departament of Computer Science
email: [email protected]
homepage: http://www.unimep.br/~famarostr8169.c renamed from r8169.c.orig +18 -3
@@ -303,7 +303,7 @@static int rtl8169_close (struct net_device *dev);static void rtl8169_set_rx_mode (struct net_device *dev);static void rtl8169_tx_timeout (struct net_device *dev); -static struct net_device_stats *rtl8169_get_stats (struct net_device *netdev); +static struct net_device_stats *rtl8169_get_stats (struct net_device *ethernet_device);static const u16 rtl8169_intr_mask = SYSErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver | TxErr | TxOK |
@@ -1113,11 +1113,26 @@spin_unlock_irqrestore (&tp->lock, flags); } +/** +* rtl8169_get_stats: - Get rtl8169 read/write statistics +* @ethernet_device: The Ethernet Device to get statistics for +* +* Get TX/RX statistics for rtl8169 +*/ struct net_device_stats * -rtl8169_get_stats (struct net_device *dev) +rtl8169_get_stats (struct net_device *ethernet_device) { -struct rtl8169_private *tp = dev->priv; +struct rtl8169_private *tp = ethernet_device->priv; +void *ioaddr = tp->mmio_addr; +unsigned long flags; +if (netif_running (ethernet_device)) { +spin_lock_irqsave (&tp->lock, flags); + tp->stats.rx_missed_errors +=RTL_R32 (RxMissed); +RTL_W32 (RxMissed,0 ); +spin_unlock_irqrestore (&tp->lock, flags); + } +return &tp->stats; }
Re: [PATCH 2.6] Realtek RTL-8169 RX/TX Statistics
Fernando Alencar Mar�stica <[email protected]> :
[...]
Quoted 2 lines
It's a simple and small patch.
This patch add stats improvements and fixes.
Thanks.
--
Ueimor
PATCH 1/1 2.6.0-test11 - rtl8169 endianness
In reply to Francois RomieuSee patch in attachment.
Francois Romieu <[email protected]> :
[...]
Quoted 6 lines
o Pure 2.6.0-test11:
Get:
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.0-test11/r8169-blob.tar.bz2
debuntarzipe and apply/compile/test in following order:
r8169-dma-api-tx.patch
[...]
Quoted 1 line
r8169-suspend.patch
Insert here.
[...]
Quoted 6 lines
o 2.6.0-test11 + 2.6.0-test9-bk25-netdrvr-exp1
Get:
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.0-test11-netdrv/r8169-blob.tar.bz2
Same thing as above with:
r8169-mac-phy-version.patch
[...]
Quoted 2 lines
r8169-suspend.patch
r8169-dma-api-rx-buffers-ahum.patch
Or here.
--
Ueimor
Endianness update (original idea from Alexandra N. Kossovsky):
- descriptors status (bitfields enumerated as _DescStatusBit);
- address of buffers stored in Rx/Tx descriptors.
drivers/net/r8169.c | 31 ++++++++++++++++--------------- 1 files changed, 16 insertions(+), 15 deletions(-)
drivers/net/r8169.c renamed from drivers/net/r8169.c~r8169-endianness +16 -15
@@ -1123,13 +1123,14 @@ rtl8169_hw_start(struct net_device *dev)static inline void rtl8169_make_unusable_by_asic (struct RxDesc *desc) { desc->buf_addr =0xdeadbeef ; - desc->status &= ~(OWNbit | RsvdMask); + desc->status &= ~cpu_to_le32 (OWNbit | RsvdMask); }static void rtl8169_free_rx_skb (struct pci_dev *pdev,struct sk_buff **sk_buff,struct RxDesc *desc) { -pci_unmap_single (pdev, desc->buf_addr,RX_BUF_SIZE ,PCI_DMA_FROMDEVICE ); +pci_unmap_single (pdev,le32_to_cpu (desc->buf_addr),RX_BUF_SIZE , +PCI_DMA_FROMDEVICE );dev_kfree_skb (*sk_buff); *sk_buff =NULL ;rtl8169_make_unusable_by_asic (desc);
@@ -1137,13 +1138,13 @@ static void rtl8169_free_rx_skb(struct pstatic inline void rtl8169_return_to_asic (struct RxDesc *desc) { - desc->status |= OWNbit +RX_BUF_SIZE ; + desc->status |=cpu_to_le32 (OWNbit +RX_BUF_SIZE ); }static inline void rtl8169_give_to_asic (struct RxDesc *desc,dma_addr_t mapping) { - desc->buf_addr = mapping; - desc->status |= OWNbit +RX_BUF_SIZE ; + desc->buf_addr =cpu_to_le32 (mapping); + desc->status |=cpu_to_le32 (OWNbit +RX_BUF_SIZE ); } static int rtl8169_alloc_rx_skb(struct pci_dev *pdev, struct net_device *dev,
@@ -1208,7 +1209,7 @@ static u32 rtl8169_rx_fill(struct rtl816static inline void rtl8169_mark_as_last_descriptor (struct RxDesc *desc) { - desc->status |= EORbit; + desc->status |=cpu_to_le32 (EORbit); }static int rtl8169_init_ring (struct net_device *dev)
@@ -1240,8 +1241,8 @@ static void rtl8169_unmap_tx_skb(struct {u32 len = sk_buff[0 ]->len; -pci_unmap_single (pdev, desc->buf_addr, len <ETH_ZLEN ?ETH_ZLEN : len, -PCI_DMA_TODEVICE ); +pci_unmap_single (pdev,le32_to_cpu (desc->buf_addr), + len <ETH_ZLEN ?ETH_ZLEN : len,PCI_DMA_TODEVICE ); desc->buf_addr =0x00 ; *sk_buff =NULL ; }
@@ -1307,17 +1308,17 @@ rtl8169_start_xmit(struct sk_buff *skb,spin_lock_irq (&tp->lock); -if ((tp->TxDescArray[entry].status & OWNbit) ==0 ) { +if (!(le32_to_cpu (tp->TxDescArray[entry].status) & OWNbit)) {dma_addr_t mapping; mapping =pci_map_single (tp->pci_dev, skb->data, len,PCI_DMA_TODEVICE ); tp->Tx_skbuff[entry] = skb; - tp->TxDescArray[entry].buf_addr = mapping; + tp->TxDescArray[entry].buf_addr =cpu_to_le32 (mapping); - tp->TxDescArray[entry].status = OWNbit | FSbit | LSbit | len | - (EORbit * !((entry +1 ) %NUM_TX_DESC )); + tp->TxDescArray[entry].status =cpu_to_le32 (OWNbit | FSbit | + LSbit | len | (EORbit * !((entry +1 ) %NUM_TX_DESC )));RTL_W8 (TxPoll,0x40 );//set polling bit
@@ -1358,7 +1359,7 @@ rtl8169_tx_interrupt(struct net_device * tx_left = tp->cur_tx - dirty_tx;while (tx_left >0 ) { -if ((tp->TxDescArray[entry].status & OWNbit) ==0 ) { +if (!(le32_to_cpu (tp->TxDescArray[entry].status) & OWNbit)) {int cur = dirty_tx %NUM_TX_DESC ;struct sk_buff *skb = tp->Tx_skbuff[cur];
@@ -1416,8 +1417,8 @@ rtl8169_rx_interrupt(struct net_device * cur_rx = tp->cur_rx %RX_BUF_SIZE ; -while ((tp->RxDescArray[cur_rx].status & OWNbit) ==0 ) { -u32 status = tp->RxDescArray[cur_rx].status; +while (!(le32_to_cpu (tp->RxDescArray[cur_rx].status) & OWNbit)) { +u32 status =le32_to_cpu (tp->RxDescArray[cur_rx].status);if (status & RxRES) {printk (KERN_INFO "%s: Rx ERROR!!!\n" , dev->name);
_
Re: [PATCH 2.6] 2.6.0-test11 - rtl8169 endianness
k, cool ... I should have time to test all this tonight ...
-Brad
Quoted 151 lines · Francois Romieu
See patch in attachment.
Francois Romieu <[email protected]> :
[...]Quoted 5 lines
o Pure 2.6.0-test11:
Get:
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.0-test11/r8169-blob.tar.bz2 debuntarzipe and apply/compile/test in following order:
r8169-dma-api-tx.patch[...]
Quoted 1 line
r8169-suspend.patch
Insert here.
[...]
Quoted 5 lines
o 2.6.0-test11 + 2.6.0-test9-bk25-netdrvr-exp1
Get:
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.0-test11-netdrv/r8169-blob.tar.bz2 Same thing as above with:
r8169-mac-phy-version.patch[...]
Quoted 2 lines
r8169-suspend.patch
r8169-dma-api-rx-buffers-ahum.patchOr here.
--
Ueimor------------------------------------------------------------------------
Endianness update (original idea from Alexandra N. Kossovsky):
- descriptors status (bitfields enumerated as_DescStatusBit);
- address of buffers stored in Rx/Tx descriptors.drivers/net/r8169.c | 31 ++++++++++++++++--------------- 1 files changed, 16 insertions(+), 15 deletions(-)diff -puN
drivers/net/r8169.c~r8169-endiannessdrivers/net/r8169.cdrivers/net/r8169.c renamed from drivers/net/r8169.c~r8169-endianness +16
-15@@ -1123,13 +1123,14 @@ rtl8169_hw_start(struct net_device *dev)static inline void rtl8169_make_unusable_by_asic (struct RxDesc *desc) { desc->buf_addr =0xdeadbeef ; - desc->status &= ~(OWNbit | RsvdMask); + desc->status &= ~cpu_to_le32 (OWNbit | RsvdMask); }static void rtl8169_free_rx_skb (struct pci_dev *pdev,struct sk_buff **sk_buff,struct RxDesc *desc) { -pci_unmap_single (pdev, desc->buf_addr,RX_BUF_SIZE ,PCI_DMA_FROMDEVICE ); +pci_unmap_single (pdev,le32_to_cpu (desc->buf_addr),RX_BUF_SIZE , +PCI_DMA_FROMDEVICE );dev_kfree_skb (*sk_buff); *sk_buff =NULL ;rtl8169_make_unusable_by_asic (desc);@@ -1137,13 +1138,13 @@ static void rtl8169_free_rx_skb(struct pstatic inline void rtl8169_return_to_asic (struct RxDesc *desc) { - desc->status |= OWNbit +RX_BUF_SIZE ; + desc->status |=cpu_to_le32 (OWNbit +RX_BUF_SIZE ); }static inline void rtl8169_give_to_asic (struct RxDesc *desc,dma_addr_t mapping) { - desc->buf_addr = mapping; - desc->status |= OWNbit +RX_BUF_SIZE ; + desc->buf_addr =cpu_to_le32 (mapping); + desc->status |=cpu_to_le32 (OWNbit +RX_BUF_SIZE ); } static int rtl8169_alloc_rx_skb(struct pci_dev *pdev, struct net_device *dev,@@ -1208,7 +1209,7 @@ static u32 rtl8169_rx_fill(struct rtl816static inline void rtl8169_mark_as_last_descriptor (struct RxDesc *desc) { - desc->status |= EORbit; + desc->status |=cpu_to_le32 (EORbit); }static int rtl8169_init_ring (struct net_device *dev)@@ -1240,8 +1241,8 @@ static void rtl8169_unmap_tx_skb(struct {u32 len = sk_buff[0 ]->len; -pci_unmap_single (pdev, desc->buf_addr, len <ETH_ZLEN ?ETH_ZLEN : len, -PCI_DMA_TODEVICE ); +pci_unmap_single (pdev,le32_to_cpu (desc->buf_addr), + len <ETH_ZLEN ?ETH_ZLEN : len,PCI_DMA_TODEVICE ); desc->buf_addr =0x00 ; *sk_buff =NULL ; }@@ -1307,17 +1308,17 @@ rtl8169_start_xmit(struct sk_buff *skb,spin_lock_irq (&tp->lock); -if ((tp->TxDescArray[entry].status & OWNbit) ==0 ) { +if (!(le32_to_cpu (tp->TxDescArray[entry].status) & OWNbit)) {dma_addr_t mapping; mapping =pci_map_single (tp->pci_dev, skb->data, len,PCI_DMA_TODEVICE ); tp->Tx_skbuff[entry] = skb; - tp->TxDescArray[entry].buf_addr = mapping; + tp->TxDescArray[entry].buf_addr =cpu_to_le32 (mapping); - tp->TxDescArray[entry].status = OWNbit | FSbit | LSbit | len | - (EORbit * !((entry +1 ) %NUM_TX_DESC )); + tp->TxDescArray[entry].status =cpu_to_le32 (OWNbit | FSbit | + LSbit | len | (EORbit * !((entry +1 ) %NUM_TX_DESC )));RTL_W8 (TxPoll,0x40 );//set polling bit @@ -1358,7 +1359,7 @@ rtl8169_tx_interrupt(struct net_device * tx_left = tp->cur_tx - dirty_tx;while (tx_left >0 ) { -if ((tp->TxDescArray[entry].status & OWNbit) ==0 ) { +if (!(le32_to_cpu (tp->TxDescArray[entry].status) & OWNbit)) {int cur = dirty_tx %NUM_TX_DESC ;struct sk_buff *skb = tp->Tx_skbuff[cur];@@ -1416,8 +1417,8 @@ rtl8169_rx_interrupt(struct net_device * cur_rx = tp->cur_rx %RX_BUF_SIZE ; -while ((tp->RxDescArray[cur_rx].status & OWNbit) ==0 ) { -u32 status = tp->RxDescArray[cur_rx].status; +while (!(le32_to_cpu (tp->RxDescArray[cur_rx].status) & OWNbit)) { +u32 status =le32_to_cpu (tp->RxDescArray[cur_rx].status);if (status & RxRES) {printk (KERN_INFO "%s: Rx ERROR!!!\n" , dev->name);_
Re: [PATCH 2.6] 2.6.0-test11 - more rtl8169
In reply to Francois RomieuQuoted 10 lines · Francois Romieu
Get:
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.0-test11-netdrv/r8169-blob.tar.bz2 Same thing as above with:
r8169-mac-phy-version.patch
r8169-init_one.patch
r8169-timer.patch
r8169-hw_start.patch
r8169-missing-tx-stats.patch
r8169-intr_mask.patch
r8169-suspend.patch
r8169-dma-api-rx-buffers-ahum.patch
All the above patches applied, in the above order.
Thanks much, Francois!
Is there anything left?
Jeff
P.S. Will release updated 2.5-exp patch soon.
PATCH 1/1 2.6.0-test11-bk5 - rtl8169
Jeff Garzik <[email protected]> :
[...]
Quoted 1 line
Is there anything left?
See attachment for
r8169-endianness.patch
r8169-getstats.patch
(against 2.6.0-test11-bk5 + 2.6.0-test11-bk5-netdrvr-exp1).
I diffed the whole thing against pure 2.6.0-test11 as well. It is available at:
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.0-test11-bk5
--
Ueimor
Endianness update (original idea from Alexandra N. Kossovsky):
- descriptors status (bitfields enumerated as _DescStatusBit);
- address of buffers stored in Rx/Tx descriptors.
drivers/net/r8169.c | 31 ++++++++++++++++--------------- 1 files changed, 16 insertions(+), 15 deletions(-)
drivers/net/r8169.c renamed from drivers/net/r8169.c~r8169-endianness +16 -15
@@ -1116,13 +1116,14 @@ rtl8169_hw_start(struct net_device *dev)static inline void rtl8169_make_unusable_by_asic (struct RxDesc *desc) { desc->buf_addr =0xdeadbeef ; - desc->status &= ~(OWNbit | RsvdMask); + desc->status &= ~cpu_to_le32 (OWNbit | RsvdMask); }static void rtl8169_free_rx_skb (struct pci_dev *pdev,struct sk_buff **sk_buff,struct RxDesc *desc) { -pci_unmap_single (pdev, desc->buf_addr,RX_BUF_SIZE ,PCI_DMA_FROMDEVICE ); +pci_unmap_single (pdev,le32_to_cpu (desc->buf_addr),RX_BUF_SIZE , +PCI_DMA_FROMDEVICE );dev_kfree_skb (*sk_buff); *sk_buff =NULL ;rtl8169_make_unusable_by_asic (desc);
@@ -1130,13 +1131,13 @@ static void rtl8169_free_rx_skb(struct pstatic inline void rtl8169_return_to_asic (struct RxDesc *desc) { - desc->status |= OWNbit +RX_BUF_SIZE ; + desc->status |=cpu_to_le32 (OWNbit +RX_BUF_SIZE ); }static inline void rtl8169_give_to_asic (struct RxDesc *desc,dma_addr_t mapping) { - desc->buf_addr = mapping; - desc->status |= OWNbit +RX_BUF_SIZE ; + desc->buf_addr =cpu_to_le32 (mapping); + desc->status |=cpu_to_le32 (OWNbit +RX_BUF_SIZE ); } static int rtl8169_alloc_rx_skb(struct pci_dev *pdev, struct net_device *dev,
@@ -1201,7 +1202,7 @@ static u32 rtl8169_rx_fill(struct rtl816static inline void rtl8169_mark_as_last_descriptor (struct RxDesc *desc) { - desc->status |= EORbit; + desc->status |=cpu_to_le32 (EORbit); }static int rtl8169_init_ring (struct net_device *dev)
@@ -1233,8 +1234,8 @@ static void rtl8169_unmap_tx_skb(struct {u32 len = sk_buff[0 ]->len; -pci_unmap_single (pdev, desc->buf_addr, len <ETH_ZLEN ?ETH_ZLEN : len, -PCI_DMA_TODEVICE ); +pci_unmap_single (pdev,le32_to_cpu (desc->buf_addr), + len <ETH_ZLEN ?ETH_ZLEN : len,PCI_DMA_TODEVICE ); desc->buf_addr =0x00 ; *sk_buff =NULL ; }
@@ -1300,17 +1301,17 @@ rtl8169_start_xmit(struct sk_buff *skb,spin_lock_irq (&tp->lock); -if ((tp->TxDescArray[entry].status & OWNbit) ==0 ) { +if (!(le32_to_cpu (tp->TxDescArray[entry].status) & OWNbit)) {dma_addr_t mapping; mapping =pci_map_single (tp->pci_dev, skb->data, len,PCI_DMA_TODEVICE ); tp->Tx_skbuff[entry] = skb; - tp->TxDescArray[entry].buf_addr = mapping; + tp->TxDescArray[entry].buf_addr =cpu_to_le32 (mapping); - tp->TxDescArray[entry].status = OWNbit | FSbit | LSbit | len | - (EORbit * !((entry +1 ) %NUM_TX_DESC )); + tp->TxDescArray[entry].status =cpu_to_le32 (OWNbit | FSbit | + LSbit | len | (EORbit * !((entry +1 ) %NUM_TX_DESC )));RTL_W8 (TxPoll,0x40 );//set polling bit
@@ -1351,7 +1352,7 @@ rtl8169_tx_interrupt(struct net_device * tx_left = tp->cur_tx - dirty_tx;while (tx_left >0 ) { -if ((tp->TxDescArray[entry].status & OWNbit) ==0 ) { +if (!(le32_to_cpu (tp->TxDescArray[entry].status) & OWNbit)) {int cur = dirty_tx %NUM_TX_DESC ;struct sk_buff *skb = tp->Tx_skbuff[cur];
@@ -1409,8 +1410,8 @@ rtl8169_rx_interrupt(struct net_device * cur_rx = tp->cur_rx %RX_BUF_SIZE ; -while ((tp->RxDescArray[cur_rx].status & OWNbit) ==0 ) { -u32 status = tp->RxDescArray[cur_rx].status; +while (!(le32_to_cpu (tp->RxDescArray[cur_rx].status) & OWNbit)) { +u32 status =le32_to_cpu (tp->RxDescArray[cur_rx].status);if (status & RxRES) {printk (KERN_INFO "%s: Rx ERROR!!!\n" , dev->name);
_
Stats fix (Fernando Alencar Mar�stica <[email protected]>).
drivers/net/r8169.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+)
drivers/net/r8169.c renamed from drivers/net/r8169.c~r8169-getstats +15 -0
@@ -1610,11 +1610,26 @@ rtl8169_set_rx_mode(struct net_device *dspin_unlock_irqrestore (&tp->lock, flags); } +/** +* rtl8169_get_stats - Get rtl8169 read/write statistics +* @dev: The Ethernet Device to get statistics for +* +* Get TX/RX statistics for rtl8169 +*/ struct net_device_stats *rtl8169_get_stats (struct net_device *dev) {struct rtl8169_private *tp = dev->priv; +void *ioaddr = tp->mmio_addr; +unsigned long flags; +if (netif_running (dev)) { +spin_lock_irqsave (&tp->lock, flags); + tp->stats.rx_missed_errors +=RTL_R32 (RxMissed); +RTL_W32 (RxMissed,0 ); +spin_unlock_irqrestore (&tp->lock, flags); + } +return &tp->stats; }
_
Jeff Garzik
AppliedRe: [PATCH 2.6] 2.6.0-test11-bk5 - rtl8169
thanks, applied both -endianness and -getstats patches.