app/testpmd: fix wrong return value

Message ID 20190929032209.23407-1-qi.z.zhang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series app/testpmd: fix wrong return value |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-dpdk_compile success Compile Testing PASS
ci/iol-dpdk_compile_ovs success Compile Testing PASS
ci/iol-dpdk_compile_spdk success Compile Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Qi Zhang Sept. 29, 2019, 3:22 a.m. UTC
  The patch fix the issue that return value in parse_vc_action_rss
be overwritten unexpectly. That cause an rte_flow creation command
with rss action does not work.

For example:

testpmd> flow create 0 ingress pattern eth / ipv4 / end \
actions rss types ipv4 end / end

We will get error "Bad Agument"

Fixes: f5267e485a2a ("app/testpmd: check status of getting ethdev info")

Reported-by: Simei Su <simei.su@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 app/test-pmd/cmdline_flow.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
  

Comments

Xiaolong Ye Sept. 30, 2019, 8:23 a.m. UTC | #1
On 09/29, Qi Zhang wrote:
>The patch fix the issue that return value in parse_vc_action_rss
>be overwritten unexpectly. That cause an rte_flow creation command
>with rss action does not work.
>
>For example:
>
>testpmd> flow create 0 ingress pattern eth / ipv4 / end \
>actions rss types ipv4 end / end
>
>We will get error "Bad Agument"
>
>Fixes: f5267e485a2a ("app/testpmd: check status of getting ethdev info")
>
>Reported-by: Simei Su <simei.su@intel.com>
>Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
>---
> app/test-pmd/cmdline_flow.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
>diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
>index 369426cbd..932bdb98e 100644
>--- a/app/test-pmd/cmdline_flow.c
>+++ b/app/test-pmd/cmdline_flow.c
>@@ -3549,10 +3549,11 @@ parse_vc_action_rss(struct context *ctx, const struct token *token,
> 	if (!port_id_is_invalid(ctx->port, DISABLED_WARN) &&
> 	    ctx->port != (portid_t)RTE_PORT_ALL) {
> 		struct rte_eth_dev_info info;
>+		int ret2;
> 
>-		ret = rte_eth_dev_info_get(ctx->port, &info);
>-		if (ret != 0)
>-			return ret;
>+		ret2 = rte_eth_dev_info_get(ctx->port, &info);
>+		if (ret2 != 0)
>+			return ret2;
> 
> 		action_rss_data->conf.key_len =
> 			RTE_MIN(sizeof(action_rss_data->key),
>-- 
>2.13.6
>

Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
  
Ferruh Yigit Sept. 30, 2019, 2:48 p.m. UTC | #2
On 9/30/2019 9:23 AM, Ye Xiaolong wrote:
> On 09/29, Qi Zhang wrote:
>> The patch fix the issue that return value in parse_vc_action_rss
>> be overwritten unexpectly. That cause an rte_flow creation command
>> with rss action does not work.
>>
>> For example:
>>
>> testpmd> flow create 0 ingress pattern eth / ipv4 / end \
>> actions rss types ipv4 end / end
>>
>> We will get error "Bad Agument"
>>
>> Fixes: f5267e485a2a ("app/testpmd: check status of getting ethdev info")
>>
>> Reported-by: Simei Su <simei.su@intel.com>
>> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
>> ---
>> app/test-pmd/cmdline_flow.c | 7 ++++---
>> 1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
>> index 369426cbd..932bdb98e 100644
>> --- a/app/test-pmd/cmdline_flow.c
>> +++ b/app/test-pmd/cmdline_flow.c
>> @@ -3549,10 +3549,11 @@ parse_vc_action_rss(struct context *ctx, const struct token *token,
>> 	if (!port_id_is_invalid(ctx->port, DISABLED_WARN) &&
>> 	    ctx->port != (portid_t)RTE_PORT_ALL) {
>> 		struct rte_eth_dev_info info;
>> +		int ret2;
>>
>> -		ret = rte_eth_dev_info_get(ctx->port, &info);
>> -		if (ret != 0)
>> -			return ret;
>> +		ret2 = rte_eth_dev_info_get(ctx->port, &info);
>> +		if (ret2 != 0)
>> +			return ret2;
>>
>> 		action_rss_data->conf.key_len =
>> 			RTE_MIN(sizeof(action_rss_data->key),
>> -- 
>> 2.13.6
>>
> 
> Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
> 

Squashed into relevant commit in next-net, thanks.
  

Patch

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 369426cbd..932bdb98e 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -3549,10 +3549,11 @@  parse_vc_action_rss(struct context *ctx, const struct token *token,
 	if (!port_id_is_invalid(ctx->port, DISABLED_WARN) &&
 	    ctx->port != (portid_t)RTE_PORT_ALL) {
 		struct rte_eth_dev_info info;
+		int ret2;
 
-		ret = rte_eth_dev_info_get(ctx->port, &info);
-		if (ret != 0)
-			return ret;
+		ret2 = rte_eth_dev_info_get(ctx->port, &info);
+		if (ret2 != 0)
+			return ret2;
 
 		action_rss_data->conf.key_len =
 			RTE_MIN(sizeof(action_rss_data->key),