[v4,4/6] net/bonding: support add port by data name

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

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Chaoyong He Oct. 18, 2023, 7:48 a.m. UTC
  From: Long Wu <long.wu@corigine.com>

Several ports may share the same PCI address, like nfp representor.
So we 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, we include an option to add such ports to the bonding port.

After adding this feature, we 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

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

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

Patch

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;
 }