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 129CBA034C; Wed, 21 Dec 2022 09:41:27 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0D14A42D40; Wed, 21 Dec 2022 09:40:56 +0100 (CET) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2044.outbound.protection.outlook.com [40.107.100.44]) by mails.dpdk.org (Postfix) with ESMTP id C693F42D30 for ; Wed, 21 Dec 2022 09:40:54 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HTW9BT9ZyHnUiKFttM9LQuKy/GCPm3I/Xs/tYruj72spwG8wnl/RK130Fu9GOY4F2hevHxbpysagv3ow+i7XzJQbEWhkjSZ4Iu8dWbI9AoBKM97CoWLufRPwITtfFcDew+hUBvGx18sQ588Yspt5aiShuji9LEkpkMkBo6h888Ih4LiCcIguxpqRnsRCxcIU/pXW4D/I8HmDJLPObOBzsWpRV+Wm2Ecvy+JACpfNusFbPw2johrEEz6ZWN+PUOxPoLu6By8sK2CnJlfnasamNNHiIwgr8jtZ59YThu3egD7WMTgFi+Q5hX/CZHEaDB1NY0vN34p15eyw1uUa4KpCZA== 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=dXjhHwMEaTYrcOpigqNnDfHZvDkyMXFwz5SISmjdXZM=; b=L2pwnLrEEl07OqN6JiZahPqAqaA8x/+B2JN9FogCapeWtG1bM8A4B/AnsHzIQ/mIx/MChhifYEBEVAit++Zx8jv7eBlgXZURfUJsZfacD6sKoOII/ks0oGo0W6onBugQmco9W5kmk/6+gEFtusgfCKWECGgUCqFGONuCPHvopKeyPXPojLUs7sh9t+OtDQQY6bNkof0/Usu5YyLfqZt8jhvbXuOc/AmuE9Z1ZpvKoj3dXT3el3SSNY0O+Hhl3dUKyn7wSCk+0gEQnxg4LOclhfPOXIF0PYY1x9iobmXNHrFOKxlZB90M5Tlk1+ZrUmg/0zr2WSMpah2sxS3F7SSamg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=monjalon.net 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=dXjhHwMEaTYrcOpigqNnDfHZvDkyMXFwz5SISmjdXZM=; b=FKq1fNfWsMUMeDETaE+KqtR6is2I/f5TKqmQLcJDZN2kPEeik/snAP97T4uekQ2zn2MoEBHfCL+MXvYP51HoK+glkc0aevEdbispS49NLN2LbPjRDxSxPW+aWHSR07bT0A3q4XdWq5+Vyym6mTXcr2Rg6aC2wQNLn7IHvEPMVQrJpe5K7KMheYLxsBMWLxgNEBk0RpaHs5NSa8Z3ntQdUMpCw63GBvICQZ2DUieD7Pp3I8yf9wR3pqZ0gDL1wJrbIbp2S8uBDGWguE7UWA+wNUkOnCh8OqvQToxXsAZeTwfZ0rLIVNryZU4Ld4hXG8OpAiaDI93CfvpSFS2dRtos8Q== Received: from BN8PR04CA0037.namprd04.prod.outlook.com (2603:10b6:408:d4::11) by PH7PR12MB8153.namprd12.prod.outlook.com (2603:10b6:510:2b0::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Wed, 21 Dec 2022 08:40:52 +0000 Received: from BL02EPF00010208.namprd05.prod.outlook.com (2603:10b6:408:d4:cafe::d1) by BN8PR04CA0037.outlook.office365.com (2603:10b6:408:d4::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.21 via Frontend Transport; Wed, 21 Dec 2022 08:40:52 +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 BL02EPF00010208.mail.protection.outlook.com (10.167.241.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.8 via Frontend Transport; Wed, 21 Dec 2022 08:40:52 +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, 21 Dec 2022 00:40:38 -0800 Received: from nvidia.com (10.126.231.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, 21 Dec 2022 00:40:36 -0800 From: Rongwei Liu To: , , , CC: , Subject: [RFC 8/9] net/mlx5: return error for sws modify field Date: Wed, 21 Dec 2022 10:39:59 +0200 Message-ID: <20221221084000.3680015-9-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20221221084000.3680015-1-rongweil@nvidia.com> References: <20221221084000.3680015-1-rongweil@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.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: BL02EPF00010208:EE_|PH7PR12MB8153:EE_ X-MS-Office365-Filtering-Correlation-Id: 88007213-c13e-4967-d904-08dae32f1193 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: iNMi5Et4P7Rw6ODDyjJcwRuKjuChD5LnICQ+YCPwJb3Q8dgBXUuVMDnOkUSPmeQ+NNAIt5pWjGQVs2vWncF9f9Y1MqevNzvdO16j8YDC/GPY9L9kaBGh7rkT5+EZhh3eKEbyzlXvvvdVaqRoX9HoTBHid1394OM3nO4PI+lx2LAXMgrYT+Uvg9R0kXB2y9XYC3O7PVmV5GaBVIzmkZIVFsKJej/XdJas80iiAjxLidyr4uD+O1flQXreF83oTjjvkzUe/4Cs48xBvPDq8+hVpRTsdXak1NqZjdUT4GA2ea55IUB1Gd3n7/MitISPFjTy7kdFRZKL07w6cju4455txn9S3k0NmxrfHZ0MWs+TnkI+9r3OZIzsFzJfZEUP6i6+bVjO3/Ch9Blmoefs1uv65V4K8TpcMELRw86oShMxD3DwAGUZslJPxPNVaUrKMwuuyWNvxr3MEAj4MCoUVajhAPtH6CeAUnlBCtQbgHZ/e8fe/nqyGgC75YwKDApG8/cHWBqcHaLyajJNXmQfqcpyd3SkVVuf1RzO3D14SZoXLfT9picLYlgR7+80vK/svyzgW+h83r5QdHseK7h7bc89rVfzKN5Rk3F1WgrBBRCPGXgjfc9nWhtKgv1qDTSmF8IKnrZsv93726CG1Zor5t0BQuljEf71XGfk55FzssGU1nia+4xAxM0GsNvNDO1x9i4Do/5twrC7LBEQ8OLYO8El/g== 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:(13230022)(4636009)(396003)(376002)(346002)(39860400002)(136003)(451199015)(36840700001)(40470700004)(46966006)(70586007)(4326008)(86362001)(70206006)(8676002)(40460700003)(316002)(5660300002)(36756003)(8936002)(36860700001)(2616005)(41300700001)(82310400005)(6666004)(16526019)(1076003)(6286002)(186003)(107886003)(47076005)(26005)(83380400001)(426003)(336012)(7696005)(356005)(40480700001)(82740400003)(55016003)(7636003)(478600001)(54906003)(110136005)(2906002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 08:40:52.2341 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 88007213-c13e-4967-d904-08dae32f1193 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: BL02EPF00010208.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB8153 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. Signed-off-by: Rongwei Liu --- drivers/net/mlx5/mlx5_flow_dv.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 110d08b271..f9419463eb 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -4824,10 +4824,18 @@ flow_dv_validate_action_modify_hdr(const uint64_t action_flags, const struct rte_flow_action *action, struct rte_flow_error *error) { + const struct rte_flow_action_modify_field *action_modify_field = action->conf; + if (action->type != RTE_FLOW_ACTION_TYPE_DEC_TTL && !action->conf) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION_CONF, NULL, "action configuration not set"); + 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"); if (action_flags & MLX5_FLOW_ACTION_ENCAP) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL, @@ -5153,17 +5161,16 @@ 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; + 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