From: Chengwen Feng <fengchengwen@huawei.com>
To: <thomas@monjalon.net>, <stephen@networkplumber.org>,
<aman.deep.singh@intel.com>
Cc: <dev@dpdk.org>
Subject: [PATCH 2/2] app/testpmd: fix segment fault when config DCB
Date: Thu, 20 Feb 2025 15:06:51 +0800 [thread overview]
Message-ID: <20250220070651.42123-3-fengchengwen@huawei.com> (raw)
In-Reply-To: <20250220070651.42123-1-fengchengwen@huawei.com>
The "port config dcb ..." command will segment fault when input with
invalid port id, this patch fixes it.
Fixes: 9b53e542e9e1 ("app/testpmd: add priority flow control")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
app/test-pmd/cmdline.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 86d763b66a..56031fbd4e 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -3462,6 +3462,9 @@ cmd_config_dcb_parsed(void *parsed_result,
uint8_t pfc_en;
int ret;
+ if (port_id_is_invalid(port_id, ENABLED_WARN))
+ return;
+
port = &ports[port_id];
/** Check if the port is not started **/
if (port->port_status != RTE_PORT_STOPPED) {
@@ -6664,6 +6667,9 @@ cmd_priority_flow_ctrl_set_parsed(void *parsed_result,
int rx_fc_enable, tx_fc_enable;
int ret;
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
/*
* Rx on/off, flow control is enabled/disabled on RX side. This can indicate
* the RTE_ETH_FC_TX_PAUSE, Transmit pause frame at the Rx side.
--
2.17.1
next prev parent reply other threads:[~2025-02-20 7:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-20 7:06 [PATCH 0/2] fix testpmd DCB command Chengwen Feng
2025-02-20 7:06 ` [PATCH 1/2] app/testpmd: support display DCB all priority's TC map Chengwen Feng
2025-02-20 7:06 ` Chengwen Feng [this message]
2025-02-20 20:54 ` [PATCH 0/2] fix testpmd DCB command Stephen Hemminger
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=20250220070651.42123-3-fengchengwen@huawei.com \
--to=fengchengwen@huawei.com \
--cc=aman.deep.singh@intel.com \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
/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).