diff mbox series

[v14,6/9] app/testpmd: fix parse_fec_mode return type name

Message ID 1624487698-31136-7-git-send-email-jizh@linux.microsoft.com (mailing list archive)
State Superseded, archived
Delegated to: Andrew Rybchenko
Headers show
Series app/testpmd: enable testpmd on Windows | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Jie Zhou June 23, 2021, 10:34 p.m. UTC
Replace parse_fec_mode misleading return type name mode with fec_capa

Fixes: b19da32e3151 ("app/testpmd: add FEC command")
Cc: stable@dpdk.org

Signed-off-by: Jie Zhou <jizh@microsoft.com>
Signed-off-by: Jie Zhou <jizh@linux.microsoft.com>
---
 app/test-pmd/cmdline.c | 6 +++---
 app/test-pmd/config.c  | 4 ++--
 app/test-pmd/testpmd.h | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

Comments

Andrew Rybchenko June 28, 2021, 10:55 a.m. UTC | #1
On 6/24/21 1:34 AM, Jie Zhou wrote:
> Replace parse_fec_mode misleading return type name mode with fec_capa
> 
> Fixes: b19da32e3151 ("app/testpmd: add FEC command")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Jie Zhou <jizh@microsoft.com>
> Signed-off-by: Jie Zhou <jizh@linux.microsoft.com>

[snip]

> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
> index 283b5e3680..9ae4d90dd1 100644
> --- a/app/test-pmd/testpmd.h
> +++ b/app/test-pmd/testpmd.h
> @@ -885,7 +885,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);

I guess that the real reason behind is to fix implicit
conversion of enum pointer to/from uint32_t pointer.
I guess the problem is different signness of enum on
Windows compiler.

If so, please, put real motivation of the changeset in summary.
It should be human-readable (and do not contain function name).
Explain details in the description.

Yes, I agree that mode is misleading here and should be mentioned
in the description, but I guess it is not the root cause.
May be I'm wrong.
Tyler Retzlaff June 28, 2021, 2:29 p.m. UTC | #2
On Mon, Jun 28, 2021 at 01:55:02PM +0300, Andrew Rybchenko wrote:
> On 6/24/21 1:34 AM, Jie Zhou wrote:
> >Replace parse_fec_mode misleading return type name mode with fec_capa
> >
> >Fixes: b19da32e3151 ("app/testpmd: add FEC command")
> >Cc: stable@dpdk.org
> >
> >Signed-off-by: Jie Zhou <jizh@microsoft.com>
> >Signed-off-by: Jie Zhou <jizh@linux.microsoft.com>
> 
> [snip]
> 
> >diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
> >index 283b5e3680..9ae4d90dd1 100644
> >--- a/app/test-pmd/testpmd.h
> >+++ b/app/test-pmd/testpmd.h
> >@@ -885,7 +885,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);
> 
> I guess that the real reason behind is to fix implicit
> conversion of enum pointer to/from uint32_t pointer.
> I guess the problem is different signness of enum on
> Windows compiler.

yes, compilers targeting targets will select `int' once all constants of
the enumeration list are defined.

> 
> If so, please, put real motivation of the changeset in summary.
> It should be human-readable (and do not contain function name).
> Explain details in the description.
> 
> Yes, I agree that mode is misleading here and should be mentioned
> in the description, but I guess it is not the root cause.
> May be I'm wrong.
Jie Zhou June 29, 2021, 6:34 p.m. UTC | #3
On Mon, Jun 28, 2021 at 07:29:11AM -0700, Tyler Retzlaff wrote:
> On Mon, Jun 28, 2021 at 01:55:02PM +0300, Andrew Rybchenko wrote:
> > On 6/24/21 1:34 AM, Jie Zhou wrote:
> > >Replace parse_fec_mode misleading return type name mode with fec_capa
> > >
> > >Fixes: b19da32e3151 ("app/testpmd: add FEC command")
> > >Cc: stable@dpdk.org
> > >
> > >Signed-off-by: Jie Zhou <jizh@microsoft.com>
> > >Signed-off-by: Jie Zhou <jizh@linux.microsoft.com>
> > 
> > [snip]
> > 
> > >diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
> > >index 283b5e3680..9ae4d90dd1 100644
> > >--- a/app/test-pmd/testpmd.h
> > >+++ b/app/test-pmd/testpmd.h
> > >@@ -885,7 +885,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);
> > 
> > I guess that the real reason behind is to fix implicit
> > conversion of enum pointer to/from uint32_t pointer.
> > I guess the problem is different signness of enum on
> > Windows compiler.
> 
> yes, compilers targeting targets will select `int' once all constants of
> the enumeration list are defined.
> 
> > 
> > If so, please, put real motivation of the changeset in summary.
> > It should be human-readable (and do not contain function name).
> > Explain details in the description.
> > 
> > Yes, I agree that mode is misleading here and should be mentioned
> > in the description, but I guess it is not the root cause.
> > May be I'm wrong.

Your understanding on the root cause is corret. Will fix the description in V15. Thanks.
diff mbox series

Patch

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0268b18f95..dff5a75ec5 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -16997,17 +16997,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;
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 43c79b5021..79526796e9 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -3617,13 +3617,13 @@  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;
 		}
 	}
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 283b5e3680..9ae4d90dd1 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -885,7 +885,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);