From: Jie Liu <[email protected]>
sxe2_eth_pmd_probe() always probes a single PF port (index 0) even
when multiple ports are requested in the device arguments, so
additional PF ports are never created.
Loop over eth_da.nb_ports and probe each requested port, falling
back to a single probe when no ports are specified.
Fixes: d8e4e075ac ("net/sxe2: add probing skeleton")
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Jie Liu <[email protected]>
---
drivers/net/sxe2/sxe2_ethdev.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/net/sxe2/sxe2_ethdev.c b/drivers/net/sxe2/sxe2_ethdev.c
index 1dd10cd515..8e3afd6eed 100644
--- a/drivers/net/sxe2/sxe2_ethdev.c
+++ b/drivers/net/sxe2/sxe2_ethdev.c
@@ -2325,6 +2325,7 @@ static int32_t sxe2_eth_pmd_probe(struct
sxe2_common_device *cdev,
{
struct rte_eth_devargs eth_da = { .nb_ports = 0 };
int32_t ret = 0;
+ uint16_t port;
ret = sxe2_parse_eth_devargs(cdev->dev, ð_da);
if (ret != 0) {
@@ -2332,7 +2333,18 @@ static int32_t sxe2_eth_pmd_probe(struct
sxe2_common_device *cdev,
goto l_end;
}
- ret = sxe2_eth_pmd_probe_pf(cdev, ð_da, 0, kvargs);
+ if (eth_da.nb_ports > 0) {
+ for (port = 0; port < eth_da.nb_ports; port++) {
+ ret = sxe2_eth_pmd_probe_pf(cdev, ð_da, port,
kvargs);
+ if (ret != 0) {
+ PMD_LOG_ERR(INIT, "sxe2 eth pmd probe failed,
ret=%d", ret);
+ (void)sxe2_eth_pmd_remove(cdev);
+ goto l_end;
+ }
+ }
+ } else {
+ ret = sxe2_eth_pmd_probe_pf(cdev, ð_da, 0, kvargs);
+ }
l_end:
return ret;
--
2.52.0