From: Jiri Pirko Date: Thu, 3 Dec 2015 11:12:06 +0000 (+0100) Subject: net: add netif_is_team_master helper X-Git-Tag: v4.1.12-124.31.3~245 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=e1ec0840eccf0f950a792538995ee22781dcb42f;p=users%2Fjedix%2Flinux-maple.git net: add netif_is_team_master helper Orabug: 29495360 Similar to other helpers, caller can use this to find out if device is team master. Signed-off-by: Jiri Pirko Signed-off-by: David S. Miller (cherry picked from commit c981e4213e9d2d4ec79501bd607722ec712742a2) Signed-off-by: Brian Maly Conflicts: drivers/net/team/team.c include/linux/netdevice.h --- diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 2b45d0168c3c..8ae02cc3fbfd 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c @@ -2050,6 +2050,7 @@ static void team_setup(struct net_device *dev) dev->tx_queue_len = 0; dev->flags |= IFF_MULTICAST; dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING); + dev->priv_flags |= IFF_TEAM; /* * Indicate we support unicast address filtering. That way core won't diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 7eaee17f54b7..a6b177fab6fd 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1250,6 +1250,7 @@ struct net_device_ops { * @IFF_MACSEC: device is a MACsec device * @IFF_FAILOVER: device is a failover master device * @IFF_FAILOVER_SLAVE: device is lower dev of a failover master device + * @IFF_TEAM: device is a team device */ enum netdev_priv_flags { IFF_802_1Q_VLAN = 1<<0, @@ -1281,6 +1282,7 @@ enum netdev_priv_flags { IFF_MACSEC = 1<<27, IFF_FAILOVER = 1<<28, IFF_FAILOVER_SLAVE = 1<<29, + IFF_TEAM = 1<<24, }; #define IFF_802_1Q_VLAN IFF_802_1Q_VLAN @@ -1312,6 +1314,7 @@ enum netdev_priv_flags { #define IFF_MACSEC IFF_MACSEC #define IFF_FAILOVER IFF_FAILOVER #define IFF_FAILOVER_SLAVE IFF_FAILOVER_SLAVE +#define IFF_TEAM IFF_TEAM /** * struct net_device - The DEVICE structure. @@ -3902,6 +3905,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_team_master(struct net_device *dev) +{ + return dev->priv_flags & IFF_TEAM; +} + /* This device needs to keep skb dst for qdisc enqueue or ndo_start_xmit() */ static inline void netif_keep_dst(struct net_device *dev) {