diff options
author | Eric Dumazet <edumazet@google.com> | 2012-07-12 08:19:38 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-18 20:40:53 +0400 |
commit | 6ecd09dd35fd07b8f2f6f5210ecffd4cc5ac0581 (patch) | |
tree | 1bb18232c3c0041df27451e05a611fcb6b014589 /drivers/net/ethernet/faraday/ftmac100.c | |
parent | db8dacf953a70274172236957a4b97d4fdb376f0 (diff) | |
download | linux-6ecd09dd35fd07b8f2f6f5210ecffd4cc5ac0581.tar.xz |
net: ftgmac100/ftmac100: dont pull too much data
Drivers should pull only ethernet header from page frag
to skb->head.
Pulling 64 bytes is too much for TCP (without options) on IPv4.
However, it makes sense to pull all the frame if it fits the
128 bytes bloc allocated for skb->head, to free one page per
small incoming frame.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Po-Yu Chuang <ratbert@faraday-tech.com>
Acked-by: Yan-Pai Chen <yanpai.chen@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/faraday/ftmac100.c')
-rw-r--r-- | drivers/net/ethernet/faraday/ftmac100.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/net/ethernet/faraday/ftmac100.c b/drivers/net/ethernet/faraday/ftmac100.c index 829b1092fd78..b901a01e3fa5 100644 --- a/drivers/net/ethernet/faraday/ftmac100.c +++ b/drivers/net/ethernet/faraday/ftmac100.c @@ -441,11 +441,14 @@ static bool ftmac100_rx_packet(struct ftmac100 *priv, int *processed) skb->len += length; skb->data_len += length; - /* page might be freed in __pskb_pull_tail() */ - if (length > 64) + if (length > 128) { skb->truesize += PAGE_SIZE; - __pskb_pull_tail(skb, min(length, 64)); - + /* We pull the minimum amount into linear part */ + __pskb_pull_tail(skb, ETH_HLEN); + } else { + /* Small frames are copied into linear part to free one page */ + __pskb_pull_tail(skb, length); + } ftmac100_alloc_rx_page(priv, rxdes, GFP_ATOMIC); ftmac100_rx_pointer_advance(priv); |