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 0A7E741D3B; Wed, 22 Feb 2023 10:38:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DBC3542FCC; Wed, 22 Feb 2023 10:38:00 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2086.outbound.protection.outlook.com [40.107.92.86]) by mails.dpdk.org (Postfix) with ESMTP id 696FB42FC6 for ; Wed, 22 Feb 2023 10:37:58 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nJma2e5qQPS5N+okZ0UDwRE5RmeFqEHPXg+kpdqq2oNZhnBS6H2rWAPz1hAKHnqJSMvlJtCyIHwPQm2k+jUp1u9yd+ieOm1isFCtk0NkkR9Q/QC8LiP86WaJ4BaX7U5BWWQfRz4rRW+3/vvX769uLD7oDr63tmZ+nRWs5sfxfpfYVO7anHYx04tM9A2dkUDBICxR0eRCezWDuWlfr40rqECs4JiLe5NLyrCrstouaVtCNtQ+ezoOwg/21042c/7Sbvhsi6hV+6VBX/NKvMcOxjp4Bjx9AvSKytLgxBHikgvI2E7/KUuxIrgRZt/+UhxxiyPDU0Oe91/Tgd8+dGE1QQ== 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=js7ihsfYz7j12vixQqllburVrCTRyOwZM4/3toabbZ8=; b=eBX9/JoYgjKHaG9b56WjbTkswjyYmuwKojrmj3KgU8DkZeUvc2vEum+JiLXlJZ9rYc8H3tguDbmq08RRCzDAtNJgbDyL46E+1lTuS4PTvV2yHgeTbnO0EThIfLxV5RYK3utR2paz8E2yWZVflRhTUorgJqM2Fqnk7I+knYHzLKYXeEH/SzKVnizPV/cmw6lbLeWu9MWklMiCiUipgtX2u+BCKWJOuPV7WfzYOY01kHDdFkscy6LpL3cxUM3j6g77uQX9KPiJ9kCOdazoTcC/1o9XC1X6h5cmOLsXySHPp1Yqkxs2MPf4ghDjfwP0zixlQds+ogfapequfurAKvydAA== 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 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=js7ihsfYz7j12vixQqllburVrCTRyOwZM4/3toabbZ8=; b=VCAtcBq2EmpQngfqbePi/KA/esnBXqtuhYfPWAgUYMXXdpOenP4tu+gCDg0lBVP4wWpZJicZ+XxSscKa20hh1Arj2IcCUZPlf3FaCEqcvSSd0r/SdIu5WP+KFjW1QyZ0LpiD+FEV6clgxkNkts2TJ0+bdZdCrGyQgl+2FiiVyN/h56bqjvqWQB0uN/3qs2zZeJfaokPkJl4x9uQTMgzob103+cgHtmApjY6y6e3WNngHgJj8lQVtCITJl3DQeFRkzTbp0Qy8e6qqjHyZa9eKwWp/YfZKGhPickQYhv8bNoTGHVYMMUsuEflL2EJfS6sMp/c44u0YIEgv1FDGK4TMOw== Received: from MW4PR04CA0374.namprd04.prod.outlook.com (2603:10b6:303:81::19) by CY5PR12MB6480.namprd12.prod.outlook.com (2603:10b6:930:33::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.19; Wed, 22 Feb 2023 09:37:57 +0000 Received: from CO1NAM11FT115.eop-nam11.prod.protection.outlook.com (2603:10b6:303:81:cafe::cc) by MW4PR04CA0374.outlook.office365.com (2603:10b6:303:81::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.21 via Frontend Transport; Wed, 22 Feb 2023 09:37:56 +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 CO1NAM11FT115.mail.protection.outlook.com (10.13.174.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.19 via Frontend Transport; Wed, 22 Feb 2023 09:37:56 +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.36; Wed, 22 Feb 2023 01:37:43 -0800 Received: from nvidia.com (10.126.230.37) 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.36; Wed, 22 Feb 2023 01:37:41 -0800 From: Rongwei Liu To: , , , , CC: , Dariusz Sosnowski Subject: [PATCH v2 5/6] net/mlx5: return error for sws modify field Date: Wed, 22 Feb 2023 11:37:14 +0200 Message-ID: <20230222093715.740279-6-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230222093715.740279-1-rongweil@nvidia.com> References: <20230215115251.3924578-7-rongweil@nvidia.com> <20230222093715.740279-1-rongweil@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT115:EE_|CY5PR12MB6480:EE_ X-MS-Office365-Filtering-Correlation-Id: 93545f8a-2e6b-49b4-de47-08db14b87aab 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: EnKJUEBtA1sgV4nuuJQgjRzluBWJFP6rP4817JxmriU64kHuWdInVHNTX37JVXKdYwNdNfsBpN5Rhc6Bww+Dy9dP6kYbpgLs79Kkxy1vIGiyUdPTBLa7ox3FT6reMQc52Kebov0gn9f0dbbd8qpyC1X2WSKkmJa294wfSrdtbMW1MBrYITCC4BESqefjGu0ev0Qtj/4zl7DhTgqDrWB4DqdoiirDo5EcHDM/5HJfmtY4IcS9ZGx0EhMR+e4PogOCwUCtPd6cXEhG2uuFbbpS1OCKDFS0uTn2o9zohIlAviz0oFK7tkOEWq4rKUTKdLfJmzZdO4DnQRaU9sOi6STDBwx7BaQORKuLkDPe82zcRdc8Jxc4x3MJM8ilCahRm1qSN2W1JwBILKJIW9GhvkRORMWw0FcmTodMo8OikL5l4u+Skprw0/e6v0iIE5hgFiVSgPHGXGeF8nasMmbx6u3HW+p1sRIh0fx0NQKCMXL/QAusHE3mZuXYsBZLm626OVMEf2j0FJhwiAyxE9UJh0y7x6N3/e+uJRLHZkNMP3APUkTozcndRVloLitfWtgfLR8Cf5uykoFbm03b1tTUAVSjl9Elk0q65NDF/wgBuykHLhTxle7ksoB8axrkg3nDKrzBjut0yIEUH6Q0b5p2UbsmobbeBSpGqznftIGCvGTDVTS6QgnDyJjzXCThFpwbs41nlkix6lYozsXM/aNBhi7boKncLRex7feHBMiGNMsNCdA= 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:(13230025)(4636009)(396003)(136003)(376002)(346002)(39860400002)(451199018)(46966006)(36840700001)(40470700004)(40460700003)(5660300002)(8936002)(107886003)(41300700001)(2906002)(336012)(426003)(2616005)(47076005)(54906003)(110136005)(7696005)(316002)(4326008)(478600001)(16526019)(26005)(8676002)(70586007)(1076003)(186003)(6666004)(70206006)(6286002)(82740400003)(356005)(86362001)(55016003)(40480700001)(36756003)(82310400005)(36860700001)(34020700004)(83380400001)(7636003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2023 09:37:56.6585 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 93545f8a-2e6b-49b4-de47-08db14b87aab 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: CO1NAM11FT115.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6480 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 Return unsupported error message when application tries to modify flex item field. Validation of packet modifications actions for SW Steering checked if either source or destination field of MODIFY_FIELD action was a flex item. When DEC_TTL action is used, DEC_TTL action does not have any action configuration and dereferencing source or destination field is invalid, so validation of source and destination field types should be moved to MODIFY_FIELD specific validation function, then field types are validated if and only if action type is MODIFY_FIELD. Signed-off-by: Dariusz Sosnowski Signed-off-by: Rongwei Liu Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow_dv.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 8355249ce5..3d760d1913 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -4838,6 +4838,7 @@ flow_dv_validate_action_modify_hdr(const uint64_t action_flags, return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION_CONF, NULL, "action configuration not set"); + if (action_flags & MLX5_FLOW_ACTION_ENCAP) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL, @@ -5163,17 +5164,21 @@ flow_dv_validate_action_modify_field(struct rte_eth_dev *dev, struct mlx5_hca_attr *hca_attr = &priv->sh->cdev->config.hca_attr; const struct rte_flow_action_modify_field *action_modify_field = action->conf; - uint32_t dst_width = mlx5_flow_item_field_width(dev, - action_modify_field->dst.field, - -1, attr, error); - uint32_t src_width = mlx5_flow_item_field_width(dev, - action_modify_field->src.field, - dst_width, attr, error); + uint32_t dst_width, src_width; ret = flow_dv_validate_action_modify_hdr(action_flags, action, error); if (ret) return ret; - + if (action_modify_field->src.field == RTE_FLOW_FIELD_FLEX_ITEM || + action_modify_field->dst.field == RTE_FLOW_FIELD_FLEX_ITEM) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, action, + "flex item fields modification" + " is not supported"); + dst_width = mlx5_flow_item_field_width(dev, action_modify_field->dst.field, + -1, attr, error); + src_width = mlx5_flow_item_field_width(dev, action_modify_field->src.field, + dst_width, attr, error); if (action_modify_field->width == 0) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, action, -- 2.27.0