aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2015-08-27 03:31:20 -0400
committerDavid S. Miller <davem@davemloft.net>2015-08-27 19:28:35 -0400
commit35d4e1725202e6656fcfa8b88447327ad3ae0c0c (patch)
treea3d559ce4df8e097e51e443749bf3830e7030906
parent0894ae3f0a587bda9733ec4a4b67af7ded3a9498 (diff)
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: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/netdevice.h8
-rw-r--r--net/openvswitch/vport-internal_dev.c2
2 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index be625f4754b9..6656a43c072d 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1264,6 +1264,7 @@ struct net_device_ops {
1264 * @IFF_MACVLAN: Macvlan device 1264 * @IFF_MACVLAN: Macvlan device
1265 * @IFF_VRF_MASTER: device is a VRF master 1265 * @IFF_VRF_MASTER: device is a VRF master
1266 * @IFF_NO_QUEUE: device can run without qdisc attached 1266 * @IFF_NO_QUEUE: device can run without qdisc attached
1267 * @IFF_OPENVSWITCH: device is a Open vSwitch master
1267 */ 1268 */
1268enum netdev_priv_flags { 1269enum netdev_priv_flags {
1269 IFF_802_1Q_VLAN = 1<<0, 1270 IFF_802_1Q_VLAN = 1<<0,
@@ -1293,6 +1294,7 @@ enum netdev_priv_flags {
1293 IFF_IPVLAN_SLAVE = 1<<24, 1294 IFF_IPVLAN_SLAVE = 1<<24,
1294 IFF_VRF_MASTER = 1<<25, 1295 IFF_VRF_MASTER = 1<<25,
1295 IFF_NO_QUEUE = 1<<26, 1296 IFF_NO_QUEUE = 1<<26,
1297 IFF_OPENVSWITCH = 1<<27,
1296}; 1298};
1297 1299
1298#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN 1300#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
@@ -1322,6 +1324,7 @@ enum netdev_priv_flags {
1322#define IFF_IPVLAN_SLAVE IFF_IPVLAN_SLAVE 1324#define IFF_IPVLAN_SLAVE IFF_IPVLAN_SLAVE
1323#define IFF_VRF_MASTER IFF_VRF_MASTER 1325#define IFF_VRF_MASTER IFF_VRF_MASTER
1324#define IFF_NO_QUEUE IFF_NO_QUEUE 1326#define IFF_NO_QUEUE IFF_NO_QUEUE
1327#define IFF_OPENVSWITCH IFF_OPENVSWITCH
1325 1328
1326/** 1329/**
1327 * struct net_device - The DEVICE structure. 1330 * struct net_device - The DEVICE structure.
@@ -3853,6 +3856,11 @@ static inline bool netif_is_bridge_master(const struct net_device *dev)
3853 return dev->priv_flags & IFF_EBRIDGE; 3856 return dev->priv_flags & IFF_EBRIDGE;
3854} 3857}
3855 3858
3859static inline bool netif_is_ovs_master(const struct net_device *dev)
3860{
3861 return dev->priv_flags & IFF_OPENVSWITCH;
3862}
3863
3856static inline bool netif_index_is_vrf(struct net *net, int ifindex) 3864static inline bool netif_index_is_vrf(struct net *net, int ifindex)
3857{ 3865{
3858 bool rc = false; 3866 bool rc = false;
diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c
index c058bbf876c3..80b3e12ec882 100644
--- a/net/openvswitch/vport-internal_dev.c
+++ b/net/openvswitch/vport-internal_dev.c
@@ -135,7 +135,7 @@ static void do_setup(struct net_device *netdev)
135 netdev->netdev_ops = &internal_dev_netdev_ops; 135 netdev->netdev_ops = &internal_dev_netdev_ops;
136 136
137 netdev->priv_flags &= ~IFF_TX_SKB_SHARING; 137 netdev->priv_flags &= ~IFF_TX_SKB_SHARING;
138 netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE; 138 netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_OPENVSWITCH;
139 netdev->destructor = internal_dev_destructor; 139 netdev->destructor = internal_dev_destructor;
140 netdev->ethtool_ops = &internal_dev_ethtool_ops; 140 netdev->ethtool_ops = &internal_dev_ethtool_ops;
141 netdev->rtnl_link_ops = &internal_dev_link_ops; 141 netdev->rtnl_link_ops = &internal_dev_link_ops;