Skip to content

Commit

Permalink
net: add netif_is_team_master helper
Browse files Browse the repository at this point in the history
Similar to other helpers, caller can use this to find out if device is
team master.

Change-Id: I8301442073b4af1e19a1ee207fa5055a3ab5c908
Signed-off-by: Jiri Pirko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
jpirko authored and chrmhoffmann committed Nov 7, 2023
1 parent e967300 commit 47cbd1f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/team/team.c
Original file line number Diff line number Diff line change
Expand Up @@ -2081,6 +2081,7 @@ static void team_setup(struct net_device *dev)
dev->flags |= IFF_MULTICAST;
dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING);
dev->priv_flags |= IFF_NO_QUEUE;
dev->priv_flags |= IFF_TEAM;

/*
* Indicate we support unicast address filtering. That way core won't
Expand Down
8 changes: 8 additions & 0 deletions include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,7 @@ struct net_device_ops {
* @IFF_NO_QUEUE: device can run without qdisc attached
* @IFF_OPENVSWITCH: device is a Open vSwitch master
* @IFF_L3MDEV_SLAVE: device is enslaved to an L3 master device
* @IFF_TEAM: device is a team device
*/
enum netdev_priv_flags {
IFF_802_1Q_VLAN = 1<<0,
Expand All @@ -1297,6 +1298,7 @@ enum netdev_priv_flags {
IFF_NO_QUEUE = 1<<21,
IFF_OPENVSWITCH = 1<<22,
IFF_L3MDEV_SLAVE = 1<<23,
IFF_TEAM = 1<<24,
};

#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
Expand All @@ -1323,6 +1325,7 @@ enum netdev_priv_flags {
#define IFF_NO_QUEUE IFF_NO_QUEUE
#define IFF_OPENVSWITCH IFF_OPENVSWITCH
#define IFF_L3MDEV_SLAVE IFF_L3MDEV_SLAVE
#define IFF_TEAM IFF_TEAM

/**
* struct net_device - The DEVICE structure.
Expand Down Expand Up @@ -3974,6 +3977,11 @@ static inline bool netif_is_ovs_master(const struct net_device *dev)
return dev->priv_flags & IFF_OPENVSWITCH;
}

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)
{
Expand Down

0 comments on commit 47cbd1f

Please sign in to comment.