From patchwork Wed May 27 21:25:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edwin Peer X-Patchwork-Id: 218404 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DDE2C433DF for ; Wed, 27 May 2020 21:25:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E092F2073B for ; Wed, 27 May 2020 21:25:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Grsi+NfZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728273AbgE0VZn (ORCPT ); Wed, 27 May 2020 17:25:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726114AbgE0VZm (ORCPT ); Wed, 27 May 2020 17:25:42 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81ECBC05BD1E for ; Wed, 27 May 2020 14:25:42 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id m1so6161840pgk.1 for ; Wed, 27 May 2020 14:25:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=J2VOOXXZfYrf0j0BZGTqHjZXz3vmkYSxdF+W6kFIlUM=; b=Grsi+NfZcOSkP8amdHNoSH455H5jrFeMkEzJSH9cQZzoiNQjZvYu5qzjxSTGsQEVX3 dc4cAIW+5ot8HvpiNadkZlE2n804EGyYvdSCs8EfVh5PC7erL5s35YOTdIcEWgbrOHzZ SvhCHvRZ3PCwmEWz0KxChxNTjKlL8l2F/CURI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J2VOOXXZfYrf0j0BZGTqHjZXz3vmkYSxdF+W6kFIlUM=; b=kx7sXARlYvTEG3bjk+AOrHPOOqOcj8Dw7o6qUjPS+vhTMkMgyLP6ukWsQhed0axjO7 rI5jlyR18fjyoPffQGpepEsGD4+0wEkhO6Oubih/jYyXQ4GUj6G7Gw5RzcbIWvlIvocI sUtNaKN0y+2n7Kfvemr4q0aD2vzQ4bvnBRXDfi3kwmkYrfjwsaVpV5qZ/j3iaA/7lI7/ McKqk/Bms/aeNlFzZnCHujC4bQSDDIdNXoMNv/7LtmSUMUER9yip5yt0i0txotUC5Y6m cRpXmUyjyGtz358Cq2eULmf3mGMKLufmSRqbhOUpWpWfT3mKeR/tVcJ3VERgO9kxR7vX tYjw== X-Gm-Message-State: AOAM531njigqkEJjqx6/j7Q02Q8AjDhXsVTDK5iLc6BczcAFBizA2+uH 60MJRxrEjg1i0R94dQGUkYhgsO6/neRbo5z8Ni3UBJlZVR003hlPUmdi7dNqzjE9mKG+6K85yIS 5FN38Z78779Cfl5NguDSzsXbFgOI3izp09zMClhJcYhWxiI1GlX/wPJLVkn2RD/SH48koPzZH X-Google-Smtp-Source: ABdhPJwDSug2TCiNT0AEu160YDkRY8FUOcXqWgrwkGwmLUZpEj3dht0HgFf12VGv6IszkOKoIcgmcQ== X-Received: by 2002:aa7:8425:: with SMTP id q5mr5615357pfn.98.1590614741542; Wed, 27 May 2020 14:25:41 -0700 (PDT) Received: from localhost.localdomain ([2600:8802:202:f600::ddf]) by smtp.gmail.com with ESMTPSA id c4sm2770344pfb.130.2020.05.27.14.25.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2020 14:25:41 -0700 (PDT) From: Edwin Peer To: netdev@vger.kernel.org Cc: Edwin Peer , edumazet@google.com, linville@tuxdriver.com, shemminger@vyatta.com, mirq-linux@rere.qmqm.pl, jesse.brandeburg@intel.com, jchapman@katalix.com, david@weave.works, j.vosburgh@gmail.com, vfalico@gmail.com, andy@greyhouse.net, sridhar.samudrala@intel.com, jiri@mellanox.com, geoff@infradead.org, mokuno@sm.sony.co.jp, msink@permonline.ru, mporter@kernel.crashing.org, inaky.perez-gonzalez@intel.com, jwi@linux.ibm.com, kgraul@linux.ibm.com, ubraun@linux.ibm.com, grant.likely@secretlab.ca, hadi@cyberus.ca, dsahern@kernel.org, shrijeet@gmail.com, jon.mason@intel.com, dave.jiang@intel.com, saeedm@mellanox.com, hadarh@mellanox.com, ogerlitz@mellanox.com, allenbh@gmail.com, michael.chan@broadcom.com Subject: [RFC PATCH net-next 01/11] net: geneve: enable vlan offloads Date: Wed, 27 May 2020 14:25:02 -0700 Message-Id: <20200527212512.17901-2-edwin.peer@broadcom.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527212512.17901-1-edwin.peer@broadcom.com> References: <20200527212512.17901-1-edwin.peer@broadcom.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Support offloads for nested VLANs in the same fashion as is done for VXLAN interfaces. In particular, this allows software GSO and checksum offload to function when VLANs are encapsulated inside Geneve tunnels. Signed-off-by: Edwin Peer --- drivers/net/geneve.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index 6b461be1820b..8d790cf85b21 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -1137,6 +1137,8 @@ static void geneve_setup(struct net_device *dev) dev->features |= NETIF_F_RXCSUM; dev->features |= NETIF_F_GSO_SOFTWARE; + dev->vlan_features = dev->features; + dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM; dev->hw_features |= NETIF_F_GSO_SOFTWARE; From patchwork Wed May 27 21:25:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edwin Peer X-Patchwork-Id: 218403 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD636C433E1 for ; Wed, 27 May 2020 21:25:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A6A65207D8 for ; Wed, 27 May 2020 21:25:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="PuT49a2+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728623AbgE0VZu (ORCPT ); Wed, 27 May 2020 17:25:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726114AbgE0VZt (ORCPT ); Wed, 27 May 2020 17:25:49 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBFDCC05BD1E for ; Wed, 27 May 2020 14:25:48 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id m7so10668984plt.5 for ; Wed, 27 May 2020 14:25:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gUSZT4fCNdZtufE1Q8hPMwDBbNtgClmr/6n+Cb71Sx0=; b=PuT49a2+E4jeGf/qW1w3m22Dg0J6pRvqIqbyupLk2cPZ3B/zF7k4i8RRJOg7aN1FoY hmciePuE1UV5TfnQhqp8eQdObhkNUJqO5hfzyFv0vw87J2zBrHWmD6UYLn4/r2IHjaX4 pS8rVAikRqVZSLLgJwWOcKWHPQCfC0IINLXwM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gUSZT4fCNdZtufE1Q8hPMwDBbNtgClmr/6n+Cb71Sx0=; b=QYSujNX1tpryqeB4ZGBxFtlixyzEDcgmc6Jk1VNmercx8gQnSq5aCQ+CifzRJhBcuc WJaTGCLZmuuWrzpSwVk3Dg2qrjxAwlzdpVys8YwNHWhssRg7GwA4gJY1/FDZaSJplpv4 rsri7PJm+4ylIxB6NUrHwsxRybcFtLDnnF8z4y1F7UyWQJ+n+kSL3dDfaCnaScvg9q68 G1A8WHZ0NCcf9uF9cJeWurf6RfRuV/nXBGIkeQA/vPK+urRIcyAk227GGVxVGJhqrMQu XZWZ4lGN+jcMKWQCiKSjaa1uht5sbTQeLbH7pt43jtZYj/c5FDU5pGu74wkkVs7PdDKg BbsA== X-Gm-Message-State: AOAM531TQRpro3VncDmXkbVbRX5m++jhBnbJ1JnQ6Go3cn5rLsYZvi8u qW+/EJ5+arJV/XsuZ/oGAGMUvdfJ1C/XqFXpiIIbqY4e8cEnreuNi0HbH+fQX+ydAHwUswFmnVV +q6BEf8dg+OQwBompvYpzbq9I9/RFIqa10IriXu695KWy2/RhPyZFRsxmRNQmC9iI1xzMMNWc X-Google-Smtp-Source: ABdhPJyM2uh3TdlYU3y9SoREO3jUtEkMmYmbSnwirJDW/TvuI9S/lUoLkyaUDhL5aOeMeMw0/UqasA== X-Received: by 2002:a17:90b:ecf:: with SMTP id gz15mr361019pjb.122.1590614747871; Wed, 27 May 2020 14:25:47 -0700 (PDT) Received: from localhost.localdomain ([2600:8802:202:f600::ddf]) by smtp.gmail.com with ESMTPSA id c4sm2770344pfb.130.2020.05.27.14.25.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2020 14:25:47 -0700 (PDT) From: Edwin Peer To: netdev@vger.kernel.org Cc: Edwin Peer , edumazet@google.com, linville@tuxdriver.com, shemminger@vyatta.com, mirq-linux@rere.qmqm.pl, jesse.brandeburg@intel.com, jchapman@katalix.com, david@weave.works, j.vosburgh@gmail.com, vfalico@gmail.com, andy@greyhouse.net, sridhar.samudrala@intel.com, jiri@mellanox.com, geoff@infradead.org, mokuno@sm.sony.co.jp, msink@permonline.ru, mporter@kernel.crashing.org, inaky.perez-gonzalez@intel.com, jwi@linux.ibm.com, kgraul@linux.ibm.com, ubraun@linux.ibm.com, grant.likely@secretlab.ca, hadi@cyberus.ca, dsahern@kernel.org, shrijeet@gmail.com, jon.mason@intel.com, dave.jiang@intel.com, saeedm@mellanox.com, hadarh@mellanox.com, ogerlitz@mellanox.com, allenbh@gmail.com, michael.chan@broadcom.com Subject: [RFC PATCH net-next 03/11] net: vlan: add IFF_NO_VLAN_ROOM to constrain MTU Date: Wed, 27 May 2020 14:25:04 -0700 Message-Id: <20200527212512.17901-4-edwin.peer@broadcom.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527212512.17901-1-edwin.peer@broadcom.com> References: <20200527212512.17901-1-edwin.peer@broadcom.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Normally MTU does not account for an outer VLAN tag, since MTU is an L3 constraint. Some Ethernet devices, however, have a size constrained L2 that cannot expand to accommodate a VLAN tag. The MACsec virtual device is an existing example that limits the MTU of upper VLAN devices via netif_reduces_vlan_mtu(), but there are other devices that should do so too. For example, virtual tunnel devices that provide L2 overlays inside L3 networks where the inner L2 headers contribute towards the outer L3 size. Generalize netif_reduces_vlan_mtu() using a new device private flag to indicate that the lower device does not have sufficient room to accommodate a VLAN tag and convert MACsec to use the new flag. Also apply this concept to the VLAN virtual device itself, since physical devices do not generally allocate L2 room for nested VLANs. Note that if the lower device is manually configured to a smaller MTU value than the maximum it supports, then there is sufficient room and IFF_NO_VLAN_ROOM should not be set. Signed-off-by: Edwin Peer --- drivers/net/macsec.c | 6 ++++-- include/linux/if_vlan.h | 40 +++++++++++++++++++++++++++++++++++++++ include/linux/netdevice.h | 6 ++++-- net/8021q/vlan_dev.c | 9 +++++++++ net/8021q/vlan_netlink.c | 2 ++ 5 files changed, 59 insertions(+), 4 deletions(-) diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index 20b53e255f68..4d02a953803a 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c @@ -3633,11 +3633,13 @@ static int macsec_change_mtu(struct net_device *dev, int new_mtu) { struct macsec_dev *macsec = macsec_priv(dev); unsigned int extra = macsec->secy.icv_len + macsec_extra_len(true); + unsigned int max_mtu = macsec->real_dev->mtu - extra; - if (macsec->real_dev->mtu - extra < new_mtu) + if (new_mtu > max_mtu) return -ERANGE; dev->mtu = new_mtu; + __vlan_constrain_mtu(dev, max_mtu); return 0; } @@ -4018,7 +4020,7 @@ static int macsec_newlink(struct net *net, struct net_device *dev, if (real_dev->type != ARPHRD_ETHER) return -EINVAL; - dev->priv_flags |= IFF_MACSEC; + dev->priv_flags |= IFF_MACSEC | IFF_NO_VLAN_ROOM; macsec->real_dev = real_dev; diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index b05e855f1ddd..e4a5532fb179 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -749,4 +749,44 @@ static inline unsigned long compare_vlan_header(const struct vlan_hdr *h1, (__force u32)h2->h_vlan_encapsulated_proto); #endif } + +/* max_mtu is not necessarily the same as dev->max_mtu */ +static inline void __vlan_constrain_mtu(struct net_device *dev, int max_mtu) +{ + if (dev->mtu > max_mtu - VLAN_HLEN) + dev->priv_flags |= IFF_NO_VLAN_ROOM; + else + dev->priv_flags &= ~IFF_NO_VLAN_ROOM; +} + +/** + * vlan_constrain_mtu - reduce MTU for upper VLAN devices if there's no L2 room + * @dev: a lower device having a VLAN constrained L2 + * + * Sets IFF_NO_VLAN_ROOM based on the device's current and max MTU. + * + * Normally MTU does not account for an outer VLAN tag, since MTU is an L3 + * constraint. Thus, this should only be called by devices that cannot expand + * L2 to accommodate one. For example, in order to support VLANs without IP + * fragmentation inside various tunnel encapsulations where the inner L2 size + * contributes towards the outer L3 size. + * + * This can also be useful for supporting VLANs, using a reduced MTU, on + * hardware which is VLAN challenged. + */ +static inline void vlan_constrain_mtu(struct net_device *dev) +{ + __vlan_constrain_mtu(dev, dev->max_mtu); +} + +/** + * vlan_constrained_change_mtu - ndo_change_mtu for VLAN challenged devices + * @dev: the device to update + * @new_mtu: the new MTU + * + * This handler updates MTU and maintains the IFF_NO_VLAN_ROOM flag based on + * the newly requested MTU and the maximum supported by the device. + */ +int vlan_constrained_change_mtu(struct net_device *dev, int new_mtu); + #endif /* !(_LINUX_IF_VLAN_H_) */ diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index fe7705eaad5a..4d2ccdb9c57e 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1516,6 +1516,7 @@ struct net_device_ops { * @IFF_LIVE_ADDR_CHANGE: device supports hardware address * change when it's running * @IFF_MACVLAN: Macvlan device + * @IFF_NO_VLAN_ROOM: space constrained L2, upper VLAN devices must reduce MTU * @IFF_L3MDEV_MASTER: device is an L3 master device * @IFF_NO_QUEUE: device can run without qdisc attached * @IFF_OPENVSWITCH: device is a Open vSwitch master @@ -1549,6 +1550,7 @@ enum netdev_priv_flags { IFF_SUPP_NOFCS = 1<<14, IFF_LIVE_ADDR_CHANGE = 1<<15, IFF_MACVLAN = 1<<16, + IFF_NO_VLAN_ROOM = 1<<17, IFF_L3MDEV_MASTER = 1<<18, IFF_NO_QUEUE = 1<<19, IFF_OPENVSWITCH = 1<<20, @@ -1581,6 +1583,7 @@ enum netdev_priv_flags { #define IFF_SUPP_NOFCS IFF_SUPP_NOFCS #define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE #define IFF_MACVLAN IFF_MACVLAN +#define IFF_NO_VLAN_ROOM IFF_NO_VLAN_ROOM #define IFF_L3MDEV_MASTER IFF_L3MDEV_MASTER #define IFF_NO_QUEUE IFF_NO_QUEUE #define IFF_OPENVSWITCH IFF_OPENVSWITCH @@ -4855,8 +4858,7 @@ static inline void netif_keep_dst(struct net_device *dev) /* return true if dev can't cope with mtu frames that need vlan tag insertion */ static inline bool netif_reduces_vlan_mtu(struct net_device *dev) { - /* TODO: reserve and use an additional IFF bit, if we get more users */ - return dev->priv_flags & IFF_MACSEC; + return dev->priv_flags & IFF_NO_VLAN_ROOM; } extern struct pernet_operations __net_initdata loopback_net_ops; diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index f00bb57f0f60..67354b4ebcdb 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c @@ -149,10 +149,19 @@ static int vlan_dev_change_mtu(struct net_device *dev, int new_mtu) return -ERANGE; dev->mtu = new_mtu; + __vlan_constrain_mtu(dev, max_mtu); return 0; } +int vlan_constrained_change_mtu(struct net_device *dev, int new_mtu) +{ + dev->mtu = new_mtu; + vlan_constrain_mtu(dev); + return 0; +} +EXPORT_SYMBOL_GPL(vlan_constrained_change_mtu); + void vlan_dev_set_ingress_priority(const struct net_device *dev, u32 skb_prio, u16 vlan_prio) { diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c index 0db85aeb119b..c7aea2488f46 100644 --- a/net/8021q/vlan_netlink.c +++ b/net/8021q/vlan_netlink.c @@ -181,6 +181,8 @@ static int vlan_newlink(struct net *src_net, struct net_device *dev, dev->mtu = max_mtu; else if (dev->mtu > max_mtu) return -EINVAL; + else if (dev->mtu > max_mtu - VLAN_HLEN) + dev->priv_flags |= IFF_NO_VLAN_ROOM; err = vlan_changelink(dev, tb, data, extack); if (!err) From patchwork Wed May 27 21:25:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edwin Peer X-Patchwork-Id: 218402 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3ECBBC433DF for ; Wed, 27 May 2020 21:25:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1B049207D8 for ; Wed, 27 May 2020 21:25:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="U284Q8h2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387410AbgE0VZ5 (ORCPT ); Wed, 27 May 2020 17:25:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726114AbgE0VZ4 (ORCPT ); Wed, 27 May 2020 17:25:56 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99510C05BD1E for ; Wed, 27 May 2020 14:25:56 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id g5so945221pfm.10 for ; Wed, 27 May 2020 14:25:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pIJb8OlIrEi/I/juOatU3vRzicOP7TfyuvuaEq31vrs=; b=U284Q8h2rYv3eTeGbB88vUoieKDXDt2YYekFL3vYIeIJ5SbWTXLyHGYuoYv9vX0dai qpcW51SL6oKG53oAslKM4HDz0AUTNz5I5mjKZGS25WBlCBxQN7g5J6Pgbq3u+OJMXW1u E4roIVYOoZ+sAHFlombLz+xjH2GTUr8ylhWIA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pIJb8OlIrEi/I/juOatU3vRzicOP7TfyuvuaEq31vrs=; b=bsg3UvemQrjUsCLcBQ6ZkR/Yn1CA7Da/Ub0AjoHnpHqH0SundUu42wPpm3L/SH5emq IsJN2xr9tTgJRhrlDxBY48DNj6GbOrgN2tDcHd8v9sgzPUDgJOPYcRmGY+gx2+RJIC3r 8lXPjmllbREqcDdRVeYZo/HUXxHq7Cw34LsBAihHiReucsUKZRJEN/XgsG1AKL8S3Fri r2xwfXt8VJVRL5G+GbhPx8OWPimnusft/UYbjcywWf5cSWoxgP31hq/zGAnYNsm2WGy1 h/OXN+7pF3QUUCk/YzO3rIya9QxFl6n082C4qj5b/QF7QpkTyE63gvgAxMYsIuUnKweH Hhdw== X-Gm-Message-State: AOAM5307ik+UwHuGJ2WCkP1721W07zX+WPiqclpjW6GChxxWSiupdq9M Bb9GDQ+TReA2bBITjmx97FSCMcoO18MuU6kPYWL2ckj5Y1WelsPBFkkZ7QOLNJH/Sn5rlLoqDtN 90EKBTT8GFw0Puytt/pHxruBxU6SoJjgBh4y1lwvngD8oUcGlLWIq976VGEMcfYzDjLj7hE/V X-Google-Smtp-Source: ABdhPJwob2kWZrti9hIQwdG84/YjwMxVx6AtRWAgWdxW6+PbPsi9a1FW2ot0IF9YH05mAUGXmy84RA== X-Received: by 2002:a65:6496:: with SMTP id e22mr6061953pgv.63.1590614755602; Wed, 27 May 2020 14:25:55 -0700 (PDT) Received: from localhost.localdomain ([2600:8802:202:f600::ddf]) by smtp.gmail.com with ESMTPSA id c4sm2770344pfb.130.2020.05.27.14.25.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2020 14:25:55 -0700 (PDT) From: Edwin Peer To: netdev@vger.kernel.org Cc: Edwin Peer , edumazet@google.com, linville@tuxdriver.com, shemminger@vyatta.com, mirq-linux@rere.qmqm.pl, jesse.brandeburg@intel.com, jchapman@katalix.com, david@weave.works, j.vosburgh@gmail.com, vfalico@gmail.com, andy@greyhouse.net, sridhar.samudrala@intel.com, jiri@mellanox.com, geoff@infradead.org, mokuno@sm.sony.co.jp, msink@permonline.ru, mporter@kernel.crashing.org, inaky.perez-gonzalez@intel.com, jwi@linux.ibm.com, kgraul@linux.ibm.com, ubraun@linux.ibm.com, grant.likely@secretlab.ca, hadi@cyberus.ca, dsahern@kernel.org, shrijeet@gmail.com, jon.mason@intel.com, dave.jiang@intel.com, saeedm@mellanox.com, hadarh@mellanox.com, ogerlitz@mellanox.com, allenbh@gmail.com, michael.chan@broadcom.com Subject: [RFC PATCH net-next 05/11] net: vxlan: constrain upper VLAN MTU using IFF_NO_VLAN_ROOM Date: Wed, 27 May 2020 14:25:06 -0700 Message-Id: <20200527212512.17901-6-edwin.peer@broadcom.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527212512.17901-1-edwin.peer@broadcom.com> References: <20200527212512.17901-1-edwin.peer@broadcom.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Constrain the MTU of upper VLAN devices if the MTU of the VXLAN device is configured to its default optimal size, which does not leave space for a nested VLAN tag without causing fragmentation. If the underlying lower device is not known, then the worst case is assumed and any upper VLAN devices will always be adjusted to accommodate the VLAN tag. Signed-off-by: Edwin Peer --- drivers/net/vxlan.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index a0015cdedfaf..3e9c65eb4737 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -3098,18 +3098,20 @@ static int vxlan_change_mtu(struct net_device *dev, int new_mtu) struct net_device *lowerdev = __dev_get_by_index(vxlan->net, dst->remote_ifindex); bool use_ipv6 = !!(vxlan->cfg.flags & VXLAN_F_IPV6); + unsigned int max_mtu = 0; /* This check is different than dev->max_mtu, because it looks at * the lowerdev->mtu, rather than the static dev->max_mtu */ if (lowerdev) { - int max_mtu = lowerdev->mtu - - (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM); + max_mtu = lowerdev->mtu - + (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM); if (new_mtu > max_mtu) return -EINVAL; } dev->mtu = new_mtu; + __vlan_constrain_mtu(dev, max_mtu); return 0; } @@ -3241,7 +3243,7 @@ static void vxlan_setup(struct net_device *dev) dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM; dev->hw_features |= NETIF_F_GSO_SOFTWARE; netif_keep_dst(dev); - dev->priv_flags |= IFF_NO_QUEUE; + dev->priv_flags |= IFF_NO_QUEUE | IFF_NO_VLAN_ROOM; /* MTU range: 68 - 65535 */ dev->min_mtu = ETH_MIN_MTU; @@ -3762,6 +3764,8 @@ static void vxlan_config_apply(struct net_device *dev, if (dev->mtu > max_mtu) dev->mtu = max_mtu; + __vlan_constrain_mtu(dev, max_mtu); + if (use_ipv6 || conf->flags & VXLAN_F_COLLECT_METADATA) needed_headroom += VXLAN6_HEADROOM; else From patchwork Wed May 27 21:25:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edwin Peer X-Patchwork-Id: 218401 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC8ABC433DF for ; Wed, 27 May 2020 21:26:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 894892078C for ; Wed, 27 May 2020 21:26:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Uem4qny7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387486AbgE0V0D (ORCPT ); Wed, 27 May 2020 17:26:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387412AbgE0V0D (ORCPT ); Wed, 27 May 2020 17:26:03 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D0FCC05BD1E for ; Wed, 27 May 2020 14:26:03 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id 124so6206290pgi.9 for ; Wed, 27 May 2020 14:26:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qBtlx5cSFWoIzmSUvjtqmJJ/wx+m6j8k9yl1yVIDcWo=; b=Uem4qny7EMYOeJx1UBoA2Lr3mDzYJ9v6EoT5iah6YD8Jq1jYJ1xdx51408Lmab2zfa 7/kbMWVB/Bd9wkuFmcvdEH83oMhfS87m4T4SxNTAVpLiYkrUjQyeXPbTAaFUYqJQQjgi dKprV4mDXRfkB4TEBSI7pjzdnvnst/ihzk7Fs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qBtlx5cSFWoIzmSUvjtqmJJ/wx+m6j8k9yl1yVIDcWo=; b=aRf0bi0MWNyovawA9/jXP04qk/rwNtroFuwNup6K9iV6Dff++kpJ1/5EH5Y2q4xHDB 4SMQpWmfLw9PV4cJzKPZmfUdyJ/OLUlyYumYgrhqFIT9sRgv32OO2D3TUdm5wM9A6ms3 REyGt8UBc6kr0l6eP9W+InLw2TCsAq8iHXyv1JV9XsBDCd8PTHez3xcItAg1igREQOzR X2S7cbyRS9QoRYwNZoHaIopqOTf7yNquh2ZxN09JaLi2Wl5RR5n6wu2SqwycJilWIe4Y l//rjXmMYFZJWvjdkR8ji1stgC7f0Occ3fXalv8M9kDfYdD9HYM/zjJTIslWQcBbc0Zz ut7A== X-Gm-Message-State: AOAM531uiTKCrKSkbJxGaKIc8VegaSeq0ajutu5KD82M3m01Kl/Kuinp 5Ax/AAKQM11mtYESfXZwGtMbZ7CilcAteaUtZN0v6G2GgMft1Lo3ZUZI5NQ7B/jBC3xb3IjBKRe Mkc03VxMQD/j3o/6VAZAF188AzFgjSyP6AhmjxZMH/wdB8MUjultntR+5gi3yEQPVHmqWEZ0n X-Google-Smtp-Source: ABdhPJxmB7Dqiue9OhpcJtekBG+OhCvRR5sLCjN+vtFx2LA2nSnaNb5DiL5WuURV5M9jctqJfRnkOw== X-Received: by 2002:a62:2c8d:: with SMTP id s135mr6129030pfs.231.1590614762080; Wed, 27 May 2020 14:26:02 -0700 (PDT) Received: from localhost.localdomain ([2600:8802:202:f600::ddf]) by smtp.gmail.com with ESMTPSA id c4sm2770344pfb.130.2020.05.27.14.25.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2020 14:26:01 -0700 (PDT) From: Edwin Peer To: netdev@vger.kernel.org Cc: Edwin Peer , edumazet@google.com, linville@tuxdriver.com, shemminger@vyatta.com, mirq-linux@rere.qmqm.pl, jesse.brandeburg@intel.com, jchapman@katalix.com, david@weave.works, j.vosburgh@gmail.com, vfalico@gmail.com, andy@greyhouse.net, sridhar.samudrala@intel.com, jiri@mellanox.com, geoff@infradead.org, mokuno@sm.sony.co.jp, msink@permonline.ru, mporter@kernel.crashing.org, inaky.perez-gonzalez@intel.com, jwi@linux.ibm.com, kgraul@linux.ibm.com, ubraun@linux.ibm.com, grant.likely@secretlab.ca, hadi@cyberus.ca, dsahern@kernel.org, shrijeet@gmail.com, jon.mason@intel.com, dave.jiang@intel.com, saeedm@mellanox.com, hadarh@mellanox.com, ogerlitz@mellanox.com, allenbh@gmail.com, michael.chan@broadcom.com Subject: [RFC PATCH net-next 07/11] net: gre: constrain upper VLAN MTU using IFF_NO_VLAN_ROOM Date: Wed, 27 May 2020 14:25:08 -0700 Message-Id: <20200527212512.17901-8-edwin.peer@broadcom.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527212512.17901-1-edwin.peer@broadcom.com> References: <20200527212512.17901-1-edwin.peer@broadcom.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Constrain the MTU of upper VLAN devices if the MTU of the GRE device is configured to its default optimal size, which does not leave space for a nested VLAN tag without causing fragmentation. If the underlying lower device is not known, then the worst case is assumed and any upper VLAN devices will always be adjusted to accommodate the VLAN tag. For IPv4 tunnels, the changes to support this are made in the generic ip_tunnel_change_mtu() handler and so IFF_NO_VLAN_ROOM is consequently maintained for all tunnel devices that leverage this implementation. GRE is, however, the only one of these implementations that might use an L2 overlay. At present nothing prevents VLAN devices being layered above raw IP tunnel devices, which does not make sense. This limitation will be addressed by a later patch in this series. IPv6 GRE is dependent on PMTU discovery, but the MTU of nested VLANs still need to be constrained, because non-VLAN packets will share the same path MTU. Signed-off-by: Edwin Peer --- net/ipv4/ip_tunnel.c | 2 ++ net/ipv6/ip6_gre.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index f4f1d11eab50..21803bd35ab3 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c @@ -981,6 +981,7 @@ int __ip_tunnel_change_mtu(struct net_device *dev, int new_mtu, bool strict) struct ip_tunnel *tunnel = netdev_priv(dev); int t_hlen = tunnel->hlen + sizeof(struct iphdr); int max_mtu = IP_MAX_MTU - dev->hard_header_len - t_hlen; + int best_mtu = ip_tunnel_bind_dev(dev); if (new_mtu < ETH_MIN_MTU) return -EINVAL; @@ -993,6 +994,7 @@ int __ip_tunnel_change_mtu(struct net_device *dev, int new_mtu, bool strict) } dev->mtu = new_mtu; + __vlan_constrain_mtu(dev, best_mtu); return 0; } EXPORT_SYMBOL_GPL(__ip_tunnel_change_mtu); diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 781ca8c07a0d..0b86ee7f3d31 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -1131,6 +1131,8 @@ static void ip6gre_tnl_link_config_route(struct ip6_tnl *t, int set_mtu, if (dev->mtu < IPV6_MIN_MTU) dev->mtu = IPV6_MIN_MTU; + + dev->priv_flags |= IFF_NO_VLAN_ROOM; } } ip6_rt_put(rt); @@ -1801,7 +1803,7 @@ static int ip6gre_tap_init(struct net_device *dev) if (ret) return ret; - dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; + dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_VLAN_ROOM; return 0; } From patchwork Wed May 27 21:25:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edwin Peer X-Patchwork-Id: 218400 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDFCAC433E0 for ; Wed, 27 May 2020 21:26:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B8B202078C for ; Wed, 27 May 2020 21:26:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="XlQZ9y2F" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387571AbgE0V0L (ORCPT ); Wed, 27 May 2020 17:26:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387412AbgE0V0K (ORCPT ); Wed, 27 May 2020 17:26:10 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3741C05BD1E for ; Wed, 27 May 2020 14:26:09 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id 131so4065453pfv.13 for ; Wed, 27 May 2020 14:26:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=W6vatV0mvvrqwbvSWrarzUt8Jg9KpoDo83UO+GzNTrQ=; b=XlQZ9y2FJ5RGwLyIkChlsXW9mHkOED6xJjHN1t8bF+SogVPsfAIKb9cMk29PeWYY+Z d0/b6eqk+O7EcYUrMDUdTqExplIHcfnpKByVAOfiF7Y7KW+zY5q2fW3q+BIdsthtYmPU hY0kC3SNGC5zLMYhI9Zt5tRVSdyfiPPaSnicI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=W6vatV0mvvrqwbvSWrarzUt8Jg9KpoDo83UO+GzNTrQ=; b=dkpTpxpGZ9mj+h0xXzTLyygNZRsDQV4q3BgAaWNzmV7rx7C2w4aFbl25ghgWaok4ZS MKj5XQ3Lkv2BiFkM2g5ek44HQrC/FGrQzjUfoIOyaabj+rYa8nN4m4iz2YTSXApGsrdo tCXxpjdxAxBABjDnZHPtE5s9hmPLAdBXqVSni1/umuomDympGKX8jXN8FPD8ECqdt7eU mySwcJNAMd463YOlEbN9pYW0eSroD7Q5NBbYjYGM4aCJxOASED1C7IgilkGlxtuAJf20 I6kolRyHhg0lT+B+8ITxJRUUMaD2/8RPUoezDTyYL78FlrE9DULy0LSqr+JljnE6CvjX isxQ== X-Gm-Message-State: AOAM533KLYKr4ebsvi3nKjbwU8ARTSPkQah0pUyrAPX2ie+ljHztG9Sv 2yDuGlDVYEfcFBjXnk6YQfi288oiFzAR2v6mrAC5QE8mL+5zgroXpb5r6KjYizvrz0CzQ+wdHXo bqOQduQn67dFfXONo2lnY2QsRIpmnSs1Jw3vaBxIMynO4IvegNzqtBiznd/Rf87XFLibKOyBw X-Google-Smtp-Source: ABdhPJwXeqjzQdeE+KH7e0Kr51gRUNBF9ay82rsWxhNkMgjDPb+T++jKfYFi3q+qizPoyDDWcUP39g== X-Received: by 2002:a63:3c0a:: with SMTP id j10mr6062578pga.35.1590614768610; Wed, 27 May 2020 14:26:08 -0700 (PDT) Received: from localhost.localdomain ([2600:8802:202:f600::ddf]) by smtp.gmail.com with ESMTPSA id c4sm2770344pfb.130.2020.05.27.14.26.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2020 14:26:08 -0700 (PDT) From: Edwin Peer To: netdev@vger.kernel.org Cc: Edwin Peer , edumazet@google.com, linville@tuxdriver.com, shemminger@vyatta.com, mirq-linux@rere.qmqm.pl, jesse.brandeburg@intel.com, jchapman@katalix.com, david@weave.works, j.vosburgh@gmail.com, vfalico@gmail.com, andy@greyhouse.net, sridhar.samudrala@intel.com, jiri@mellanox.com, geoff@infradead.org, mokuno@sm.sony.co.jp, msink@permonline.ru, mporter@kernel.crashing.org, inaky.perez-gonzalez@intel.com, jwi@linux.ibm.com, kgraul@linux.ibm.com, ubraun@linux.ibm.com, grant.likely@secretlab.ca, hadi@cyberus.ca, dsahern@kernel.org, shrijeet@gmail.com, jon.mason@intel.com, dave.jiang@intel.com, saeedm@mellanox.com, hadarh@mellanox.com, ogerlitz@mellanox.com, allenbh@gmail.com, michael.chan@broadcom.com Subject: [RFC PATCH net-next 09/11] net: ntb_netdev: support VLAN using IFF_NO_VLAN_ROOM Date: Wed, 27 May 2020 14:25:10 -0700 Message-Id: <20200527212512.17901-10-edwin.peer@broadcom.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527212512.17901-1-edwin.peer@broadcom.com> References: <20200527212512.17901-1-edwin.peer@broadcom.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org It's not clear how useful VLANs layered over Ethernet emulated over NTB transport are, but they are presently allowed. The L2 emulation exposed by NTB does not account for possible VLAN tags in the space allocated for Ethernet headers when configured for maximal MTU. Signed-off-by: Edwin Peer --- drivers/net/ntb_netdev.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ntb_netdev.c b/drivers/net/ntb_netdev.c index a5bab614ff84..839414afa175 100644 --- a/drivers/net/ntb_netdev.c +++ b/drivers/net/ntb_netdev.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #define NTB_NETDEV_VER "0.7" @@ -299,14 +300,16 @@ static int ntb_netdev_close(struct net_device *ndev) static int ntb_netdev_change_mtu(struct net_device *ndev, int new_mtu) { struct ntb_netdev *dev = netdev_priv(ndev); + unsigned int max_mtu = ntb_transport_max_size(dev->qp) - ETH_HLEN; struct sk_buff *skb; int len, rc; - if (new_mtu > ntb_transport_max_size(dev->qp) - ETH_HLEN) + if (new_mtu > max_mtu) return -EINVAL; if (!netif_running(ndev)) { ndev->mtu = new_mtu; + __vlan_constrain_mtu(ndev, max_mtu); return 0; } @@ -336,6 +339,7 @@ static int ntb_netdev_change_mtu(struct net_device *ndev, int new_mtu) } ndev->mtu = new_mtu; + __vlan_constrain_mtu(ndev, max_mtu); ntb_transport_link_up(dev->qp); @@ -422,7 +426,7 @@ static int ntb_netdev_probe(struct device *client_dev) dev->pdev = pdev; ndev->features = NETIF_F_HIGHDMA; - ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE; + ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_VLAN_ROOM; ndev->hw_features = ndev->features; ndev->watchdog_timeo = msecs_to_jiffies(NTB_TX_TIMEOUT_MS); From patchwork Wed May 27 21:25:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edwin Peer X-Patchwork-Id: 218399 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47E5DC433E0 for ; Wed, 27 May 2020 21:26:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 14B732078C for ; Wed, 27 May 2020 21:26:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Fa6hhPCj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387618AbgE0V0R (ORCPT ); Wed, 27 May 2020 17:26:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387412AbgE0V0Q (ORCPT ); Wed, 27 May 2020 17:26:16 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F60CC05BD1E for ; Wed, 27 May 2020 14:26:16 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id z64so7921528pfb.1 for ; Wed, 27 May 2020 14:26:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HWEGO/iE0XxNGyN+z1BODXRHBWSEu9H1jpC3AeUzrKE=; b=Fa6hhPCjOuTZ+HSLigGAcgAQjY6tz1HY6FDAZ+aRsa2/tvTDA/cIGDvHdDUlVW5k10 QEwxDlksIALB01UxEX7HjgY6uOPkHpl6Mxsw6PMJW1HxbJpcbxxxJ0AhkMHYTB6LEmIq 3rKGU5yFrMU7IQa9v/2pt2WI175yKewcgsbq0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HWEGO/iE0XxNGyN+z1BODXRHBWSEu9H1jpC3AeUzrKE=; b=LhTX0moqw8gZUPtv8QNlDxFS0t2mRnzdzDgATz+8/c9Ip7K6+wxPIADzXIHNcojkQx 8vaUWck9o2kz+W/LOf7XyshWLH6kQxMPGyVBVFtwXGtJ/zPKQXm3PZ11WNsYu/xanRYT 5Y7VSqgrATm2ldbTrtM0nTgNmySxdskRw6LJPgPOLR3dTe29oTVaRjjHGzBU0J7D8pLt QS89j5wR1W+fg4XvW18onWLkJY7b6Dl6vKhdgCamy78mhJyh3ntXrMBNB19j8ODJ4pKa z4OM5siuO6GQlp4Ku2Ep7EvrrbSWNci9t+xJlX/dDg190nwZEqHqajCNesCK8bAE4t8q xRPQ== X-Gm-Message-State: AOAM532tCWi0ZxakWDQ+eYOMHK0TGAnS8CRbTZ+lo7iO4ukqFyZNc6rY UwxuxOsTZNYxSIhEdyB6Spki8j4k51TNAj/Gm3tn2MBTiO4Cxc7KK16xemGBh+xgfPGppyPLexa 6eAgI0mn66UHbp09Dmyz3AfYWPYuiUNQgIZ0DTqERAu0HUvJNxq2Wf6qn463KgAwqDIKW2eUG X-Google-Smtp-Source: ABdhPJzv6Wgs3C1CuH+vYbbPvcIWxn4HMZYllnavytyIYs7XCm6ET8vQKXqSto+LFcAuje9ZVMIk/A== X-Received: by 2002:a63:f74b:: with SMTP id f11mr5793647pgk.368.1590614775074; Wed, 27 May 2020 14:26:15 -0700 (PDT) Received: from localhost.localdomain ([2600:8802:202:f600::ddf]) by smtp.gmail.com with ESMTPSA id c4sm2770344pfb.130.2020.05.27.14.26.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2020 14:26:14 -0700 (PDT) From: Edwin Peer To: netdev@vger.kernel.org Cc: Edwin Peer , edumazet@google.com, linville@tuxdriver.com, shemminger@vyatta.com, mirq-linux@rere.qmqm.pl, jesse.brandeburg@intel.com, jchapman@katalix.com, david@weave.works, j.vosburgh@gmail.com, vfalico@gmail.com, andy@greyhouse.net, sridhar.samudrala@intel.com, jiri@mellanox.com, geoff@infradead.org, mokuno@sm.sony.co.jp, msink@permonline.ru, mporter@kernel.crashing.org, inaky.perez-gonzalez@intel.com, jwi@linux.ibm.com, kgraul@linux.ibm.com, ubraun@linux.ibm.com, grant.likely@secretlab.ca, hadi@cyberus.ca, dsahern@kernel.org, shrijeet@gmail.com, jon.mason@intel.com, dave.jiang@intel.com, saeedm@mellanox.com, hadarh@mellanox.com, ogerlitz@mellanox.com, allenbh@gmail.com, michael.chan@broadcom.com Subject: [RFC PATCH net-next 11/11] net: leverage IFF_NO_VLAN_ROOM to limit NETIF_F_VLAN_CHALLENGED Date: Wed, 27 May 2020 14:25:12 -0700 Message-Id: <20200527212512.17901-12-edwin.peer@broadcom.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527212512.17901-1-edwin.peer@broadcom.com> References: <20200527212512.17901-1-edwin.peer@broadcom.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This addresses an old FIXME in netdev-features.txt. The new IFF_NO_VLAN_ROOM infrastructure makes supporting VLANs on most of these limited devices trivial. VLANs are now supported on these devices if either: a) the underlying device's MTU is configured VLAN_HLEN smaller than the maximum supported MTU, or b) by the upper VLAN automatically configuring a reduced MTU if the configured device MTU is too large. The Mellanox switch driver required a little more refactoring than most to access the maximum supported MTU from ndo_change_mtu. The Intel WiMAX 2400M is natively a raw IP device, but the driver emulates Ethernet headers to present a fake Ethernet device. All these contortions are probably entirely unnecessary, but absent hardware to test, changing this aspect seems risky. The ps3_gelic_net device is also interesting. An outer VLAN is sometimes used internally to distinguish the output device, but there doesn't appear to be any reason nested VLAN tags cannot be supported. Furthermore, with an advertised maximum MTU of 1518, there should be sufficient room for an additional tag too. The remaining VLAN challenged holdouts are: net/hsr/hsr_device.c drivers/net/ipvlan/ipvlan_main.c drivers/net/ethernet/mellanox/mlx5/core/en_rep.c The HSR device could in theory support VLANs, but this would appear to be a nontrivial exercise. It's not clear why mlx5 representors don't handle VLANs, but other VF representors do appear to, so perhaps this could be revised too. That would leave only ipvlan, which unfortantely does not lend itself to removing NET_F_VLAN_CHALLENGED entirely, since it has a mode exposing an L2 Ethernet device for which VLANs do not have any sensible meaning. Signed-off-by: Edwin Peer --- Documentation/networking/netdev-features.rst | 4 +- drivers/net/ethernet/intel/e100.c | 15 +++++- .../net/ethernet/mellanox/mlxsw/switchx2.c | 52 ++++++++++++++----- drivers/net/ethernet/toshiba/ps3_gelic_net.c | 12 +---- drivers/net/ethernet/wiznet/w5100.c | 6 ++- drivers/net/ethernet/wiznet/w5300.c | 6 ++- drivers/net/rionet.c | 3 ++ drivers/net/wimax/i2400m/netdev.c | 5 +- drivers/s390/net/qeth_l2_main.c | 12 ++++- 9 files changed, 80 insertions(+), 35 deletions(-) diff --git a/Documentation/networking/netdev-features.rst b/Documentation/networking/netdev-features.rst index a2d7d7160e39..ca4632839f59 100644 --- a/Documentation/networking/netdev-features.rst +++ b/Documentation/networking/netdev-features.rst @@ -157,9 +157,7 @@ Don't use it in drivers. * VLAN challenged NETIF_F_VLAN_CHALLENGED should be set for devices which can't cope with VLAN -headers. Some drivers set this because the cards can't handle the bigger MTU. -[FIXME: Those cases could be fixed in VLAN code by allowing only reduced-MTU -VLANs. This may be not useful, though.] +headers. * rx-fcs diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c index 1b8d015ebfb0..caea569a76c5 100644 --- a/drivers/net/ethernet/intel/e100.c +++ b/drivers/net/ethernet/intel/e100.c @@ -2753,6 +2753,18 @@ static int e100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) return generic_mii_ioctl(&nic->mii, if_mii(ifr), cmd, NULL); } +static int e100_change_mtu(struct net_device *netdev, int new_mtu) +{ + struct nic *nic = netdev_priv(netdev); + + netdev->mtu = new_mtu; + /* D100 MAC doesn't allow rx of vlan packets with normal MTU */ + if (nic->mac < mac_82558_D101_A4) + vlan_constrain_mtu(netdev); + + return 0; +} + static int e100_alloc(struct nic *nic) { nic->mem = pci_alloc_consistent(nic->pdev, sizeof(struct mem), @@ -2808,6 +2820,7 @@ static const struct net_device_ops e100_netdev_ops = { .ndo_set_rx_mode = e100_set_multicast_list, .ndo_set_mac_address = e100_set_mac_address, .ndo_do_ioctl = e100_do_ioctl, + .ndo_change_mtu = e100_change_mtu, .ndo_tx_timeout = e100_tx_timeout, #ifdef CONFIG_NET_POLL_CONTROLLER .ndo_poll_controller = e100_netpoll, @@ -2883,7 +2896,7 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent) /* D100 MAC doesn't allow rx of vlan packets with normal MTU */ if (nic->mac < mac_82558_D101_A4) - netdev->features |= NETIF_F_VLAN_CHALLENGED; + netdev->priv_flags |= IFF_NO_VLAN_ROOM; /* locks must be initialized before calling hw_reset */ spin_lock_init(&nic->cb_lock); diff --git a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c index b438f5576e18..cc25e4bade16 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c +++ b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c @@ -184,38 +184,54 @@ static int mlxsw_sx_port_oper_status_get(struct mlxsw_sx_port *mlxsw_sx_port, return 0; } -static int __mlxsw_sx_port_mtu_set(struct mlxsw_sx_port *mlxsw_sx_port, - u16 mtu) +static int mlxsw_sx_port_mtu_max(struct mlxsw_sx_port *mlxsw_sx_port) { struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx; char pmtu_pl[MLXSW_REG_PMTU_LEN]; - int max_mtu; int err; mlxsw_reg_pmtu_pack(pmtu_pl, mlxsw_sx_port->local_port, 0); err = mlxsw_reg_query(mlxsw_sx->core, MLXSW_REG(pmtu), pmtu_pl); if (err) - return err; - max_mtu = mlxsw_reg_pmtu_max_mtu_get(pmtu_pl); + return err; /* all errors are negative */ + return mlxsw_reg_pmtu_max_mtu_get(pmtu_pl); +} - if (mtu > max_mtu) - return -EINVAL; +static int ____mlxsw_sx_port_mtu_eth_set(struct mlxsw_sx_port *mlxsw_sx_port, + u16 mtu) +{ + struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx; + char pmtu_pl[MLXSW_REG_PMTU_LEN]; mlxsw_reg_pmtu_pack(pmtu_pl, mlxsw_sx_port->local_port, mtu); return mlxsw_reg_write(mlxsw_sx->core, MLXSW_REG(pmtu), pmtu_pl); } +static int __mlxsw_sx_port_mtu_eth_set(struct mlxsw_sx_port *mlxsw_sx_port, + u16 mtu) +{ + int max_mtu = mlxsw_sx_port_mtu_max(mlxsw_sx_port); + + if (max_mtu < 0) + return max_mtu; /* error code */ + + if (mtu > max_mtu) + return -EINVAL; + + return ____mlxsw_sx_port_mtu_eth_set(mlxsw_sx_port, mtu); +} + static int mlxsw_sx_port_mtu_eth_set(struct mlxsw_sx_port *mlxsw_sx_port, u16 mtu) { mtu += MLXSW_TXHDR_LEN + ETH_HLEN; - return __mlxsw_sx_port_mtu_set(mlxsw_sx_port, mtu); + return __mlxsw_sx_port_mtu_eth_set(mlxsw_sx_port, mtu); } static int mlxsw_sx_port_mtu_ib_set(struct mlxsw_sx_port *mlxsw_sx_port, u16 mtu) { - return __mlxsw_sx_port_mtu_set(mlxsw_sx_port, mtu); + return __mlxsw_sx_port_mtu_eth_set(mlxsw_sx_port, mtu); } static int mlxsw_sx_port_ib_port_set(struct mlxsw_sx_port *mlxsw_sx_port, @@ -336,12 +352,23 @@ static netdev_tx_t mlxsw_sx_port_xmit(struct sk_buff *skb, static int mlxsw_sx_port_change_mtu(struct net_device *dev, int mtu) { struct mlxsw_sx_port *mlxsw_sx_port = netdev_priv(dev); + int max_mtu = mlxsw_sx_port_mtu_max(mlxsw_sx_port); int err; - err = mlxsw_sx_port_mtu_eth_set(mlxsw_sx_port, mtu); + if (max_mtu < 0) + return max_mtu; /* error code */ + + max_mtu -= MLXSW_TXHDR_LEN + ETH_HLEN; + if (mtu > max_mtu) + return -EINVAL; + + err = ____mlxsw_sx_port_mtu_eth_set(mlxsw_sx_port, mtu); if (err) return err; + dev->mtu = mtu; + __vlan_constrain_mtu(dev, max_mtu); + return 0; } @@ -1013,8 +1040,9 @@ static int __mlxsw_sx_port_eth_create(struct mlxsw_sx *mlxsw_sx, u8 local_port, netif_carrier_off(dev); - dev->features |= NETIF_F_NETNS_LOCAL | NETIF_F_LLTX | NETIF_F_SG | - NETIF_F_VLAN_CHALLENGED; + dev->features |= NETIF_F_NETNS_LOCAL | NETIF_F_LLTX | NETIF_F_SG; + + dev->priv_flags |= IFF_NO_VLAN_ROOM; dev->min_mtu = 0; dev->max_mtu = ETH_MAX_MTU; diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c index 310e6839c6e5..7e008139ad22 100644 --- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c +++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c @@ -1479,18 +1479,8 @@ int gelic_net_setup_netdev(struct net_device *netdev, struct gelic_card *card) } memcpy(netdev->dev_addr, &v1, ETH_ALEN); - if (card->vlan_required) { + if (card->vlan_required) netdev->hard_header_len += VLAN_HLEN; - /* - * As vlan is internally used, - * we can not receive vlan packets - */ - netdev->features |= NETIF_F_VLAN_CHALLENGED; - } - - /* MTU range: 64 - 1518 */ - netdev->min_mtu = GELIC_NET_MIN_MTU; - netdev->max_mtu = GELIC_NET_MAX_MTU; status = register_netdev(netdev); if (status) { diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c index c0d181a7f83a..a417c0dbce56 100644 --- a/drivers/net/ethernet/wiznet/w5100.c +++ b/drivers/net/ethernet/wiznet/w5100.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "w5100.h" @@ -1038,6 +1039,7 @@ static const struct net_device_ops w5100_netdev_ops = { .ndo_set_rx_mode = w5100_set_rx_mode, .ndo_set_mac_address = w5100_set_macaddr, .ndo_validate_addr = eth_validate_addr, + .ndo_change_mtu = vlan_constrained_change_mtu, }; static int w5100_mmio_probe(struct platform_device *pdev) @@ -1137,9 +1139,9 @@ int w5100_probe(struct device *dev, const struct w5100_ops *ops, netif_napi_add(ndev, &priv->napi, w5100_napi_poll, 16); /* This chip doesn't support VLAN packets with normal MTU, - * so disable VLAN for this device. + * so constrain MTU of upper VLAN devices. */ - ndev->features |= NETIF_F_VLAN_CHALLENGED; + ndev->priv_flags |= IFF_NO_VLAN_ROOM; err = register_netdev(ndev); if (err < 0) diff --git a/drivers/net/ethernet/wiznet/w5300.c b/drivers/net/ethernet/wiznet/w5300.c index 46aae30c4636..e4d97a6749b3 100644 --- a/drivers/net/ethernet/wiznet/w5300.c +++ b/drivers/net/ethernet/wiznet/w5300.c @@ -25,6 +25,7 @@ #include #include #include +#include #define DRV_NAME "w5300" #define DRV_VERSION "2012-04-04" @@ -520,6 +521,7 @@ static const struct net_device_ops w5300_netdev_ops = { .ndo_set_rx_mode = w5300_set_rx_mode, .ndo_set_mac_address = w5300_set_macaddr, .ndo_validate_addr = eth_validate_addr, + .ndo_change_mtu = vlan_constrained_change_mtu, }; static int w5300_hw_probe(struct platform_device *pdev) @@ -606,9 +608,9 @@ static int w5300_probe(struct platform_device *pdev) netif_napi_add(ndev, &priv->napi, w5300_napi_poll, 16); /* This chip doesn't support VLAN packets with normal MTU, - * so disable VLAN for this device. + * so constrain MTU of upper VLAN devices. */ - ndev->features |= NETIF_F_VLAN_CHALLENGED; + ndev->priv_flags |= IFF_NO_VLAN_ROOM; err = register_netdev(ndev); if (err < 0) diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c index 2056d6ad04b5..1fd7df17d552 100644 --- a/drivers/net/rionet.c +++ b/drivers/net/rionet.c @@ -21,6 +21,7 @@ #include #include #include +#include #define DRV_NAME "rionet" #define DRV_VERSION "0.3" @@ -476,6 +477,7 @@ static const struct net_device_ops rionet_netdev_ops = { .ndo_start_xmit = rionet_start_xmit, .ndo_validate_addr = eth_validate_addr, .ndo_set_mac_address = eth_mac_addr, + .ndo_change_mtu = vlan_constrained_change_mtu, }; static int rionet_setup_netdev(struct rio_mport *mport, struct net_device *ndev) @@ -514,6 +516,7 @@ static int rionet_setup_netdev(struct rio_mport *mport, struct net_device *ndev) ndev->min_mtu = ETH_MIN_MTU; ndev->max_mtu = RIONET_MAX_MTU; ndev->features = NETIF_F_LLTX; + ndev->priv_flags |= IFF_NO_VLAN_ROOM; SET_NETDEV_DEV(ndev, &mport->dev); ndev->ethtool_ops = &rionet_ethtool_ops; diff --git a/drivers/net/wimax/i2400m/netdev.c b/drivers/net/wimax/i2400m/netdev.c index a7fcbceb6e6b..4097182a21c7 100644 --- a/drivers/net/wimax/i2400m/netdev.c +++ b/drivers/net/wimax/i2400m/netdev.c @@ -583,13 +583,12 @@ void i2400m_netdev_setup(struct net_device *net_dev) { d_fnstart(3, NULL, "(net_dev %p)\n", net_dev); ether_setup(net_dev); + net_dev->type = ARPHRD_RAWIP; net_dev->mtu = I2400M_MAX_MTU; net_dev->min_mtu = 0; net_dev->max_mtu = I2400M_MAX_MTU; net_dev->tx_queue_len = I2400M_TX_QLEN; - net_dev->features = - NETIF_F_VLAN_CHALLENGED - | NETIF_F_HIGHDMA; + net_dev->features = NETIF_F_HIGHDMA; net_dev->flags = IFF_NOARP /* i2400m is apure IP device */ & (~IFF_BROADCAST /* i2400m is P2P */ diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index da47e423e1b1..e9507237f3b7 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c @@ -629,6 +629,15 @@ static void qeth_l2_set_rx_mode(struct net_device *dev) schedule_work(&card->rx_mode_work); } +static int qeth_l2_change_mtu(struct net_device *dev, int new_mtu) +{ + struct qeth_card *card = dev->ml_priv; + + dev->mtu = new_mtu; + if (IS_OSM(card)) + vlan_constrain_mtu(dev); +} + static const struct net_device_ops qeth_l2_netdev_ops = { .ndo_open = qeth_open, .ndo_stop = qeth_stop, @@ -640,6 +649,7 @@ static const struct net_device_ops qeth_l2_netdev_ops = { .ndo_set_rx_mode = qeth_l2_set_rx_mode, .ndo_do_ioctl = qeth_do_ioctl, .ndo_set_mac_address = qeth_l2_set_mac_address, + .ndo_change_mtu = qeth_l2_change_mtu, .ndo_vlan_rx_add_vid = qeth_l2_vlan_rx_add_vid, .ndo_vlan_rx_kill_vid = qeth_l2_vlan_rx_kill_vid, .ndo_tx_timeout = qeth_tx_timeout, @@ -675,7 +685,7 @@ static int qeth_l2_setup_netdev(struct qeth_card *card) card->dev->priv_flags |= IFF_UNICAST_FLT; if (IS_OSM(card)) { - card->dev->features |= NETIF_F_VLAN_CHALLENGED; + card->dev->priv_flags |= IFF_NO_VLAN_ROOM; } else { if (!IS_VM_NIC(card)) card->dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER;