]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
[PATCH] add r8169-rx-desc-len-fix.patch
authorchrisw@osdl.org <chrisw@osdl.org>
Thu, 10 Mar 2005 19:02:26 +0000 (11:02 -0800)
committerGreg KH <gregkh@suse.de>
Thu, 12 May 2005 05:10:06 +0000 (22:10 -0700)
r8169-rx-desc-len-fix.patch [new file with mode: 0644]

diff --git a/r8169-rx-desc-len-fix.patch b/r8169-rx-desc-len-fix.patch
new file mode 100644 (file)
index 0000000..25d2a3a
--- /dev/null
@@ -0,0 +1,64 @@
+Date: Thu, 10 Mar 2005 10:51:39 -0800
+From: Stephen Hemminger <shemminger@osdl.org>
+To: Greg KH <greg@kroah.com>, Chris Wright <chrisw@osdl.org>
+Cc: Jeff Garzik <jgarzik@pobox.com>, Francois Romieu <romieu@fr.zoreil.com>
+Subject: {PATCH] r8169: receive descriptor length fix
+
+The status and received packets indication in the Rx descriptor ring
+are not correctly reset when a descriptor is recycled.
+
+Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
+Signed-off-by: Chris Wright <chrisw@osdl.org>
+
+diff -puN drivers/net/r8169.c~r8169-490 drivers/net/r8169.c
+--- a/drivers/net/r8169.c~r8169-490    2005-03-08 00:01:26.000000000 +0100
++++ b/drivers/net/r8169.c              2005-03-09 00:38:34.235464833 +0100
+@@ -1683,16 +1683,19 @@ static void rtl8169_free_rx_skb(struct r
+       rtl8169_make_unusable_by_asic(desc);
+ }
+-static inline void rtl8169_return_to_asic(struct RxDesc *desc, int rx_buf_sz)
++static inline void rtl8169_mark_to_asic(struct RxDesc *desc, u32 rx_buf_sz)
+ {
+-      desc->opts1 |= cpu_to_le32(DescOwn + rx_buf_sz);
++      u32 eor = le32_to_cpu(desc->opts1) & RingEnd;
++
++      desc->opts1 = cpu_to_le32(DescOwn | eor | rx_buf_sz);
+ }
+-static inline void rtl8169_give_to_asic(struct RxDesc *desc, dma_addr_t mapping,
+-                                      int rx_buf_sz)
++static inline void rtl8169_map_to_asic(struct RxDesc *desc, dma_addr_t mapping,
++                                     u32 rx_buf_sz)
+ {
+       desc->addr = cpu_to_le64(mapping);
+-      desc->opts1 |= cpu_to_le32(DescOwn + rx_buf_sz);
++      wmb();
++      rtl8169_mark_to_asic(desc, rx_buf_sz);
+ }
+ static int rtl8169_alloc_rx_skb(struct pci_dev *pdev, struct sk_buff **sk_buff,
+@@ -1712,7 +1715,7 @@ static int rtl8169_alloc_rx_skb(struct p
+       mapping = pci_map_single(pdev, skb->tail, rx_buf_sz,
+                                PCI_DMA_FROMDEVICE);
+-      rtl8169_give_to_asic(desc, mapping, rx_buf_sz);
++      rtl8169_map_to_asic(desc, mapping, rx_buf_sz);
+ out:
+       return ret;
+@@ -2150,7 +2153,7 @@ static inline int rtl8169_try_rx_copy(st
+                       skb_reserve(skb, NET_IP_ALIGN);
+                       eth_copy_and_sum(skb, sk_buff[0]->tail, pkt_size, 0);
+                       *sk_buff = skb;
+-                      rtl8169_return_to_asic(desc, rx_buf_sz);
++                      rtl8169_mark_to_asic(desc, rx_buf_sz);
+                       ret = 0;
+               }
+       }
+
+_
+
+-- 
+Ueimor
+