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 3E64F41D50; Thu, 23 Feb 2023 13:50:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 94BA74322F; Thu, 23 Feb 2023 13:49:40 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2089.outbound.protection.outlook.com [40.107.243.89]) by mails.dpdk.org (Postfix) with ESMTP id EE4074321C for ; Thu, 23 Feb 2023 13:49:36 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KYk8gyMS9tqOONfF+276dFo/5qgQEUmSg6GA6BRSY4m6yDibLfqsdTmOvIDCV7skHBgagn9DqyoSHCw68AnCMYDNzhXMwk/eRAMOC57LUNwE9hiM8KZ4QZjjd8j6BXWFjyvQ/NpBKoW65W8kqxkbt1Wnx2qzuEpMemKCiWWKVj+20XMk0p1aDTX26eYKKKmVg5QwauK/t2rJpC5VwfrF1FgTA4M7B/MSsEH2+oxzSlhQPEcsiBgAJBhAoWvCdciLr/59h4vPGqS1IzL4f1M4KZQ/GmxhIsd7iwVu6P7qgUWR27xZEwQnsDKAr2VfBpzTZLADvKqRJZSC3dliWk+JIQ== 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=Kzkb07908cbK350vhMquGSxLvhWE7fd6QOHwfinIeuK9DwqHKAG4FQYccORgE3boGqNurD8ZVnClNSGeUU5TyPR0CZNQR1yK1+bClvEdXyZ6oyGlVLUvusUvzAzj/FQIHaHCiJo1PoRG90sOyd3ypqQNiiO/7qmumWfGD1d4y0y4V+xggt+kpp37x4oHR1vTwBNbTWGvANnWEYUH71nwyjcdahyP/L1xdkQLzG7ROhIRwqzvlq3C8fqxMYPsscMEyAZ+OVUyRxC8V2f/zTiFAFPMqCcWu444KaDtuaS66wJfcCJA1ufNfxXISHxUuQ+pc15MSsEBrJfFhO++aanOCA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=GwGqVmy5M5pzasfdzuI+8yBQC0dh0GEArnKeGbRXhpa6pWM/NB64A7UFjYjkP7JCNyQ4ELnFqZA5kv6Vm3TEHcT6g9UaRp5VfH3oy9NCjb4Wk1zMutaUviZdxefdVctU1ETyKaXCdvybqqLMe1DgC/jxYnUFxSgABUy8ZbGWCVNnVpsjlIWrWK495dQobJKH0vsEaxz9uphiwBcpMpG3luivMMtE3NW00xFGS46IxM2VbyRVJai4ERTwBZ0esCmEelYMNxp0QkYVb3iYyLJsX3Te2DTnbjPLJ2vXi0248MokpM3Yu1CDNxoRCH/cB92/Ub33JANpwIF671iTIXgyew== Received: from BN0PR04CA0070.namprd04.prod.outlook.com (2603:10b6:408:ea::15) by PH7PR12MB7916.namprd12.prod.outlook.com (2603:10b6:510:26a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.21; Thu, 23 Feb 2023 12:49:34 +0000 Received: from BN8NAM11FT003.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ea:cafe::49) by BN0PR04CA0070.outlook.office365.com (2603:10b6:408:ea::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.21 via Frontend Transport; Thu, 23 Feb 2023 12:49:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN8NAM11FT003.mail.protection.outlook.com (10.13.177.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.21 via Frontend Transport; Thu, 23 Feb 2023 12:49:34 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Thu, 23 Feb 2023 04:49:24 -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; Thu, 23 Feb 2023 04:49:22 -0800 From: Rongwei Liu To: , , , , CC: , Dariusz Sosnowski Subject: [PATCH v4 5/6] net/mlx5: return error for sws modify field Date: Thu, 23 Feb 2023 14:48:57 +0200 Message-ID: <20230223124858.1042097-6-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230223124858.1042097-1-rongweil@nvidia.com> References: <34229594.ATrlOLLGV9@thomas> <20230223124858.1042097-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: BN8NAM11FT003:EE_|PH7PR12MB7916:EE_ X-MS-Office365-Filtering-Correlation-Id: 59a00367-406b-4a39-29bc-08db159c6a3c 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: +BFQT8SD8ro+m8uksZAvV9LWG83NsaXVVmjweiPADe8A/ZdyjN/ijF8hipvM4omdMmA17S0jUQTjel4Fs29wx1OybloCQBwn3UBzpggHOW5RlzYdsh2RJEbZKVPAe195i98z/JEwiuaDJMxXThvNuOdYo8IMRu8pXT7rOhlKDOCBA5LGrowbpiV7hexNDnKtPsipxhQ737PbPPl0mws+ez45U9WqrFiIkiB6RgXyHlVO2VhjyY+G0rnhuVmakVHhEBr6G46id8CtcZy42lMOc//kep5xoYTL9dnmvWqaGwhGZAF9MMjw6Zm4CA73SOEFD/y6p70lFBacRlSsoU/BCbVxaFP/1wgn8dEluBmfkMRH5FnZE15BQaX3l9y05QGp5mKCq/EZz+L7xTIyrFo8bTqvvEQ4TH9FM9VTInbCf2dM4XfCqNBffwznilkqDJwIXM9546fBUS6GWHqIymjq295HEqXpK3F4JuBI3Fk/7AtWJyveNi6j0fzXw66SAsxny2H2G9waQWIG5p6/N0hYM6MGEWvxnAX1SrrEVBVggwqsZDCKtI3oqkX7edqFxo+tRV93ApAycb3WePGXXDs6HI0pxYuyzbXZkyvt+BJApnyiloSatm/uCdtYBmAAwtS6XzvnacxMsmC+o/72qTCIuR8rIYJQDAmHaprEnT1sp/lJpjhE6rzEeqP98oO88rWJtwyLaemJWJc4BVXWt+iAWEHN/aiTwz5aWBmw9gDj1N4= X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(346002)(39860400002)(136003)(396003)(376002)(451199018)(36840700001)(40470700004)(46966006)(6286002)(82310400005)(36756003)(16526019)(8936002)(2616005)(5660300002)(8676002)(316002)(41300700001)(40480700001)(40460700003)(55016003)(336012)(26005)(36860700001)(86362001)(186003)(34020700004)(426003)(2906002)(83380400001)(47076005)(70586007)(478600001)(1076003)(107886003)(70206006)(6666004)(110136005)(54906003)(7636003)(4326008)(7696005)(356005)(82740400003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Feb 2023 12:49:34.2435 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 59a00367-406b-4a39-29bc-08db159c6a3c 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.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT003.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7916 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