diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-11-28 17:50:16 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:04:19 -0500 |
commit | 5f06eba4dce361bfc077868d044768476b41d698 (patch) | |
tree | fd3522e31b06bae67609b9088231b82200834316 | |
parent | f03b865491c2f30f2a4d77cdafc69c978ceb38a0 (diff) |
sky2: rx allocation threshold change
When using larger MTU's sky2 driver changes from allocating one
data area, to using multiple pages. The threshold for this was based on
a heuristic where the cost of a single allocation is bigger than one
page. Since the allocator has changed, this heuristic is now incorrect;
instead just make the threshold be when the total size of the allocation
is greater than one page.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/net/sky2.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 30e567a2d5a1..c177e87182f4 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -1234,7 +1234,7 @@ static int sky2_rx_start(struct sky2_port *sky2) | |||
1234 | struct sky2_hw *hw = sky2->hw; | 1234 | struct sky2_hw *hw = sky2->hw; |
1235 | struct rx_ring_info *re; | 1235 | struct rx_ring_info *re; |
1236 | unsigned rxq = rxqaddr[sky2->port]; | 1236 | unsigned rxq = rxqaddr[sky2->port]; |
1237 | unsigned i, size, space, thresh; | 1237 | unsigned i, size, thresh; |
1238 | 1238 | ||
1239 | sky2->rx_put = sky2->rx_next = 0; | 1239 | sky2->rx_put = sky2->rx_next = 0; |
1240 | sky2_qset(hw, rxq); | 1240 | sky2_qset(hw, rxq); |
@@ -1261,28 +1261,18 @@ static int sky2_rx_start(struct sky2_port *sky2) | |||
1261 | /* Stopping point for hardware truncation */ | 1261 | /* Stopping point for hardware truncation */ |
1262 | thresh = (size - 8) / sizeof(u32); | 1262 | thresh = (size - 8) / sizeof(u32); |
1263 | 1263 | ||
1264 | /* Account for overhead of skb - to avoid order > 0 allocation */ | 1264 | sky2->rx_nfrags = size >> PAGE_SHIFT; |
1265 | space = SKB_DATA_ALIGN(size) + NET_SKB_PAD | ||
1266 | + sizeof(struct skb_shared_info); | ||
1267 | |||
1268 | sky2->rx_nfrags = space >> PAGE_SHIFT; | ||
1269 | BUG_ON(sky2->rx_nfrags > ARRAY_SIZE(re->frag_addr)); | 1265 | BUG_ON(sky2->rx_nfrags > ARRAY_SIZE(re->frag_addr)); |
1270 | 1266 | ||
1271 | if (sky2->rx_nfrags != 0) { | 1267 | /* Compute residue after pages */ |
1272 | /* Compute residue after pages */ | 1268 | size -= sky2->rx_nfrags << PAGE_SHIFT; |
1273 | space = sky2->rx_nfrags << PAGE_SHIFT; | ||
1274 | 1269 | ||
1275 | if (space < size) | 1270 | /* Optimize to handle small packets and headers */ |
1276 | size -= space; | 1271 | if (size < copybreak) |
1277 | else | 1272 | size = copybreak; |
1278 | size = 0; | 1273 | if (size < ETH_HLEN) |
1274 | size = ETH_HLEN; | ||
1279 | 1275 | ||
1280 | /* Optimize to handle small packets and headers */ | ||
1281 | if (size < copybreak) | ||
1282 | size = copybreak; | ||
1283 | if (size < ETH_HLEN) | ||
1284 | size = ETH_HLEN; | ||
1285 | } | ||
1286 | sky2->rx_data_size = size; | 1276 | sky2->rx_data_size = size; |
1287 | 1277 | ||
1288 | /* Fill Rx ring */ | 1278 | /* Fill Rx ring */ |