e1000: tune our dynamic itr transmit packet accounting
authorJesse Brandeburg <jesse.brandeburg@intel.com>
Thu, 18 Jan 2007 17:25:31 +0000 (09:25 -0800)
committerJeff Garzik <jeff@garzik.org>
Mon, 5 Feb 2007 21:58:41 +0000 (16:58 -0500)
The driver was still mis-calculating the number of bytes sent during
transmit, now the driver computes what appears to be exactly 100%
correct byte counts (not including CRC) when figuring out how many
bytes and frames were sent during the current transmit packet.

drivers/net/e1000/e1000_main.c

index 8c6c74d1284a81b9eda8e0055a6d69a22eba318e..ae76479d89d1c0618c214aabb38e78cf111c689c 100644 (file)
@@ -4020,10 +4020,13 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter,
 
                        if (cleaned) {
                                struct sk_buff *skb = buffer_info->skb;
-                               unsigned int segs = skb_shinfo(skb)->gso_segs;
+                               unsigned int segs, bytecount;
+                               segs = skb_shinfo(skb)->gso_segs ?: 1;
+                               /* multiply data chunks by size of headers */
+                               bytecount = ((segs - 1) * skb_headlen(skb)) +
+                                           skb->len;
                                total_tx_packets += segs;
-                               total_tx_packets++;
-                               total_tx_bytes += skb->len;
+                               total_tx_bytes += bytecount;
                        }
                        e1000_unmap_and_free_tx_resource(adapter, buffer_info);
                        tx_desc->upper.data = 0;