aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-12-08 14:23:00 -0500
committerDavid S. Miller <davem@davemloft.net>2017-12-08 14:23:00 -0500
commit62fd8b189e925156e63772d18d3add1797242dca (patch)
treefd5c58a47be81e46ab6cedfef32e59b612df49b7
parent5a6a0445d1edb28fc89fd12b49cda2d5114e2665 (diff)
parent72d24955b44a4039db54a1c252b5031969eeaac3 (diff)
Merge branch 'veth-and-GSO-maximums'
Stephen Hemminger says: ==================== veth and GSO maximums This is the more general way to solving the issue of GSO limits not being set correctly for containers on Azure. If a GSO packet is sent to host that exceeds the limit (reported by NDIS), then the host is forced to do segmentation in software which has noticeable performance impact. The core rtnetlink infrastructure already has the messages and infrastructure to allow changing gso limits. With an updated iproute2 the following already works: # ip li set dev dummy0 gso_max_size 30000 These patches are about making it easier with veth. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/veth.c3
-rw-r--r--net/core/rtnetlink.c34
2 files changed, 37 insertions, 0 deletions
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index f5438d0978ca..a69ad39ee57e 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -410,6 +410,9 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
410 if (ifmp && (dev->ifindex != 0)) 410 if (ifmp && (dev->ifindex != 0))
411 peer->ifindex = ifmp->ifi_index; 411 peer->ifindex = ifmp->ifi_index;
412 412
413 peer->gso_max_size = dev->gso_max_size;
414 peer->gso_max_segs = dev->gso_max_segs;
415
413 err = register_netdevice(peer); 416 err = register_netdevice(peer);
414 put_net(net); 417 put_net(net);
415 net = NULL; 418 net = NULL;
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index a4faefd65006..412ebf0b09c6 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1637,6 +1637,8 @@ static const struct nla_policy ifla_policy[IFLA_MAX+1] = {
1637 [IFLA_PROMISCUITY] = { .type = NLA_U32 }, 1637 [IFLA_PROMISCUITY] = { .type = NLA_U32 },
1638 [IFLA_NUM_TX_QUEUES] = { .type = NLA_U32 }, 1638 [IFLA_NUM_TX_QUEUES] = { .type = NLA_U32 },
1639 [IFLA_NUM_RX_QUEUES] = { .type = NLA_U32 }, 1639 [IFLA_NUM_RX_QUEUES] = { .type = NLA_U32 },
1640 [IFLA_GSO_MAX_SEGS] = { .type = NLA_U32 },
1641 [IFLA_GSO_MAX_SIZE] = { .type = NLA_U32 },
1640 [IFLA_PHYS_PORT_ID] = { .type = NLA_BINARY, .len = MAX_PHYS_ITEM_ID_LEN }, 1642 [IFLA_PHYS_PORT_ID] = { .type = NLA_BINARY, .len = MAX_PHYS_ITEM_ID_LEN },
1641 [IFLA_CARRIER_CHANGES] = { .type = NLA_U32 }, /* ignored */ 1643 [IFLA_CARRIER_CHANGES] = { .type = NLA_U32 }, /* ignored */
1642 [IFLA_PHYS_SWITCH_ID] = { .type = NLA_BINARY, .len = MAX_PHYS_ITEM_ID_LEN }, 1644 [IFLA_PHYS_SWITCH_ID] = { .type = NLA_BINARY, .len = MAX_PHYS_ITEM_ID_LEN },
@@ -2287,6 +2289,34 @@ static int do_setlink(const struct sk_buff *skb,
2287 } 2289 }
2288 } 2290 }
2289 2291
2292 if (tb[IFLA_GSO_MAX_SIZE]) {
2293 u32 max_size = nla_get_u32(tb[IFLA_GSO_MAX_SIZE]);
2294
2295 if (max_size > GSO_MAX_SIZE) {
2296 err = -EINVAL;
2297 goto errout;
2298 }
2299
2300 if (dev->gso_max_size ^ max_size) {
2301 netif_set_gso_max_size(dev, max_size);
2302 status |= DO_SETLINK_MODIFIED;
2303 }
2304 }
2305
2306 if (tb[IFLA_GSO_MAX_SEGS]) {
2307 u32 max_segs = nla_get_u32(tb[IFLA_GSO_MAX_SEGS]);
2308
2309 if (max_segs > GSO_MAX_SEGS) {
2310 err = -EINVAL;
2311 goto errout;
2312 }
2313
2314 if (dev->gso_max_segs ^ max_segs) {
2315 dev->gso_max_segs = max_segs;
2316 status |= DO_SETLINK_MODIFIED;
2317 }
2318 }
2319
2290 if (tb[IFLA_OPERSTATE]) 2320 if (tb[IFLA_OPERSTATE])
2291 set_operstate(dev, nla_get_u8(tb[IFLA_OPERSTATE])); 2321 set_operstate(dev, nla_get_u8(tb[IFLA_OPERSTATE]));
2292 2322
@@ -2651,6 +2681,10 @@ struct net_device *rtnl_create_link(struct net *net,
2651 dev->link_mode = nla_get_u8(tb[IFLA_LINKMODE]); 2681 dev->link_mode = nla_get_u8(tb[IFLA_LINKMODE]);
2652 if (tb[IFLA_GROUP]) 2682 if (tb[IFLA_GROUP])
2653 dev_set_group(dev, nla_get_u32(tb[IFLA_GROUP])); 2683 dev_set_group(dev, nla_get_u32(tb[IFLA_GROUP]));
2684 if (tb[IFLA_GSO_MAX_SIZE])
2685 netif_set_gso_max_size(dev, nla_get_u32(tb[IFLA_GSO_MAX_SIZE]));
2686 if (tb[IFLA_GSO_MAX_SEGS])
2687 dev->gso_max_size = nla_get_u32(tb[IFLA_GSO_MAX_SEGS]);
2654 2688
2655 return dev; 2689 return dev;
2656} 2690}