From patchwork Fri May 15 04:49:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 70285 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 922B1A00C3; Fri, 15 May 2020 06:49:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 253921D98F; Fri, 15 May 2020 06:49:36 +0200 (CEST) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id EC2701D98D for ; Fri, 15 May 2020 06:49:33 +0200 (CEST) From: Bing Zhao To: viacheslavo@mellanox.com, rasland@mellanox.com Cc: orika@mellanox.com, matan@mellanox.com, dev@dpdk.org, suanmingm@mellanox.com Date: Fri, 15 May 2020 12:49:18 +0800 Message-Id: <1589518158-333653-1-git-send-email-bingz@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH] net/mlx5: fix wrong port action assert position 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" In the current implementation, only one port action is supported in switchdev mode. So only one port action will exist in a single device flow. In debug mode, an assertion will be used to check the if the port action is none, and it should locate before the port action resource registration. In the meanwhile, all the fields of the action will be overwritten in the registration stage. There is no need to clear the temporary resource with memset. Fixes: f3faf9ea1185 ("net/mlx5: convert port id action to indexed") Cc: suanmingm@mellanox.com Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow_dv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 4ebb7ce..64d9a79 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -7846,12 +7846,11 @@ struct field_modify_info modify_tcp[] = { if (flow_dv_translate_action_port_id(dev, action, &port_id, error)) return -rte_errno; - memset(&port_id_resource, 0, sizeof(port_id_resource)); port_id_resource.port_id = port_id; + MLX5_ASSERT(!handle->rix_port_id_action); if (flow_dv_port_id_action_resource_register (dev, &port_id_resource, dev_flow, error)) return -rte_errno; - MLX5_ASSERT(!handle->rix_port_id_action); dev_flow->dv.actions[actions_n++] = dev_flow->dv.port_id_action->action; action_flags |= MLX5_FLOW_ACTION_PORT_ID;