From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: [PATCH net-next 2/2] veth: allow configuring GSO maximums Date: Fri, 1 Dec 2017 12:11:58 -0800 Message-ID: <20171201201158.25594-3-sthemmin@microsoft.com> References: <20171201201158.25594-1-sthemmin@microsoft.com> Cc: netdev@vger.kernel.org, Stephen Hemminger To: davem@davemloft.net Return-path: Received: from mail-pf0-f193.google.com ([209.85.192.193]:41589 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752217AbdLAUML (ORCPT ); Fri, 1 Dec 2017 15:12:11 -0500 Received: by mail-pf0-f193.google.com with SMTP id j28so5100378pfk.8 for ; Fri, 01 Dec 2017 12:12:11 -0800 (PST) In-Reply-To: <20171201201158.25594-1-sthemmin@microsoft.com> Sender: netdev-owner@vger.kernel.org List-ID: Veth's can be used in environments (like Azure) where the underlying network device is impacted by large GSO packets. This patch allows gso maximum values to be passed in when creating the device via netlink. In theory, other pseudo devices could also use netlink attributes to set GSO maximums but for now veth is what has been observed to be an issue. Signed-off-by: Stephen Hemminger --- drivers/net/veth.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/net/veth.c b/drivers/net/veth.c index f5438d0978ca..510c058ba227 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -410,6 +410,26 @@ static int veth_newlink(struct net *src_net, struct net_device *dev, if (ifmp && (dev->ifindex != 0)) peer->ifindex = ifmp->ifi_index; + if (tbp[IFLA_GSO_MAX_SIZE]) { + u32 max_size = nla_get_u32(tbp[IFLA_GSO_MAX_SIZE]); + + if (max_size > GSO_MAX_SIZE) + return -EINVAL; + + peer->gso_max_size = max_size; + dev->gso_max_size = max_size; + } + + if (tbp[IFLA_GSO_MAX_SEGS]) { + u32 max_segs = nla_get_u32(tbp[IFLA_GSO_MAX_SEGS]); + + if (max_segs > GSO_MAX_SEGS) + return -EINVAL; + + peer->gso_max_segs = max_segs; + dev->gso_max_segs = max_segs; + } + err = register_netdevice(peer); put_net(net); net = NULL; -- 2.11.0