diff options
author | Auke Kok <auke-jan.h.kok@intel.com> | 2006-05-23 13:29:41 -0400 |
---|---|---|
committer | Auke Kok <juke-jan.h.kok@intel.com> | 2006-05-23 13:29:41 -0400 |
commit | 96f9c2e277768099479fbed7c3b69c294b1fadef (patch) | |
tree | 468b06ab34bb6184e6561c1849dbffef06ffc7eb /drivers/net | |
parent | 4e3ceac609cce39cb96e0eb8604934592371ed8c (diff) |
ixgb: fix rare early tso completion
Fix rare early completion when using TSO. This essentially is the
e1000 fix, with code that was mostly already written. Another skb frag
was also needed.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: John Ronciak <john.ronciak@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ixgb/ixgb_main.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index cfd67d812f0d..13181c4f1d20 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -1266,6 +1266,7 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb, | |||
1266 | struct ixgb_buffer *buffer_info; | 1266 | struct ixgb_buffer *buffer_info; |
1267 | int len = skb->len; | 1267 | int len = skb->len; |
1268 | unsigned int offset = 0, size, count = 0, i; | 1268 | unsigned int offset = 0, size, count = 0, i; |
1269 | unsigned int mss = skb_shinfo(skb)->tso_size; | ||
1269 | 1270 | ||
1270 | unsigned int nr_frags = skb_shinfo(skb)->nr_frags; | 1271 | unsigned int nr_frags = skb_shinfo(skb)->nr_frags; |
1271 | unsigned int f; | 1272 | unsigned int f; |
@@ -1277,6 +1278,11 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb, | |||
1277 | while(len) { | 1278 | while(len) { |
1278 | buffer_info = &tx_ring->buffer_info[i]; | 1279 | buffer_info = &tx_ring->buffer_info[i]; |
1279 | size = min(len, IXGB_MAX_JUMBO_FRAME_SIZE); | 1280 | size = min(len, IXGB_MAX_JUMBO_FRAME_SIZE); |
1281 | /* Workaround for premature desc write-backs | ||
1282 | * in TSO mode. Append 4-byte sentinel desc */ | ||
1283 | if(unlikely(mss && !nr_frags && size == len && size > 8)) | ||
1284 | size -= 4; | ||
1285 | |||
1280 | buffer_info->length = size; | 1286 | buffer_info->length = size; |
1281 | buffer_info->dma = | 1287 | buffer_info->dma = |
1282 | pci_map_single(adapter->pdev, | 1288 | pci_map_single(adapter->pdev, |
@@ -1301,6 +1307,12 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb, | |||
1301 | while(len) { | 1307 | while(len) { |
1302 | buffer_info = &tx_ring->buffer_info[i]; | 1308 | buffer_info = &tx_ring->buffer_info[i]; |
1303 | size = min(len, IXGB_MAX_JUMBO_FRAME_SIZE); | 1309 | size = min(len, IXGB_MAX_JUMBO_FRAME_SIZE); |
1310 | /* Workaround for premature desc write-backs | ||
1311 | * in TSO mode. Append 4-byte sentinel desc */ | ||
1312 | if(unlikely(mss && (f == (nr_frags-1)) && (size == len) | ||
1313 | && (size > 8))) | ||
1314 | size -= 4; | ||
1315 | |||
1304 | buffer_info->length = size; | 1316 | buffer_info->length = size; |
1305 | buffer_info->dma = | 1317 | buffer_info->dma = |
1306 | pci_map_page(adapter->pdev, | 1318 | pci_map_page(adapter->pdev, |
@@ -1378,7 +1390,8 @@ ixgb_tx_queue(struct ixgb_adapter *adapter, int count, int vlan_id,int tx_flags) | |||
1378 | #define TXD_USE_COUNT(S) (((S) >> IXGB_MAX_TXD_PWR) + \ | 1390 | #define TXD_USE_COUNT(S) (((S) >> IXGB_MAX_TXD_PWR) + \ |
1379 | (((S) & (IXGB_MAX_DATA_PER_TXD - 1)) ? 1 : 0)) | 1391 | (((S) & (IXGB_MAX_DATA_PER_TXD - 1)) ? 1 : 0)) |
1380 | #define DESC_NEEDED TXD_USE_COUNT(IXGB_MAX_DATA_PER_TXD) + \ | 1392 | #define DESC_NEEDED TXD_USE_COUNT(IXGB_MAX_DATA_PER_TXD) + \ |
1381 | MAX_SKB_FRAGS * TXD_USE_COUNT(PAGE_SIZE) + 1 | 1393 | MAX_SKB_FRAGS * TXD_USE_COUNT(PAGE_SIZE) + 1 \ |
1394 | /* one more for TSO workaround */ + 1 | ||
1382 | 1395 | ||
1383 | static int | 1396 | static int |
1384 | ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | 1397 | ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev) |
@@ -1416,7 +1429,7 @@ ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1416 | return NETDEV_TX_OK; | 1429 | return NETDEV_TX_OK; |
1417 | } | 1430 | } |
1418 | 1431 | ||
1419 | if (tso) | 1432 | if (likely(tso)) |
1420 | tx_flags |= IXGB_TX_FLAGS_TSO; | 1433 | tx_flags |= IXGB_TX_FLAGS_TSO; |
1421 | else if(ixgb_tx_csum(adapter, skb)) | 1434 | else if(ixgb_tx_csum(adapter, skb)) |
1422 | tx_flags |= IXGB_TX_FLAGS_CSUM; | 1435 | tx_flags |= IXGB_TX_FLAGS_CSUM; |