Skip to content

Commit 76cd622

Browse files
author
Saeed Mahameed
committed
Merge branch 'mlx5-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux
This merge includes updates to bonding driver needed for the rdma stack, to avoid conflicts with the RDMA branch. Maor Gottlieb Says: ==================== Bonding: Add support to get xmit slave The following series adds support to get the LAG master xmit slave by introducing new .ndo - ndo_get_xmit_slave. Every LAG module can implement it and it first implemented in the bond driver. This is follow-up to the RFC discussion [1]. The main motivation for doing this is for drivers that offload part of the LAG functionality. For example, Mellanox Connect-X hardware implements RoCE LAG which selects the TX affinity when the resources are created and port is remapped when it goes down. The first part of this patchset introduces the new .ndo and add the support to the bonding module. The second part adds support to get the RoCE LAG xmit slave by building skb of the RoCE packet based on the AH attributes and call to the new .ndo. The third part change the mlx5 driver driver to set the QP's affinity port according to the slave which found by the .ndo. ==================== Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
2 parents 5eb2bcf + c6bc604 commit 76cd622

8 files changed

Lines changed: 301 additions & 99 deletions

File tree

‎drivers/net/bonding/bond_alb.c‎

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,11 +1331,11 @@ static netdev_tx_t bond_do_alb_xmit(struct sk_buff *skb, struct bonding *bond,
13311331
return bond_tx_drop(bond->dev, skb);
13321332
}
13331333

1334-
netdev_tx_t bond_tlb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
1334+
struct slave *bond_xmit_tlb_slave_get(struct bonding *bond,
1335+
struct sk_buff *skb)
13351336
{
1336-
struct bonding *bond = netdev_priv(bond_dev);
1337-
struct ethhdr *eth_data;
13381337
struct slave *tx_slave = NULL;
1338+
struct ethhdr *eth_data;
13391339
u32 hash_index;
13401340

13411341
skb_reset_mac_header(skb);
@@ -1357,7 +1357,7 @@ netdev_tx_t bond_tlb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
13571357
struct bond_up_slave *slaves;
13581358
unsigned int count;
13591359

1360-
slaves = rcu_dereference(bond->slave_arr);
1360+
slaves = rcu_dereference(bond->usable_slaves);
13611361
count = slaves ? READ_ONCE(slaves->count) : 0;
13621362
if (likely(count))
13631363
tx_slave = slaves->arr[hash_index %
@@ -1366,20 +1366,29 @@ netdev_tx_t bond_tlb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
13661366
break;
13671367
}
13681368
}
1369-
return bond_do_alb_xmit(skb, bond, tx_slave);
1369+
return tx_slave;
13701370
}
13711371

1372-
netdev_tx_t bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
1372+
netdev_tx_t bond_tlb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
13731373
{
13741374
struct bonding *bond = netdev_priv(bond_dev);
1375-
struct ethhdr *eth_data;
1375+
struct slave *tx_slave;
1376+
1377+
tx_slave = bond_xmit_tlb_slave_get(bond, skb);
1378+
return bond_do_alb_xmit(skb, bond, tx_slave);
1379+
}
1380+
1381+
struct slave *bond_xmit_alb_slave_get(struct bonding *bond,
1382+
struct sk_buff *skb)
1383+
{
13761384
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
1377-
struct slave *tx_slave = NULL;
13781385
static const __be32 ip_bcast = htonl(0xffffffff);
1379-
int hash_size = 0;
1386+
struct slave *tx_slave = NULL;
1387+
const u8 *hash_start = NULL;
13801388
bool do_tx_balance = true;
1389+
struct ethhdr *eth_data;
13811390
u32 hash_index = 0;
1382-
const u8 *hash_start = NULL;
1391+
int hash_size = 0;
13831392

13841393
skb_reset_mac_header(skb);
13851394
eth_data = eth_hdr(skb);
@@ -1491,14 +1500,22 @@ netdev_tx_t bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
14911500
struct bond_up_slave *slaves;
14921501
unsigned int count;
14931502

1494-
slaves = rcu_dereference(bond->slave_arr);
1503+
slaves = rcu_dereference(bond->usable_slaves);
14951504
count = slaves ? READ_ONCE(slaves->count) : 0;
14961505
if (likely(count))
14971506
tx_slave = slaves->arr[bond_xmit_hash(bond, skb) %
14981507
count];
14991508
}
15001509
}
1510+
return tx_slave;
1511+
}
1512+
1513+
netdev_tx_t bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
1514+
{
1515+
struct bonding *bond = netdev_priv(bond_dev);
1516+
struct slave *tx_slave = NULL;
15011517

1518+
tx_slave = bond_xmit_alb_slave_get(bond, skb);
15021519
return bond_do_alb_xmit(skb, bond, tx_slave);
15031520
}
15041521

0 commit comments

Comments
 (0)