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 8F0C041D49; Thu, 23 Feb 2023 08:07:41 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C578D430C7; Thu, 23 Feb 2023 08:07:17 +0100 (CET) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2078.outbound.protection.outlook.com [40.107.101.78]) by mails.dpdk.org (Postfix) with ESMTP id 39186430B5 for ; Thu, 23 Feb 2023 08:07:14 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G/1nsYBvVFOyc36WWGpE6jZdTJ/X5AHwiuzwLs+lmlVKswoKeQ3KGa/P+BSF8NjKGGMLo/DNaGH7BpGZiCDBEIvOItlK1zoKLNiVL/OSAzackY0Xp2/6ErmjcNPKij2AhTjcHSJ0ScCs6eASqgpSrD2cf+UP/nV8QJO14KJAvUeENMOA0YnDPSERkQ5UApysgmLmq7xU5LF27XO6bNLcHNI1uwXYws7LL2Grn+aj3Hxyr1Yh2L5KhBzx0/PqUBbzhHknnlx3B1bfLimLBYHSFYbi9plUCTXWIA+SqUsC6E49q9oNF/pNLlPLY/le2LjDpUibajYIM0mv9EMpbjDfSw== 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=ImUr2PJd1xtnPZ/FXvDbf/EQidh6Jg1eLYhW9g1RVUuCOIdIJtdwaLzGePam+KsfjsKdFTz+JCv+CaRsZsdFYkig8nfiF9iWLkILN03M22b89O8YZRVVwVy5UOiHS6jxKx5iTBN6rrwu4NHgGSCR2ycYZDsUtUVSYcJtc7oIC1PowVzuSoLxwvzNi4JOMo1jdf/lK48GU0PJG/CJrjq0GcTe12qRsgEW7mFm/9Ng50Sdmew7w7z6A6z/7R5Rl4Rvk9tlAHghjbXeML7HcWHXJOwuFcvF2CoAkBT6ShKa8rUWNxpr3opcJ8lyDNSSOV4P79guY8UsKaxNTUuXfZpK6w== 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=Lr2qtN/pbNRv1rjNue/ugF4dZhfXTMtQ1Lr0INaKyDAhgil51AKhFDLSXoYMRS5R1koUvwIKqpb1CcUR+4yb1HyeUKdera1ImkOmWSl8SbLccIgdZO/rtfLpBa57o/xv/71AapoVX8oe4KoJzzRW0psPAf5ihdgtWLjWZGGd5bGNQAnEasBJjO5qfCouBbXn318FbZBUOUf1vAc3gs/tkolZcqok+t/Zowrg7bS/TCEmeP+K5nQtxe0O/0u9KBIC+SyAEp3Vzn99gyJ254nGPMzQYsN4Bn00+lZ3CQWsuiiGF680lH4aIL2q6ZGIYiYQ+RsPJid8LpG+2m+4BLoNHg== Received: from BN9P221CA0028.NAMP221.PROD.OUTLOOK.COM (2603:10b6:408:10a::10) by MW4PR12MB5668.namprd12.prod.outlook.com (2603:10b6:303:16b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.21; Thu, 23 Feb 2023 07:07:12 +0000 Received: from BN8NAM11FT033.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10a:cafe::9d) by BN9P221CA0028.outlook.office365.com (2603:10b6:408:10a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.21 via Frontend Transport; Thu, 23 Feb 2023 07:07:12 +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 BN8NAM11FT033.mail.protection.outlook.com (10.13.177.149) 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 07:07: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, 22 Feb 2023 23:07:00 -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; Wed, 22 Feb 2023 23:06:58 -0800 From: Rongwei Liu To: , , , , CC: , Dariusz Sosnowski Subject: [PATCH v3 5/7] net/mlx5: return error for sws modify field Date: Thu, 23 Feb 2023 09:06:31 +0200 Message-ID: <20230223070633.946328-6-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230223070633.946328-1-rongweil@nvidia.com> References: <20230215115251.3924578-7-rongweil@nvidia.com> <20230223070633.946328-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: 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: BN8NAM11FT033:EE_|MW4PR12MB5668:EE_ X-MS-Office365-Filtering-Correlation-Id: 7378c1f0-c7ca-4d9c-440c-08db156c9600 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: RrjuS+ApbAf1tPvAcwrcjS0zGO23tY0TYoGDO2rvho22LlVaZP7PAqPimOqYHJ+1ZQJqfjMDmSadKs50JfCVNM8/1arG8DQGxoNxY83mhT3OZSx5eREnUUV+Lio3txeF6ulOC+cyxgJGXeJUsOSFjIRlVaiOa3pyNZS1VSmsQXkhiKaex5vBlZX/lfylHHg51W+x3Z7VfyBNs0TuZQBT5xZd6bS7UJAs3mHCcnDpFV6h1F7fdiTdBRTMT5UI03cAMnjMMajd03bO3PogBLi4i9FxlDZwYf0ncA2IXDy/zxQcarhdkMkd4mUC866UtwgAb1DiqB2LdO0YS4ewyfa7HvPaw2gc+PJyJslTs0jp/uR8h4yEbDirea/HfD5LHHlDz8l42KnZcJadIDBmBZVG0PnDjsUhWlXuy6GiA34Uw5Q90HiwdHnpFNBhG7+z4mOxynahD1ZhtgTPBtcJFctr3OKlY1x1LAskzqskFCGvk/Tbij3kjf/OjF60Yl1cU9gLghvjHIvSLsPDGUBr4hpdrvdNpWp9fB0RsreCeQTeZBgFVKRMx+0NVcinm9as1OTukcJSTZFvwdS8c2iKqYbJfkq5mbwcvhRNNV2xX+iREcr54nOM6lAXP+d27AKNe0VupWTZZK32LuMU7WuNfrWN9uHb4ILRV6fK9ZIRr2ibWprjtH+8yDP4KFyOs7vBfEj5PJ1gI9Gh8blsZ+TpHs6PMoI/ZVEj30Zn/bNpv66ERKA= 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)(136003)(396003)(376002)(39860400002)(451199018)(46966006)(36840700001)(40470700004)(40460700003)(70206006)(70586007)(83380400001)(54906003)(110136005)(316002)(8676002)(8936002)(34020700004)(5660300002)(4326008)(41300700001)(6666004)(107886003)(1076003)(2616005)(16526019)(26005)(186003)(6286002)(47076005)(426003)(478600001)(336012)(7696005)(356005)(55016003)(40480700001)(36756003)(82310400005)(86362001)(2906002)(82740400003)(36860700001)(7636003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Feb 2023 07:07:11.8433 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7378c1f0-c7ca-4d9c-440c-08db156c9600 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: BN8NAM11FT033.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB5668 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