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 6418941CA5; Wed, 15 Feb 2023 12:53:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F1A604303E; Wed, 15 Feb 2023 12:53:36 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2049.outbound.protection.outlook.com [40.107.244.49]) by mails.dpdk.org (Postfix) with ESMTP id 4A8384304C for ; Wed, 15 Feb 2023 12:53:36 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j1yFtn+AeTXJ62QId8lm3K9CfBppV5Yaw2d1pQlRsL6PUgCv8souS8QV/i+Cj5qYciAqjkErMGnGqtb7Vg9DvaRPjFPS9RlMknYTE9+sZKnlbFHVDuVoEcUDcQoqCPARePcXGUJbr4fvkUOCG5JLSCPP0rgRiCrxwHjHqvWK2IIry8pEeTK7xrm+1m3UqMeBOf326yKus8jnmByOAuYB/5GxuEvsa5e2TADAhrOhbenTnOXRSfZ5KiaMkxYUrH0P8O38K6JpE9hmzsA2WiP01oTBJJOMQBHuXwkHtKEmi7m8FIFs8KUn6maLxWZvJxU/u5x6VQl9eb4/W1Su9Mz4Lg== 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=K7wvaYlHLpdVc5r2VqQCgY5rFxyNIekBp5MQbmzMiYhQy8M5+s4RjnJ5jZ7khZcv2EnTmwhSefwpp/NVciaZ84Qe6UhJFpMP2imVpE2T9maYPTQ8okxC/4UO9Enfi/Z6iSc7Uuh3p5jjAPLV9Wh4wo2ymA0w+QTPJy3BDwjx0fGalmHeQrEtFBU3l1UIAJ480OB/cCWIujpIWq1V/JN394PqFV0dTj0xSzFMXpMgL7t6bnyNxQM4Qey/vsixem8HfHaO0o5cEKKAh61DAdxOHoURWUrJSrim1TqFnq9zBU4ZwqzSDJ8WSx0gKnwmbCl+F7GQTOCr2jrTQ8pqbfRFWQ== 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=SqOqXA5QqfUGXu/ygJpJfUaGlNku9wy7WMvJ1pnit6/KUHw/6WVu8i44CBLJtc/fT6W+4AWg7MwNlxRk/DqgEQt+vzvAE/QUxHXHQgcFNDmgmAvfsvg9OUaUJgwBZR9LLbjRCwKg4sBMK1xJa9hvCTMUNGJnqWcDDk2ZRnxFXyJmyqW+NzMtshOWuAmKoGoMUhwDddN0fml1lDS8oHykbCOcP8y24jQeCXP8TiaLxIoUK8BwHiOgl/DZQFl6wJu+VKh1SQP8EQUFcu1spYPrwXMIfbscP55V9hKPKFqkdtJbcDBamMm/buUNJdhbzHQnv8xR+H+QgMe7lM8wK98PbA== Received: from BN9PR03CA0260.namprd03.prod.outlook.com (2603:10b6:408:ff::25) by PH7PR12MB5832.namprd12.prod.outlook.com (2603:10b6:510:1d7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Wed, 15 Feb 2023 11:53:29 +0000 Received: from BN8NAM11FT054.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ff:cafe::c7) by BN9PR03CA0260.outlook.office365.com (2603:10b6:408:ff::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26 via Frontend Transport; Wed, 15 Feb 2023 11:53:29 +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 BN8NAM11FT054.mail.protection.outlook.com (10.13.177.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.12 via Frontend Transport; Wed, 15 Feb 2023 11:53:28 +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, 15 Feb 2023 03:53:19 -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, 15 Feb 2023 03:53:17 -0800 From: Rongwei Liu To: , , , , CC: , Dariusz Sosnowski Subject: [PATCH v1 5/6] net/mlx5: return error for sws modify field Date: Wed, 15 Feb 2023 13:52:50 +0200 Message-ID: <20230215115251.3924578-6-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230215115251.3924578-1-rongweil@nvidia.com> References: <20230215115251.3924578-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: BN8NAM11FT054:EE_|PH7PR12MB5832:EE_ X-MS-Office365-Filtering-Correlation-Id: 76d8a676-8443-4db8-c35e-08db0f4b40fd 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: Xc+XgEDM9vkX7Nyq5M3twHIdc7kMA7KHdIT3yWw2AF8GOLEARQQ8H3mwBYLE/Q7qf9uMevxLzqw6qWIhefI9YWd3LWOq/mSaTjuN2Q2h3aDdf1L1Cp8vcu1JaYPXRRjCmRoW7eJCbG/Irf3ToIMd6uhwjCfzNWKEXpO3HsMCUe0YH1JFeOkkFf/XfwaRcs5w4xHh7RRqqURDA5Db5Crh3bZlM7DvCKiQgAaIdTNp4lG/Tb+nFDcn987/Qn5os+kmT9vvZtPcGAELQAwQgF2iWEH9JtIv+PxK9TvWhfLKdrOP1h4sjIWZZ8gmkfM+iTUZ5w50kbsWcIFrFGa40iBGno4O9xmoYgWF2a6V2b+u6JpqzrC6M1zSCcgyd6HyqAOrKQ6RoyqoUZWbKhGYSEOBOfGfsFUvEba6UebNl3Jc6GA4e7Ltt8yRDL9FpT0XgsXoyQXOBGzUnBpj/iLMrJ0cF0rit/t8DKJXQPhs460XyWHiBkQejWUSrgeF/Dg3DidqiM5Za81MqonEaSPEguEv1rrAcJ83OdFAJQp2XBazR9+1KDHOqx8aOrAFay9RUC8dGhjucRpzpgr7yzOxyrMFfWSPZLzrGS1BgjHYA1d+RbhTfl6dyx3YRsvwGFJDHKspYmzD69mV0E2JgtR4HvJEs1BK0wTkI6kzeMaphK45Puedyi4xw0UF3mZHta9ctAxNtYrqJl+/0V7MjJ5b6XKxhA== 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)(346002)(376002)(39860400002)(396003)(136003)(451199018)(40470700004)(36840700001)(46966006)(83380400001)(7636003)(107886003)(36860700001)(478600001)(6286002)(1076003)(6666004)(186003)(26005)(54906003)(82740400003)(110136005)(7696005)(16526019)(70586007)(70206006)(4326008)(36756003)(8676002)(5660300002)(8936002)(356005)(316002)(426003)(2616005)(336012)(47076005)(86362001)(41300700001)(2906002)(82310400005)(40480700001)(40460700003)(55016003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2023 11:53:28.8362 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 76d8a676-8443-4db8-c35e-08db0f4b40fd 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: BN8NAM11FT054.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5832 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