From: Edwin Peer <edwin.peer@broadcom.com>
To: netdev@vger.kernel.org
Cc: Edwin Peer <edwin.peer@broadcom.com>,
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 [thread overview]
Message-ID: <20200527212512.17901-10-edwin.peer@broadcom.com> (raw)
In-Reply-To: <20200527212512.17901-1-edwin.peer@broadcom.com>
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 <edwin.peer@broadcom.com>
---
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 <linux/module.h>
#include <linux/pci.h>
#include <linux/ntb.h>
+#include <linux/if_vlan.h>
#include <linux/ntb_transport.h>
#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);
--
2.26.2
next prev parent reply other threads:[~2020-05-27 21:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-27 21:25 [RFC PATCH net-next 00/11] Nested VLANs - decimate flags and add another Edwin Peer
2020-05-27 21:25 ` [RFC PATCH net-next 01/11] net: geneve: enable vlan offloads Edwin Peer
2020-05-27 21:25 ` [RFC PATCH net-next 02/11] net: do away with the IFF_XMIT_DST_RELEASE_PERM flag Edwin Peer
2020-05-27 21:25 ` [RFC PATCH net-next 03/11] net: vlan: add IFF_NO_VLAN_ROOM to constrain MTU Edwin Peer
2020-05-27 21:25 ` [RFC PATCH net-next 04/11] net: geneve: constrain upper VLAN MTU using IFF_NO_VLAN_ROOM Edwin Peer
2020-05-27 21:25 ` [RFC PATCH net-next 05/11] net: vxlan: " Edwin Peer
2020-05-27 21:25 ` [RFC PATCH net-next 06/11] net: l2tp_eth: " Edwin Peer
2020-05-27 21:25 ` [RFC PATCH net-next 07/11] net: gre: " Edwin Peer
2020-05-27 21:25 ` [RFC PATCH net-next 08/11] net: distribute IFF_NO_VLAN_ROOM into aggregate devs Edwin Peer
2020-05-27 21:25 ` Edwin Peer [this message]
2020-05-27 21:25 ` [RFC PATCH net-next 10/11] net: vlan: disallow non-Ethernet devices Edwin Peer
2020-05-27 21:25 ` [RFC PATCH net-next 11/11] net: leverage IFF_NO_VLAN_ROOM to limit NETIF_F_VLAN_CHALLENGED Edwin Peer
2020-05-28 0:15 ` [RFC PATCH net-next 00/11] Nested VLANs - decimate flags and add another Michał Mirosław
2020-05-28 0:39 ` Edwin Peer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200527212512.17901-10-edwin.peer@broadcom.com \
--to=edwin.peer@broadcom.com \
--cc=allenbh@gmail.com \
--cc=andy@greyhouse.net \
--cc=dave.jiang@intel.com \
--cc=david@weave.works \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=geoff@infradead.org \
--cc=grant.likely@secretlab.ca \
--cc=hadarh@mellanox.com \
--cc=hadi@cyberus.ca \
--cc=inaky.perez-gonzalez@intel.com \
--cc=j.vosburgh@gmail.com \
--cc=jchapman@katalix.com \
--cc=jesse.brandeburg@intel.com \
--cc=jiri@mellanox.com \
--cc=jon.mason@intel.com \
--cc=jwi@linux.ibm.com \
--cc=kgraul@linux.ibm.com \
--cc=linville@tuxdriver.com \
--cc=michael.chan@broadcom.com \
--cc=mirq-linux@rere.qmqm.pl \
--cc=mokuno@sm.sony.co.jp \
--cc=mporter@kernel.crashing.org \
--cc=msink@permonline.ru \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
--cc=saeedm@mellanox.com \
--cc=shemminger@vyatta.com \
--cc=shrijeet@gmail.com \
--cc=sridhar.samudrala@intel.com \
--cc=ubraun@linux.ibm.com \
--cc=vfalico@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).