aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2014-10-05 13:11:27 -0400
committerDavid S. Miller <davem@davemloft.net>2014-10-06 17:56:28 -0400
commitfcbeb976d7ce783fd58e63e61c196d9a8912b3be (patch)
treec6dde6923e5316b2bfc4bdb04bd6643515cc1598 /net
parent9d31a7b9f9963e97e067e72ef13492e6ace7d345 (diff)
net: introduce netdevice gso_min_segs attribute
Some TSO engines might have a too heavy setup cost, that impacts performance on hosts sending small bursts (2 MSS per packet). This patch adds a device gso_min_segs, allowing drivers to set a minimum segment size for TSO packets, according to the NIC performance. Tested on a mlx4 NIC, this allows to get a ~110% increase of throughput when sending 2 MSS per packet. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/dev.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 7d5691cc1f47..c1a4de275576 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2567,10 +2567,12 @@ static netdev_features_t harmonize_features(struct sk_buff *skb,
2567 2567
2568netdev_features_t netif_skb_features(struct sk_buff *skb) 2568netdev_features_t netif_skb_features(struct sk_buff *skb)
2569{ 2569{
2570 const struct net_device *dev = skb->dev;
2571 netdev_features_t features = dev->features;
2572 u16 gso_segs = skb_shinfo(skb)->gso_segs;
2570 __be16 protocol = skb->protocol; 2573 __be16 protocol = skb->protocol;
2571 netdev_features_t features = skb->dev->features;
2572 2574
2573 if (skb_shinfo(skb)->gso_segs > skb->dev->gso_max_segs) 2575 if (gso_segs > dev->gso_max_segs || gso_segs < dev->gso_min_segs)
2574 features &= ~NETIF_F_GSO_MASK; 2576 features &= ~NETIF_F_GSO_MASK;
2575 2577
2576 if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) { 2578 if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) {
@@ -2581,7 +2583,7 @@ netdev_features_t netif_skb_features(struct sk_buff *skb)
2581 } 2583 }
2582 2584
2583 features = netdev_intersect_features(features, 2585 features = netdev_intersect_features(features,
2584 skb->dev->vlan_features | 2586 dev->vlan_features |
2585 NETIF_F_HW_VLAN_CTAG_TX | 2587 NETIF_F_HW_VLAN_CTAG_TX |
2586 NETIF_F_HW_VLAN_STAG_TX); 2588 NETIF_F_HW_VLAN_STAG_TX);
2587 2589
@@ -6661,6 +6663,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
6661 6663
6662 dev->gso_max_size = GSO_MAX_SIZE; 6664 dev->gso_max_size = GSO_MAX_SIZE;
6663 dev->gso_max_segs = GSO_MAX_SEGS; 6665 dev->gso_max_segs = GSO_MAX_SEGS;
6666 dev->gso_min_segs = 0;
6664 6667
6665 INIT_LIST_HEAD(&dev->napi_list); 6668 INIT_LIST_HEAD(&dev->napi_list);
6666 INIT_LIST_HEAD(&dev->unreg_list); 6669 INIT_LIST_HEAD(&dev->unreg_list);