app/testpmd: fix transmission from speed to str
PATCH 1/1 app/testpmd: fix transmission from speed to str
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) <[email protected]>
--- app/test-pmd/config.c | 47 ++++++----------------------------------------- 1 file changed, 6 insertions(+), 41 deletions(-)
app/test-pmd/config.c +6 -41
@@ -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" ); }
Signature · 1 line
2.7.4
Quoted 7 lines · Min Hu (Connor)
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) <[email protected]>
Squashed into relevant commit in next-net, thanks.