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 1418FA034E; Thu, 24 Feb 2022 14:41:45 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9B22D42706; Thu, 24 Feb 2022 14:41:37 +0100 (CET) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2060.outbound.protection.outlook.com [40.107.212.60]) by mails.dpdk.org (Postfix) with ESMTP id B0006426F6 for ; Thu, 24 Feb 2022 14:41:33 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h2wFTUOlyX2u5u5yn1LZqmiI2meH2cVeHKgSL/HtYFAzLgriEdUUaAVHii4X8i9TWV8tnVj8pTZpkGRVqJSDPH75PrfdpbQ+2iGKJ4BJOr25WyQ7iF4g3NmWhb8mBqTXzy9rNfO2rVi6YABe5dJp0XE/LPq8WJtfb3BA4608RmNK6NDHBLjzQAIQWgsZilhjrgjvPun3n2q26oYZApNoz8fonLT94Lny7cWRKZym2s/Mk9p0h23WxNRbsawXe01egu9760xHEF/bAq74qEaq2oY6rTpYtYYSfx2WYk7+DZRtsJoNwR7nWu0zvjl1Uc3Ow2NeJuj2RRjNZnagq/28lg== 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=ZJRwBTkzDZITW6T9WOfl7eVn6T5Kp/pUIHkXcYYAZ6Q=; b=OaOEixvRZn2rAV13mZfQVoWkoSjwf7c6xdOj22aBmxG33EYifXe6NK6hzQCy4u6Qiksa3+jP6CcVYcGiOBBvj6w+AS34SHhSmA4AoXXbaKzHT+sDt7xvWodllEUWbQNh1yeAt8l2k/rPfMcbuGzYFYNyvuG5Jk7L+n4bIvp6ihm8qpB897LUT5ud7YOpZTlXPbkQggGBhZsl8pJWEexnmx9PDkAPYEJFwNmpBD0ODfWr2ldafhh+frWoZX14XfPNQbaQm02rYopufzYJwvs6W0Mz1aC0y0zf+Ve5bmgAlp7rYwcF8tfBAT/oL0ctEJdIBIpsXq5/f6pjbIBhVVi7Cw== 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=ZJRwBTkzDZITW6T9WOfl7eVn6T5Kp/pUIHkXcYYAZ6Q=; b=DwgrV7zi03ejCIpw5nO209PU5nW15PTyjMeAFzy/Yn2K4/+7J8sAkHOKPAiBHUk0sOlwT1OrykOMEeHcoViJOf2wvB6LckMnTGFsmc7fkNnRnYk1k5clyYhCATPdno9/e1yQJZTZ9xEn7w/BsjDGO3MlxBN8Ad9hPRUZEpqNTeA6U88LUEljtSJrLRM7muT8c5q+2BzIxewB1fXsn0qmQbICB6a6POT+Edg/rwbCWxgKVGqv+AfegrbyOSjHCiyKR6YGs/yyc2LJLpqhJ43s5zLIQfIA0p+j4zdkddpVlP48kHitq9/on+NSSDeF3qD6B7QWfdgVD74BkKdjF0qUvg== Received: from BN9PR03CA0723.namprd03.prod.outlook.com (2603:10b6:408:110::8) by BYAPR12MB3157.namprd12.prod.outlook.com (2603:10b6:a03:130::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.19; Thu, 24 Feb 2022 13:41:30 +0000 Received: from BN8NAM11FT068.eop-nam11.prod.protection.outlook.com (2603:10b6:408:110:cafe::ba) by BN9PR03CA0723.outlook.office365.com (2603:10b6:408:110::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.22 via Frontend Transport; Thu, 24 Feb 2022 13:41:30 +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; Received: from mail.nvidia.com (12.22.5.236) by BN8NAM11FT068.mail.protection.outlook.com (10.13.177.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5017.22 via Frontend Transport; Thu, 24 Feb 2022 13:41:29 +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.18; Thu, 24 Feb 2022 13:41:17 +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.9; Thu, 24 Feb 2022 05:41:15 -0800 From: Suanming Mou To: , CC: , , Subject: [PATCH v4 03/14] net/mlx5: introduce hardware steering enable routine Date: Thu, 24 Feb 2022 15:40:40 +0200 Message-ID: <20220224134051.18167-4-suanmingm@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20220224134051.18167-1-suanmingm@nvidia.com> References: <20220210162926.20436-1-suanmingm@nvidia.com> <20220224134051.18167-1-suanmingm@nvidia.com> MIME-Version: 1.0 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: 68ddc1f5-6327-4d40-0e07-08d9f79b5d37 X-MS-TrafficTypeDiagnostic: BYAPR12MB3157: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: bK4YNoq5hkRg6nV2uJ8nJ/ydpgXiqkz3CFYt2HVMQHbswFOHlMMt731V99enqOGzJi31rEe+gl4zOZjcAKAWHQM/tUsdC5rBt1+zsj2x0Cu5wFhOZuFc3nggA8FU7f4MhDaXWwHXD+687jb5CcmZgT/lbUfcYNG58wYREtyqJKq3bbSJCZxH26fQx9rZvKMExvvP/FF9Zm6sek3Ui719YlyXQLHHMGmE+ILFYAjIwD41wyjJ9d7nRHSe0EeCsVOc7vKdi/qql1qXY3W+wpTA4cJaKlTnCSUJwbgjdbnRF6EtuaP9ijQwZGkLVwLbWL/+azEkx84FsrDxJUbrRrqt14HcP+ipdnC4SR0FQ/UOhA9Be4GfFv2mePcyXX65jrx1ezv1l4RmaBIw7WGYJyKHcJRKkEH1LdYiYt3IplpYOBNxavXCCNGpQMZFQ2m8aaZtlqhGdYDLv6kVblOjKu0I/8f6q1zBnSvHAcJuckcCdCqJ+BYsfsN+bU23cST9CFY6pyMrcLXhwKMVRUP+ZyWy/jJlFzM2YkdrPlAsv4ei2GBWtdjmeHI2XkHZxXEXfQmCeZw+y0lNo6rTpa+JDEkZPWIOqW5RlZ4xddJ3h7YDzAtyJMZJtakgLKHBc2MFIYjNIMp1mcN9ZrJCPaKAn7cb+LMyhVKpsdC66Rl3tHTaXJJAod9lSm4OPFi8N8Cn2vzsq+Ybb6jlN92qQVfSh67yjnMPT29h/gdZyopNsdFd3uQ= X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(83380400001)(47076005)(2616005)(7696005)(316002)(336012)(426003)(8936002)(36756003)(2906002)(6636002)(26005)(16526019)(6286002)(186003)(1076003)(356005)(55016003)(82310400004)(6666004)(81166007)(36860700001)(8676002)(40460700003)(70206006)(54906003)(110136005)(5660300002)(4326008)(86362001)(70586007)(508600001)(36900700001)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2022 13:41:29.7235 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 68ddc1f5-6327-4d40-0e07-08d9f79b5d37 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: BN8NAM11FT068.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3157 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 The new hardware steering engine relies on using dedicated steering WQEs instead of direct writing to the low-level steering table entries directly. In the first introduce implementation the hardware steering engine supports the new queue based Flow API, the existing synchronous non-queue based Flow API is not supported. A new dv_flow_en value 2 is added to manage mlx5 PMD steering engine: dv_flow_en rte_flow API rte_flow_async API ------------------------------------------------ 0 support not support 1 support not support 2 not support support This commit introduces the extra dv_flow_en = 2 to specify the new flow initialize and manage operation routine. Signed-off-by: Suanming Mou Acked-by: Viacheslav Ovsiienko --- doc/guides/nics/mlx5.rst | 13 ++++++++++--- drivers/net/mlx5/linux/mlx5_os.c | 4 ++++ drivers/net/mlx5/mlx5.c | 7 ++++++- drivers/net/mlx5/mlx5.h | 3 ++- drivers/net/mlx5/mlx5_flow.c | 22 ++++++++++++++++++++++ 5 files changed, 44 insertions(+), 5 deletions(-) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index 34be031360..92127675a3 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -943,10 +943,17 @@ for an additional list of options shared with other mlx5 drivers. - ``dv_flow_en`` parameter [int] - A nonzero value enables the DV flow steering assuming it is supported - by the driver (RDMA Core library version is rdma-core-24.0 or higher). + Value 0 means legacy Verbs flow offloading. - Enabled by default if supported. + Value 1 enables the DV flow steering assuming it is supported by the + driver (RDMA Core library version is rdma-core-24.0 or higher). + + Value 2 enables the WQE based hardware steering. In this mode only + the queue-based rte_flow_q flow management is supported. + + Configured by default to 1 DV flow steering if the driver(RDMA CORE library) + supported. Otherwise, the value will be 0 which indicates legacy Verbs flow + offloading. - ``dv_esw_en`` parameter [int] diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 058c140fe1..5b91e057b2 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -482,6 +482,8 @@ mlx5_alloc_shared_dr(struct mlx5_priv *priv) err = mlx5_alloc_table_hash_list(priv); if (err) goto error; + if (priv->sh->config.dv_flow_en == 2) + return 0; /* The resources below are only valid with DV support. */ #ifdef HAVE_IBV_FLOW_DV_SUPPORT /* Init port id action list. */ @@ -1535,6 +1537,8 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, priv->drop_queue.hrxq = mlx5_drop_action_create(eth_dev); if (!priv->drop_queue.hrxq) goto error; + if (priv->sh->config.dv_flow_en == 2) + return eth_dev; /* Port representor shares the same max priority with pf port. */ if (!priv->sh->flow_priority_check_flag) { /* Supported Verbs flow priority number detection. */ diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 9760f52b46..baa4ae75f3 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1199,7 +1199,12 @@ mlx5_dev_args_check_handler(const char *key, const char *val, void *opaque) } else if (strcmp(MLX5_DV_ESW_EN, key) == 0) { config->dv_esw_en = !!tmp; } else if (strcmp(MLX5_DV_FLOW_EN, key) == 0) { - config->dv_flow_en = !!tmp; + if (tmp > 2) { + DRV_LOG(ERR, "Invalid %s parameter.", key); + rte_errno = EINVAL; + return -rte_errno; + } + config->dv_flow_en = tmp; } else if (strcmp(MLX5_DV_XMETA_EN, key) == 0) { if (tmp != MLX5_XMETA_MODE_LEGACY && tmp != MLX5_XMETA_MODE_META16 && diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index fa27f65a36..d36d679625 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -287,7 +287,8 @@ struct mlx5_sh_config { int tx_skew; /* Tx scheduling skew between WQE and data on wire. */ uint32_t reclaim_mode:2; /* Memory reclaim mode. */ uint32_t dv_esw_en:1; /* Enable E-Switch DV flow. */ - uint32_t dv_flow_en:1; /* Enable DV flow. */ + /* Enable DV flow. 1 means SW steering, 2 means HW steering. */ + unsigned int dv_flow_en:2; uint32_t dv_xmeta_en:2; /* Enable extensive flow metadata. */ uint32_t dv_miss_info:1; /* Restore packet after partial hw miss. */ uint32_t l3_vxlan_en:1; /* Enable L3 VXLAN flow creation. */ diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index aec14ea39d..ef7f2ceaee 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -6849,6 +6849,15 @@ mlx5_flow_create(struct rte_eth_dev *dev, const struct rte_flow_action actions[], struct rte_flow_error *error) { + struct mlx5_priv *priv = dev->data->dev_private; + + if (priv->sh->config.dv_flow_en == 2) { + rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, + "Flow non-Q creation not supported"); + return NULL; + } /* * If the device is not started yet, it is not allowed to created a * flow from application. PMD default flows and traffic control flows @@ -7345,6 +7354,13 @@ mlx5_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow, struct rte_flow_error *error __rte_unused) { + struct mlx5_priv *priv = dev->data->dev_private; + + if (priv->sh->config.dv_flow_en == 2) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, + "Flow non-Q destruction not supported"); flow_list_destroy(dev, MLX5_FLOW_TYPE_GEN, (uintptr_t)(void *)flow); return 0; @@ -7442,7 +7458,13 @@ mlx5_flow_query(struct rte_eth_dev *dev, struct rte_flow_error *error) { int ret; + struct mlx5_priv *priv = dev->data->dev_private; + if (priv->sh->config.dv_flow_en == 2) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, + "Flow non-Q query not supported"); ret = flow_drv_query(dev, (uintptr_t)(void *)flow, actions, data, error); if (ret < 0) -- 2.25.1