aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/faraday/ftgmac100.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2012-07-12 00:19:38 -0400
committerDavid S. Miller <davem@davemloft.net>2012-07-18 12:40:53 -0400
commit6ecd09dd35fd07b8f2f6f5210ecffd4cc5ac0581 (patch)
tree1bb18232c3c0041df27451e05a611fcb6b014589 /drivers/net/ethernet/faraday/ftgmac100.c
parentdb8dacf953a70274172236957a4b97d4fdb376f0 (diff)
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/ftgmac100.c')
-rw-r--r--drivers/net/ethernet/faraday/ftgmac100.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index 16b07048274c..74d749e29aab 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -479,9 +479,14 @@ static bool ftgmac100_rx_packet(struct ftgmac100 *priv, int *processed)
479 rxdes = ftgmac100_current_rxdes(priv); 479 rxdes = ftgmac100_current_rxdes(priv);
480 } while (!done); 480 } while (!done);
481 481
482 if (skb->len <= 64) 482 /* Small frames are copied into linear part of skb to free one page */
483 if (skb->len <= 128) {
483 skb->truesize -= PAGE_SIZE; 484 skb->truesize -= PAGE_SIZE;
484 __pskb_pull_tail(skb, min(skb->len, 64U)); 485 __pskb_pull_tail(skb, skb->len);
486 } else {
487 /* We pull the minimum amount into linear part */
488 __pskb_pull_tail(skb, ETH_HLEN);
489 }
485 skb->protocol = eth_type_trans(skb, netdev); 490 skb->protocol = eth_type_trans(skb, netdev);
486 491
487 netdev->stats.rx_packets++; 492 netdev->stats.rx_packets++;