TSO fixes
- fix rare early completion when using TSO
- extra descriptor for the sentinel descriptor

Signed-off-by: Jeff Kirsher <[EMAIL PROTECTED]>
Signed-off-by: John Ronciak <[EMAIL PROTECTED]>
Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]>


diff -up linux-2.6/drivers/net/ixgb/ixgb_main.c
linux-2.6.new/drivers/net/ixgb/ixgb_main.c
--- linux-2.6/drivers/net/ixgb/ixgb_main.c      2005-11-14 19:59:34.000000000 
-0800
+++ linux-2.6.new/drivers/net/ixgb/ixgb_main.c  2005-10-31
12:02:56.000000000 -0800
@@ -1261,6 +1261,9 @@ ixgb_tx_csum(struct ixgb_adapter *adapte
        struct ixgb_buffer *buffer_info;
        int len = skb->len;
        unsigned int offset = 0, size, count = 0, i;
+#ifdef NETIF_F_TSO
+       unsigned int mss = skb_shinfo(skb)->tso_size;
+#endif

        unsigned int nr_frags = skb_shinfo(skb)->nr_frags;
        unsigned int f;
@@ -1272,6 +1278,13 @@ ixgb_tx_map(struct ixgb_adapter *adapter
        while(len) {
                buffer_info = &tx_ring->buffer_info[i];
                size = min(len, IXGB_MAX_JUMBO_FRAME_SIZE);
+#ifdef NETIF_F_TSO
+               /* Workaround for premature desc write-backs
+                * in TSO mode.  Append 4-byte sentinel desc */
+               if(unlikely(mss && !nr_frags && size == len && size > 8))
+                       size -= 4;
+
+#endif
                buffer_info->length = size;
                buffer_info->dma =
                        pci_map_single(adapter->pdev,
@@ -1296,6 +1307,14 @@ ixgb_tx_map(struct ixgb_adapter *adapter
                while(len) {
                        buffer_info = &tx_ring->buffer_info[i];
                        size = min(len, IXGB_MAX_JUMBO_FRAME_SIZE);
+#ifdef NETIF_F_TSO
+                       /* Workaround for premature desc write-backs
+                        * in TSO mode.  Append 4-byte sentinel desc */
+                       if(unlikely(mss && (f == (nr_frags-1)) && (size == len)
+                                               && (size > 8)))
+                               size -= 4;
+
+#endif
                        buffer_info->length = size;
                        buffer_info->dma =
                                pci_map_page(adapter->pdev,
@@ -1373,7 +1373,8 @@ ixgb_tx_queue(struct ixgb_adapter *adapt
 #define TXD_USE_COUNT(S) (((S) >> IXGB_MAX_TXD_PWR) + \
                         (((S) & (IXGB_MAX_DATA_PER_TXD - 1)) ? 1 : 0))
 #define DESC_NEEDED TXD_USE_COUNT(IXGB_MAX_DATA_PER_TXD) + \
-       MAX_SKB_FRAGS * TXD_USE_COUNT(PAGE_SIZE) + 1
+       MAX_SKB_FRAGS * TXD_USE_COUNT(PAGE_SIZE) + 1 \
+       /* one more for TSO workaround */ + 1

 static int
 ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to