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 D068E424B9; Mon, 30 Jan 2023 05:54:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4909142D29; Mon, 30 Jan 2023 05:54:03 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2052.outbound.protection.outlook.com [40.107.223.52]) by mails.dpdk.org (Postfix) with ESMTP id DA656410F6 for ; Mon, 30 Jan 2023 05:53:59 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=daPR6XBlBIBg2vJvmPeQWy1Im8jNwD7IZclVyuxPWAmKTwvet3kJ+LkpjLCz/X31nCHSbCLhZSrFuFNX+pAh6BqlyRb942qpMk9ZpwJIaRYxuJQj9TFcli7GZ03kiQKIlkEKmrjTMmInmj3m1rlnvX6bOwwINe+EBA45NhJNtK5I/97eg8A5dqHJN6fhhCVF11XdJrEGbgREIKNVpEFgV7YCAEfliiKESWIC6rjVj1E+VrcB9xqMLL//gwKWmFVX72NUsQYa2OboL8iWCa5svFGWIKnlQg/OT38oz4GJ2IWmdTYFEiQhWlHhzqkp7FR0LygD82JhGODQZnGlsGSP5w== 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=TbjfSJBETZ0hSgu/wzBcf0wtA0PY8AUmae3PHwwLifj2sLyMGK51yWljZTYqnznQ2E/7d3v1heg6uzlxIF2VESvdsPu0WgikntYyxhRdWkfz6xrXQ6/fkSgA7u03xThC0hSWs/I0YaJYtfhY00S1rfswBOs4a+PzY44Cs29JgdVjUMBQHvdeltVOfUPHvQ2O8McVNdpgzm1ZYS1UrPPP/+e9+FcRXrfpux06EWh20CMvKfUrK6x1+1GW1eV9tGW7/8Q5cnD0xT7vws/9aOFMDLlWEL/73oMf+8V32VPJK2itoBsqw1oJO6Kd46RBAZkzEJbACJpfAZBeBwojzSDJ1Q== 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=JUbq7eriwz2PQ8uTosZsB8MR1Zum9yUUxrxaI58b8LnSjtiSMuDmQGU1KQBhCGs5w0gtx+15hM9ND5MhmgqVVEHFXvl45SuFxXQEQ1/Xg9d4M3+KvTTYiomyYLqqV//PnqsEqCyuSvENsbtBc++1fHfZrJUcXOwo0uxYakGEPPCEGLsWZYiJKEzG3T12/3MPZ3WYOBhQv4vH2/led3hClGa4HXipulpoLsAIFAzFJ8rdBAVCm2WnN8oxYIj9pyXgFJaoKkiin12nRvY25n8T231XcrjOViq+DN4Pxsv0UmRWjZhYHu7LokK72QL+UzGRyQ+QTUqVb536w5cfhfkf2A== Received: from MW4PR03CA0262.namprd03.prod.outlook.com (2603:10b6:303:b4::27) by PH7PR12MB5855.namprd12.prod.outlook.com (2603:10b6:510:1d6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.33; Mon, 30 Jan 2023 04:53:58 +0000 Received: from CO1NAM11FT038.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b4:cafe::58) by MW4PR03CA0262.outlook.office365.com (2603:10b6:303:b4::27) 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 04:53:57 +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 CO1NAM11FT038.mail.protection.outlook.com (10.13.174.231) 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 04:53:57 +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; Sun, 29 Jan 2023 20:53: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; Sun, 29 Jan 2023 20:53:41 -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 06:52:59 +0200 Message-ID: <20230130045302.1560006-9-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230130045302.1560006-1-rongweil@nvidia.com> References: <3ba49f25-52d0-fe07-02e6-22a71e0fbe13@oktetlabs.ru> <20230130045302.1560006-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: CO1NAM11FT038:EE_|PH7PR12MB5855:EE_ X-MS-Office365-Filtering-Correlation-Id: 9917e5d2-e19d-47a1-d289-08db027dfefd 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: I0ADr5PsQBhtJpBvWUenAp8cslwSoQdwEyTYSophK6arFDMRjhf3u0ChbKi67/0uhC6IS5A55S4WnDdc2rP7FRA0NNqghnPyL2wTzCK1KwGeuYUSAVKJKzn3yJEBIGmu+vCCQpKJt+tCnSd8x4bVsmx6qftmLg6B2kuhF3vLLsDiQPSYS0oromwZ5sEnLGWqnIfU5Yewh1wY9C2lWN3he+vLTlbHVRNS2N8mCTIwiMBQgndOjcKoXH2cax3jKmdiwUO7rQ/vOQlUBjJ5cbUwgK+PCCFebjJ7Lz+sAAlZIhIOUYO5nVkV20zsNem+62ICa227OPNnGhS0g6mF/U8DH19CPbwQB0S6EdFCwJ4nzNXzZxdmhaTiFVKUPxj8sxcLj4WtD3sqbiV0bJM7RhvcO6QdjSiQA7lgVCv/a8MtdkdoiWIpQlRmwSRb1dFwxsSyIC0UWnC2CUZQ7F4CiZkEWcTMMVkufUHtgdBh1ZCtmpac7MD9UOnsXpnqPp+JakPM5etH4c736VKVvAH5Ug2dwDJy5KUzArvYtwFE7rZw9MoHh7hgyEsFin1dF6yQHHJwWyqcXS5hZNNSstcEMcdjApQhw3r4LdnjYFCuEricbPJ+rKHrRsLuu0yiEezXzooP714HqC1Hmc5sCOiCbjfGRdO/1b+K+IFzHN+pZSHeaOqdyOptoB2CZj/I2oP4rctZqZeEH1vJFH6WHF90ymduuA== 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)(376002)(346002)(396003)(136003)(451199018)(40470700004)(36840700001)(46966006)(356005)(86362001)(82310400005)(36756003)(41300700001)(2906002)(54906003)(7696005)(110136005)(6666004)(478600001)(107886003)(2616005)(8936002)(55016003)(40480700001)(5660300002)(316002)(4326008)(70206006)(70586007)(8676002)(83380400001)(7636003)(82740400003)(26005)(36860700001)(6286002)(16526019)(186003)(1076003)(40460700003)(47076005)(426003)(336012); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2023 04:53:57.4334 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9917e5d2-e19d-47a1-d289-08db027dfefd 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: CO1NAM11FT038.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5855 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