patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Huisong Li <lihuisong@huawei.com>
To: <stable@dpdk.org>, <ktraynor@redhat.com>
Cc: <liudongdong3@huawei.com>, <huangdaode@huawei.com>,
	<liuyonglong@huawei.com>, <lihuisong@huawei.com>
Subject: [PATCH 21.11 04/17] net/hns3: fix burst mode query with dummy function
Date: Tue, 21 Mar 2023 17:22:53 +0800	[thread overview]
Message-ID: <20230321092306.16918-5-lihuisong@huawei.com> (raw)
In-Reply-To: <20230321092306.16918-1-lihuisong@huawei.com>

[ 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")

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 f596d435b6..305d8f3744 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -2797,6 +2797,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"    },
+		{ hns3_dummy_rxtx_burst,	"Dummy"         },
 	};
 
 	eth_rx_burst_t pkt_burst = dev->rx_pkt_burst;
@@ -4283,24 +4284,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"    },
+		{ hns3_dummy_rxtx_burst,	"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.22.0


  parent reply	other threads:[~2023-03-21  9:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21  9:22 [PATCH 21.11 00/17] backport some patches for hns3 Huisong Li
2023-03-21  9:22 ` [PATCH 21.11 01/17] net/hns3: separate Tx prepare from getting Tx function Huisong Li
2023-03-21  9:22 ` [PATCH 21.11 02/17] net/hns3: make getting Tx function static Huisong Li
2023-03-21  9:22 ` [PATCH 21.11 03/17] net/hns3: fix RSS key size compatibility Huisong Li
2023-03-21  9:22 ` Huisong Li [this message]
2023-03-21  9:22 ` [PATCH 21.11 05/17] net/hns3: extract common functions to set Rx/Tx Huisong Li
2023-03-21  9:22 ` [PATCH 21.11 06/17] net/hns3: use hardware config to report hash key Huisong Li
2023-03-21  9:22 ` [PATCH 21.11 07/17] net/hns3: use hardware config to report hash types Huisong Li
2023-03-21  9:22 ` [PATCH 21.11 08/17] net/hns3: separate setting hash algorithm Huisong Li
2023-03-21  9:22 ` [PATCH 21.11 09/17] net/hns3: separate setting hash key Huisong Li
2023-03-21  9:22 ` [PATCH 21.11 10/17] net/hns3: separate setting RSS types Huisong Li
2023-03-21  9:23 ` [PATCH 21.11 11/17] net/hns3: use new RSS rule to configure hardware Huisong Li
2023-03-21  9:23 ` [PATCH 21.11 12/17] net/hns3: save hash algo to RSS filter list node Huisong Li
2023-03-21  9:23 ` [PATCH 21.11 13/17] net/hns3: remove unused structures Huisong Li
2023-03-21  9:23 ` [PATCH 21.11 14/17] net/hns3: allow adding queue buffer size hash rule Huisong Li
2023-03-21  9:23 ` [PATCH 21.11 15/17] net/hns3: separate flow RSS config from RSS conf Huisong Li
2023-03-21  9:23 ` [PATCH 21.11 16/17] net/hns3: reimplement hash flow function Huisong Li
2023-03-21  9:23 ` [PATCH 21.11 17/17] net/hns3: add verification of RSS types Huisong Li
2023-03-21 16:21 ` [PATCH 21.11 00/17] backport some patches for hns3 Kevin Traynor

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=20230321092306.16918-5-lihuisong@huawei.com \
    --to=lihuisong@huawei.com \
    --cc=huangdaode@huawei.com \
    --cc=ktraynor@redhat.com \
    --cc=liudongdong3@huawei.com \
    --cc=liuyonglong@huawei.com \
    --cc=stable@dpdk.org \
    /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).