From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 5F27029D6 for ; Sun, 25 Jun 2017 10:00:07 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from shacharbe@mellanox.com) with ESMTPS (AES256-SHA encrypted); 25 Jun 2017 10:46:42 +0300 Received: from gen-r-vrt-059.mtr.labs.mlnx (gen-r-vrt-059.mtr.labs.mlnx [10.215.59.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v5P7kgqo005673; Sun, 25 Jun 2017 10:46:42 +0300 Received: from gen-r-vrt-059.mtr.labs.mlnx (localhost [127.0.0.1]) by gen-r-vrt-059.mtr.labs.mlnx (8.14.7/8.14.7) with ESMTP id v5P7kgbP007849; Sun, 25 Jun 2017 07:46:42 GMT Received: (from shacharbe@localhost) by gen-r-vrt-059.mtr.labs.mlnx (8.14.7/8.14.7/Submit) id v5P7kfPT007847; Sun, 25 Jun 2017 07:46:41 GMT From: Shachar Beiser To: dev@dpdk.org Cc: Adrien Mazarguil , Nelio Laranjeiro , Shachar Beiser Date: Sun, 25 Jun 2017 07:46:38 +0000 Message-Id: <09f627ea8059ff7fd490ea1120e5c68137fa4944.1498376152.git.shacharbe@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: In-Reply-To: References: <4233196997a3d8aba05b16a130ccc87f27f076bf.1498046009.git.shacharbe@mellanox.com> Subject: [dpdk-dev] [PATCH v2] net/mlx5: fix drop action seg fault X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jun 2017 08:00:07 -0000 Content-Type: text/plain; charset="UTF-8" Message-ID: <20170625074638.Y8gxc-CyMkT2J0WWMUiuPX6IdO8GB4kJg3Jik_qZY_k@z> 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 --- 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