[SRU][F:linux-bluefield][PATCH 22/32] bonding: Add function to get the xmit slave in active-backup mode
Daniel Jurgens
danielj at nvidia.com
Mon May 3 19:39:07 UTC 2021
From: Maor Gottlieb <maorg at mellanox.com>
BugLink: https://bugs.launchpad.net/bugs/1926994
Add helper function to get the xmit slave in active-backup mode.
It's only one line function that return the curr_active_slave,
but it will used both in the xmit flow and by the new .ndo to get
the xmit slave.
Signed-off-by: Maor Gottlieb <maorg at mellanox.com>
Reviewed-by: Jiri Pirko <jiri at mellanox.com>
Reviewed-by: Jay Vosburgh <jay.vosburgh at canonical.com>
Acked-by: David S. Miller <davem at davemloft.net>
Signed-off-by: Saeed Mahameed <saeedm at mellanox.com>
(cherry picked from commit 5a19f1c1a2a0f7d5fb80b130ab4a15fa99e792d7)
Signed-off-by: Daniel Jurgens <danielj at nvidia.com>
---
drivers/net/bonding/bond_main.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 7a838d2..95de414 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4113,6 +4113,12 @@ static netdev_tx_t bond_xmit_roundrobin(struct sk_buff *skb,
return bond_tx_drop(bond_dev, skb);
}
+static struct slave *bond_xmit_activebackup_slave_get(struct bonding *bond,
+ struct sk_buff *skb)
+{
+ return rcu_dereference(bond->curr_active_slave);
+}
+
/* In active-backup mode, we know that bond->curr_active_slave is always valid if
* the bond has a usable interface.
*/
@@ -4122,7 +4128,7 @@ static netdev_tx_t bond_xmit_activebackup(struct sk_buff *skb,
struct bonding *bond = netdev_priv(bond_dev);
struct slave *slave;
- slave = rcu_dereference(bond->curr_active_slave);
+ slave = bond_xmit_activebackup_slave_get(bond, skb);
if (slave)
return bond_dev_queue_xmit(bond, skb, slave->dev);
--
1.8.3.1
More information about the kernel-team
mailing list