aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2009-06-05 00:04:16 -0400
committerDavid S. Miller <davem@davemloft.net>2009-06-08 03:21:48 -0400
commit042a53a9e437feaf2230dd2cadcecfae9c7bfe05 (patch)
treeae9078f61e390a3014aecb3fe80d3438ab25ee51 /drivers/net/tg3.c
parenteae3f29cc73f83cc3f1891d3ad40021b5172c630 (diff)
net: skb_shared_info optimization
skb_dma_unmap() is quite expensive for small packets, because we use two different cache lines from skb_shared_info. One to access nr_frags, one to access dma_maps[0] Instead of dma_maps being an array of MAX_SKB_FRAGS + 1 elements, let dma_head alone in a new dma_head field, close to nr_frags, to reduce cache lines misses. Tested on my dev machine (bnx2 & tg3 adapters), nice speedup ! Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index a39b534fb43e..46a3f86125be 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -5021,7 +5021,7 @@ static int tigon3_dma_hwbug_workaround(struct tg3 *tp, struct sk_buff *skb,
5021 /* New SKB is guaranteed to be linear. */ 5021 /* New SKB is guaranteed to be linear. */
5022 entry = *start; 5022 entry = *start;
5023 ret = skb_dma_map(&tp->pdev->dev, new_skb, DMA_TO_DEVICE); 5023 ret = skb_dma_map(&tp->pdev->dev, new_skb, DMA_TO_DEVICE);
5024 new_addr = skb_shinfo(new_skb)->dma_maps[0]; 5024 new_addr = skb_shinfo(new_skb)->dma_head;
5025 5025
5026 /* Make sure new skb does not cross any 4G boundaries. 5026 /* Make sure new skb does not cross any 4G boundaries.
5027 * Drop the packet if it does. 5027 * Drop the packet if it does.
@@ -5155,7 +5155,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
5155 5155
5156 sp = skb_shinfo(skb); 5156 sp = skb_shinfo(skb);
5157 5157
5158 mapping = sp->dma_maps[0]; 5158 mapping = sp->dma_head;
5159 5159
5160 tp->tx_buffers[entry].skb = skb; 5160 tp->tx_buffers[entry].skb = skb;
5161 5161
@@ -5173,7 +5173,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
5173 skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; 5173 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
5174 5174
5175 len = frag->size; 5175 len = frag->size;
5176 mapping = sp->dma_maps[i + 1]; 5176 mapping = sp->dma_maps[i];
5177 tp->tx_buffers[entry].skb = NULL; 5177 tp->tx_buffers[entry].skb = NULL;
5178 5178
5179 tg3_set_txd(tp, entry, mapping, len, 5179 tg3_set_txd(tp, entry, mapping, len,
@@ -5331,7 +5331,7 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev)
5331 5331
5332 sp = skb_shinfo(skb); 5332 sp = skb_shinfo(skb);
5333 5333
5334 mapping = sp->dma_maps[0]; 5334 mapping = sp->dma_head;
5335 5335
5336 tp->tx_buffers[entry].skb = skb; 5336 tp->tx_buffers[entry].skb = skb;
5337 5337
@@ -5356,7 +5356,7 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev)
5356 skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; 5356 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
5357 5357
5358 len = frag->size; 5358 len = frag->size;
5359 mapping = sp->dma_maps[i + 1]; 5359 mapping = sp->dma_maps[i];
5360 5360
5361 tp->tx_buffers[entry].skb = NULL; 5361 tp->tx_buffers[entry].skb = NULL;
5362 5362