Skip to contentSkip to conversation

net/mlx5: fix drop action seg fault

PATCH Superseded Shachar Beiser 3 participants 13 messages Jun 21, 2017 – Jun 26, 2017 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: fix drop action seg fault

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")
---
 drivers/net/mlx5/mlx5_flow.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/mlx5/mlx5_flow.c +5 -3
index 12893c6..cad3d16 100644
@@ -580,6 +580,8 @@ struct mlx5_flow_action {
 	}
 	if (action->mark && !flow->ibv_attr && !action->drop)
 		flow->offset += sizeof(struct ibv_exp_flow_spec_action_tag);
+	if (!flow->ibv_attr && action->drop)
+		flow->offset += sizeof(struct ibv_exp_flow_spec_action_drop);
 	if (!action->queue && !action->drop) {
 		rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE,
 				   NULL, "no valid action");
@@ -1011,9 +1013,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 +1022,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);
Signature · 1 line
1.8.3.1
Acked-by on v1 1/1
#1 lore raw
Quoted 44 lines · Shachar Beiser

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")
---
 drivers/net/mlx5/mlx5_flow.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/mlx5/mlx5_flow.c +5 -3
index 12893c6..cad3d16 100644
@@ -580,6 +580,8 @@ struct mlx5_flow_action {
 	}
 	if (action->mark && !flow->ibv_attr && !action->drop)
 		flow->offset += sizeof(struct ibv_exp_flow_spec_action_tag);
+	if (!flow->ibv_attr && action->drop)
+		flow->offset += sizeof(struct ibv_exp_flow_spec_action_drop);
 	if (!action->queue && !action->drop) {
 		rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE,
 				   NULL, "no valid action");
@@ -1011,9 +1013,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 +1022,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);
Signature · 1 line
1.8.3.1

Ferruh, this patch is fixing an issue of a patch only present in your master-net branch, the fixline sha1 will be wrong.

Thanks,

Signature · 2 lines
Nélio Laranjeiro
6WIND
#2 lore raw

Hi Nelio,

Quoted 6 lines · Nélio Laranjeiro
Quoted 5 lines · Shachar Beiser

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

<...>

Quoted 7 lines
Quoted 2 lines
Signature · 1 line
1.8.3.1

Ferruh, this patch is fixing an issue of a patch only present in your master-net branch, the fixline sha1 will be wrong.

I can squash this into relevant patch (88c77dedfbb0).

But there is another patch [1] that cause conflict and seems fixing same commit (88c77dedfbb0) again.

What do you think squashing all three into one?
I can share latest patch if you want.

[1] net/mlx5: fix creation of drop flows
http://dpdk.org/browse/next/dpdk-next-net/commit/?id=e0e37c1f80a00a2acbb581649b3125a5d465f2c6

Quoted 3 lines

Thanks,

#3 lore raw
In reply to Shachar Beiser
Quoted 14 lines · Shachar Beiser

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")
---
 drivers/net/mlx5/mlx5_flow.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/mlx5/mlx5_flow.c +0 -0
index 12893c6..cad3d16 100644

drivers/net/mlx5/mlx5_flow.c struct mlx5_flow_action { · line 584

Quoted 5 lines
drivers/net/mlx5/mlx5_flow.c +2 -0
@@ -580,6 +580,8 @@ struct mlx5_flow_action {
 	}
 	if (action->mark && !flow->ibv_attr && !action->drop)
 		flow->offset += sizeof(struct ibv_exp_flow_spec_action_tag);
+	if (!flow->ibv_attr && action->drop)
+		flow->offset += sizeof(struct ibv_exp_flow_spec_action_drop);

Is using "struct ibv_exp_flow_spec_action_drop" here required HAVE_VERBS_IBV_EXP_FLOW_SPEC_ACTION_DROP check?

Quoted 24 lines
drivers/net/mlx5/mlx5_flow.c +3 -3
 	if (!action->queue && !action->drop) {
 		rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE,
 				   NULL, "no valid action");
@@ -1011,9 +1013,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 +1022,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);
#4 lore raw

PATCH v2 1/1 fix drop action seg fault missing compilation flag

In reply to Shachar Beiser

Shachar Beiser (1):
net/mlx5: fix drop action seg fault

 drivers/net/mlx5/mlx5_flow.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.3.1
#5 lore raw

PATCH v2 1/1 net/mlx5: fix drop action seg fault

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")
---
 drivers/net/mlx5/mlx5_flow.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/mlx5/mlx5_flow.c +7 -3
index 12893c6..86be929 100644
@@ -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);
Signature · 1 line
1.8.3.1
#6 lore raw

PATCH v2 1/1 Adding compilation flag for fix drop action seg fault

In reply to Shachar Beiser

Shachar Beiser (1):
net/mlx5: fix drop action seg fault

 drivers/net/mlx5/mlx5_flow.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.3.1
#7 lore raw

PATCH v2 1/1 net/mlx5: fix drop action seg fault

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")
---
 drivers/net/mlx5/mlx5_flow.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/mlx5/mlx5_flow.c +7 -3
index 12893c6..86be929 100644
@@ -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);
Signature · 1 line
1.8.3.1
Acked-by on v2 1/1
#8 lore raw
Quoted 46 lines · Shachar Beiser

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")
---
 drivers/net/mlx5/mlx5_flow.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/mlx5/mlx5_flow.c +7 -3
index 12893c6..86be929 100644
@@ -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);
Signature · 1 line
1.8.3.1
Signature · 2 lines
Nélio Laranjeiro
6WIND
#9 lore raw
Quoted 8 lines · Nélio Laranjeiro
Quoted 5 lines · Shachar Beiser

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

Hi Nelio, Shachar,

What do you think squashing this and [1] into 88c77dedfbb0? Both this and [1] looks like fixing same commit.

[1]
e0e37c1f80a0 ("net/mlx5: fix creation of drop flows")

#10 lore raw
Quoted 10 lines · Ferruh Yigit
Quoted 8 lines · Nélio Laranjeiro
Quoted 5 lines · Shachar Beiser

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")
Quoted 7 lines

Hi Nelio, Shachar,

What do you think squashing this and [1] into 88c77dedfbb0? Both this and [1] looks like fixing same commit.

[1]
e0e37c1f80a0 ("net/mlx5: fix creation of drop flows")

Hi Ferruh,

No it is not the same issue, one this new patch is fixing some code for the hardware drop flow support which will be available with next version of MLNX_OFED.

e0e37c1f80a0 ("net/mlx5: fix creation of drop flows") is fixing the current version of the software drop queue which is possible with the current MLNX_OFED GA.

Please keep them separate.

Thanks,

Signature · 2 lines
Nélio Laranjeiro
6WIND
#11 lore raw
Quoted 25 lines · Nélio Laranjeiro
Quoted 10 lines · Ferruh Yigit
Quoted 8 lines · Nélio Laranjeiro
Quoted 5 lines · Shachar Beiser

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")
Quoted 7 lines

Hi Nelio, Shachar,

What do you think squashing this and [1] into 88c77dedfbb0? Both this and [1] looks like fixing same commit.

[1]
e0e37c1f80a0 ("net/mlx5: fix creation of drop flows")

Hi Ferruh,

No it is not the same issue, one this new patch is fixing some code for the hardware drop flow support which will be available with next version of MLNX_OFED.

Quoted 5 lines

e0e37c1f80a0 ("net/mlx5: fix creation of drop flows") is fixing the current version of the software drop queue which is possible with the current MLNX_OFED GA.

Please keep them separate.

OK, thanks for clarification.

Quoted 3 lines

Thanks,