!403 [sync] PR-398: fix testpmd segment fault and hns3 IMP reset trigger
From: @openeuler-sync-bot Reviewed-by: @li-huisong Signed-off-by: @li-huisong
This commit is contained in:
commit
2dfba4c232
117
0311-ethdev-add-API-to-check-if-queue-is-valid.patch
Normal file
117
0311-ethdev-add-API-to-check-if-queue-is-valid.patch
Normal file
@ -0,0 +1,117 @@
|
||||
From 16b5ecbb2f93fa577a0f665b7e1aaf07c63525f1 Mon Sep 17 00:00:00 2001
|
||||
From: Dengdui Huang <huangdengdui@huawei.com>
|
||||
Date: Mon, 5 Jun 2023 10:27:40 +0800
|
||||
Subject: ethdev: add API to check if queue is valid
|
||||
|
||||
[ upstream commit dcf6ce9c2100c604fd0cf602841d290d8236b504 ]
|
||||
|
||||
The API rte_eth_dev_is_valid_rxq/txq which
|
||||
is used to check if Rx/Tx queue is valid.
|
||||
If the queue has been setup, it is considered valid.
|
||||
|
||||
Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
|
||||
Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
|
||||
---
|
||||
lib/ethdev/rte_ethdev.c | 22 ++++++++++++++++++++++
|
||||
lib/ethdev/rte_ethdev.h | 38 ++++++++++++++++++++++++++++++++++++++
|
||||
lib/ethdev/version.map | 2 ++
|
||||
3 files changed, 62 insertions(+)
|
||||
|
||||
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
|
||||
index 61731ec83e..1a25515148 100644
|
||||
--- a/lib/ethdev/rte_ethdev.c
|
||||
+++ b/lib/ethdev/rte_ethdev.c
|
||||
@@ -1009,6 +1009,28 @@ eth_dev_validate_tx_queue(const struct rte_eth_dev *dev, uint16_t tx_queue_id)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+int
|
||||
+rte_eth_dev_is_valid_rxq(uint16_t port_id, uint16_t queue_id)
|
||||
+{
|
||||
+ struct rte_eth_dev *dev;
|
||||
+
|
||||
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
|
||||
+ dev = &rte_eth_devices[port_id];
|
||||
+
|
||||
+ return eth_dev_validate_rx_queue(dev, queue_id);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+rte_eth_dev_is_valid_txq(uint16_t port_id, uint16_t queue_id)
|
||||
+{
|
||||
+ struct rte_eth_dev *dev;
|
||||
+
|
||||
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
|
||||
+ dev = &rte_eth_devices[port_id];
|
||||
+
|
||||
+ return eth_dev_validate_tx_queue(dev, queue_id);
|
||||
+}
|
||||
+
|
||||
int
|
||||
rte_eth_dev_rx_queue_start(uint16_t port_id, uint16_t rx_queue_id)
|
||||
{
|
||||
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
|
||||
index 2064d439c8..c555ecb840 100644
|
||||
--- a/lib/ethdev/rte_ethdev.h
|
||||
+++ b/lib/ethdev/rte_ethdev.h
|
||||
@@ -2692,6 +2692,44 @@ int rte_eth_dev_socket_id(uint16_t port_id);
|
||||
*/
|
||||
int rte_eth_dev_is_valid_port(uint16_t port_id);
|
||||
|
||||
+/**
|
||||
+ * @warning
|
||||
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
|
||||
+ *
|
||||
+ * Check if Rx queue is valid. If the queue has been setup,
|
||||
+ * it is considered valid.
|
||||
+ *
|
||||
+ * @param port_id
|
||||
+ * The port identifier of the Ethernet device.
|
||||
+ * @param queue_id
|
||||
+ * The index of the receive queue.
|
||||
+ * @return
|
||||
+ * - -ENODEV: if *port_id* is invalid.
|
||||
+ * - -EINVAL: if queue_id is out of range or queue is not been setup.
|
||||
+ * - 0 if Rx queue is valid.
|
||||
+ */
|
||||
+__rte_experimental
|
||||
+int rte_eth_dev_is_valid_rxq(uint16_t port_id, uint16_t queue_id);
|
||||
+
|
||||
+/**
|
||||
+ * @warning
|
||||
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
|
||||
+ *
|
||||
+ * Check if Tx queue is valid. If the queue has been setup,
|
||||
+ * it is considered valid.
|
||||
+ *
|
||||
+ * @param port_id
|
||||
+ * The port identifier of the Ethernet device.
|
||||
+ * @param queue_id
|
||||
+ * The index of the transmit queue.
|
||||
+ * @return
|
||||
+ * - -ENODEV: if *port_id* is invalid.
|
||||
+ * - -EINVAL: if queue_id is out of range or queue is not been setup.
|
||||
+ * - 0 if Tx queue is valid.
|
||||
+ */
|
||||
+__rte_experimental
|
||||
+int rte_eth_dev_is_valid_txq(uint16_t port_id, uint16_t queue_id);
|
||||
+
|
||||
/**
|
||||
* Start specified Rx queue of a port. It is used when rx_deferred_start
|
||||
* flag of the specified queue is true.
|
||||
diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
|
||||
index 590aa5a0a6..f593f64ea9 100644
|
||||
--- a/lib/ethdev/version.map
|
||||
+++ b/lib/ethdev/version.map
|
||||
@@ -263,6 +263,8 @@ EXPERIMENTAL {
|
||||
# added in 22.11
|
||||
rte_eth_rx_descriptor_dump;
|
||||
rte_eth_tx_descriptor_dump;
|
||||
+ rte_eth_dev_is_valid_rxq;
|
||||
+ rte_eth_dev_is_valid_txq;
|
||||
};
|
||||
|
||||
INTERNAL {
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -0,0 +1,82 @@
|
||||
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
|
||||
|
||||
66
0313-net-hns3-fix-IMP-reset-trigger.patch
Normal file
66
0313-net-hns3-fix-IMP-reset-trigger.patch
Normal file
@ -0,0 +1,66 @@
|
||||
From deb9dd8d00b81173425215f82ba9cb3e0db31e5c Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Tue, 6 Jun 2023 20:10:28 +0800
|
||||
Subject: net/hns3: fix IMP reset trigger
|
||||
|
||||
[ upstream commit bc49e0b4132a05cc012f5e2e7934fbec6589861c ]
|
||||
|
||||
Currently, driver sends the command with an unknown opcode to the
|
||||
firmware to trigger IMP reset when some hardware error happened.
|
||||
This unknown opcode cannot be parsed by the firmware.
|
||||
|
||||
So this patch fixes the way by writing register to do it.
|
||||
|
||||
Fixes: 2790c6464725 ("net/hns3: support device reset")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 16 ++++------------
|
||||
1 file changed, 4 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index 9af08a7748..6c3ae75c4d 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -44,6 +44,7 @@
|
||||
#define HNS3_VECTOR0_IMP_CMDQ_ERR_B 4U
|
||||
#define HNS3_VECTOR0_IMP_RD_POISON_B 5U
|
||||
#define HNS3_VECTOR0_ALL_MSIX_ERR_B 6U
|
||||
+#define HNS3_VECTOR0_TRIGGER_IMP_RESET_B 7U
|
||||
|
||||
#define HNS3_RESET_WAIT_MS 100
|
||||
#define HNS3_RESET_WAIT_CNT 200
|
||||
@@ -5575,17 +5576,6 @@ hns3_func_reset_cmd(struct hns3_hw *hw, int func_id)
|
||||
return hns3_cmd_send(hw, &desc, 1);
|
||||
}
|
||||
|
||||
-static int
|
||||
-hns3_imp_reset_cmd(struct hns3_hw *hw)
|
||||
-{
|
||||
- struct hns3_cmd_desc desc;
|
||||
-
|
||||
- hns3_cmd_setup_basic_desc(&desc, 0xFFFE, false);
|
||||
- desc.data[0] = 0xeedd;
|
||||
-
|
||||
- return hns3_cmd_send(hw, &desc, 1);
|
||||
-}
|
||||
-
|
||||
static void
|
||||
hns3_msix_process(struct hns3_adapter *hns, enum hns3_reset_level reset_level)
|
||||
{
|
||||
@@ -5603,7 +5593,9 @@ hns3_msix_process(struct hns3_adapter *hns, enum hns3_reset_level reset_level)
|
||||
|
||||
switch (reset_level) {
|
||||
case HNS3_IMP_RESET:
|
||||
- hns3_imp_reset_cmd(hw);
|
||||
+ val = hns3_read_dev(hw, HNS3_VECTOR0_OTER_EN_REG);
|
||||
+ hns3_set_bit(val, HNS3_VECTOR0_TRIGGER_IMP_RESET_B, 1);
|
||||
+ hns3_write_dev(hw, HNS3_VECTOR0_OTER_EN_REG, val);
|
||||
hns3_warn(hw, "IMP Reset requested time=%ld.%.6ld",
|
||||
tv.tv_sec, tv.tv_usec);
|
||||
break;
|
||||
--
|
||||
2.23.0
|
||||
|
||||
14
dpdk.spec
14
dpdk.spec
@ -1,6 +1,6 @@
|
||||
Name: dpdk
|
||||
Version: 21.11
|
||||
Release: 46
|
||||
Release: 47
|
||||
Packager: packaging@6wind.com
|
||||
URL: http://dpdk.org
|
||||
%global source_version 21.11
|
||||
@ -329,7 +329,9 @@ Patch9307: 0307-net-hns3-fix-uninitialized-variable.patch
|
||||
Patch9308: 0308-net-hns3-refactor-code.patch
|
||||
Patch9309: 0309-net-hns3-fix-inaccurate-log.patch
|
||||
Patch9310: 0310-net-hns3-fix-redundant-line-break-in-log.patch
|
||||
|
||||
Patch9311: 0311-ethdev-add-API-to-check-if-queue-is-valid.patch
|
||||
Patch9312: 0312-app-testpmd-fix-segment-fault-with-invalid-queue-ID.patch
|
||||
Patch9313: 0313-net-hns3-fix-IMP-reset-trigger.patch
|
||||
|
||||
Summary: Data Plane Development Kit core
|
||||
Group: System Environment/Libraries
|
||||
@ -474,6 +476,14 @@ strip -g $RPM_BUILD_ROOT/lib/modules/%{kern_devel_ver}/extra/dpdk/igb_uio.ko
|
||||
/usr/sbin/depmod
|
||||
|
||||
%changelog
|
||||
* Wed Jun 07 2023 chenjiji <chenjiji09@163.com> - 21.11-47
|
||||
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
|
||||
|
||||
* Mon Jun 05 2023 chenjiji <chenjiji09@163.com> - 21.11-46
|
||||
Sync some patchs from upstreaming for hns3 pmd and modifications
|
||||
are as follow:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user