Skip to content

Commit

Permalink
app/testpmd: fix type of FEC mode parsing output
Browse files Browse the repository at this point in the history
[ upstream commit ce0a4a1 ]

Passing an uint32_t pointer to an enum pointer parameter causes
pointer-sign warning on Windows (converts between pointers to
integer types with different sign), since enum is implicitly
converted to int on Windows.

And the current enum pointer parameter of that function is actually
misleading and should be fixed as an uint32_t pointer parameter.

Fixes: b19da32 ("app/testpmd: add FEC command")

Signed-off-by: Jie Zhou <jizh@linux.microsoft.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
  • Loading branch information
Jie Zhou authored and bluca committed Jul 12, 2021
1 parent f4a79bb commit ca95cf7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app/test-pmd/cmdline.c
Expand Up @@ -16449,17 +16449,17 @@ cmd_set_port_fec_mode_parsed(
{
struct cmd_set_port_fec_mode *res = parsed_result;
uint16_t port_id = res->port_id;
uint32_t mode;
uint32_t fec_capa;
int ret;

ret = parse_fec_mode(res->fec_value, &mode);
ret = parse_fec_mode(res->fec_value, &fec_capa);
if (ret < 0) {
printf("Unknown fec mode: %s for Port %d\n", res->fec_value,
port_id);
return;
}

ret = rte_eth_fec_set(port_id, mode);
ret = rte_eth_fec_set(port_id, fec_capa);
if (ret == -ENOTSUP) {
printf("Function not implemented\n");
return;
Expand Down
5 changes: 3 additions & 2 deletions app/test-pmd/config.c
Expand Up @@ -3760,13 +3760,14 @@ set_tx_pkt_split(const char *name)
}

int
parse_fec_mode(const char *name, uint32_t *mode)
parse_fec_mode(const char *name, uint32_t *fec_capa)
{
uint8_t i;

for (i = 0; i < RTE_DIM(fec_mode_name); i++) {
if (strcmp(fec_mode_name[i].name, name) == 0) {
*mode = RTE_ETH_FEC_MODE_TO_CAPA(fec_mode_name[i].mode);
*fec_capa =
RTE_ETH_FEC_MODE_TO_CAPA(fec_mode_name[i].mode);
return 0;
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/test-pmd/testpmd.h
Expand Up @@ -878,7 +878,7 @@ void show_tx_pkt_segments(void);
void set_tx_pkt_times(unsigned int *tx_times);
void show_tx_pkt_times(void);
void set_tx_pkt_split(const char *name);
int parse_fec_mode(const char *name, enum rte_eth_fec_mode *mode);
int parse_fec_mode(const char *name, uint32_t *fec_capa);
void show_fec_capability(uint32_t num, struct rte_eth_fec_capa *speed_fec_capa);
void set_nb_pkt_per_burst(uint16_t pkt_burst);
char *list_pkt_forwarding_modes(void);
Expand Down

0 comments on commit ca95cf7

Please sign in to comment.