DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Min Hu (Connor)" <humin29@huawei.com>
To: <dev@dpdk.org>
Cc: <konstantin.ananyev@intel.com>, <thomas@monjalon.net>,
	<arybchenko@solarflare.com>, <ferruh.yigit@intel.com>,
	<linuxarm@huawei.com>
Subject: [dpdk-dev] [PATCH] app/testpmd: fix transmission from speed to str
Date: Fri, 9 Oct 2020 11:45:19 +0800	[thread overview]
Message-ID: <1602215119-64740-1-git-send-email-humin29@huawei.com> (raw)

This patch uses a new 'rte_eth_link_speed_to_str()' API in the
ethdev which enables removing above global 'eth_speed_name' array [1].

Fixes: 466c55e4d85b ("app/testpmd: add FEC command")

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 app/test-pmd/config.c | 47 ++++++-----------------------------------------
 1 file changed, 6 insertions(+), 41 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 7873426..8ccd989 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -161,36 +161,6 @@ static const struct {
 	},
 };
 
-static const struct {
-	uint32_t speed;
-	const char *name;
-} eth_speed_name[] = {
-	{
-		.speed = ETH_SPEED_NUM_10G,
-		.name = "Speed 10G",
-	},
-	{
-		.speed = ETH_SPEED_NUM_25G,
-		.name = "Speed 25G",
-	},
-	{
-		.speed = ETH_SPEED_NUM_40G,
-		.name = "Speed 40G",
-	},
-	{
-		.speed = ETH_SPEED_NUM_50G,
-		.name = "Speed 50G",
-	},
-	{
-		.speed = ETH_SPEED_NUM_100G,
-		.name = "Speed 100G",
-	},
-	{
-		.speed = ETH_SPEED_NUM_200G,
-		.name = "Speed 200G",
-	},
-};
-
 static void
 print_ethaddr(const char *name, struct rte_ether_addr *eth_addr)
 {
@@ -3260,23 +3230,18 @@ parse_fec_mode(const char *name, uint32_t *mode)
 void
 show_fec_capability(unsigned int num, struct rte_eth_fec_capa *speed_fec_capa)
 {
-	unsigned int i, j, k;
+	unsigned int i, j;
 
 	printf("FEC capabilities:\n");
 
 	for (i = 0; i < num; i++) {
-		for (j = 0; j < RTE_DIM(eth_speed_name); j++) {
-			if (eth_speed_name[j].speed ==
-						speed_fec_capa[i].speed) {
-				printf("%s : ", eth_speed_name[j].name);
-				break;
-			}
-		}
+		printf("%s : ",
+			rte_eth_link_speed_to_str(speed_fec_capa[i].speed));
 
-		for (k = RTE_ETH_FEC_AUTO; k < RTE_DIM(fec_mode_name); k++) {
-			if (RTE_ETH_FEC_MODE_TO_CAPA(k) &
+		for (j = RTE_ETH_FEC_AUTO; j < RTE_DIM(fec_mode_name); j++) {
+			if (RTE_ETH_FEC_MODE_TO_CAPA(j) &
 						speed_fec_capa[i].capa)
-				printf("%s ", fec_mode_name[k].name);
+				printf("%s ", fec_mode_name[j].name);
 		}
 		printf("\n");
 	}
-- 
2.7.4


             reply	other threads:[~2020-10-09  3:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-09  3:45 Min Hu (Connor) [this message]
2020-10-09 11:05 ` Ferruh Yigit

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=1602215119-64740-1-git-send-email-humin29@huawei.com \
    --to=humin29@huawei.com \
    --cc=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=linuxarm@huawei.com \
    --cc=thomas@monjalon.net \
    /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).