From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ido Schimmel Subject: [PATCH net-next 11/18] vxlan: Add netif_is_vxlan() Date: Sat, 13 Oct 2018 17:18:38 +0000 Message-ID: <20181013171725.3261-12-idosch@mellanox.com> References: <20181013171725.3261-1-idosch@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: "davem@davemloft.net" , Jiri Pirko , Petr Machata , "ivecera@redhat.com" , "roopa@cumulusnetworks.com" , "nikolay@cumulusnetworks.com" , "andrew@lunn.ch" , "vivien.didelot@savoirfairelinux.com" , "f.fainelli@gmail.com" , "stephen@networkplumber.org" , "bridge@lists.linux-foundation.org" , mlxsw , Ido Schimmel To: "netdev@vger.kernel.org" Return-path: Received: from mail-he1eur01on0083.outbound.protection.outlook.com ([104.47.0.83]:32183 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727051AbeJNA47 (ORCPT ); Sat, 13 Oct 2018 20:56:59 -0400 In-Reply-To: <20181013171725.3261-1-idosch@mellanox.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: 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 Reviewed-by: Petr Machata --- 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; =20 + dev->priv_flags |=3D IFF_VXLAN; dev->ethtool_ops =3D &vxlan_ethtool_ops; =20 /* 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 =3D 1<<0, @@ -1518,6 +1519,7 @@ enum netdev_priv_flags { IFF_NO_RX_HANDLER =3D 1<<26, IFF_FAILOVER =3D 1<<27, IFF_FAILOVER_SLAVE =3D 1<<28, + IFF_VXLAN =3D 1<<29, }; =20 #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 =20 /** * struct net_device - The DEVICE structure. @@ -4567,6 +4570,11 @@ static inline bool netif_is_failover_slave(const str= uct net_device *dev) return dev->priv_flags & IFF_FAILOVER_SLAVE; } =20 +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) { --=20 2.17.2