net/mlx5: fix port id action domain check

Message ID 1570456563-4951-1-git-send-email-viacheslavo@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: fix port id action domain check |

Checks

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

Commit Message

Slava Ovsiienko Oct. 7, 2019, 1:56 p.m. UTC
  The validating routines flow_dv_validate_action_port_id() and
flow_dv_validate_item_port_id() could return the positive or
ever zero value in case of domains mismatch and the validation
routine missed the rules for ports belonging to different
switching domains.

Fixes: 812909392b52 ("net/mlx5: elaborate E-Switch port parameters query")

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
  

Comments

Raslan Darawsheh Oct. 8, 2019, 9:34 a.m. UTC | #1
Hi,

> -----Original Message-----
> From: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
> Sent: Monday, October 7, 2019 4:56 PM
> To: dev@dpdk.org
> Cc: Matan Azrad <matan@mellanox.com>; Raslan Darawsheh
> <rasland@mellanox.com>
> Subject: [PATCH] net/mlx5: fix port id action domain check
> 
> The validating routines flow_dv_validate_action_port_id() and
> flow_dv_validate_item_port_id() could return the positive or ever zero
> value in case of domains mismatch and the validation routine missed the
> rules for ports belonging to different switching domains.
> 
> Fixes: 812909392b52 ("net/mlx5: elaborate E-Switch port parameters query")
> 
> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>


Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh
  
Ferruh Yigit Oct. 8, 2019, 11:02 a.m. UTC | #2
On 10/8/2019 10:34 AM, Raslan Darawsheh wrote:
> Hi,
> 
>> -----Original Message-----
>> From: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
>> Sent: Monday, October 7, 2019 4:56 PM
>> To: dev@dpdk.org
>> Cc: Matan Azrad <matan@mellanox.com>; Raslan Darawsheh
>> <rasland@mellanox.com>
>> Subject: [PATCH] net/mlx5: fix port id action domain check
>>
>> The validating routines flow_dv_validate_action_port_id() and
>> flow_dv_validate_item_port_id() could return the positive or ever zero
>> value in case of domains mismatch and the validation routine missed the
>> rules for ports belonging to different switching domains.
>>
>> Fixes: 812909392b52 ("net/mlx5: elaborate E-Switch port parameters query")
>>
>> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
> 
> 
> Patch applied to next-net-mlx,

Squashed into relevant commit in next-net, thanks.
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 2a7e3ed..20e66f6 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -847,18 +847,18 @@  struct field_modify_info modify_tcp[] = {
 		return 0;
 	esw_priv = mlx5_port_to_eswitch_info(spec->id);
 	if (!esw_priv)
-		return rte_flow_error_set(error, -rte_errno,
+		return rte_flow_error_set(error, rte_errno,
 					  RTE_FLOW_ERROR_TYPE_ITEM_SPEC, spec,
 					  "failed to obtain E-Switch info for"
 					  " port");
 	dev_priv = mlx5_dev_to_eswitch_info(dev);
 	if (!dev_priv)
-		return rte_flow_error_set(error, -rte_errno,
+		return rte_flow_error_set(error, rte_errno,
 					  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
 					  NULL,
 					  "failed to obtain E-Switch info");
 	if (esw_priv->domain_id != dev_priv->domain_id)
-		return rte_flow_error_set(error, -ret,
+		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ITEM_SPEC, spec,
 					  "cannot match on a port from a"
 					  " different E-Switch");
@@ -2462,7 +2462,7 @@  struct field_modify_info modify_tcp[] = {
 					  " a flow");
 	dev_priv = mlx5_dev_to_eswitch_info(dev);
 	if (!dev_priv)
-		return rte_flow_error_set(error, -rte_errno,
+		return rte_flow_error_set(error, rte_errno,
 					  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
 					  NULL,
 					  "failed to obtain E-Switch info");
@@ -2471,12 +2471,12 @@  struct field_modify_info modify_tcp[] = {
 	act_priv = mlx5_port_to_eswitch_info(port);
 	if (!act_priv)
 		return rte_flow_error_set
-				(error, -rte_errno,
+				(error, rte_errno,
 				 RTE_FLOW_ERROR_TYPE_ACTION_CONF, port_id,
 				 "failed to obtain E-Switch port id for port");
 	if (act_priv->domain_id != dev_priv->domain_id)
 		return rte_flow_error_set
-				(error, -rte_errno,
+				(error, EINVAL,
 				 RTE_FLOW_ERROR_TYPE_ACTION, NULL,
 				 "port does not belong to"
 				 " E-Switch being configured");