DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shachar Beiser <shacharbe@mellanox.com>
To: dev@dpdk.org
Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>,
	Nelio Laranjeiro <nelio.laranjeiro@6wind.com>,
	Shachar Beiser <shacharbe@mellanox.com>
Subject: [dpdk-dev] [PATCH v2] net/mlx5: fix drop action seg fault
Date: Sun, 25 Jun 2017 07:42:38 +0000	[thread overview]
Message-ID: <09f627ea8059ff7fd490ea1120e5c68137fa4944.1498376152.git.shacharbe@mellanox.com> (raw)
In-Reply-To: <cover.1498376152.git.shacharbe@mellanox.com>
In-Reply-To: <cover.1498376152.git.shacharbe@mellanox.com>

Missing room in flow allocation to store the drop specification.
Changing flow without storing the change in rte_flow.
Fixes: 88c77dedfbb0 ("net/mlx5: implement drop action in hardware classifier")

Signed-off-by: Shachar Beiser <shacharbe@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 12893c6..86be929 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -580,6 +580,10 @@ struct mlx5_flow_action {
 	}
 	if (action->mark && !flow->ibv_attr && !action->drop)
 		flow->offset += sizeof(struct ibv_exp_flow_spec_action_tag);
+#ifdef HAVE_VERBS_IBV_EXP_FLOW_SPEC_ACTION_DROP
+	if (!flow->ibv_attr && action->drop)
+		flow->offset += sizeof(struct ibv_exp_flow_spec_action_drop);
+#endif
 	if (!action->queue && !action->drop) {
 		rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE,
 				   NULL, "no valid action");
@@ -1011,9 +1015,6 @@ struct mlx5_flow_action {
 		return NULL;
 	}
 	rte_flow->drop = 1;
-	rte_flow->ibv_attr = flow->ibv_attr;
-	if (!priv->started)
-		return rte_flow;
 #ifdef HAVE_VERBS_IBV_EXP_FLOW_SPEC_ACTION_DROP
 	drop = (void *)((uintptr_t)flow->ibv_attr + flow->offset);
 	*drop = (struct ibv_exp_flow_spec_action_drop){
@@ -1023,6 +1024,9 @@ struct mlx5_flow_action {
 	++flow->ibv_attr->num_of_specs;
 	flow->offset += sizeof(struct ibv_exp_flow_spec_action_drop);
 #endif
+	rte_flow->ibv_attr = flow->ibv_attr;
+	if (!priv->started)
+		return rte_flow;
 	rte_flow->qp = priv->flow_drop_queue->qp;
 	rte_flow->ibv_flow = ibv_exp_create_flow(rte_flow->qp,
 						 rte_flow->ibv_attr);
-- 
1.8.3.1

WARNING: multiple messages have this Message-ID
From: Shachar Beiser <shacharbe@mellanox.com>
To: dev@dpdk.org
Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>,
	Nelio Laranjeiro <nelio.laranjeiro@6wind.com>,
	Shachar Beiser <shacharbe@mellanox.com>
Subject: [dpdk-dev] [PATCH v2] net/mlx5: fix drop action seg fault
Date: Sun, 25 Jun 2017 07:46:38 +0000	[thread overview]
Message-ID: <09f627ea8059ff7fd490ea1120e5c68137fa4944.1498376152.git.shacharbe@mellanox.com> (raw)
Message-ID: <20170625074638.Y8gxc-CyMkT2J0WWMUiuPX6IdO8GB4kJg3Jik_qZY_k@z> (raw)
In-Reply-To: <cover.1498376152.git.shacharbe@mellanox.com>
In-Reply-To: <cover.1498376152.git.shacharbe@mellanox.com>

Missing room in flow allocation to store the drop specification.
Changing flow without storing the change in rte_flow.
Fixes: 88c77dedfbb0 ("net/mlx5: implement drop action in hardware classifier")

Signed-off-by: Shachar Beiser <shacharbe@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 12893c6..86be929 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -580,6 +580,10 @@ struct mlx5_flow_action {
 	}
 	if (action->mark && !flow->ibv_attr && !action->drop)
 		flow->offset += sizeof(struct ibv_exp_flow_spec_action_tag);
+#ifdef HAVE_VERBS_IBV_EXP_FLOW_SPEC_ACTION_DROP
+	if (!flow->ibv_attr && action->drop)
+		flow->offset += sizeof(struct ibv_exp_flow_spec_action_drop);
+#endif
 	if (!action->queue && !action->drop) {
 		rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE,
 				   NULL, "no valid action");
@@ -1011,9 +1015,6 @@ struct mlx5_flow_action {
 		return NULL;
 	}
 	rte_flow->drop = 1;
-	rte_flow->ibv_attr = flow->ibv_attr;
-	if (!priv->started)
-		return rte_flow;
 #ifdef HAVE_VERBS_IBV_EXP_FLOW_SPEC_ACTION_DROP
 	drop = (void *)((uintptr_t)flow->ibv_attr + flow->offset);
 	*drop = (struct ibv_exp_flow_spec_action_drop){
@@ -1023,6 +1024,9 @@ struct mlx5_flow_action {
 	++flow->ibv_attr->num_of_specs;
 	flow->offset += sizeof(struct ibv_exp_flow_spec_action_drop);
 #endif
+	rte_flow->ibv_attr = flow->ibv_attr;
+	if (!priv->started)
+		return rte_flow;
 	rte_flow->qp = priv->flow_drop_queue->qp;
 	rte_flow->ibv_flow = ibv_exp_create_flow(rte_flow->qp,
 						 rte_flow->ibv_attr);
-- 
1.8.3.1

  reply	other threads:[~2017-06-25  7:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21 11:55 [dpdk-dev] [PATCH] " Shachar Beiser
2017-06-21 13:02 ` Nélio Laranjeiro
2017-06-22  9:51   ` Ferruh Yigit
2017-06-22 11:11 ` Ferruh Yigit
2017-06-25  7:42 ` [dpdk-dev] [PATCH v2] fix drop action seg fault missing compilation flag Shachar Beiser
2017-06-25  7:42   ` Shachar Beiser [this message]
2017-06-25  7:46     ` [dpdk-dev] [PATCH v2] net/mlx5: fix drop action seg fault Shachar Beiser
2017-06-25  7:46   ` [dpdk-dev] [PATCH v2] fix drop action seg fault missing compilation flag Shachar Beiser
2017-06-25  7:53 ` [dpdk-dev] [PATCH v2] Adding compilation flag for fix drop action seg fault Shachar Beiser
2017-06-25  7:55   ` Shachar Beiser
2017-06-25  7:53 ` [dpdk-dev] [PATCH v2] net/mlx5: " Shachar Beiser
2017-06-25  7:55   ` Shachar Beiser
2017-06-26 12:28   ` Nélio Laranjeiro
2017-06-26 12:55     ` Ferruh Yigit
2017-06-26 13:41       ` Nélio Laranjeiro
2017-06-26 13:51         ` Ferruh Yigit
2017-06-26 14:12     ` 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=09f627ea8059ff7fd490ea1120e5c68137fa4944.1498376152.git.shacharbe@mellanox.com \
    --to=shacharbe@mellanox.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=nelio.laranjeiro@6wind.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).