代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/dpdk 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 6a7c7c31b57bb4dadaf3750a3fc36e3ec0761f3f Mon Sep 17 00:00:00 2001
From: Huisong Li <lihuisong@huawei.com>
Date: Sat, 11 Feb 2023 17:18:25 +0800
Subject: net/hns3: fix burst mode query with dummy function
[ upstream commit 10f91af5a5b370df922f888826a4387abebe1cde ]
The rte_eth_rx/tx_burst_mode_get API will fail when Rx/Tx
function is dummy.
Fixes: 7ef933908f04 ("net/hns3: add simple Tx path")
Fixes: 521ab3e93361 ("net/hns3: add simple Rx path")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
drivers/net/hns3/hns3_rxtx.c | 38 ++++++++++++++++++++++--------------
1 file changed, 23 insertions(+), 15 deletions(-)
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index 9a597e032e..c69fb38402 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -2786,6 +2786,7 @@ hns3_rx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id,
{ hns3_recv_scattered_pkts, "Scalar Scattered" },
{ hns3_recv_pkts_vec, "Vector Neon" },
{ hns3_recv_pkts_vec_sve, "Vector Sve" },
+ { rte_eth_pkt_burst_dummy, "Dummy" },
};
eth_rx_burst_t pkt_burst = dev->rx_pkt_burst;
@@ -4272,24 +4273,31 @@ int
hns3_tx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id,
struct rte_eth_burst_mode *mode)
{
+ static const struct {
+ eth_tx_burst_t pkt_burst;
+ const char *info;
+ } burst_infos[] = {
+ { hns3_xmit_pkts_simple, "Scalar Simple" },
+ { hns3_xmit_pkts, "Scalar" },
+ { hns3_xmit_pkts_vec, "Vector Neon" },
+ { hns3_xmit_pkts_vec_sve, "Vector Sve" },
+ { rte_eth_pkt_burst_dummy, "Dummy" },
+ };
+
eth_tx_burst_t pkt_burst = dev->tx_pkt_burst;
- const char *info = NULL;
-
- if (pkt_burst == hns3_xmit_pkts_simple)
- info = "Scalar Simple";
- else if (pkt_burst == hns3_xmit_pkts)
- info = "Scalar";
- else if (pkt_burst == hns3_xmit_pkts_vec)
- info = "Vector Neon";
- else if (pkt_burst == hns3_xmit_pkts_vec_sve)
- info = "Vector Sve";
-
- if (info == NULL)
- return -EINVAL;
+ int ret = -EINVAL;
+ unsigned int i;
- snprintf(mode->info, sizeof(mode->info), "%s", info);
+ for (i = 0; i < RTE_DIM(burst_infos); i++) {
+ if (pkt_burst == burst_infos[i].pkt_burst) {
+ snprintf(mode->info, sizeof(mode->info), "%s",
+ burst_infos[i].info);
+ ret = 0;
+ break;
+ }
+ }
- return 0;
+ return ret;
}
static bool
--
2.23.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。