[v6,04/14] net/bonding: support add port by data name

Message ID 20231226072824.3163121-5-chaoyong.he@corigine.com (mailing list archive)
State New
Delegated to: Ferruh Yigit
Series Enhance the bond framework to support offload |


Context Check Description
ci/checkpatch success coding style OK

Commit Message

Chaoyong He Dec. 26, 2023, 7:28 a.m. UTC
  From: Long Wu <long.wu@corigine.com>

Several ports may share the same PCI address, like NFP representor port.
So users cannot add this type of ports to bonding port by "--vdev"
argument in dpdk-testpmd. But the port's data name is unique between
them, include an option to add such ports to the bonding port.

After adding this feature, users can create a bonding port that member
port is this type of port by "--vdev" in dpdk-testpmd start command.

For example:
dpdk-testpmd -l 2-10 -s 0x8 -a ca:00.0,representor=[0-2]
--vdev 'net_bonding0,member=flower_repr_p0,member=flower_repr_p1,
mode=4,socket_id=1,xmit_policy=l34' -- -i

1. "ca:00.0" is NFP 4000 card.
2. "flower_repr_p0" and "flower_repr_p1" are NFP phy representor port's
data name.

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: James Hershaw <james.hershaw@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
 drivers/net/bonding/rte_eth_bond_args.c | 3 +++
 1 file changed, 3 insertions(+)


diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c
index 8a3e4656ef..b320eb3038 100644
--- a/drivers/net/bonding/rte_eth_bond_args.c
+++ b/drivers/net/bonding/rte_eth_bond_args.c
@@ -70,6 +70,9 @@  find_port_id_by_dev_name(const char *name)
 		if (strcmp(rte_eth_devices[i].device->name, name) == 0)
 			return i;
+		if (strcmp(rte_eth_devices[i].data->name, name) == 0)
+			return i;
 	return -1;