Sync some patchs from upstreaming about a segment fault for testpmd app and a IMP reset trigger for hns3 pmd. Patchs are as follow: - ethdev: add API to check if queue is valid - app/testpmd: fix segment fault with invalid queue ID - net/hns3: fix IMP reset trigger (cherry picked from commit 06e0b2741afcd87d686d24608ecb3c974ea83f6d)
83 lines
2.6 KiB
Diff
83 lines
2.6 KiB
Diff
From 1c7616769fc09d9443cfd39816fa35b4b0ddd33d Mon Sep 17 00:00:00 2001
|
|
From: Dengdui Huang <huangdengdui@huawei.com>
|
|
Date: Mon, 5 Jun 2023 10:27:41 +0800
|
|
Subject: app/testpmd: fix segment fault with invalid queue ID
|
|
|
|
[ upstream commit 53191add2203e943c46af0b86002613f22b734b3 ]
|
|
|
|
When input queue ID is invalid, it will lead to
|
|
Segmentation fault, like:
|
|
|
|
dpdk-testpmd -a 0000:01:00.0 -- -i
|
|
testpmd> show port 0 txq/rxq 99 desc 0 status
|
|
Segmentation fault
|
|
|
|
dpdk-testpmd -a 0000:01:00.0 -- -i
|
|
testpmd> show port 0 rxq 99 desc used count
|
|
Segmentation fault
|
|
|
|
This patch fixes it.
|
|
|
|
Fixes: fae9aa717d6c ("app/testpmd: support checking descriptor status")
|
|
Fixes: 3f9acb5c83bb ("ethdev: avoid non-dataplane checks in Rx queue count")
|
|
Cc: stable@dpdk.org
|
|
|
|
Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
|
|
Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
|
|
---
|
|
app/test-pmd/cmdline.c | 23 ++++++++++++++++-------
|
|
1 file changed, 16 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
|
|
index 0d9c7d449c..bc770f3d56 100644
|
|
--- a/app/test-pmd/cmdline.c
|
|
+++ b/app/test-pmd/cmdline.c
|
|
@@ -17315,12 +17315,13 @@ cmd_show_rx_tx_desc_status_parsed(void *parsed_result,
|
|
struct cmd_show_rx_tx_desc_status_result *res = parsed_result;
|
|
int rc;
|
|
|
|
- if (!rte_eth_dev_is_valid_port(res->cmd_pid)) {
|
|
- fprintf(stderr, "invalid port id %u\n", res->cmd_pid);
|
|
- return;
|
|
- }
|
|
-
|
|
if (!strcmp(res->cmd_keyword, "rxq")) {
|
|
+ if (rte_eth_dev_is_valid_rxq(res->cmd_pid, res->cmd_qid) != 0) {
|
|
+ fprintf(stderr,
|
|
+ "Invalid input: port id = %d, queue id = %d\n",
|
|
+ res->cmd_pid, res->cmd_qid);
|
|
+ return;
|
|
+ }
|
|
rc = rte_eth_rx_descriptor_status(res->cmd_pid, res->cmd_qid,
|
|
res->cmd_did);
|
|
if (rc < 0) {
|
|
@@ -17336,6 +17337,12 @@ cmd_show_rx_tx_desc_status_parsed(void *parsed_result,
|
|
else
|
|
printf("Desc status = UNAVAILABLE\n");
|
|
} else if (!strcmp(res->cmd_keyword, "txq")) {
|
|
+ if (rte_eth_dev_is_valid_txq(res->cmd_pid, res->cmd_qid) != 0) {
|
|
+ fprintf(stderr,
|
|
+ "Invalid input: port id = %d, queue id = %d\n",
|
|
+ res->cmd_pid, res->cmd_qid);
|
|
+ return;
|
|
+ }
|
|
rc = rte_eth_tx_descriptor_status(res->cmd_pid, res->cmd_qid,
|
|
res->cmd_did);
|
|
if (rc < 0) {
|
|
@@ -17415,8 +17422,10 @@ cmd_show_rx_queue_desc_used_count_parsed(void *parsed_result,
|
|
struct cmd_show_rx_queue_desc_used_count_result *res = parsed_result;
|
|
int rc;
|
|
|
|
- if (!rte_eth_dev_is_valid_port(res->cmd_pid)) {
|
|
- fprintf(stderr, "invalid port id %u\n", res->cmd_pid);
|
|
+ if (rte_eth_dev_is_valid_rxq(res->cmd_pid, res->cmd_qid) != 0) {
|
|
+ fprintf(stderr,
|
|
+ "Invalid input: port id = %d, queue id = %d\n",
|
|
+ res->cmd_pid, res->cmd_qid);
|
|
return;
|
|
}
|
|
|
|
--
|
|
2.23.0
|
|
|