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 8E016A0501; Sat, 2 Apr 2022 09:12:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 646234286E; Sat, 2 Apr 2022 09:12:20 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2082.outbound.protection.outlook.com [40.107.220.82]) by mails.dpdk.org (Postfix) with ESMTP id 3A86040143 for ; Sat, 2 Apr 2022 09:12:19 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dxudlw6LbNU6Syt399VB1s/TdtEAUL9jHZwYcXxwHPFVoFBSSd2x4oc37CBLAf5600KWw8Bt9rXayan1Gs2xkxI9LMYvFDc7jjKCdytaQzgNDBzgI/wjWyktawZn3HMtQ7cYHZwiB1jv2T6TrjAX9mMFFdo9soHx8QI2f0Yd804kOVKJvn/MX1ndouJDdjCwfDgRiLFzpcgZPgOz8kQfqlqzOh8xILLlxKakWi8bS9CA5uT16dAJVr30PJHFviLsTjkg8yVIi/J4kkKjdCWIScm1GavS25nKI0RkosQ9ybsIBpVf4VoN43s8Fe4YD5rqQJiericZc5744UKCIj0s0g== 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=YAcUbHgFJTZ6xnLFQ4CuMiCp+TVntZlnEW3IEG1lbbM=; b=YaPWFHhRFpPrgutIt3TAephFpVxmi7vM5ScUwPtk+eEUY+Guz99uZydV2/EJTPRReGg3shqKwFKjRhqDn32NmncWcAyKAvCxJLeie7LkYon2tVkBTy64nai3yRIHf2zSsT7T1KlWMDRz0l/OYFZgPgef5SOVNC7mz7rgGCNCKd+BuLPWTN2uRzKGCy0l7D7Bnf5NtRlV24gsBmh58sMM3VHI6xAFilw00+VC+RhgPOGfGfVF9EvsMi8MrjBmt/N2uUdGc5idd3Q4I3WS1Wy5YNNIYb9nC+3cn9JeRjW/zVtngSp+nRqhhujFitCeChFJywW5EGhO4KDaxtHRJxU0Fg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) 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=YAcUbHgFJTZ6xnLFQ4CuMiCp+TVntZlnEW3IEG1lbbM=; b=akuPiZIo8Ps9T3HehLw0j31H/IoUsILdHi3o7Zf7iaV0lmjHRqZ94jQGSozDu3OLBgsPpeBYAGf/0Fk54U1xcmJ00iRc9DuKMm/ZQjYinPBEIT4IgTvmPyAT800M2gR3ODHH1eM3H2fV9K7d6KPhmQnSvskxH37iVV5TbHzqjIicEHAksZ4vfY0oNXjxrYmKyGs+zQgbN/pNKxxSSYxbJgkqklLZGZ/bJnDoz3Hqy4TKTKLxgS6LdB0HqPM9Tvmi0/i8w86WNsDU/IW2Gf8iKpu+SN4E90tYJs16NKlbw31ELymSoKGp5OLyc2dl76N0g6wJJ4RYlCyUQM9u9Kbhiw== Received: from BN8PR03CA0013.namprd03.prod.outlook.com (2603:10b6:408:94::26) by MWHPR12MB1936.namprd12.prod.outlook.com (2603:10b6:300:114::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.30; Sat, 2 Apr 2022 07:12:16 +0000 Received: from BN8NAM11FT048.eop-nam11.prod.protection.outlook.com (2603:10b6:408:94:cafe::80) by BN8PR03CA0013.outlook.office365.com (2603:10b6:408:94::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.26 via Frontend Transport; Sat, 2 Apr 2022 07:12:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) 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 12.22.5.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.234) by BN8NAM11FT048.mail.protection.outlook.com (10.13.177.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5123.19 via Frontend Transport; Sat, 2 Apr 2022 07:12:15 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Sat, 2 Apr 2022 07:12:14 +0000 Received: from nvidia.com (10.126.230.35) 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.22; Sat, 2 Apr 2022 00:12:12 -0700 From: Sean Zhang To: Matan Azrad , Viacheslav Ovsiienko CC: Subject: [v1 3/4] net/mlx5: add support to modify ECN field Date: Sat, 2 Apr 2022 10:11:49 +0300 Message-ID: <20220402071150.9392-4-xiazhang@nvidia.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220402071150.9392-1-xiazhang@nvidia.com> References: <20220402071150.9392-1-xiazhang@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] 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-Office365-Filtering-Correlation-Id: ecc00d43-3187-4f65-fd28-08da14781e0a X-MS-TrafficTypeDiagnostic: MWHPR12MB1936:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nyQVe/DmXALwAiHTE9hfcNnex28qiRlbcqBa8uuWIioUr9vw3e5oF1vch7ouah/RXVzpmIsmNCUVlzaWzAmrEM3gBGsM7Lz/KoJ1z9Uucc6BceacApRf6F58xUnZy4xfCSUI0uYon3N+kt/t2LGeebqesrqu1NCO+t7s4/yIj+2J79+cTiMh7RZ8uYFr/f+gXupX7ickdHoHQwui9WKpdnBDh9sJvHzKJGjiTlyLkx9BhLEswxnu2TmWinCG4dLcTfppdBsJYMu+7fHtkA6GjYb78QM6FH9BcLrXYBS1+WHJir6sMgAFcLrCA2Qemd9cd8H4L+7C8oFrO5gGyPzjLuSuE7lhx5+4/FNJwWyQaTDdclDk0hboPIbQKl7LeoTCtcaGqgAahK85v15iCGnmKk/p9Ima+60m+osUXfukHCzioqV2VcDmWzQi7pq7xbJVULH/NwzAsszR0HOrsEvj/eArzoJhfuKUQmaSKIQXyWq/D1Q0ycgD/haM+vtMCHZ7w394iYGDBvNeZBBU1Dsmh8pYFS+TFK35wv7efm8EyKwZSQjNNi+18JTLLa9NDJg0BCDb9Ss5c3sIuYWYgFMBb0/A7tNxzZ34ovqr4gTispm0OHO1wg3puu4t+qa956nNFtOw4oGvTPC3QAuPN3VfP5eTfsVcUNu5JmYSgYjkpkZYps5BR2iozutA2sPm6qwnOm4tIuliXP/q4zRHm0hSqQ== X-Forefront-Antispam-Report: CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(40470700004)(46966006)(86362001)(426003)(336012)(186003)(26005)(55016003)(1076003)(2616005)(16526019)(316002)(83380400001)(6636002)(47076005)(5660300002)(110136005)(8936002)(82310400004)(40460700003)(508600001)(6666004)(6286002)(7696005)(70206006)(70586007)(8676002)(36756003)(81166007)(2906002)(356005)(4326008)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2022 07:12:15.7295 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ecc00d43-3187-4f65-fd28-08da14781e0a X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.234]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT048.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1936 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 This patch is to support modify ECN field in IPv4/IPv6 header. Signed-off-by: Sean Zhang --- drivers/net/mlx5/mlx5_flow_dv.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 1e9bd63635..e416eb5701 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1449,6 +1449,9 @@ mlx5_flow_item_field_width(struct rte_eth_dev *dev, case RTE_FLOW_FIELD_POINTER: case RTE_FLOW_FIELD_VALUE: return inherit < 0 ? 0 : inherit; + case RTE_FLOW_FIELD_IPV4_ECN: + case RTE_FLOW_FIELD_IPV6_ECN: + return 2; default: MLX5_ASSERT(false); } @@ -1826,6 +1829,13 @@ mlx5_flow_field_id_to_modify_info (meta_count - width)) & meta_mask); } break; + case RTE_FLOW_FIELD_IPV4_ECN: + case RTE_FLOW_FIELD_IPV6_ECN: + info[idx] = (struct field_modify_info){1, 0, + MLX5_MODI_OUT_IP_ECN}; + if (mask) + mask[idx] = 0x3 >> (2 - width); + break; case RTE_FLOW_FIELD_POINTER: case RTE_FLOW_FIELD_VALUE: default: @@ -4825,6 +4835,7 @@ flow_dv_validate_action_modify_field(struct rte_eth_dev *dev, int ret = 0; struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_sh_config *config = &priv->sh->config; + 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, @@ -4952,6 +4963,15 @@ flow_dv_validate_action_modify_field(struct rte_eth_dev *dev, RTE_FLOW_ERROR_TYPE_ACTION, action, "add and sub operations" " are not supported"); + if (action_modify_field->dst.field == RTE_FLOW_FIELD_IPV4_ECN || + action_modify_field->src.field == RTE_FLOW_FIELD_IPV4_ECN || + action_modify_field->dst.field == RTE_FLOW_FIELD_IPV6_ECN || + action_modify_field->src.field == RTE_FLOW_FIELD_IPV6_ECN) + if (!hca_attr->modify_outer_ip_ecn && + !attr->transfer && !attr->group) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, action, + "modifications of the ECN for current firmware is not supported"); return (action_modify_field->width / 32) + !!(action_modify_field->width % 32); } -- 2.31.1