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 B5C74A0544; Tue, 7 Jun 2022 13:19:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D91DB42B6C; Tue, 7 Jun 2022 13:19:30 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2076.outbound.protection.outlook.com [40.107.92.76]) by mails.dpdk.org (Postfix) with ESMTP id 43F47406B4 for ; Tue, 7 Jun 2022 13:19:29 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H2uenDUCrdOFTmMtzVdrc7nJ+zJz9tpv87zuWHwvCFT7vnYyHj91Mk+judL+L9QRxoxj4MNI6yy9/Xp8sqnzzGnQxHh1QH1S/DkhyF9+qaZp2vBSBuIoqmnyshb1q5V4ITgQLejWGnYd4fg8FcwN/QRyb1W4z88iVa7To8hGTtg12E4uZ6tI5OBJ8g1udBdaxq3xzAK82dwR6rEiRlvdM8CKckByFqyxkOEWxH2cBl4Pf8FXQqSDCrv+m1dLbgpKM+cwPaFjPiyNIFL4EpLEMLyjUUhv/3SrlooqBQ/BfABt8Z9ckstqqwpxzkzVs3U0o1dw+oWUof6zK2aUOaCCjA== 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=uKpK562CUabwlO+Pr/0I1I0MZ3SOkF8ptzNzHH6miKI=; b=R6YYX/e8JI6DQ70lvvOJgNUupcfp55LJhbm9haqLujKLExuOXtdDBvZtbAW79kCz4ZhGVdoNfrfOTTCH1lZUDsF+WxxEf5MskGuHaC0ZO0B9glFv/3IAIPUkCEtkHwC8OJrc+hKHKPvrrGptChPf0UZn42lnlE+GSoQmINO4ixILBHZhr5v2+Tibb0i07i0aDFqC6pBVlPKThww6W/hnDRzHpS2jA/G4pwS+ouIFMscTX1KvLjJpblL6y4eBC6WwRdnsnYd0GycHDniPmWyW7Ay8hgoLmbtUdc+c+lYiAUilZkh3kBvOYS0Xbz+WfQQAHyZjeLeIZnrWCcRdgpufTQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) 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=uKpK562CUabwlO+Pr/0I1I0MZ3SOkF8ptzNzHH6miKI=; b=V9NMNTleHaaXLlYdFnbYtJYPS6XBRam3NmGoS5NbeE3K/0gqjI4WHNiqEuI58QwcIy5/I6qla+Sr/p2wqXu/DLmyzkDzztcbhVcTzHuRnpCge/g9CLulXfb+2qcpd0nbWAzK5me+wbWJ/cTgATaO8ul6Ocu6fu0ucOFJQjaVKNF70S3R1j8Rlxrs8AgfBEqqnm3W842HpxkEwc/yM0r/BMmEUDTH+kpFv+LV4sbgM8hemhSQrHZm1nrDiSwIuL1K0+TfqPEzYUqqPkKmJtRcqQdVcePbs0CB51S55JDWgr+JKSyHvF7uKjZ9ZV3Y+1RAVB8w0p8Utpa5YEXDfkmDSw== Received: from BN0PR03CA0037.namprd03.prod.outlook.com (2603:10b6:408:e7::12) by MN2PR12MB3023.namprd12.prod.outlook.com (2603:10b6:208:c8::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.15; Tue, 7 Jun 2022 11:19:27 +0000 Received: from BN8NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e7:cafe::b1) by BN0PR03CA0037.outlook.office365.com (2603:10b6:408:e7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12 via Frontend Transport; Tue, 7 Jun 2022 11:19:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) 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.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.236) by BN8NAM11FT032.mail.protection.outlook.com (10.13.177.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5314.12 via Frontend Transport; Tue, 7 Jun 2022 11:19:25 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Tue, 7 Jun 2022 11:19:22 +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; Tue, 7 Jun 2022 04:19:20 -0700 From: Sean Zhang To: , Matan Azrad , "Viacheslav Ovsiienko" CC: Subject: [v2 2/3] net/mlx5: add support to modify ECN field Date: Tue, 7 Jun 2022 14:18:59 +0300 Message-ID: <20220607111900.23432-3-xiazhang@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220607111900.23432-1-xiazhang@nvidia.com> References: <20220402064000.8772-1-xiazhang@nvidia.com> <20220607111900.23432-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: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: daf93f52-c2a2-4227-46b9-08da48779453 X-MS-TrafficTypeDiagnostic: MN2PR12MB3023:EE_ X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr 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: EH7CkARBpoqnxT87558mwhb0Yk5VwsByE/Wq/v3g9f4Pxn4VXMcG2nOTWTfjwCsSihLm3oHUrkPKh5T8BKsiQaCyQvPfo4ANb80MGq0Ttr7nMMwMfhpRQYrK09dJWdZp9aqNk5eJhpUKk6x4hpgajqhtTD4Wsx2Yw23SAwjWpzTpiBr1/lCe0FJQovGAHvM0Ax7vC7GF1VlxOEHTlvgfRv3Go4BRubolM+ZshDHY7jA79+0IZYpbs/sOEQ51zavglqhoWcMi1WL0nuQYUeDLiX3ACQC+qBtMbtT24jbuWlkyv9ENaJsdNQPBmkw60QHbXpfj5jFBpTL0O6LwOC8+rCz7Up2GseBfZXvkTcxFUaKnH+4VL1CJyWbegZM4LRo2Iivh/GRx2CcX7/C/svL2Ud1bqTrD5fBMF4wA8m2SfDGWrz6FVZT9mgvg6UqW8JLi4R4H23ZK3IYaWa47gjZfyCftt8amuZBtshgNP86HojVxn3G1nsc+1ab9hytNvPi0ApRjYP8/x3bEwHi2ZLLO5Qq0XzDslMh7Z8hO5tCJ2lBMSaxjvIyqJ/qDpo54dH0+1ALpef/QMh1Ihz1TlGKOgElTvN5WrrG5y7+V+nv0W6DP/MVPCThNpQluu1DJ9k1uC7tfu8BvfkbHAIr/K/EZ2MLECFrUpDK2KuXfQjtL7qkxGvIADd7sdymT8NZvcGxcFJ8kOmMkbAgwQX2kBaBmtw== X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:ErrorRetry; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(336012)(6666004)(55016003)(81166007)(356005)(6636002)(36756003)(2616005)(70586007)(70206006)(26005)(86362001)(5660300002)(8676002)(4326008)(7696005)(8936002)(1076003)(186003)(426003)(6286002)(16526019)(316002)(82310400005)(110136005)(36860700001)(47076005)(508600001)(83380400001)(40460700003)(2906002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2022 11:19:25.1421 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: daf93f52-c2a2-4227-46b9-08da48779453 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.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3023 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 Acked-by: Viacheslav Ovsiienko --- doc/guides/nics/mlx5.rst | 1 + doc/guides/rel_notes/release_22_07.rst | 1 + drivers/net/mlx5/mlx5_flow_dv.c | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index d83c56d..7ecf11e 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -93,6 +93,7 @@ Features - Connection tracking. - Sub-Function representors. - Sub-Function. +- Modify IPv4/IPv6 ECN field. Limitations diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst index d46f773..a2a8cf0 100644 --- a/doc/guides/rel_notes/release_22_07.rst +++ b/doc/guides/rel_notes/release_22_07.rst @@ -116,6 +116,7 @@ New Features * Added support for promiscuous mode on Windows. * Added support for MTU on Windows. * Added matching and RSS on IPsec ESP. + * Added support for modifying ECN field of IPv4/IPv6. * **Updated VMware vmxnet3 networking driver.** diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index a575e31..0f028de 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1450,6 +1450,9 @@ struct field_modify_info modify_tcp[] = { 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); } @@ -1827,6 +1830,13 @@ struct field_modify_info modify_tcp[] = { (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: @@ -4826,6 +4836,7 @@ struct mlx5_list_entry * 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, @@ -4953,6 +4964,15 @@ struct mlx5_list_entry * 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); } -- 1.8.3.1