Add the ability to determine whether a netdev is a VxLAN netdev by calling the above mentioned function that checks the netdev's private flags. This will allow modules to identify netdev events involving a VxLAN netdev and act accordingly. For example, drivers capable of VxLAN offload will need to configure the underlying device when a VxLAN netdev is being enslaved to an offloaded bridge. Signed-off-by: Ido Schimmel <idosch@xxxxxxxxxxxx> Reviewed-by: Petr Machata <petrm@xxxxxxxxxxxx> --- drivers/net/vxlan.c | 1 + include/linux/netdevice.h | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index a646aa8e98ff..9bfd562aa81c 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -3178,6 +3178,7 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev, if (err) return err; + dev->priv_flags |= IFF_VXLAN; dev->ethtool_ops = &vxlan_ethtool_ops; /* create an fdb entry for a valid default destination */ diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 22e4ef7bb701..290083ff285a 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1487,6 +1487,7 @@ struct net_device_ops { * @IFF_NO_RX_HANDLER: device doesn't support the rx_handler hook * @IFF_FAILOVER: device is a failover master device * @IFF_FAILOVER_SLAVE: device is lower dev of a failover master device + * @IFF_VXLAN: device is a VxLAN device */ enum netdev_priv_flags { IFF_802_1Q_VLAN = 1<<0, @@ -1518,6 +1519,7 @@ enum netdev_priv_flags { IFF_NO_RX_HANDLER = 1<<26, IFF_FAILOVER = 1<<27, IFF_FAILOVER_SLAVE = 1<<28, + IFF_VXLAN = 1<<29, }; #define IFF_802_1Q_VLAN IFF_802_1Q_VLAN @@ -1548,6 +1550,7 @@ enum netdev_priv_flags { #define IFF_NO_RX_HANDLER IFF_NO_RX_HANDLER #define IFF_FAILOVER IFF_FAILOVER #define IFF_FAILOVER_SLAVE IFF_FAILOVER_SLAVE +#define IFF_VXLAN IFF_VXLAN /** * struct net_device - The DEVICE structure. @@ -4567,6 +4570,11 @@ static inline bool netif_is_failover_slave(const struct net_device *dev) return dev->priv_flags & IFF_FAILOVER_SLAVE; } +static inline bool netif_is_vxlan(const struct net_device *dev) +{ + return dev->priv_flags & IFF_VXLAN; +} + /* This device needs to keep skb dst for qdisc enqueue or ndo_start_xmit() */ static inline void netif_keep_dst(struct net_device *dev) { -- 2.17.2