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 05F4043B5B; Wed, 21 Feb 2024 08:11:41 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5179240A4B; Wed, 21 Feb 2024 08:11:35 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id C1E7C40689; Wed, 21 Feb 2024 08:11:31 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B7GScSpRL4ekp5ZO8JOAjUEEVniJJIsTrqiumohZGc+CP1zCnNquKHteLv1y1HBJW4d0xOI3OKTN5IoG0vHwfTahH0sK7HOaXbs68GD4EvsA1QmCPQPpdYign7Ch7lOGyvKlZcujigkTlS90m3YxCkQ2V83SkVGyFf6Ei7phP4MAx25VrctKS9IDxVJTswtqgPO69hxhdJMO7qtPF7M+CMQxjo8up1gXMF/5AWh+PUnzOaQTdfdlJNmRz0vMTpZ0Dzq+fM51F2Kmp09wvORzhS88VfauH7VtXmXR1lZbwiHK/LT1N0zGQpGvUAygyzKtUR9zc5/+4xH9ctJQ35qXvg== 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=VKhJumb0QgfjJCWKGmtkgdBWJ4ikRMdW9utG7a3dxSc=; b=DIAakGTF3r/xB7b+kw9vAnKeHa5d6T2DAKzHF7mPiSLimBDiBxv9HFTmXnZu7+sz8WRqYOqaMJqS0XqUFsJ4wGmiLQzwmV26/DkcpZXSkf0IgdKjiBwhQYGNt9MYArgN0V7+9riUTpJwEAqQEeVDk9dtCIjom/sgtIZVsYFk5uPQXNkATV5zOLSq7yVPZ1db+rqRdr/Vg5ltkdfoRAaO/ap383kmylQ8RHrdlpWvj8BnBkwRi3p4xniy02Epn983SDKGo8vb0R/JJbmwt4L+BhrSRKwYgMjQAGbOuLP1xc6XrhNvR6Qwt2scgkPdCxo950PpoGdTlLKvSJO42nsWlw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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 (0) 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=VKhJumb0QgfjJCWKGmtkgdBWJ4ikRMdW9utG7a3dxSc=; b=cK+YIuGzy89qSrft0H9hMfnvFVN0LgmdgckdM49fcipgpnFrNaJcbWnIRqgUwdhRsSbKXDn7VH8MEiadUG2EKP7fPZw9vLhlIwnYf7LdnZTcxodkTlLcK+43oePz4LkohqJXgk88NqUDvXqlQxuppJzQfBZBFBWuV98xOYMZPcTn3V3icQuOSStcmi1DLs3rQpu8nRnRmuiWZPgK/fI63id4KMtUVHS2DbCHL6/3hL+izQO8NChjZqOc+sD14axxtjvAPCWq6u8j5TjE3E9Tgm79NNhn4lLc24TE46Vyxb/x62JIEWr3C2kASElixqFECV4Xa+JskFUTNM5xdUkyDA== Received: from CYZPR14CA0008.namprd14.prod.outlook.com (2603:10b6:930:8f::26) by BL3PR12MB6476.namprd12.prod.outlook.com (2603:10b6:208:3bc::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.14; Wed, 21 Feb 2024 07:11:29 +0000 Received: from CY4PEPF0000EDD4.namprd03.prod.outlook.com (2603:10b6:930:8f:cafe::dd) by CYZPR14CA0008.outlook.office365.com (2603:10b6:930:8f::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.41 via Frontend Transport; Wed, 21 Feb 2024 07:11:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CY4PEPF0000EDD4.mail.protection.outlook.com (10.167.241.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.25 via Frontend Transport; Wed, 21 Feb 2024 07:11:29 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 20 Feb 2024 23:11:09 -0800 Received: from nvidia.com (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.1258.12; Tue, 20 Feb 2024 23:11:07 -0800 From: Rongwei Liu To: , , , , , CC: , , Dariusz Sosnowski Subject: [PATCH v1 2/2] net/mlx5: fix modify flex item error Date: Wed, 21 Feb 2024 09:10:43 +0200 Message-ID: <20240221071043.3309205-3-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240221071043.3309205-1-rongweil@nvidia.com> References: <20240221071043.3309205-1-rongweil@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EDD4:EE_|BL3PR12MB6476:EE_ X-MS-Office365-Filtering-Correlation-Id: 5a4b5e1e-c786-4b93-2005-08dc32ac5385 X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ycE5ZjyftVPQEfNyJ/HmNSQYqj3XxO6Cdhq0e+o0u/X4WbEo/YXV28rXde3JCNcRQPnPnLoFE/GCr69Mfd2TJQ2mrmO2iMFesQ5+LKQUa6Zn49NQ0WfxxfFhPtleu/bBUlMUwsb9yjPpnR/z3GkRS5YiHAGB/g3aA+pu/Bv37wbJ9eK8NbJztsC/YNRwe9PSPzh53l6qCxyyIRuCkv8Jcfg4A9CUhKzWja5oVdr5gUi2FFtfsnuokse7MANr0VLpD8zYKEaiUBCIgLdyLsuKUha3ImcypPjINN5wQvVGJzKG2D0Zkq1NuBRptO8YvZkeu3xevP3o4iusv8DXHWo2FTv4bNfSi0vrL9iv0JBa0mse2ghxXLZX35YejBEQXtUQ/vZrBpg5dcbpxPJfKu3B+ETuvKkyD8yY+K8om4Vq6U45ROobc3k9h1sAKWwlN+tHRIOyXMAtJDlTa3IfxtWXHAdJOYsEDAOFVaE607tNwY562X1AoCkrf1+F7vzUdytIK/eQRy7KT7x6xihPOmY/MXcroVH3ZY/BSTljpxSpdtQWuxyuR+0rhT3kt7D5o57r0Qso0QVwqB1p5HXqhqv+ByEVpDBKXw3XMo+A5RjOFGDK5n7fgJOtDmnBKZieKJXLtk1kcre4rE6MEn+vcwo8bQ== X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230031)(36860700004)(46966006)(40470700004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2024 07:11:29.4264 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5a4b5e1e-c786-4b93-2005-08dc32ac5385 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EDD4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6476 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 In the rte_flow_field_data structure, the flex item handle is part of union with other members like level/tag_index. If the user wants to modify the flex item as source or destination, there should not be any checking against zero. Signed-off-by: Rongwei Liu Fixes: 7ea38955b ("ethdev: update MPLS header modification API") Cc: michaelba@nvidia.com Cc: stable@dpdk.org Acked-by: Dariusz Sosnowski --- drivers/net/mlx5/mlx5_flow.c | 2 +- drivers/net/mlx5/mlx5_flow_hw.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 3c306a5f70..9caecc3db6 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2369,7 +2369,7 @@ int flow_validate_modify_field_level(const struct rte_flow_field_data *data, struct rte_flow_error *error) { - if (data->level == 0) + if (data->level == 0 || data->field == RTE_FLOW_FIELD_FLEX_ITEM) return 0; if (data->field != RTE_FLOW_FIELD_TAG && data->field != (enum rte_flow_field_id)MLX5_RTE_FLOW_FIELD_META_REG) { diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index efbf88f56d..6dde19c1b9 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -6104,7 +6104,8 @@ flow_hw_validate_action_modify_field(struct rte_eth_dev *dev, ret = flow_hw_validate_modify_field_level(&action_conf->dst, false, error); if (ret) return ret; - if (!flow_hw_modify_field_is_geneve_opt(action_conf->dst.field)) { + if (action_conf->dst.field != RTE_FLOW_FIELD_FLEX_ITEM && + !flow_hw_modify_field_is_geneve_opt(action_conf->dst.field)) { if (action_conf->dst.tag_index && !flow_modify_field_support_tag_array(action_conf->dst.field)) return rte_flow_error_set(error, EINVAL, @@ -6129,7 +6130,8 @@ flow_hw_validate_action_modify_field(struct rte_eth_dev *dev, "destination field mask and template are not equal"); if (action_conf->src.field != RTE_FLOW_FIELD_POINTER && action_conf->src.field != RTE_FLOW_FIELD_VALUE) { - if (!flow_hw_modify_field_is_geneve_opt(action_conf->src.field)) { + if (action_conf->src.field != RTE_FLOW_FIELD_FLEX_ITEM && + !flow_hw_modify_field_is_geneve_opt(action_conf->src.field)) { if (action_conf->src.tag_index && !flow_modify_field_support_tag_array(action_conf->src.field)) return rte_flow_error_set(error, EINVAL, -- 2.27.0