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 3D3C044144; Mon, 3 Jun 2024 10:07:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 205BC42E33; Mon, 3 Jun 2024 10:06:06 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2078.outbound.protection.outlook.com [40.107.94.78]) by mails.dpdk.org (Postfix) with ESMTP id D2B6542E12 for ; Mon, 3 Jun 2024 10:06:01 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ldrYKByvmHIukfhwjrXv/wMM/TB7AjPdb1TwDPTFcgUZ3zt1UYfNYwEY+E4+kRQg21cDRq2WULmgpxKQkGyTFBH/neXpHpZRIeLqOgSXM9FActxaxxDaypY8L6Brz5lefExt+i1QGtOFqLy+raTJDj6J4CRrAzYS2sVYlc1vsITFcUj6Mm+dPZ8K3/DduWk1IgG1G+k8n+YS7E9WHexAirXmNBmxBUY+vIyaOwYoknKt3BVjjc0u4PXWyJ4vRLG2Y7ITTAKuu56ORkX4kd4ENkSjGc2se7jC4s0UFqqbljqtQtO7XmXFsgZLvo4cqJ8ueOjeiNecgwyaWMk8KPTxOQ== 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=lD6nAkcaegVozBlzausGWWWBeLKKoJZMv0Ym/Fr/4pA=; b=CeVnykLV1TXV0xFEvDX+3P5JJW8NG6qQIGmoQA8SPhhoco1p89x1G5m/OxdQNDWUJSS3MrhqLb/ChjbRtzGJhr+s/O6TkDluj4eajBLoN0pWuaphrgmThzkAJENnjI44rjdedY16af7H53xpWLyAB8tbHd+k05w4zRJDhncN4jK1NkTLCcwNqnyNdXBYpUmeg/fdsRLsGpSplBHJGsSL4mSJJv1OogQeIXTBbJnhNB8p8DIVP+XJ8lM+k0uaeT8FY8pnkqe6OLcD2wzssM6VNeVhhsYsgkxoviFhIGM+WVROGBsXjks6kAGi+Nk1PXVj3rZfJf+m1tFKNsffe0aelQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) 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 (0) 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=lD6nAkcaegVozBlzausGWWWBeLKKoJZMv0Ym/Fr/4pA=; b=p9YM+SiUCOi5FQK70hGDuVNWW6SQRddyyn3drXxEErIruNgqRCeQ1WGcC27UyTAGE2mvxlEXVDxRgJQBqTzXHuWtmCzGKnyBCWu0Q7VFNTFxwmwlbzYDKxmAdKuRfPS6ygo1L61hjmaIFGCZ6LSrbTRZ8P+BNA6cAK13iPwMDBxBzh1t+DithEfWm7Q42oO946hCNXOV+DisCyDQ71wI2+qnZg4pC3nTs6MDGaCNJuV74bjpyvBtBpmjfxYYYli5GaRrB5ll8fmgCZnmD0k5HHAARWv7JfbTmjAU+VhSLezVuQ4LKv0EPc1H/x92g0v7G2s7wazsSarKyHG8UGHMtA== Received: from SJ0PR03CA0343.namprd03.prod.outlook.com (2603:10b6:a03:39c::18) by IA1PR12MB6092.namprd12.prod.outlook.com (2603:10b6:208:3ec::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.22; Mon, 3 Jun 2024 08:05:58 +0000 Received: from SJ1PEPF0000231B.namprd03.prod.outlook.com (2603:10b6:a03:39c:cafe::c1) by SJ0PR03CA0343.outlook.office365.com (2603:10b6:a03:39c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.27 via Frontend Transport; Mon, 3 Jun 2024 08:05:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) 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.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by SJ1PEPF0000231B.mail.protection.outlook.com (10.167.242.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.15 via Frontend Transport; Mon, 3 Jun 2024 08:05:57 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 3 Jun 2024 01:05:50 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 3 Jun 2024 01:05:49 -0700 Received: from nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4 via Frontend Transport; Mon, 3 Jun 2024 01:05:47 -0700 From: Maayan Kashani To: CC: , , , Viacheslav Ovsiienko , Ori Kam , Suanming Mou , Matan Azrad Subject: [PATCH v2 15/34] net/mlx5: initial design changes Date: Mon, 3 Jun 2024 11:05:04 +0300 Message-ID: <20240603080505.2641-11-mkashani@nvidia.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20240603080505.2641-1-mkashani@nvidia.com> References: <20240602102802.196920-1-mkashani@nvidia.com> <20240603080505.2641-1-mkashani@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF0000231B:EE_|IA1PR12MB6092:EE_ X-MS-Office365-Filtering-Correlation-Id: 982302c4-fed1-4473-8ea9-08dc83a40007 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|36860700004|376005|82310400017|1800799015; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?QBQ1Muk1oONvruV7tiG8DNK8yhv+OEr2SdOU5RiQnfeRXtEShMAsxHQZeDLA?= =?us-ascii?Q?SpvSXSRzSeNcT25925MOY+GBSHvxXYYPpXTXoqOoOGUDwi1UU4g6mF9U1+12?= =?us-ascii?Q?y1R+3rMJMOJ+w6jPeqbeeKuIg0yKdrpghpBj//Wm+orDtSpNhGMC3OLcWDAp?= =?us-ascii?Q?jW14A9/KRyPAaFoPhuwIG1pDmTa2X4js9BmKfulvv6nUwGTKDwzUQC/od4xE?= =?us-ascii?Q?ZszhgHv3KPLhoh0T1aCdrm2b7kzdqpgriC8zrnf2AJnXSQBn+EspET/MCBe/?= =?us-ascii?Q?f74F0poiZT4dtP/EYt0WX3O/4Kv7tY/JwoT7K2yHjrRRyxw0TZt8JTW0WCaB?= =?us-ascii?Q?J7brR04v6DHJC3swveoRqjDvu+RFXwfRms/TgPGPy81j4BEVkiLX//SJxlz4?= =?us-ascii?Q?v34RiU4B7NXzJoLz6bz19HTvxPZc8LCLkUjy3z4a6F2i77QuxKayXmZyOiBW?= =?us-ascii?Q?4wK2CUbuhO7sD9qb9q/MDES5S7KSuZvnNhQ1Cn4RpXj/wqd2zKACNOWJttB+?= =?us-ascii?Q?H9C3VaEve5n01od3SsZegFPzaW/E/yePxv/F4UhSeUGXm3lao+ZHARWVFO+d?= =?us-ascii?Q?9CGlHgP8gNgT/BWN5T0tsiaiy3rWOlD/S6oJimzpI6mMoWHZxPDgv+bNa64i?= =?us-ascii?Q?NCsEQhYNxzCWzKovovjEjEioXBILC0ob5HT7QPuQJRuMYpkG5v4rIw48lEFU?= =?us-ascii?Q?Y6B/9EHBSIojuxGTUjPP98GFsTlzouRCA8/ktmN6mgum1fQq0t7e79WzGfYH?= =?us-ascii?Q?HSFKdf5t9VWLlCoXR5cBec609v6vKlASDWhw8GsBQ/h8SjNMgIRM0Wd7YvYN?= =?us-ascii?Q?Nl9JCDi1LCtC309jKkvlhZfJW8THCeZ0Q2HcyuyZCCrb9en6SqM+Sv5bIEQk?= =?us-ascii?Q?azSmq3t/uQIMfHH6BaaKjTRPpU+g+QwottiQCJjEXiRKdNI5S5/nhaJthhPD?= =?us-ascii?Q?/eDQYqK2+GsnegAAJSy1WBqLV+EAuMDZ+L+C+ogQiMJoaH0S4g5mQIx2NBWX?= =?us-ascii?Q?IDKhpo664mU7DqECIh4lPxwdloiQi+Mtnd2cYK7X5Lq7IWPF5LyN/T47tr3H?= =?us-ascii?Q?9TmJHNW5CSrMUGVxVGkEOJOMjZ1jP8CylsjBYzyDW9z3Q6dyfsVMyN1o6lOx?= =?us-ascii?Q?eaoQTWtT4FjAdfx5WUbOfHfmcrhhJ2BFnJxG1hZBkVHxSfjsy8HLnJdSVIqT?= =?us-ascii?Q?fIgmpB2nxniOvqEV0XQ8MloV+D+Zw6fP4+SFOGIkJDk/4mBQjniaNXr6nckT?= =?us-ascii?Q?oIAGcKkPe/GJ9VGXDGSrDTj+3lUTdlbhxIzLXO3QyxDJM0POYc2I+s9yPYbp?= =?us-ascii?Q?blYrghf1ycwEEfqDfFazwB6ScQe0TcWq7WR/dDPIdWyfuSJVAAhazlA2MQdf?= =?us-ascii?Q?c4zSQS409D+O13t6x6dORb6QclNP?= X-Forefront-Antispam-Report: CIP:216.228.118.232; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge1.nvidia.com; CAT:NONE; SFS:(13230031)(36860700004)(376005)(82310400017)(1800799015); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2024 08:05:57.7982 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 982302c4-fed1-4473-8ea9-08dc83a40007 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.232]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF0000231B.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6092 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 Change flow_drv_list_create/destroy to mlx5_flow_list_create/destroy. Remove resource release function inlining. Check number of queues in template mode in hw configure function. Use user priority to calculate matcher priority. Signed-off-by: Maayan Kashani --- drivers/net/mlx5/mlx5_flow.c | 70 +++++++--------------- drivers/net/mlx5/mlx5_flow_hw.c | 100 +++++++++++++++----------------- 2 files changed, 68 insertions(+), 102 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 68f20300a5..32d6defdb0 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -4928,19 +4928,6 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, return 0; } -/* Declare flow create/destroy prototype in advance. */ - -static uintptr_t -flow_drv_list_create(struct rte_eth_dev *dev, enum mlx5_flow_type type, - const struct rte_flow_attr *attr, - const struct rte_flow_item items[], - const struct rte_flow_action actions[], - bool external, struct rte_flow_error *error); - -static void -flow_drv_list_destroy(struct rte_eth_dev *dev, enum mlx5_flow_type type, - uintptr_t flow_idx); - int flow_dv_mreg_match_cb(void *tool_ctx __rte_unused, struct mlx5_list_entry *entry, void *cb_ctx) @@ -5059,7 +5046,7 @@ flow_dv_mreg_create_cb(void *tool_ctx, void *cb_ctx) * be applied, removed, deleted in arbitrary order * by list traversing. */ - mcp_res->rix_flow = flow_drv_list_create(dev, MLX5_FLOW_TYPE_MCP, + mcp_res->rix_flow = mlx5_flow_list_create(dev, MLX5_FLOW_TYPE_MCP, &attr, items, actions, false, error); if (!mcp_res->rix_flow) { mlx5_ipool_free(priv->sh->ipool[MLX5_IPOOL_MCP], idx); @@ -5153,7 +5140,7 @@ flow_dv_mreg_remove_cb(void *tool_ctx, struct mlx5_list_entry *entry) struct mlx5_priv *priv = dev->data->dev_private; MLX5_ASSERT(mcp_res->rix_flow); - flow_drv_list_destroy(dev, MLX5_FLOW_TYPE_MCP, mcp_res->rix_flow); + mlx5_flow_list_destroy(dev, MLX5_FLOW_TYPE_MCP, mcp_res->rix_flow); mlx5_ipool_free(priv->sh->ipool[MLX5_IPOOL_MCP], mcp_res->idx); } @@ -7540,7 +7527,7 @@ mlx5_flow_create_esw_table_zero_flow(struct rte_eth_dev *dev) }; struct rte_flow_error error; - return (void *)(uintptr_t)flow_drv_list_create(dev, MLX5_FLOW_TYPE_CTL, + return (void *)(uintptr_t)mlx5_flow_list_create(dev, MLX5_FLOW_TYPE_CTL, &attr, &pattern, actions, false, &error); } @@ -7608,14 +7595,14 @@ mlx5_flow_create_devx_sq_miss_flow(struct rte_eth_dev *dev, uint32_t sq_num) * Creates group 0, highest priority jump flow. * Matches txq to bypass kernel packets. */ - if (flow_drv_list_create(dev, MLX5_FLOW_TYPE_CTL, &attr, pattern, actions, + if (mlx5_flow_list_create(dev, MLX5_FLOW_TYPE_CTL, &attr, pattern, actions, false, &error) == 0) return 0; /* Create group 1, lowest priority redirect flow for txq. */ attr.group = 1; actions[0].conf = &port; actions[0].type = RTE_FLOW_ACTION_TYPE_PORT_ID; - return flow_drv_list_create(dev, MLX5_FLOW_TYPE_CTL, &attr, pattern, + return mlx5_flow_list_create(dev, MLX5_FLOW_TYPE_CTL, &attr, pattern, actions, false, &error); } @@ -7771,7 +7758,7 @@ mlx5_flow_cache_flow_toggle(struct rte_eth_dev *dev, bool orig_prio) flow_info->flow_idx_low_prio); if (high && low) { RTE_SWAP(*low, *high); - flow_drv_list_destroy(dev, MLX5_FLOW_TYPE_GEN, + mlx5_flow_list_destroy(dev, MLX5_FLOW_TYPE_GEN, flow_info->flow_idx_low_prio); flow_info->flow_idx_high_prio = 0; } @@ -7785,7 +7772,7 @@ mlx5_flow_cache_flow_toggle(struct rte_eth_dev *dev, bool orig_prio) while (flow_info) { if (flow_info->orig_prio != flow_info->attr.priority) { if (flow_info->flow_idx_high_prio) - flow_drv_list_destroy(dev, MLX5_FLOW_TYPE_GEN, + mlx5_flow_list_destroy(dev, MLX5_FLOW_TYPE_GEN, flow_info->flow_idx_high_prio); else break; @@ -7940,12 +7927,13 @@ mlx5_flow_create(struct rte_eth_dev *dev, RTE_PMD_MLX5_FLOW_ENGINE_FLAG_STANDBY_DUP_INGRESS))) new_attr->priority += 1; } - flow_idx = flow_drv_list_create(dev, MLX5_FLOW_TYPE_GEN, attr, items, actions, true, error); + flow_idx = mlx5_flow_list_create(dev, MLX5_FLOW_TYPE_GEN, attr, items, actions, + true, error); if (!flow_idx) return NULL; if (unlikely(mlx5_need_cache_flow(priv, attr))) { if (mlx5_flow_cache_flow_info(dev, attr, prio, items, actions, flow_idx)) { - flow_drv_list_destroy(dev, MLX5_FLOW_TYPE_GEN, flow_idx); + mlx5_flow_list_destroy(dev, MLX5_FLOW_TYPE_GEN, flow_idx); flow_idx = 0; } } @@ -7958,17 +7946,6 @@ mlx5_flow_list_create(struct rte_eth_dev *dev, enum mlx5_flow_type type, const struct rte_flow_item items[], const struct rte_flow_action actions[], bool external, struct rte_flow_error *error) -{ - return flow_drv_list_create(dev, type, attr, items, actions, external, - error); -} - -uintptr_t -flow_drv_list_create(struct rte_eth_dev *dev, enum mlx5_flow_type type, - const struct rte_flow_attr *attr, - const struct rte_flow_item items[], - const struct rte_flow_action actions[], - bool external, struct rte_flow_error *error) { const struct mlx5_flow_driver_ops *fops; enum mlx5_flow_drv_type drv_type = flow_get_drv_type(dev, attr); @@ -8017,8 +7994,8 @@ flow_legacy_list_destroy(struct rte_eth_dev *dev, enum mlx5_flow_type type, mlx5_ipool_free(priv->flows[type], flow_idx); } -static void -flow_drv_list_destroy(struct rte_eth_dev *dev, enum mlx5_flow_type type, +void +mlx5_flow_list_destroy(struct rte_eth_dev *dev, enum mlx5_flow_type type, uintptr_t flow_idx) { const struct mlx5_flow_driver_ops *fops; @@ -8029,13 +8006,6 @@ flow_drv_list_destroy(struct rte_eth_dev *dev, enum mlx5_flow_type type, fops->list_destroy(dev, type, flow_idx); } -void -mlx5_flow_list_destroy(struct rte_eth_dev *dev, enum mlx5_flow_type type, - uintptr_t flow_idx) -{ - flow_drv_list_destroy(dev, type, flow_idx); -} - /** * Destroy all flows. * @@ -8064,9 +8034,9 @@ mlx5_flow_list_flush(struct rte_eth_dev *dev, enum mlx5_flow_type type, #endif MLX5_IPOOL_FOREACH(priv->flows[type], fidx, flow) { if (priv->sh->config.dv_flow_en == 2) { - flow_drv_list_destroy(dev, type, (uintptr_t)flow); + mlx5_flow_list_destroy(dev, type, (uintptr_t)flow); } else { - flow_drv_list_destroy(dev, type, fidx); + mlx5_flow_list_destroy(dev, type, fidx); } if (unlikely(mlx5_need_cache_flow(priv, NULL) && type == MLX5_FLOW_TYPE_GEN)) { flow_info = LIST_FIRST(&mode_info->hot_upgrade); @@ -8339,7 +8309,7 @@ mlx5_ctrl_flow_source_queue(struct rte_eth_dev *dev, actions[0].type = RTE_FLOW_ACTION_TYPE_JUMP; actions[0].conf = &jump; actions[1].type = RTE_FLOW_ACTION_TYPE_END; - flow_idx = flow_drv_list_create(dev, MLX5_FLOW_TYPE_CTL, + flow_idx = mlx5_flow_list_create(dev, MLX5_FLOW_TYPE_CTL, &attr, items, actions, false, &error); if (!flow_idx) { DRV_LOG(DEBUG, @@ -8429,7 +8399,7 @@ mlx5_ctrl_flow_vlan(struct rte_eth_dev *dev, action_rss.types = 0; for (i = 0; i != priv->reta_idx_n; ++i) queue[i] = (*priv->reta_idx)[i]; - flow_idx = flow_drv_list_create(dev, MLX5_FLOW_TYPE_CTL, + flow_idx = mlx5_flow_list_create(dev, MLX5_FLOW_TYPE_CTL, &attr, items, actions, false, &error); if (!flow_idx) return -rte_errno; @@ -8504,7 +8474,7 @@ mlx5_flow_lacp_miss(struct rte_eth_dev *dev) }, }; struct rte_flow_error error; - uint32_t flow_idx = flow_drv_list_create(dev, MLX5_FLOW_TYPE_CTL, + uint32_t flow_idx = mlx5_flow_list_create(dev, MLX5_FLOW_TYPE_CTL, &attr, items, actions, false, &error); @@ -8528,7 +8498,7 @@ mlx5_flow_destroy(struct rte_eth_dev *dev, struct rte_pmd_mlx5_flow_engine_mode_info *mode_info = &priv->mode_info; struct mlx5_dv_flow_info *flow_info; - flow_drv_list_destroy(dev, MLX5_FLOW_TYPE_GEN, + mlx5_flow_list_destroy(dev, MLX5_FLOW_TYPE_GEN, (uintptr_t)(void *)flow); if (unlikely(mlx5_need_cache_flow(priv, NULL))) { flow_info = LIST_FIRST(&mode_info->hot_upgrade); @@ -9840,14 +9810,14 @@ mlx5_flow_discover_mreg_c(struct rte_eth_dev *dev) if (!priv->sh->config.dv_flow_en) break; /* Create internal flow, validation skips copy action. */ - flow_idx = flow_drv_list_create(dev, MLX5_FLOW_TYPE_GEN, &attr, + flow_idx = mlx5_flow_list_create(dev, MLX5_FLOW_TYPE_GEN, &attr, items, actions, false, &error); flow = mlx5_ipool_get(priv->flows[MLX5_FLOW_TYPE_GEN], flow_idx); if (!flow) continue; priv->sh->flow_mreg_c[n++] = idx; - flow_drv_list_destroy(dev, MLX5_FLOW_TYPE_GEN, flow_idx); + mlx5_flow_list_destroy(dev, MLX5_FLOW_TYPE_GEN, flow_idx); } for (; n < MLX5_MREG_C_NUM; ++n) priv->sh->flow_mreg_c[n] = REG_NON; diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 3022a86344..d938b5976a 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -2254,12 +2254,12 @@ mlx5_create_ipv6_ext_reformat(struct rte_eth_dev *dev, */ static int __flow_hw_translate_actions_template(struct rte_eth_dev *dev, - const struct mlx5_flow_template_table_cfg *cfg, - struct mlx5_hw_actions *acts, - struct rte_flow_actions_template *at, - struct mlx5_tbl_multi_pattern_ctx *mp_ctx, - bool nt_mode __rte_unused, - struct rte_flow_error *error) + const struct mlx5_flow_template_table_cfg *cfg, + struct mlx5_hw_actions *acts, + struct rte_flow_actions_template *at, + struct mlx5_tbl_multi_pattern_ctx *mp_ctx, + bool nt_mode, + struct rte_flow_error *error) { struct mlx5_priv *priv = dev->data->dev_private; const struct rte_flow_template_table_attr *table_attr = &cfg->attr; @@ -10609,7 +10609,7 @@ static int flow_hw_validate_attributes(const struct rte_flow_port_attr *port_attr, uint16_t nb_queue, const struct rte_flow_queue_attr *queue_attr[], - struct rte_flow_error *error) + bool nt_mode, struct rte_flow_error *error) { uint32_t size; unsigned int i; @@ -10618,7 +10618,7 @@ flow_hw_validate_attributes(const struct rte_flow_port_attr *port_attr, return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, "Port attributes must be non-NULL"); - if (nb_queue == 0) + if (nb_queue == 0 && !nt_mode) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, "At least one flow queue is required"); @@ -10695,7 +10695,7 @@ __flow_hw_configure(struct rte_eth_dev *dev, rte_errno = EINVAL; goto err; } - if (flow_hw_validate_attributes(port_attr, nb_queue, queue_attr, error)) + if (flow_hw_validate_attributes(port_attr, nb_queue, queue_attr, nt_mode, error)) return -rte_errno; /* * Calling rte_flow_configure() again is allowed if @@ -10713,7 +10713,7 @@ __flow_hw_configure(struct rte_eth_dev *dev, } } /* If previous configuration was not default non template mode config. */ - if (!(priv->hw_attr->nt_mode)) { + if (!priv->hw_attr->nt_mode) { if (flow_hw_compare_config(priv->hw_attr, port_attr, nb_queue, queue_attr)) return 0; else @@ -12176,6 +12176,7 @@ flow_hw_get_aged_flows(struct rte_eth_dev *dev, void **contexts, /** * Initialization function for non template API which calls * flow_hw_configure with default values. + * Configure non queues cause 1 queue is configured by default for inner usage. * * @param[in] dev * Pointer to the Ethernet device structure. @@ -12185,8 +12186,6 @@ flow_hw_get_aged_flows(struct rte_eth_dev *dev, void **contexts, * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */ - /* Configure non queues cause 1 queue is configured by default for inner usage. */ - int flow_hw_init(struct rte_eth_dev *dev, struct rte_flow_error *error) @@ -12214,10 +12213,10 @@ flow_hw_init(struct rte_eth_dev *dev, } static int flow_hw_prepare(struct rte_eth_dev *dev, - const struct rte_flow_action actions[] __rte_unused, - enum mlx5_flow_type type, - struct rte_flow_hw **flow, - struct rte_flow_error *error) + const struct rte_flow_action actions[] __rte_unused, + enum mlx5_flow_type type, + struct rte_flow_hw **flow, + struct rte_flow_error *error) { struct mlx5_priv *priv = dev->data->dev_private; uint32_t idx = 0; @@ -12340,14 +12339,14 @@ flow_hw_encap_decap_resource_register static int flow_hw_translate_flow_actions(struct rte_eth_dev *dev, - const struct rte_flow_attr *attr, - const struct rte_flow_action actions[], - struct rte_flow_hw *flow, - struct mlx5_flow_hw_action_params *ap, - struct mlx5_hw_actions *hw_acts, - uint64_t item_flags, - bool external, - struct rte_flow_error *error) + const struct rte_flow_attr *attr, + const struct rte_flow_action actions[], + struct rte_flow_hw *flow, + struct mlx5_flow_hw_action_params *ap, + struct mlx5_hw_actions *hw_acts, + uint64_t item_flags, + bool external, + struct rte_flow_error *error) { int ret = 0; uint32_t src_group = 0; @@ -12445,12 +12444,12 @@ flow_hw_translate_flow_actions(struct rte_eth_dev *dev, } static int flow_hw_register_matcher(struct rte_eth_dev *dev, - const struct rte_flow_attr *attr, - const struct rte_flow_item items[], - bool external, - struct rte_flow_hw *flow, - struct mlx5_flow_dv_matcher *matcher, - struct rte_flow_error *error) + const struct rte_flow_attr *attr, + const struct rte_flow_item items[], + bool external, + struct rte_flow_hw *flow, + struct mlx5_flow_dv_matcher *matcher, + struct rte_flow_error *error) { struct mlx5_priv *priv = dev->data->dev_private; struct rte_flow_error sub_error = { @@ -12481,10 +12480,7 @@ static int flow_hw_register_matcher(struct rte_eth_dev *dev, matcher->crc = rte_raw_cksum((const void *)matcher->mask.buf, matcher->mask.size); - matcher->priority = mlx5_get_matcher_priority(dev, attr, - matcher->priority, - external); - + matcher->priority = attr->priority; ret = __translate_group(dev, attr, external, attr->group, &group, error); if (ret) return ret; @@ -12592,10 +12588,10 @@ static int flow_hw_ensure_action_pools_allocated(struct rte_eth_dev *dev, /* TODO: remove dev if not used */ static int flow_hw_apply(struct rte_eth_dev *dev __rte_unused, - const struct rte_flow_item items[], - struct mlx5dr_rule_action rule_actions[], - struct rte_flow_hw *flow, - struct rte_flow_error *error) + const struct rte_flow_item items[], + struct mlx5dr_rule_action rule_actions[], + struct rte_flow_hw *flow, + struct rte_flow_error *error) { struct mlx5dr_bwc_rule *rule = NULL; @@ -12636,13 +12632,13 @@ static int flow_hw_apply(struct rte_eth_dev *dev __rte_unused, * 0 on success, negative errno value otherwise and rte_errno set. */ static int flow_hw_create_flow(struct rte_eth_dev *dev, - enum mlx5_flow_type type, - const struct rte_flow_attr *attr, - const struct rte_flow_item items[], - const struct rte_flow_action actions[], - bool external, - struct rte_flow_hw **flow, - struct rte_flow_error *error) + enum mlx5_flow_type type, + const struct rte_flow_attr *attr, + const struct rte_flow_item items[], + const struct rte_flow_action actions[], + bool external, + struct rte_flow_hw **flow, + struct rte_flow_error *error) { int ret; struct mlx5_hw_actions hw_act; @@ -12807,7 +12803,7 @@ flow_hw_destroy(struct rte_eth_dev *dev, struct rte_flow_hw *flow) * Address of flow to destroy. */ static void flow_hw_list_destroy(struct rte_eth_dev *dev, enum mlx5_flow_type type, - uintptr_t flow_addr) + uintptr_t flow_addr) { struct mlx5_priv *priv = dev->data->dev_private; /* Get flow via idx */ @@ -12843,12 +12839,12 @@ static void flow_hw_list_destroy(struct rte_eth_dev *dev, enum mlx5_flow_type ty * A flow addr on success, 0 otherwise and rte_errno is set. */ static uintptr_t flow_hw_list_create(struct rte_eth_dev *dev, - enum mlx5_flow_type type, - const struct rte_flow_attr *attr, - const struct rte_flow_item items[], - const struct rte_flow_action actions[], - bool external, - struct rte_flow_error *error) + enum mlx5_flow_type type, + const struct rte_flow_attr *attr, + const struct rte_flow_item items[], + const struct rte_flow_action actions[], + bool external, + struct rte_flow_error *error) { int ret; struct rte_flow_hw *flow = NULL; -- 2.25.1