diff options
author | Tom Herbert <therbert@google.com> | 2010-05-05 10:02:27 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-05-06 00:11:25 -0400 |
commit | 9ed318d546a29d7a591dbe648fd1a2efe3be1180 (patch) | |
tree | adcccd4b9c015d0d81fbce1928c135b269ac1d26 /drivers/net/e1000e | |
parent | 4447957a825031b3faf3b5bc2013afe35eff492b (diff) |
e1000e: save skb counts in TX to avoid cache misses
In e1000_tx_map, precompute number of segements and bytecounts which
are derived from fields in skb; these are stored in buffer_info. When
cleaning tx in e1000_clean_tx_irq use the values in the associated
buffer_info for statistics counting, this eliminates cache misses
on skb fields.
Signed-off-by: Tom Herbert <therbert@google.com>
Acked-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/e1000e')
-rw-r--r-- | drivers/net/e1000e/e1000.h | 2 | ||||
-rw-r--r-- | drivers/net/e1000e/netdev.c | 18 |
2 files changed, 11 insertions, 9 deletions
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index 906c4daaabe9..c0b3db40bd73 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h | |||
@@ -189,6 +189,8 @@ struct e1000_buffer { | |||
189 | unsigned long time_stamp; | 189 | unsigned long time_stamp; |
190 | u16 length; | 190 | u16 length; |
191 | u16 next_to_watch; | 191 | u16 next_to_watch; |
192 | unsigned int segs; | ||
193 | unsigned int bytecount; | ||
192 | u16 mapped_as_page; | 194 | u16 mapped_as_page; |
193 | }; | 195 | }; |
194 | /* Rx */ | 196 | /* Rx */ |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index d13760dc27f8..8de64ed8762c 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -1001,14 +1001,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter) | |||
1001 | cleaned = (i == eop); | 1001 | cleaned = (i == eop); |
1002 | 1002 | ||
1003 | if (cleaned) { | 1003 | if (cleaned) { |
1004 | struct sk_buff *skb = buffer_info->skb; | 1004 | total_tx_packets += buffer_info->segs; |
1005 | unsigned int segs, bytecount; | 1005 | total_tx_bytes += buffer_info->bytecount; |
1006 | segs = skb_shinfo(skb)->gso_segs ?: 1; | ||
1007 | /* multiply data chunks by size of headers */ | ||
1008 | bytecount = ((segs - 1) * skb_headlen(skb)) + | ||
1009 | skb->len; | ||
1010 | total_tx_packets += segs; | ||
1011 | total_tx_bytes += bytecount; | ||
1012 | } | 1006 | } |
1013 | 1007 | ||
1014 | e1000_put_txbuf(adapter, buffer_info); | 1008 | e1000_put_txbuf(adapter, buffer_info); |
@@ -4261,7 +4255,7 @@ static int e1000_tx_map(struct e1000_adapter *adapter, | |||
4261 | struct e1000_buffer *buffer_info; | 4255 | struct e1000_buffer *buffer_info; |
4262 | unsigned int len = skb_headlen(skb); | 4256 | unsigned int len = skb_headlen(skb); |
4263 | unsigned int offset = 0, size, count = 0, i; | 4257 | unsigned int offset = 0, size, count = 0, i; |
4264 | unsigned int f; | 4258 | unsigned int f, bytecount, segs; |
4265 | 4259 | ||
4266 | i = tx_ring->next_to_use; | 4260 | i = tx_ring->next_to_use; |
4267 | 4261 | ||
@@ -4321,7 +4315,13 @@ static int e1000_tx_map(struct e1000_adapter *adapter, | |||
4321 | } | 4315 | } |
4322 | } | 4316 | } |
4323 | 4317 | ||
4318 | segs = skb_shinfo(skb)->gso_segs ?: 1; | ||
4319 | /* multiply data chunks by size of headers */ | ||
4320 | bytecount = ((segs - 1) * skb_headlen(skb)) + skb->len; | ||
4321 | |||
4324 | tx_ring->buffer_info[i].skb = skb; | 4322 | tx_ring->buffer_info[i].skb = skb; |
4323 | tx_ring->buffer_info[i].segs = segs; | ||
4324 | tx_ring->buffer_info[i].bytecount = bytecount; | ||
4325 | tx_ring->buffer_info[first].next_to_watch = i; | 4325 | tx_ring->buffer_info[first].next_to_watch = i; |
4326 | 4326 | ||
4327 | return count; | 4327 | return count; |