From: Huisong Li <lihuisong@huawei.com>
To: <dev@dpdk.org>
Cc: <stephen@networkplumber.org>, <songx.jiale@intel.com>,
<liuyonglong@huawei.com>, <lihuisong@huawei.com>
Subject: [PATCH] app/testpmd: fix fail to set queue number when attach device
Date: Tue, 18 Feb 2025 19:31:56 +0800 [thread overview]
Message-ID: <20250218113156.7174-1-lihuisong@huawei.com> (raw)
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
next reply other threads:[~2025-02-18 11:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-18 11:31 Huisong Li [this message]
2025-02-20 20:56 ` Stephen Hemminger
2025-02-21 1:16 ` lihuisong (C)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250218113156.7174-1-lihuisong@huawei.com \
--to=lihuisong@huawei.com \
--cc=dev@dpdk.org \
--cc=liuyonglong@huawei.com \
--cc=songx.jiale@intel.com \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).