diff options
author | Jason Gunthorpe <jgg@mellanox.com> | 2020-05-02 20:18:45 -0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2020-05-02 20:18:45 -0300 |
commit | 451c9fc77ae6fda6fcfdea7c15cdb86c647a0346 (patch) | |
tree | 2fc3297c23c160b5dfbe5ccc403398b288e0ebff /net | |
parent | 0eacc574aae7300bf46c10c7116c3ba5825505b7 (diff) | |
parent | c6bc6041b10f70b617f2d13894311fe62027d292 (diff) | |
download | linux-451c9fc77ae6fda6fcfdea7c15cdb86c647a0346.tar.gz |
Merge branch 'mellanox/mlx5-next' into rdma.git for-next
From the mlx5-next branch at
git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux
Required for dependencies in following patches
* mellanox/mlx5-next:
net/mlx5: Add support to get lag physical port
net/mlx5: Change lag mutex lock to spin lock
bonding: Implement ndo_get_xmit_slave
bonding: Add array of all slaves
bonding: Add function to get the xmit slave in active-backup mode
bonding: Add helper function to get the xmit slave in rr mode
bonding: Add helper function to get the xmit slave based on hash
bonding/alb: Add helper functions to get the xmit slave
bonding: Rename slave_arr to usable_slaves
bonding: Export skip slave logic to function
net/core: Introduce netdev_get_xmit_slave
Diffstat (limited to 'net')
-rw-r--r-- | net/core/dev.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 9c9e763bfe0e..e6c10980abfd 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -7785,6 +7785,28 @@ void netdev_bonding_info_change(struct net_device *dev, } EXPORT_SYMBOL(netdev_bonding_info_change); +/** + * netdev_get_xmit_slave - Get the xmit slave of master device + * @skb: The packet + * @all_slaves: assume all the slaves are active + * + * The reference counters are not incremented so the caller must be + * careful with locks. The caller must hold RCU lock. + * %NULL is returned if no slave is found. + */ + +struct net_device *netdev_get_xmit_slave(struct net_device *dev, + struct sk_buff *skb, + bool all_slaves) +{ + const struct net_device_ops *ops = dev->netdev_ops; + + if (!ops->ndo_get_xmit_slave) + return NULL; + return ops->ndo_get_xmit_slave(dev, skb, all_slaves); +} +EXPORT_SYMBOL(netdev_get_xmit_slave); + static void netdev_adjacent_add_links(struct net_device *dev) { struct netdev_adjacent *iter; |