From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, idosch@mellanox.com, mlxsw@mellanox.com,
dsa@cumulusnetworks.com, shm@cumulusnetworks.com,
kuznet@ms2.inr.ac.ru, jmorris@namei.org, yoshfuji@linux-ipv6.org,
kaber@trash.net, lorenzo@google.com, mateusz.bajorski@nokia.com
Subject: [patch net-next 04/10] net: Add netif_is_vrf_master helper
Date: Mon, 13 Mar 2017 08:38:27 +0100 [thread overview]
Message-ID: <1489390713-2634-4-git-send-email-jiri@resnulli.us> (raw)
In-Reply-To: <1489390713-2634-1-git-send-email-jiri@resnulli.us>
From: Ido Schimmel <idosch@mellanox.com>
Drivers capable of offloading VRF configurations need to know the ports
are enslaved to an actual VRF device and not some other L3 master.
Add a flag to indicate netdev is a VRF master and a corresponding
helper.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/vrf.c | 2 +-
include/linux/netdevice.h | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 22379da..5c9a98e 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -1257,7 +1257,7 @@ static int vrf_newlink(struct net *src_net, struct net_device *dev,
if (vrf->tb_id == RT_TABLE_UNSPEC)
return -EINVAL;
- dev->priv_flags |= IFF_L3MDEV_MASTER;
+ dev->priv_flags |= IFF_L3MDEV_MASTER | IFF_VRF_MASTER;
err = register_netdevice(dev);
if (err)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 97456b25..7908d31 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1356,6 +1356,7 @@ struct net_device_ops {
* @IFF_PHONY_HEADROOM: the headroom value is controlled by an external
* entity (i.e. the master device for bridged veth)
* @IFF_MACSEC: device is a MACsec device
+ * @IFF_VRF_MASTER: device is a VRF master device
*/
enum netdev_priv_flags {
IFF_802_1Q_VLAN = 1<<0,
@@ -1386,6 +1387,7 @@ enum netdev_priv_flags {
IFF_RXFH_CONFIGURED = 1<<25,
IFF_PHONY_HEADROOM = 1<<26,
IFF_MACSEC = 1<<27,
+ IFF_VRF_MASTER = 1<<28,
};
#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
@@ -1415,6 +1417,7 @@ enum netdev_priv_flags {
#define IFF_TEAM IFF_TEAM
#define IFF_RXFH_CONFIGURED IFF_RXFH_CONFIGURED
#define IFF_MACSEC IFF_MACSEC
+#define IFF_VRF_MASTER IFF_VRF_MASTER
/**
* struct net_device - The DEVICE structure.
@@ -4155,6 +4158,11 @@ static inline bool netif_supports_nofcs(struct net_device *dev)
return dev->priv_flags & IFF_SUPP_NOFCS;
}
+static inline bool netif_is_vrf_master(const struct net_device *dev)
+{
+ return dev->priv_flags & IFF_VRF_MASTER;
+}
+
static inline bool netif_is_l3_master(const struct net_device *dev)
{
return dev->priv_flags & IFF_L3MDEV_MASTER;
--
2.7.4
next prev parent reply other threads:[~2017-03-13 7:38 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-13 7:35 [patch net-next 00/10] mlxsw: Enable VRF offload Jiri Pirko
2017-03-13 7:38 ` [patch net-next 01/10] net: fib_rules: Add default rule indication Jiri Pirko
2017-03-13 7:38 ` [patch net-next 02/10] ipv4: fib_rules: Add notifier info to FIB rules notifications Jiri Pirko
2017-03-13 7:38 ` [patch net-next 03/10] ipv4: fib_rules: Dump FIB rules when registering FIB notifier Jiri Pirko
2017-03-13 14:52 ` David Ahern
2017-03-13 17:33 ` Ido Schimmel
2017-03-13 7:38 ` Jiri Pirko [this message]
2017-03-13 14:39 ` [patch net-next 04/10] net: Add netif_is_vrf_master helper David Ahern
2017-03-13 15:01 ` Ido Schimmel
2017-03-13 15:15 ` David Ahern
2017-03-13 15:58 ` Ido Schimmel
2017-03-13 7:38 ` [patch net-next 05/10] net: vrf: Set slave's private flag before linking Jiri Pirko
2017-03-13 15:19 ` David Ahern
2017-03-13 7:38 ` [patch net-next 06/10] mlxsw: spectrum_router: Associate RIFs with correct VR Jiri Pirko
2017-03-13 7:38 ` [patch net-next 07/10] mlxsw: spectrum_router: Don't destroy RIF if L3 slave Jiri Pirko
2017-03-13 7:38 ` [patch net-next 08/10] mlxsw: spectrum_router: Add support for VRFs Jiri Pirko
2017-03-13 7:38 ` [patch net-next 09/10] mlxsw: spectrum_router: Add support for VRFs on top of bridges Jiri Pirko
2017-03-13 7:38 ` [patch net-next 10/10] mlxsw: spectrum_router: Don't abort on l3mdev rules Jiri Pirko
2017-03-13 14:59 ` David Ahern
2017-03-13 15:22 ` Ido Schimmel
2017-03-13 15:37 ` David Ahern
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=1489390713-2634-4-git-send-email-jiri@resnulli.us \
--to=jiri@resnulli.us \
--cc=davem@davemloft.net \
--cc=dsa@cumulusnetworks.com \
--cc=idosch@mellanox.com \
--cc=jmorris@namei.org \
--cc=kaber@trash.net \
--cc=kuznet@ms2.inr.ac.ru \
--cc=lorenzo@google.com \
--cc=mateusz.bajorski@nokia.com \
--cc=mlxsw@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=shm@cumulusnetworks.com \
--cc=yoshfuji@linux-ipv6.org \
/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).