* [dpdk-dev] [PATCH] app/testpmd: fix transmission from speed to str
@ 2020-10-09 3:45 Min Hu (Connor)
2020-10-09 11:05 ` Ferruh Yigit
0 siblings, 1 reply; 2+ messages in thread
From: Min Hu (Connor) @ 2020-10-09 3:45 UTC (permalink / raw)
To: dev; +Cc: konstantin.ananyev, thomas, arybchenko, ferruh.yigit, linuxarm
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-09 11:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-09 3:45 [dpdk-dev] [PATCH] app/testpmd: fix transmission from speed to str Min Hu (Connor)
2020-10-09 11:05 ` Ferruh Yigit
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).