* [PATCH] app/testpmd: fix fail to set queue number when attach device
@ 2025-02-18 11:31 Huisong Li
0 siblings, 0 replies; only message in thread
From: Huisong Li @ 2025-02-18 11:31 UTC (permalink / raw)
To: dev; +Cc: stephen, songx.jiale, liuyonglong, lihuisong
Testpmd doesn't modify the Rx/Tx queue number of all ports after attach a
new device. The root cause is that "port config all rxq <value>" would
check if all ports are stopped and the status of this port is still in
'RTE_PORT_HANDLING'. This status is changed to 'RTE_PORT_STOPPED' in
setup_attached_port() when start port.
In addition, this new port needs to be initialized in advance because these
information are depanded on many commands. Otherwise other commands like
"port config xxx" may also encounter similar issue. But the initialization
can't be in new event callback as discussed in following commit. So this
patch moves setup_attached_port() to the time point 100ms after received
the new event.
Bugzilla ID: 1663
Fixes: 994635edb2c0 ("app/testpmd: add port attach/detach for multiple process")
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
app/test-pmd/testpmd.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 19e2e37c11..b0ee39db52 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -705,7 +705,7 @@ eth_dev_set_mtu_mp(uint16_t port_id, uint16_t mtu)
}
/* Forward function declarations */
-static void setup_attached_port(portid_t pi);
+static void setup_attached_port(void *arg);
static void check_all_ports_link_status(uint32_t port_mask);
static int eth_event_callback(portid_t port_id,
enum rte_eth_event_type type,
@@ -2906,8 +2906,6 @@ start_port(portid_t pid)
at_least_one_port_exist = true;
port = &ports[pi];
- if (port->need_setup)
- setup_attached_port(pi);
if (port->port_status == RTE_PORT_STOPPED) {
port->port_status = RTE_PORT_HANDLING;
@@ -3441,7 +3439,7 @@ attach_port(char *identifier)
/* setup ports matching the devargs used for probing */
if (port_is_forwarding(pi))
continue; /* port was already attached before */
- setup_attached_port(pi);
+ setup_attached_port((void *)(intptr_t)pi);
}
out:
printf("Port %s is attached.\n", identifier);
@@ -3449,8 +3447,9 @@ attach_port(char *identifier)
}
static void
-setup_attached_port(portid_t pi)
+setup_attached_port(void *arg)
{
+ portid_t pi = (intptr_t)arg;
unsigned int socket_id;
int ret;
@@ -3786,6 +3785,10 @@ eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,
ports[port_id].need_setup = 1;
ports[port_id].port_status = RTE_PORT_HANDLING;
}
+ /* Can't initialize port directly in new event. */
+ if (rte_eal_alarm_set(100000, setup_attached_port,
+ (void *)(intptr_t)port_id))
+ fprintf(stderr, "Could not set up deferred task to setup this attached port.\n");
break;
case RTE_ETH_EVENT_INTR_RMV:
if (port_id_is_invalid(port_id, DISABLED_WARN))
--
2.22.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-02-18 11:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-18 11:31 [PATCH] app/testpmd: fix fail to set queue number when attach device Huisong Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).