From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6174842E47; Tue, 11 Jul 2023 17:21:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A15C1411F3; Tue, 11 Jul 2023 17:21:16 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2067.outbound.protection.outlook.com [40.107.237.67]) by mails.dpdk.org (Postfix) with ESMTP id 01D2F4003C; Tue, 11 Jul 2023 17:21:14 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gtQJK3ahF3cD8Ij47Qaq2PXihogJ6nQGoMZti6XL0TT+Iji5HNy2Bh50x4q7xW/Y05W6kf+v7N7w8GqMgCqiV8pIpeCyTqfXqesbDPEradzQKhxzo8tCQz4Qe6m+FzH/PnC+OpLARjNBxeCHI5+sXiCxkMDf2FgmbnZILKwYJdtuByalCcS6CiPvWOIf3MvOUA1p29r0fNo7mH2Q53Rfssm3wxBk4fN9i7rjp2YYX2z62C3h3i/iyknrmSfYmaKEqUpJNWSqmv2XuHB3n+5AjbIrjgnzAk15L3pVvTmOOJHzdDMeYB+0SL+DKdkZtMn1dNij1IiT2xE/YBwjcNYLYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RnfRCpX3BZuB1gY5jqd81tsimpBgqqH+3glG5ay26q0=; b=IXdV/0B54BBIqUxbtkyNEVathEILmgAe7yW9frqX4n6FiVyqRXddcISTCaR0Pr0zpFR6L8acXTQkLUI+YqSSYsFqXj0a4SDjYNvXcxEeyifnNnd5RKPbshESiVcOhBwpGgYxSL7QgoeVsbWVNyPmfR1u2nnp/ocJpSSB958p86/Xhs8KXtvX6n6zCKe4wkp4m2ZWHFBAmoXjOYpA5o3jbvFXW90SbKvmf6dJeTyeDXQlj+fUbDySf0ie7b70qv563vh1iBLNo7Xtk9dfNJb+R6I9P8oJKuXKCo3ImYVJ9TTJfERZWo/QgbY0L8uF2VifGu6bqcPWXbA9qHJyOoCUXA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RnfRCpX3BZuB1gY5jqd81tsimpBgqqH+3glG5ay26q0=; b=TeHj/8EGkcJTBEWRnm218FNB1WlFy6QLAAJVCGx6y/NRY/iz7qlycGK1Cd+MdTMq6CvA/CmNBcZU3aPb/clIvpYeXYwfqqmCEqkIDazapQ8MJuk9btDWgvzohOg+Hq+Y6/cLSlnQ+rVrkH83XUNi3f6n13lPWuH/AF+60mbYfU8BidLsYWWgLONplGd/cJeNS3Isn+lrUePg8vmKwsQ4UVdn16gxIpAxdoz/H/5AD08gNOOU/xZmCR0QpKxz0WThZ2QCo/H4P7NJh0s95w/8LjbmoANVSQuwy0YFquUgiHZZr2MORF3cc38Nq2SkD3hr3HIawzzdaZpgwhERjb/7Aw== Received: from BN9PR03CA0659.namprd03.prod.outlook.com (2603:10b6:408:13b::34) by MW4PR12MB7384.namprd12.prod.outlook.com (2603:10b6:303:22b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.31; Tue, 11 Jul 2023 15:21:12 +0000 Received: from BN8NAM11FT100.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13b:cafe::b6) by BN9PR03CA0659.outlook.office365.com (2603:10b6:408:13b::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.32 via Frontend Transport; Tue, 11 Jul 2023 15:21:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN8NAM11FT100.mail.protection.outlook.com (10.13.177.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.20 via Frontend Transport; Tue, 11 Jul 2023 15:21:12 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Tue, 11 Jul 2023 08:21:01 -0700 Received: from pegasus01.mtr.labs.mlnx (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Tue, 11 Jul 2023 08:20:59 -0700 From: Alexander Kozyrev To: CC: , , , , Bing Zhao Subject: [PATCH 1/3] net/mlx5: fix validation for conntrack indirect action Date: Tue, 11 Jul 2023 18:20:42 +0300 Message-ID: <20230711152044.3141138-1-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT100:EE_|MW4PR12MB7384:EE_ X-MS-Office365-Filtering-Correlation-Id: 1fe67770-e9ff-457a-5bbd-08db8222761a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +wEse5/Ag3QFu5MV5Et+FlKfzFrdHW1i6pcLa7+rXz4Zn7LYqoozWI2D1Em9gz8JcgXVQgdCkDDt1/EMIoQjPbE9fUNLmiCPN8h8B0Tkm76aczy+SIHEGATKQvU+lWrq3HDL+giBMBF3y0lxNxukYMmmOL3Or3w+LXsEnc8e0T/dXeVoyijZb8YDFpcxtZjeyF6NkGGk2bpuKhyvG68I0PLFQjMznuohyBen9FYBWCVS566ifBnfcd2cujl8SraSUJJvppQkZzNlMI7pcTG02WoFD1vmbhFRM3PryK0MKt/UaEDEVYkmByWnyr8z6/CgrPDadpdl4ksbfEhXl8CcXjCCZpPAhJiP2nJfYunsXC46XMdTJcYeYDD2udBw7BoNDHG+k7rlo0YtWDeNvltnYID3Ia4cBTqqSmiy0E0Ylwk5g0PHAdDH8OqfrtrCZDTEOesuy8PdAJIJlhHIlvpXwbCKjwBziQpCX6E3KcQ1wSlUefxZtc8mfe4vbWZeCMq2gNyLWGccYIahI4LBm2PZ0v+8SKbbOqhe2XwIqAOesgCp7Ak08du/hvXICQH4CadjzD8gpMI/bSd0mZ2JNuHYvSnFvr8VVVyx/G/V0JOD3k//tG7gmBemBGQ6wOJfpGZR8obGPdt2uhvkEf+3vXYZQ72JDpfctE9wSSzNR4EEBj730Gvg4AghQL0FcEhTgE8MW6GuSQmF1dKD84R8xU193d+8YPGOQF9I8mRW2tr+4qsRoJIAlb3Uod/h9hH2tI3d X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(396003)(346002)(376002)(136003)(451199021)(40470700004)(46966006)(36840700001)(478600001)(54906003)(450100002)(6666004)(47076005)(36860700001)(2616005)(426003)(83380400001)(36756003)(86362001)(40460700003)(40480700001)(2906002)(70206006)(82310400005)(1076003)(107886003)(186003)(16526019)(70586007)(26005)(336012)(356005)(7636003)(82740400003)(41300700001)(316002)(4326008)(8936002)(8676002)(5660300002)(6916009); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 15:21:12.2963 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1fe67770-e9ff-457a-5bbd-08db8222761a X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT100.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7384 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Bing Zhao After rte_flow_shared_action_* API was replaced with rte_flow_action_handle_* API, one input parameter of the update interface was also changed. A generic pointer was used instead of the "const struct rte_flow_action *" pointer. In the entrance of mlx5 PMD callback for update, the validation is called for all indirect actions. But for conntrack type, the pointer is no longer with rte_flow_action pointer type and it will cause an incorrect casting and error. The content for updating should only be validated when needed. It should skip the validation in the entrance. Right now, the content was already added before updating the hardware by WQE. So the type of the indirect action should be checked before calling the action validate function. When creating a new conntrack object, the validation is still needed since all the content will be used to update the hardware context. Fixes: 40327aab1491 ("ethdev: introduce indirect flow action") Signed-off-by: Bing Zhao --- drivers/net/mlx5/mlx5_flow.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 4b567f61dd..9bd92f28fd 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -10753,9 +10753,18 @@ mlx5_action_handle_update(struct rte_eth_dev *dev, const struct mlx5_flow_driver_ops *fops = flow_get_drv_ops(flow_get_drv_type(dev, &attr)); int ret; + uint32_t act_idx = (uint32_t)(uintptr_t)handle; + uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET; - ret = flow_drv_action_validate(dev, NULL, - (const struct rte_flow_action *)update, fops, error); + switch (type) { + case MLX5_INDIRECT_ACTION_TYPE_CT: + ret = 0; + break; + default: + ret = flow_drv_action_validate(dev, NULL, + (const struct rte_flow_action *)update, + fops, error); + } if (ret) return ret; return flow_drv_action_update(dev, handle, update, fops, -- 2.18.2