And patchs are as follows: - net/hns3: fix burst mode query with dummy function - net/hns3: add debug info for Rx/Tx dummy function - net/hns3: remove debug condition for Tx prepare - net/hns3: separate Tx prepare from getting Tx function - net/hns3: make getting Tx function static - net/hns3: extract common functions to set Rx/Tx
83 lines
2.4 KiB
Diff
83 lines
2.4 KiB
Diff
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
|
|
|