DPDK patches and discussions
 help / color / mirror / Atom feed
From: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
To: dev@dpdk.org
Cc: matan@mellanox.com, rasland@mellanox.com
Subject: [dpdk-dev] [PATCH] net/mlx5: fix port id action domain check
Date: Mon,  7 Oct 2019 13:56:03 +0000	[thread overview]
Message-ID: <1570456563-4951-1-git-send-email-viacheslavo@mellanox.com> (raw)

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(-)

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");
-- 
1.8.3.1


             reply	other threads:[~2019-10-07 13:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-07 13:56 Viacheslav Ovsiienko [this message]
2019-10-08  9:34 ` Raslan Darawsheh
2019-10-08 11:02   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1570456563-4951-1-git-send-email-viacheslavo@mellanox.com \
    --to=viacheslavo@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=matan@mellanox.com \
    --cc=rasland@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).