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 89B5941B81; Mon, 30 Jan 2023 14:21:27 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0A46842D51; Mon, 30 Jan 2023 14:20:54 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2062.outbound.protection.outlook.com [40.107.93.62]) by mails.dpdk.org (Postfix) with ESMTP id 0D6C142D30 for ; Mon, 30 Jan 2023 14:20:50 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=neRrEdQ9W0GOCcPwIddmss9CqHfI9IVQSbY8I6mr1bVE8FTJiC60mvvUpP7KRgFl12axKJunOY11MuUq871vvsS5M/UkiqVpFpmuZVGKCYkIv7MqemBeCqdVt+lQbuvlng9Cycpa5B6QEZah8ABZ0CaY8PvRVzU7m/ptCaJCnGcvJqxoJo7UPbpaGxfBiCZWfBX86WFqp3fOQVyRaZxVn5W9vEVQjssWwXVwflV1A7pgT8Jgugv/USdh/+bjEQDuM6D86SkvW/TPmwzsjOD3A6lA9Be0zMMmSJNP8wPYVRcR+MhaETIvQy4Ogk4NHrpLMOG4XrogCTiKymS6ORl1Yw== 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=U91mWj9rn+el/716sYdjSvOFk4B2bbMA3bpze/0pZxRw0mN2NsiT2FChk2dVnb7aIWhOy27p53Ffk31q+9Qy6m5uUFbsgV91pEGn4dsYGE1Ba0Pi5zWglysuDkR8KLke10qjHA4xx/SYqM4yI7brh1xHMfImXFg6+Zm3nlt8qDzCSYB+xKANKyggvHxEA5eYZxGRw255J0m1LSSvTmp8dz/GNvqZqVhJp/1qBWmcL+/nfqNk/6ogrFuSO6H9+HgH8a0yzN/RRs5pjqLJt9B3nrgLSNCSVzutg+8THGrt4rkoboO72xk57uJhFeSWf74jnn7e9Js3nYbkowqStnWabg== 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=akrPMYYU/pCPuVtiGA3+1hdfrrmHbr0DydkkW6vdq/zbLzFA3ZBM19EBFWoJF28U40hx7JgQmJk2iQ8lplkEIGFY77E/LIornvx7+BuA3pFBjvSiF8j0+P/S8uXZ12aMiYzbF8IoOuYWgVKGIG9vphFuasPgAjE04jN0fnCki7vvfiWy8Oh+9p7U2MIk43vcOe5QlZyCtNqgjW33kg7vBobu6DRL98hLSjfJOI3IZLSljKw70N16XI6hn3Rp7lj/EgYTGnclT3iKHENPNevo5FlqKBFlRMNwjkne9ObKWDWDEf5NYkWYJUU2eSG0vJ9f4osHj5zTwl63vSCkwYSlcg== Received: from BN8PR04CA0054.namprd04.prod.outlook.com (2603:10b6:408:d4::28) by MW4PR12MB7165.namprd12.prod.outlook.com (2603:10b6:303:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.36; Mon, 30 Jan 2023 13:20:48 +0000 Received: from BN8NAM11FT031.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::a0) by BN8PR04CA0054.outlook.office365.com (2603:10b6:408:d4::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.36 via Frontend Transport; Mon, 30 Jan 2023 13:20:48 +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 BN8NAM11FT031.mail.protection.outlook.com (10.13.177.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.36 via Frontend Transport; Mon, 30 Jan 2023 13:20:47 +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; Mon, 30 Jan 2023 05:20:37 -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; Mon, 30 Jan 2023 05:20:34 -0800 From: Rongwei Liu To: , , , CC: , , Dariusz Sosnowski Subject: [PATCH v3 08/11] net/mlx5: return error for sws modify field Date: Mon, 30 Jan 2023 15:19:57 +0200 Message-ID: <20230130132000.1715473-9-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230130132000.1715473-1-rongweil@nvidia.com> References: <3ba49f25-52d0-fe07-02e6-22a71e0fbe13@oktetlabs.ru> <20230130132000.1715473-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: 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: BN8NAM11FT031:EE_|MW4PR12MB7165:EE_ X-MS-Office365-Filtering-Correlation-Id: dd6c639c-b8e7-47e4-6c66-08db02c4cd1f 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: aawPAZigXhcPhJYsQw09yVHdo6L2anU5d8dGRusoHcC3D4CD85gmr6Z+QXRIkCpRBhNlPtJyiiu2W6accTQeB4VXvUCSAHY2fU+rBG/Dl/Odk19+GjfaoV2gVurAagO2lpweFy/NMFKEDv2uQ3fkjhn4I3HS8cnKOZ9xXNKP1TT6Op2NtVr42pH5qRazJD6o9n/eAFWNSDEnwvSUWOsZg8eB2jW/8wLiIUNvcKwFEmQcb4QM6KMs3VZP0BNu5hlTGaTf4nQDxIhtenNpQvIXIykEmVFa79kFVJxMCo15L26T8ItoITMxdZ12wwpyI0inXvQP4ZqsJRETDU0/Z9xYXqxFF6l0y3pR2qN4NEaZzyL7JXBH5a0bZ2NBdlIFaVIjqPh+d2UkutYRtyFU1BL/6Enqx1SOloz1yeoynE0GVmfmAkHOqaIMAmDm0ihQO9859rwb5wkVq20jnKEjojsNVLUP3I/bniZIR+sDGaNOYlUZVJy9BdJS6sbVC10gfWPFs9wPVCNTuVXHaUxK5ivMDkuA8wPGghmekeoruXXU2Wzvy0aKqbYcrUGtyMaqrcKwi8Xt0ihDG6UX1beqkFRVaCCa8PVAFDwKzooK1eRhkW5Kke1QOA8hFnV9cn2F+NdcFVOZTdSiUAk82VvYOr3elFxfXt1GCBlLwRGKgDdcreVQCXCxurG13Sax+TsmO58I+Yu3oiuwUuOkzZEpwrCo5w== 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)(39860400002)(396003)(346002)(136003)(376002)(451199018)(46966006)(36840700001)(40470700004)(8936002)(70206006)(70586007)(316002)(8676002)(4326008)(5660300002)(16526019)(54906003)(110136005)(1076003)(2906002)(41300700001)(7696005)(478600001)(107886003)(6666004)(186003)(6286002)(2616005)(26005)(36756003)(336012)(40460700003)(426003)(47076005)(356005)(83380400001)(36860700001)(55016003)(82310400005)(86362001)(40480700001)(7636003)(82740400003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2023 13:20:47.9260 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dd6c639c-b8e7-47e4-6c66-08db02c4cd1f 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: BN8NAM11FT031.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7165 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