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 7AD4442403; Thu, 19 Jan 2023 05:59:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A6FB442DA1; Thu, 19 Jan 2023 05:59:17 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2075.outbound.protection.outlook.com [40.107.93.75]) by mails.dpdk.org (Postfix) with ESMTP id D25BD42D9F for ; Thu, 19 Jan 2023 05:59:15 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lg+j89sk7vvfA1oXBCPlOt8UG60t4k23OCCo1U5jZ7dSvO3/KfK2EG9Te0883DIQ6fb4Y+zQTi2BGZwnRnvInpRo3FDq/prCAPN3TbFil7yjGo5rs9qFOeAfc5T4ZPAW3SiKCWYjMAiA9qZLJ06zucqVrgVTZMgS72qnX9h7AytwPYOozidA22HeECkbmSJ7IBkLDV133/5knQST6CEIYlivVxJOxNB2bwd7G3y8uwABD5WSDGkuD55XCBh3CXFvD2ZAZLSqTjJRnfZekfjf9O2QORfsbZtmNfDexZoIBHUWZGO23A7RRnSsBWXspLSnHKQ86Dat+rvWij0DSGIDwQ== 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=VeGliKw6wGEMuT4JdUBri4FswK1WamMMF9gm/ptqRr8=; b=RlzUtbXcrdr5TcpH9eO+A0U7+j3qPlib14nvPyDCAcaomUgtYFISYmcBItVybDszbwsP6qHELsuqmE7Mf/OylWnW6VyKsf4qLHnOLKOfm14h0sSjfgiqoS/AyFP4RUpEdUT1ew8lTWcJZp4nRl1G0g3BkbtuuBIb4wQQqnQCxfNBxfzyk6SC01v66RtHnae1iCb5cRalMbrxgGs8shBDNX/GEtX0A05BnYH2TBzDEzuZ+EPpqkjkkWzcQteXg1jDekzc7hu/p0fSZ4VA+074J+ALDVuKgjM2ph71bNxIynG3R7jAH4dwu+PIaA0i8T/U/W6NY7rbGqwMUooUnFuBQA== 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=VeGliKw6wGEMuT4JdUBri4FswK1WamMMF9gm/ptqRr8=; b=Auz7K7cGa3oQOFJRU4vLRgiv8YIyfLn8ix5y+m3Nlv1zPkQJdEj6khBiq50QdkH7YUMYMX9jGNfwl3wNPZ6aqNrvw4C/6FS5/NYUzje4x/w/Vw/gop/gCBV5ACyT09G9dKzxOgsJ1F7WoJYyQZbg022mahyQpJZ1crKnqbkVAbOXpw27//xUEJ4ufYBWsgztYwbcESM2vAeo6IIbPrLRzrDyITOt0VLd9DdjVgxgi4BC+Bs+Paife6I/pAvHI/3Z77Ahu9NgC9GY8ihMCIFM9VlL9IigKdWSxEphnm70fJPY6xjgfm6OPYVPLWOYCke0jZneueGNIJB8e/cyo9TvFw== Received: from MW4PR04CA0163.namprd04.prod.outlook.com (2603:10b6:303:85::18) by IA1PR12MB8311.namprd12.prod.outlook.com (2603:10b6:208:3fa::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.23; Thu, 19 Jan 2023 04:59:12 +0000 Received: from CO1NAM11FT070.eop-nam11.prod.protection.outlook.com (2603:10b6:303:85:cafe::79) by MW4PR04CA0163.outlook.office365.com (2603:10b6:303:85::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.25 via Frontend Transport; Thu, 19 Jan 2023 04:59:11 +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 CO1NAM11FT070.mail.protection.outlook.com (10.13.175.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13 via Frontend Transport; Thu, 19 Jan 2023 04:59:11 +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, 18 Jan 2023 20:59:00 -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, 18 Jan 2023 20:58:57 -0800 From: Rongwei Liu To: , , , CC: , , Dariusz Sosnowski Subject: [PATCH v2 08/11] net/mlx5: return error for sws modify field Date: Thu, 19 Jan 2023 06:58:21 +0200 Message-ID: <20230119045824.665663-9-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230119045824.665663-1-rongweil@nvidia.com> References: <20221221084000.3680015-2-rongweil@nvidia.com> <20230119045824.665663-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: CO1NAM11FT070:EE_|IA1PR12MB8311:EE_ X-MS-Office365-Filtering-Correlation-Id: 851ae573-78b3-4568-9914-08daf9d9e76f 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: pPMD54+hB9wMCVNHqL1GoEU+8YrcQ67JYVlvXx4YjXVSsJFy1lUGfA/JPWuYEB41BxolWb8TcI1zKPvmbvV+2WiiguZA6hEIl1ZQfIj5M/5sYi/IfEhElia/QbpS9fJGrS1P422jtTRgcO/zhSylcyk8Je5qOUXH69siZJWCkWcpqYw5yI2PF8NVWvKDsYKmQFNLTw1I8RBC7ju8qWdyGqPgjsZvdjbQZjeM24or0tQTJdyPtFX+AvHDBUdmjbHoPXGGw8doIxz9uWEetT9QxgDVy3uMjFRF9sW4vvVg45BUN3vEUeUcDIZ6590GA3yWHpq/PSZTEnjn75lvRO/dprDf2W3+StVDloVBfIEyxGy68nX5DoMjxCBTjFa66AYlWDb2y2vkBNuG+6tL8Gv/+L12wFeg/yaZqdPbePVj1oJIaQtqw0wk3D2Y0mfSHcxAlMRgSwVqmo96zWHOME3fAPrSpTXe6FynLveja30DCuSmBVzOMWE0EuNFNkU869AEqNDinpuy9jl1QTwOAoapY6cs4Agv0U/hH0FYBBpszivpsYwpkfQmf1Bj61wyaR57j8VUOtWjzBDTTmfa6fL0TTmmjVzCHoQT6T+xlAtdxyjjEPBXXrJa74cpX7fJieayaaxN+0mZpbLODV+3DCyvUoQBv+DGJuF0zvoVaTxBHNqWwR05VRoizHMyNV435fEj02sbqjusGacfjFrozij2Gw== 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)(376002)(346002)(136003)(39860400002)(396003)(451199015)(36840700001)(46966006)(40470700004)(36756003)(4326008)(86362001)(356005)(70206006)(70586007)(8936002)(55016003)(5660300002)(2906002)(8676002)(82740400003)(36860700001)(83380400001)(7636003)(54906003)(110136005)(40460700003)(6666004)(7696005)(316002)(426003)(82310400005)(478600001)(107886003)(26005)(41300700001)(40480700001)(1076003)(2616005)(47076005)(16526019)(6286002)(336012)(186003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 04:59:11.1479 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 851ae573-78b3-4568-9914-08daf9d9e76f 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: CO1NAM11FT070.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8311 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 92a5914d4b..a7c0d5bf17 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -4828,6 +4828,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, @@ -5153,17 +5154,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