Commit 35d4e172 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

net: add netif_is_ovs_master helper with IFF_OPENVSWITCH private flag

Add this helper so code can easily figure out if netdev is openswitch.
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0894ae3f
...@@ -1264,6 +1264,7 @@ struct net_device_ops { ...@@ -1264,6 +1264,7 @@ struct net_device_ops {
* @IFF_MACVLAN: Macvlan device * @IFF_MACVLAN: Macvlan device
* @IFF_VRF_MASTER: device is a VRF master * @IFF_VRF_MASTER: device is a VRF master
* @IFF_NO_QUEUE: device can run without qdisc attached * @IFF_NO_QUEUE: device can run without qdisc attached
* @IFF_OPENVSWITCH: device is a Open vSwitch master
*/ */
enum netdev_priv_flags { enum netdev_priv_flags {
IFF_802_1Q_VLAN = 1<<0, IFF_802_1Q_VLAN = 1<<0,
...@@ -1293,6 +1294,7 @@ enum netdev_priv_flags { ...@@ -1293,6 +1294,7 @@ enum netdev_priv_flags {
IFF_IPVLAN_SLAVE = 1<<24, IFF_IPVLAN_SLAVE = 1<<24,
IFF_VRF_MASTER = 1<<25, IFF_VRF_MASTER = 1<<25,
IFF_NO_QUEUE = 1<<26, IFF_NO_QUEUE = 1<<26,
IFF_OPENVSWITCH = 1<<27,
}; };
#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN #define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
...@@ -1322,6 +1324,7 @@ enum netdev_priv_flags { ...@@ -1322,6 +1324,7 @@ enum netdev_priv_flags {
#define IFF_IPVLAN_SLAVE IFF_IPVLAN_SLAVE #define IFF_IPVLAN_SLAVE IFF_IPVLAN_SLAVE
#define IFF_VRF_MASTER IFF_VRF_MASTER #define IFF_VRF_MASTER IFF_VRF_MASTER
#define IFF_NO_QUEUE IFF_NO_QUEUE #define IFF_NO_QUEUE IFF_NO_QUEUE
#define IFF_OPENVSWITCH IFF_OPENVSWITCH
/** /**
* struct net_device - The DEVICE structure. * struct net_device - The DEVICE structure.
...@@ -3853,6 +3856,11 @@ static inline bool netif_is_bridge_master(const struct net_device *dev) ...@@ -3853,6 +3856,11 @@ static inline bool netif_is_bridge_master(const struct net_device *dev)
return dev->priv_flags & IFF_EBRIDGE; return dev->priv_flags & IFF_EBRIDGE;
} }
static inline bool netif_is_ovs_master(const struct net_device *dev)
{
return dev->priv_flags & IFF_OPENVSWITCH;
}
static inline bool netif_index_is_vrf(struct net *net, int ifindex) static inline bool netif_index_is_vrf(struct net *net, int ifindex)
{ {
bool rc = false; bool rc = false;
......
...@@ -135,7 +135,7 @@ static void do_setup(struct net_device *netdev) ...@@ -135,7 +135,7 @@ static void do_setup(struct net_device *netdev)
netdev->netdev_ops = &internal_dev_netdev_ops; netdev->netdev_ops = &internal_dev_netdev_ops;
netdev->priv_flags &= ~IFF_TX_SKB_SHARING; netdev->priv_flags &= ~IFF_TX_SKB_SHARING;
netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE; netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_OPENVSWITCH;
netdev->destructor = internal_dev_destructor; netdev->destructor = internal_dev_destructor;
netdev->ethtool_ops = &internal_dev_ethtool_ops; netdev->ethtool_ops = &internal_dev_ethtool_ops;
netdev->rtnl_link_ops = &internal_dev_link_ops; netdev->rtnl_link_ops = &internal_dev_link_ops;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment