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 4176544173; Thu, 6 Jun 2024 12:26:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2F43D42DF0; Thu, 6 Jun 2024 12:26:44 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2068.outbound.protection.outlook.com [40.107.220.68]) by mails.dpdk.org (Postfix) with ESMTP id 804FA40299 for ; Thu, 6 Jun 2024 12:26:42 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=McJOQVcHRiY9vmYmCkiC68PGM0YIuZyocGuCW5GcNodLgu0orx/zcaY79n7gsOvhcAoqIVd9Vb5hBBRYtqdnhEU/S3AnwqTxcclVAufGKA0ZsCWRUwp/396PY+ErjhO/b0bLK3pNsmhNYVOOxrR3+RUFCXrMkpDN+tuqXtUQ8XicdWJQjnlswBmPgDoSWU8xcngSZeGG/t5OqKW5WSvF8kLLCRGgxvZAf5ZP9FUicqPPvV0ngFmW4APF5Qf4MtNm9RLUxm2x+KixKh01mP5N6TaICL1gGrapVNcs5XsiSxt3U+BivO1xNf0AI8/q0Ho4hMCDHB4gT8lLzmnD0pvpKg== 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=WgSUcXATjAwBJa1VN155LDx/Lcw96O1CyungYJtXQBQ=; b=elsXwe45cxUql383xtvEYa5KwRFfGRzj3svJobr0aE2/jF8qnLgEisgOY314PRgrIKePoz1v76f8lzGeilyratx+7VaiWsZ30IMUvx+zB+s5X1uhxM+oTDY5BIIOS67eSDlVvDW8LAFGzoXkwgCTINMPHjaatt/FKO5r+9RuDKoa/GxnFWF0i2XRs2rjRACgmm1jXJJbF+evlQfYGv4roC/lIxQ4S2TQ52gRm8LIqZ+NvUZIj7WtgzFIU5X7/5WteoBJ1dSh5yJ0yGnEsNobdwO9wWpjBj5iI5XipMtbVxVu2yxXwfwEpZ7WpgyHV2IGFVMvLb0LnlMPPTNQ9UvOVQ== 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 (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=WgSUcXATjAwBJa1VN155LDx/Lcw96O1CyungYJtXQBQ=; b=mUM3dX2Y3IXVVPqVtZAyr2DF3XyiiSWldjzJntpgWvBtJi8Xcs/I9DGYsBksmdGSmNTTxfe1fzvNk7l7sxw+cTMvuHwdiukJL+ZIZq3KUxMWnplgXatleFE2kJtuIXbWfHn6sH73QPV8OOajZBt1cldPAiPHc+avyWd3aoT+xRIdoxeMFlyHDDvx5xeGK97wXWKhlZopKqDBGL3fqKqChVxymhRxvwtFu7rbj73xBxF2FgzTNcwQYf7eYabWJLikWvGDW49h1O9V/C+OZcLbR03zCFCRasUbc3NpneXKBtQVxQgOtvH+pZqawPi+8TBuU526G1HU+U5FUZXSLlmSDg== Received: from SJ0PR05CA0099.namprd05.prod.outlook.com (2603:10b6:a03:334::14) by SJ0PR12MB8114.namprd12.prod.outlook.com (2603:10b6:a03:4e8::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.25; Thu, 6 Jun 2024 10:26:39 +0000 Received: from SJ1PEPF00001CE0.namprd05.prod.outlook.com (2603:10b6:a03:334:cafe::70) by SJ0PR05CA0099.outlook.office365.com (2603:10b6:a03:334::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.16 via Frontend Transport; Thu, 6 Jun 2024 10:26:39 +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 SJ1PEPF00001CE0.mail.protection.outlook.com (10.167.242.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.15 via Frontend Transport; Thu, 6 Jun 2024 10:26:39 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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.1544.4; Thu, 6 Jun 2024 03:26:29 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 6 Jun 2024 03:26:28 -0700 Received: from nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4 via Frontend Transport; Thu, 6 Jun 2024 03:26:26 -0700 From: Maayan Kashani To: CC: , , , Viacheslav Ovsiienko , Ori Kam , Suanming Mou , Matan Azrad Subject: [PATCH v4 11/11] net/mlx5: initial design changes Date: Thu, 6 Jun 2024 13:23:16 +0300 Message-ID: <20240606102317.172553-12-mkashani@nvidia.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20240606102317.172553-1-mkashani@nvidia.com> References: <20240603104850.9935-1-mkashani@nvidia.com> <20240606102317.172553-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: SJ1PEPF00001CE0:EE_|SJ0PR12MB8114:EE_ X-MS-Office365-Filtering-Correlation-Id: 1568cce9-94ef-4468-ff74-08dc861326cd 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?B0HENenH+yWTd5xBDpcjNTO8DyFb1mrcrrLh0WcidIVioBtgd2CFE6rpGUjh?= =?us-ascii?Q?X4C37mDWwyEAIAj7fLv94kXVgH05298g0tHkjMvr2+pcGjbkChOkEd1vtYAX?= =?us-ascii?Q?fhMTGh80rsNvfhJZ1tbSZk+f5/SSxYveT6K4nm3Xsenl7dXWneQZ4diWJYT+?= =?us-ascii?Q?wyTmbZGZzwTcsOxjCR3GUdRwiGT5ai+CxMH2g4Ozzr2D9a0RZ+OBdNCqAsHA?= =?us-ascii?Q?hTGfqZhdKYhmi1o8C6fdo/aO1N7N914qYL6uPRjLBvpUoQwxBqnErELoCxFZ?= =?us-ascii?Q?rbAOKXTqaRaLWrpmobc30a7wkLplZfXU9wIKEzRZSAPHvxc6cfI2BvUD8F1K?= =?us-ascii?Q?F55t+PO5IcHYkOoBDx+xk+9tjqwtIhvwAd38mCmtj+CS+bA0HAazowZ/urPX?= =?us-ascii?Q?9K2x/9Lj6Ga+5FR5sWtfEkVDwXm/zNVx/+LFi2Ra0iWHeA5jLjRH5jhi7KGB?= =?us-ascii?Q?DX676kYwdOu66N1OTFz4q4pzhF//bs/UT8FVndtzLjjLadIiBZ0t+Q+nbcQn?= =?us-ascii?Q?gZ49pXWBu1C8musrrPH7+lItRFm79sjFQ5nf9OLL4eVTZRUN7XYgPx70chem?= =?us-ascii?Q?sCZqhMqB2JfJgO4ZQdOrIRfsUPa3aJmaxU8OXODAVWNXgdC6VsfI8myJGtNl?= =?us-ascii?Q?Os4R84GTyugnk279FEEz3dxyMRkHqzImWvm5YMJLtsv9wHT0BWv0oFDH2kV9?= =?us-ascii?Q?3K68ejDebBbmqhyYASeIvMaZBYoJSPAjmE4SWdSRpjL3HGO6MwvLP/I4O1y/?= =?us-ascii?Q?adz8sp6eNjpd3DIGWRjgAUjlKeKtjfwOZsCIjokmEkBJiZ5KCvtpOdRAUl9W?= =?us-ascii?Q?j6EpqMVF9qrJGtvHke/4clCFk8BzveqHbPawrmFG2emF8c5nsWdf7y/J/hem?= =?us-ascii?Q?cFOIBuQSsIVBU0pE/SC12IG/vp5Up1mTAeWn3SKAoA3Y2onT6wvIkK/JmDMW?= =?us-ascii?Q?9Es2mIPFARqW2Qo8mW5xzyowMHBCgBXPoYmrw2fwFoVlyu7eKAQK+BpMcfW6?= =?us-ascii?Q?ahxMAf0U0FCkUeJCrv8ooUtHpNSGmGEKso9mh/jbQoaMYjpCU1VbRNhxiwTt?= =?us-ascii?Q?OChCgjrZI3bTUUdwU+D6Bo8Z1mraFhXxw4h/hNcGqvJujFcN5Ja6FIJKkttD?= =?us-ascii?Q?dFFkTOT2OsY2AWmXPjvTAOj0RmovxgZ0x8CgEBOKTF5ZkFFkMwguuY/AyY3/?= =?us-ascii?Q?Za+6H0WsQsUSK5C0KTXfKJqY/GfFm2lY7S9afIbN0xikff38h0iTUvp25J79?= =?us-ascii?Q?odUduLstdv8Kf1o4MaG1QfogJOnFc+jciQElBU+gMiEe7+/TucLo9LG6+W4n?= =?us-ascii?Q?5o+IrXFG6euJHDoCagsI7VrvbOHnMyPtE0MXdYn4cp2KiWNlAQmzMa+flFlI?= =?us-ascii?Q?GM6nRssYt5ReodlIFUVSXODL+WiPRYLK6viZJqpS48LxzN95Ig=3D=3D?= 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:(13230031)(36860700004)(376005)(82310400017)(1800799015); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2024 10:26:39.2990 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1568cce9-94ef-4468-ff74-08dc861326cd 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: SJ1PEPF00001CE0.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB8114 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 Acked-by: Dariusz Sosnowski --- 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.21.0