ChangeSet 1.1982.158.15, 2005/03/12 21:46:01-08:00, [EMAIL PROTECTED]

        [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 <[EMAIL PROTECTED]>
        Signed-off-by: Chris Wright <[EMAIL PROTECTED]>
        Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>



 r8169.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)


diff -Nru a/drivers/net/r8169.c b/drivers/net/r8169.c
--- a/drivers/net/r8169.c       2005-03-14 23:09:12 -08:00
+++ b/drivers/net/r8169.c       2005-03-14 23:09:12 -08:00
@@ -1683,16 +1683,19 @@
        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 @@
        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 @@
                        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;
                }
        }
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to