[dpdk-dev] [PATCH] net/mlx5: fix drop action seg fault
Shachar Beiser
shacharbe at mellanox.com
Wed Jun 21 13:55:58 CEST 2017
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 at mellanox.com>
---
drivers/net/mlx5/mlx5_flow.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 12893c6..cad3d16 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -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);
--
1.8.3.1
More information about the dev
mailing list