From patchwork Tue Jul 6 13:32:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suanming Mou X-Patchwork-Id: 95402 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7492FA0C47; Tue, 6 Jul 2021 15:35:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E1FFC41448; Tue, 6 Jul 2021 15:33:50 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2077.outbound.protection.outlook.com [40.107.94.77]) by mails.dpdk.org (Postfix) with ESMTP id B160341446 for ; Tue, 6 Jul 2021 15:33:48 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O0P6DC7Cw8sFwNcmNSCoifXueCqkxzRXvJW1m3msWBKcbPnpTmcnE63Gt8C8eSgA2sBYtdHQO1gBar1g2kgM9U592oBoGkyP2h2U7+sLL1IjIFSV/mP5StV36xW5CcNXvMtfsyl75zj1Lvw51l0V43PQXeMCo+mXscWXf1wC9m8aNriEV5h56Fu/PXY30Y9X12AYF5c1Yu60h79ZqhCTkNsXbEuGew2na7hG2xZ/3HpgS15EG4ColqBJo8PnWoYTnlo4QzeTgD7+X8FkGMh+pqEKyJhWmWKSHZUTX8E94lzrqodkRXb9lRSIE3o3Dixi/wQoM1998olN9wT9KEcuHQ== 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-SenderADCheck; bh=VZxsVcvQF1IARD3TLaFWLullyhnGtgopQRH3CzQ3GCg=; b=DGpYlfcvWcp6lXnWr8tSuQEjuc/CEuZp0i1fU2pMcuKtNkYy/3WgjUEWt/Rot9rSwPbdiD+eJobP26Z0AGR3/odbJ1Il2MezdpkDoeBsbl5U317SjRL6DGYfQ/FoEEf684INY9smUhTNKkDSUe7+Rzzp4gAB0inH/WfncAD4I4xMP13WVEWL2dr19jFYkljL132bdykcbWz6419KJLhMpl8dZSO59LBsMa0YsGjiyExgcVFlbYCI5rQC+bvSH8L7ROxLG1bY0YqrZEQsdG2BqjSTIxnWsg9elTAVENQ1MeiwWJDg5WKHIRQD14g+kUc+JKZVcLis6yumm4jOD6Qs+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none 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=VZxsVcvQF1IARD3TLaFWLullyhnGtgopQRH3CzQ3GCg=; b=EYal81oOrsTy8DsI/ijOK1OjVcNcaxfToFxweJgWxROVTH9LSwe2wxzQaLMlaAlEFFCUQsKU2bfoogSMlEwWPrRxJAa4xk2ZPKdUardbndJnDu5AFfNvRydySISqD9Lsq0ZTIoUcgxjjTVVJM4lSDfZH5CT4GLqgDZyEiHTvTPziFZlJtRmExhGEs6u/lrPfkvfxSl2YvIBLGuAN2biW+0wk5g4W1PTCwOIqdD9N6ocCu+SO3Ykvc6if1GWWUegg6iTGcYSTwi2AkOfmVHD2/9L6/Pr8mc1yP/0zlmI+YZ7D1bmh0NW7ZN/hl22CaRYqx+eWd6ikoQQG62pxkQpgaQ== Received: from BN9PR03CA0552.namprd03.prod.outlook.com (2603:10b6:408:138::17) by MW3PR12MB4428.namprd12.prod.outlook.com (2603:10b6:303:57::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.31; Tue, 6 Jul 2021 13:33:46 +0000 Received: from BN8NAM11FT062.eop-nam11.prod.protection.outlook.com (2603:10b6:408:138:cafe::2e) by BN9PR03CA0552.outlook.office365.com (2603:10b6:408:138::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.23 via Frontend Transport; Tue, 6 Jul 2021 13:33:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT062.mail.protection.outlook.com (10.13.177.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4287.22 via Frontend Transport; Tue, 6 Jul 2021 13:33:46 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 6 Jul 2021 13:33:43 +0000 From: Suanming Mou To: , CC: , , Date: Tue, 6 Jul 2021 16:32:46 +0300 Message-ID: <20210706133257.3353-16-suanmingm@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20210706133257.3353-1-suanmingm@nvidia.com> References: <20210527093403.1153127-1-suanmingm@nvidia.com> <20210706133257.3353-1-suanmingm@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4fb702e0-6f00-4d7c-c637-08d94082ae85 X-MS-TrafficTypeDiagnostic: MW3PR12MB4428: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1265; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pk8OiBIgbuVjqm5BwrOWwaWznQSRfW9GMz06edEURueJR1TnGLTifW/HJ2lApigzGNBo0S5uA1ifg/uXhRFHx7PLTSrQ1trGNKZGAawosMUdj3qOLxwIQ4VyXDyO0KOJc6yqZQUo50L5lqhc/QSN42BmMMzCjBi//427QQlTckRkcgPRKoaQfDsRRVKB+7j0MmKqGfulJK+/Rp7YeYWRfQDMb3443t64f3a5vMMHzu2uSOJ7Y0dhrQnVkxb8fNGlIRcaPn8RaJRt18Yv6R4KDTQAxpTiGl+tcxKFfh5kKVN3gC9U1XbfLO46SCwvWzalNrqNstvJAhbrmVVepwkw052cM1qA4MuuGcvX44Q+d4V5pS3uND+V0z1IYlOxGnkB6xLOtuatFgAch1BjIHNSCQEqRm50c1r4L8gq67YB+hKgPOf063w6lcCm7kdnYuypoapnQBxkdZ6rnmcGhXhAcrHHSk9IFmcoQzIGgbcppOb9xtyIb7rjsjOh/QlsdjcuL2bYK0PtHxjn4GcsmGkzDhEmGtRg47OtfMT0z2aQ+H2GpFqby5LRgiNIdCwx45dikbTIRLOb0W+aEwPlyOrQtTy7GycjHrjZ5G7gY6FAzIrW6o3evrv9O+qIYXYnMzOieuh31MsIgILkAH4JtP5PathpPGeeq/OK6GQlQVPoSDgSYgiwlNUQUDdxybU4HCeZS/K6RPaFXAYrQtByBpYj3Q== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(39860400002)(136003)(346002)(396003)(376002)(46966006)(36840700001)(82740400003)(8936002)(36756003)(6286002)(186003)(16526019)(54906003)(2906002)(26005)(5660300002)(316002)(36860700001)(336012)(2616005)(8676002)(426003)(1076003)(86362001)(6636002)(55016002)(47076005)(36906005)(70206006)(7696005)(7636003)(4326008)(70586007)(30864003)(478600001)(83380400001)(110136005)(356005)(82310400003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2021 13:33:46.4326 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4fb702e0-6f00-4d7c-c637-08d94082ae85 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT062.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4428 Subject: [dpdk-dev] [PATCH v4 15/26] common/mlx5: call list callbacks with context 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 Sender: "dev" This commit optimizes to call the list callback functions with global context directly. Signed-off-by: Suanming Mou Acked-by: Matan Azrad --- drivers/common/mlx5/mlx5_common_utils.c | 24 ++--- drivers/common/mlx5/mlx5_common_utils.h | 36 ++++---- drivers/net/mlx5/mlx5_flow.h | 94 +++++++++---------- drivers/net/mlx5/mlx5_flow_dv.c | 115 +++++++++++------------- drivers/net/mlx5/mlx5_rx.h | 13 ++- drivers/net/mlx5/mlx5_rxq.c | 53 +++-------- 6 files changed, 132 insertions(+), 203 deletions(-) diff --git a/drivers/common/mlx5/mlx5_common_utils.c b/drivers/common/mlx5/mlx5_common_utils.c index 6ac78ba97f..50c98143f7 100644 --- a/drivers/common/mlx5/mlx5_common_utils.c +++ b/drivers/common/mlx5/mlx5_common_utils.c @@ -55,7 +55,7 @@ __list_lookup(struct mlx5_list *list, int lcore_index, void *ctx, bool reuse) uint32_t ret; while (entry != NULL) { - if (list->cb_match(list, entry, ctx) == 0) { + if (list->cb_match(list->ctx, entry, ctx) == 0) { if (reuse) { ret = __atomic_add_fetch(&entry->ref_cnt, 1, __ATOMIC_RELAXED) - 1; @@ -96,7 +96,7 @@ static struct mlx5_list_entry * mlx5_list_cache_insert(struct mlx5_list *list, int lcore_index, struct mlx5_list_entry *gentry, void *ctx) { - struct mlx5_list_entry *lentry = list->cb_clone(list, gentry, ctx); + struct mlx5_list_entry *lentry = list->cb_clone(list->ctx, gentry, ctx); if (unlikely(!lentry)) return NULL; @@ -121,9 +121,9 @@ __list_cache_clean(struct mlx5_list *list, int lcore_index) if (__atomic_load_n(&entry->ref_cnt, __ATOMIC_RELAXED) == 0) { LIST_REMOVE(entry, next); if (list->lcores_share) - list->cb_clone_free(list, entry); + list->cb_clone_free(list->ctx, entry); else - list->cb_remove(list, entry); + list->cb_remove(list->ctx, entry); inv_cnt--; } entry = nentry; @@ -162,7 +162,7 @@ mlx5_list_register(struct mlx5_list *list, void *ctx) rte_rwlock_read_unlock(&list->lock); } /* 3. Prepare new entry for global list and for cache. */ - entry = list->cb_create(list, entry, ctx); + entry = list->cb_create(list->ctx, ctx); if (unlikely(!entry)) return NULL; entry->ref_cnt = 1u; @@ -174,9 +174,9 @@ mlx5_list_register(struct mlx5_list *list, void *ctx) list->name, lcore_index, (void *)entry, entry->ref_cnt); return entry; } - local_entry = list->cb_clone(list, entry, ctx); + local_entry = list->cb_clone(list->ctx, entry, ctx); if (unlikely(!local_entry)) { - list->cb_remove(list, entry); + list->cb_remove(list->ctx, entry); return NULL; } local_entry->ref_cnt = 1u; @@ -192,8 +192,8 @@ mlx5_list_register(struct mlx5_list *list, void *ctx) if (unlikely(oentry)) { /* 4.5. Found real race!!, reuse the old entry. */ rte_rwlock_write_unlock(&list->lock); - list->cb_remove(list, entry); - list->cb_clone_free(list, local_entry); + list->cb_remove(list->ctx, entry); + list->cb_clone_free(list->ctx, local_entry); return mlx5_list_cache_insert(list, lcore_index, oentry, ctx); } @@ -223,9 +223,9 @@ mlx5_list_unregister(struct mlx5_list *list, if (entry->lcore_idx == (uint32_t)lcore_idx) { LIST_REMOVE(entry, next); if (list->lcores_share) - list->cb_clone_free(list, entry); + list->cb_clone_free(list->ctx, entry); else - list->cb_remove(list, entry); + list->cb_remove(list->ctx, entry); } else if (likely(lcore_idx != -1)) { __atomic_add_fetch(&list->cache[entry->lcore_idx].inv_cnt, 1, __ATOMIC_RELAXED); @@ -244,7 +244,7 @@ mlx5_list_unregister(struct mlx5_list *list, if (likely(gentry->ref_cnt == 0)) { LIST_REMOVE(gentry, next); rte_rwlock_write_unlock(&list->lock); - list->cb_remove(list, gentry); + list->cb_remove(list->ctx, gentry); __atomic_sub_fetch(&list->count, 1, __ATOMIC_RELAXED); DRV_LOG(DEBUG, "mlx5 list %s entry %p removed.", list->name, (void *)gentry); diff --git a/drivers/common/mlx5/mlx5_common_utils.h b/drivers/common/mlx5/mlx5_common_utils.h index 000279d236..a691ff8f0d 100644 --- a/drivers/common/mlx5/mlx5_common_utils.h +++ b/drivers/common/mlx5/mlx5_common_utils.h @@ -33,19 +33,19 @@ struct mlx5_list_cache { /** * Type of callback function for entry removal. * - * @param list - * The mlx5 list. + * @param tool_ctx + * The tool instance user context. * @param entry * The entry in the list. */ -typedef void (*mlx5_list_remove_cb)(struct mlx5_list *list, - struct mlx5_list_entry *entry); +typedef void (*mlx5_list_remove_cb)(void *tool_ctx, + struct mlx5_list_entry *entry); /** * Type of function for user defined matching. * - * @param list - * The mlx5 list. + * @param tool_ctx + * The tool instance context. * @param entry * The entry in the list. * @param ctx @@ -54,34 +54,28 @@ typedef void (*mlx5_list_remove_cb)(struct mlx5_list *list, * @return * 0 if matching, non-zero number otherwise. */ -typedef int (*mlx5_list_match_cb)(struct mlx5_list *list, +typedef int (*mlx5_list_match_cb)(void *tool_ctx, struct mlx5_list_entry *entry, void *ctx); -typedef struct mlx5_list_entry *(*mlx5_list_clone_cb) - (struct mlx5_list *list, - struct mlx5_list_entry *entry, void *ctx); +typedef struct mlx5_list_entry *(*mlx5_list_clone_cb)(void *tool_ctx, + struct mlx5_list_entry *entry, void *ctx); -typedef void (*mlx5_list_clone_free_cb)(struct mlx5_list *list, - struct mlx5_list_entry *entry); +typedef void (*mlx5_list_clone_free_cb)(void *tool_ctx, + struct mlx5_list_entry *entry); /** * Type of function for user defined mlx5 list entry creation. * - * @param list - * The mlx5 list. - * @param entry - * The new allocated entry, NULL if list entry size unspecified, - * New entry has to be allocated in callback and return. + * @param tool_ctx + * The mlx5 tool instance context. * @param ctx * The pointer to new entry context. * * @return * Pointer of entry on success, NULL otherwise. */ -typedef struct mlx5_list_entry *(*mlx5_list_create_cb) - (struct mlx5_list *list, - struct mlx5_list_entry *entry, - void *ctx); +typedef struct mlx5_list_entry *(*mlx5_list_create_cb)(void *tool_ctx, + void *ctx); /** * Linked mlx5 list structure. diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index ce4d205e86..1d96c61663 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -1619,64 +1619,50 @@ struct mlx5_hlist_entry *flow_dv_encap_decap_create_cb(struct mlx5_hlist *list, void flow_dv_encap_decap_remove_cb(struct mlx5_hlist *list, struct mlx5_hlist_entry *entry); -int flow_dv_matcher_match_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry, void *ctx); -struct mlx5_list_entry *flow_dv_matcher_create_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry, - void *ctx); -void flow_dv_matcher_remove_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry); - -int flow_dv_port_id_match_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry, void *cb_ctx); -struct mlx5_list_entry *flow_dv_port_id_create_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry, - void *cb_ctx); -void flow_dv_port_id_remove_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry); -struct mlx5_list_entry *flow_dv_port_id_clone_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry __rte_unused, - void *cb_ctx); -void flow_dv_port_id_clone_free_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry __rte_unused); -int flow_dv_push_vlan_match_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry, void *cb_ctx); -struct mlx5_list_entry *flow_dv_push_vlan_create_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry, - void *cb_ctx); -void flow_dv_push_vlan_remove_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry); -struct mlx5_list_entry *flow_dv_push_vlan_clone_cb - (struct mlx5_list *list, +int flow_dv_matcher_match_cb(void *tool_ctx, struct mlx5_list_entry *entry, + void *ctx); +struct mlx5_list_entry *flow_dv_matcher_create_cb(void *tool_ctx, void *ctx); +void flow_dv_matcher_remove_cb(void *tool_ctx, struct mlx5_list_entry *entry); + +int flow_dv_port_id_match_cb(void *tool_ctx, struct mlx5_list_entry *entry, + void *cb_ctx); +struct mlx5_list_entry *flow_dv_port_id_create_cb(void *tool_ctx, void *cb_ctx); +void flow_dv_port_id_remove_cb(void *tool_ctx, struct mlx5_list_entry *entry); +struct mlx5_list_entry *flow_dv_port_id_clone_cb(void *tool_ctx, + struct mlx5_list_entry *entry, void *cb_ctx); +void flow_dv_port_id_clone_free_cb(void *tool_ctx, + struct mlx5_list_entry *entry); + +int flow_dv_push_vlan_match_cb(void *tool_ctx, struct mlx5_list_entry *entry, + void *cb_ctx); +struct mlx5_list_entry *flow_dv_push_vlan_create_cb(void *tool_ctx, + void *cb_ctx); +void flow_dv_push_vlan_remove_cb(void *tool_ctx, struct mlx5_list_entry *entry); +struct mlx5_list_entry *flow_dv_push_vlan_clone_cb(void *tool_ctx, struct mlx5_list_entry *entry, void *cb_ctx); -void flow_dv_push_vlan_clone_free_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry); - -int flow_dv_sample_match_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry, void *cb_ctx); -struct mlx5_list_entry *flow_dv_sample_create_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry, - void *cb_ctx); -void flow_dv_sample_remove_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry); -struct mlx5_list_entry *flow_dv_sample_clone_cb - (struct mlx5_list *list, +void flow_dv_push_vlan_clone_free_cb(void *tool_ctx, + struct mlx5_list_entry *entry); + +int flow_dv_sample_match_cb(void *tool_ctx, struct mlx5_list_entry *entry, + void *cb_ctx); +struct mlx5_list_entry *flow_dv_sample_create_cb(void *tool_ctx, void *cb_ctx); +void flow_dv_sample_remove_cb(void *tool_ctx, struct mlx5_list_entry *entry); +struct mlx5_list_entry *flow_dv_sample_clone_cb(void *tool_ctx, struct mlx5_list_entry *entry, void *cb_ctx); -void flow_dv_sample_clone_free_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry); - -int flow_dv_dest_array_match_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry, void *cb_ctx); -struct mlx5_list_entry *flow_dv_dest_array_create_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry, - void *cb_ctx); -void flow_dv_dest_array_remove_cb(struct mlx5_list *list, +void flow_dv_sample_clone_free_cb(void *tool_ctx, struct mlx5_list_entry *entry); -struct mlx5_list_entry *flow_dv_dest_array_clone_cb - (struct mlx5_list *list, - struct mlx5_list_entry *entry, void *cb_ctx); -void flow_dv_dest_array_clone_free_cb(struct mlx5_list *list, + +int flow_dv_dest_array_match_cb(void *tool_ctx, struct mlx5_list_entry *entry, + void *cb_ctx); +struct mlx5_list_entry *flow_dv_dest_array_create_cb(void *tool_ctx, + void *cb_ctx); +void flow_dv_dest_array_remove_cb(void *tool_ctx, struct mlx5_list_entry *entry); +struct mlx5_list_entry *flow_dv_dest_array_clone_cb(void *tool_ctx, + struct mlx5_list_entry *entry, void *cb_ctx); +void flow_dv_dest_array_clone_free_cb(void *tool_ctx, + struct mlx5_list_entry *entry); + struct mlx5_aso_age_action *flow_aso_age_get_by_idx(struct rte_eth_dev *dev, uint32_t age_idx); int flow_dev_geneve_tlv_option_resource_register(struct rte_eth_dev *dev, diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 4f7cdb0622..d32dd76c11 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -3774,23 +3774,21 @@ flow_dv_jump_tbl_resource_register } int -flow_dv_port_id_match_cb(struct mlx5_list *list __rte_unused, +flow_dv_port_id_match_cb(void *tool_ctx __rte_unused, struct mlx5_list_entry *entry, void *cb_ctx) { struct mlx5_flow_cb_ctx *ctx = cb_ctx; struct mlx5_flow_dv_port_id_action_resource *ref = ctx->data; struct mlx5_flow_dv_port_id_action_resource *res = - container_of(entry, typeof(*res), entry); + container_of(entry, typeof(*res), entry); return ref->port_id != res->port_id; } struct mlx5_list_entry * -flow_dv_port_id_create_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry __rte_unused, - void *cb_ctx) +flow_dv_port_id_create_cb(void *tool_ctx, void *cb_ctx) { - struct mlx5_dev_ctx_shared *sh = list->ctx; + struct mlx5_dev_ctx_shared *sh = tool_ctx; struct mlx5_flow_cb_ctx *ctx = cb_ctx; struct mlx5_flow_dv_port_id_action_resource *ref = ctx->data; struct mlx5_flow_dv_port_id_action_resource *resource; @@ -3821,11 +3819,11 @@ flow_dv_port_id_create_cb(struct mlx5_list *list, } struct mlx5_list_entry * -flow_dv_port_id_clone_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry __rte_unused, - void *cb_ctx) +flow_dv_port_id_clone_cb(void *tool_ctx, + struct mlx5_list_entry *entry __rte_unused, + void *cb_ctx) { - struct mlx5_dev_ctx_shared *sh = list->ctx; + struct mlx5_dev_ctx_shared *sh = tool_ctx; struct mlx5_flow_cb_ctx *ctx = cb_ctx; struct mlx5_flow_dv_port_id_action_resource *resource; uint32_t idx; @@ -3843,12 +3841,11 @@ flow_dv_port_id_clone_cb(struct mlx5_list *list, } void -flow_dv_port_id_clone_free_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry) +flow_dv_port_id_clone_free_cb(void *tool_ctx, struct mlx5_list_entry *entry) { - struct mlx5_dev_ctx_shared *sh = list->ctx; + struct mlx5_dev_ctx_shared *sh = tool_ctx; struct mlx5_flow_dv_port_id_action_resource *resource = - container_of(entry, typeof(*resource), entry); + container_of(entry, typeof(*resource), entry); mlx5_ipool_free(sh->ipool[MLX5_IPOOL_PORT_ID], resource->idx); } @@ -3893,23 +3890,21 @@ flow_dv_port_id_action_resource_register } int -flow_dv_push_vlan_match_cb(struct mlx5_list *list __rte_unused, - struct mlx5_list_entry *entry, void *cb_ctx) +flow_dv_push_vlan_match_cb(void *tool_ctx __rte_unused, + struct mlx5_list_entry *entry, void *cb_ctx) { struct mlx5_flow_cb_ctx *ctx = cb_ctx; struct mlx5_flow_dv_push_vlan_action_resource *ref = ctx->data; struct mlx5_flow_dv_push_vlan_action_resource *res = - container_of(entry, typeof(*res), entry); + container_of(entry, typeof(*res), entry); return ref->vlan_tag != res->vlan_tag || ref->ft_type != res->ft_type; } struct mlx5_list_entry * -flow_dv_push_vlan_create_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry __rte_unused, - void *cb_ctx) +flow_dv_push_vlan_create_cb(void *tool_ctx, void *cb_ctx) { - struct mlx5_dev_ctx_shared *sh = list->ctx; + struct mlx5_dev_ctx_shared *sh = tool_ctx; struct mlx5_flow_cb_ctx *ctx = cb_ctx; struct mlx5_flow_dv_push_vlan_action_resource *ref = ctx->data; struct mlx5_flow_dv_push_vlan_action_resource *resource; @@ -3946,11 +3941,11 @@ flow_dv_push_vlan_create_cb(struct mlx5_list *list, } struct mlx5_list_entry * -flow_dv_push_vlan_clone_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry __rte_unused, - void *cb_ctx) +flow_dv_push_vlan_clone_cb(void *tool_ctx, + struct mlx5_list_entry *entry __rte_unused, + void *cb_ctx) { - struct mlx5_dev_ctx_shared *sh = list->ctx; + struct mlx5_dev_ctx_shared *sh = tool_ctx; struct mlx5_flow_cb_ctx *ctx = cb_ctx; struct mlx5_flow_dv_push_vlan_action_resource *resource; uint32_t idx; @@ -3968,12 +3963,11 @@ flow_dv_push_vlan_clone_cb(struct mlx5_list *list, } void -flow_dv_push_vlan_clone_free_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry) +flow_dv_push_vlan_clone_free_cb(void *tool_ctx, struct mlx5_list_entry *entry) { - struct mlx5_dev_ctx_shared *sh = list->ctx; + struct mlx5_dev_ctx_shared *sh = tool_ctx; struct mlx5_flow_dv_push_vlan_action_resource *resource = - container_of(entry, typeof(*resource), entry); + container_of(entry, typeof(*resource), entry); mlx5_ipool_free(sh->ipool[MLX5_IPOOL_PUSH_VLAN], resource->idx); } @@ -9952,7 +9946,7 @@ flow_dv_matcher_enable(uint32_t *match_criteria) } static struct mlx5_list_entry * -flow_dv_matcher_clone_cb(struct mlx5_list *list __rte_unused, +flow_dv_matcher_clone_cb(void *tool_ctx __rte_unused, struct mlx5_list_entry *entry, void *cb_ctx) { struct mlx5_flow_cb_ctx *ctx = cb_ctx; @@ -9975,7 +9969,7 @@ flow_dv_matcher_clone_cb(struct mlx5_list *list __rte_unused, } static void -flow_dv_matcher_clone_free_cb(struct mlx5_list *list __rte_unused, +flow_dv_matcher_clone_free_cb(void *tool_ctx __rte_unused, struct mlx5_list_entry *entry) { mlx5_free(entry); @@ -10218,7 +10212,7 @@ flow_dv_tbl_resource_release(struct mlx5_dev_ctx_shared *sh, } int -flow_dv_matcher_match_cb(struct mlx5_list *list __rte_unused, +flow_dv_matcher_match_cb(void *tool_ctx __rte_unused, struct mlx5_list_entry *entry, void *cb_ctx) { struct mlx5_flow_cb_ctx *ctx = cb_ctx; @@ -10233,11 +10227,9 @@ flow_dv_matcher_match_cb(struct mlx5_list *list __rte_unused, } struct mlx5_list_entry * -flow_dv_matcher_create_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry __rte_unused, - void *cb_ctx) +flow_dv_matcher_create_cb(void *tool_ctx, void *cb_ctx) { - struct mlx5_dev_ctx_shared *sh = list->ctx; + struct mlx5_dev_ctx_shared *sh = tool_ctx; struct mlx5_flow_cb_ctx *ctx = cb_ctx; struct mlx5_flow_dv_matcher *ref = ctx->data; struct mlx5_flow_dv_matcher *resource; @@ -10733,7 +10725,7 @@ flow_dv_sample_sub_actions_release(struct rte_eth_dev *dev, } int -flow_dv_sample_match_cb(struct mlx5_list *list __rte_unused, +flow_dv_sample_match_cb(void *tool_ctx __rte_unused, struct mlx5_list_entry *entry, void *cb_ctx) { struct mlx5_flow_cb_ctx *ctx = cb_ctx; @@ -10762,9 +10754,7 @@ flow_dv_sample_match_cb(struct mlx5_list *list __rte_unused, } struct mlx5_list_entry * -flow_dv_sample_create_cb(struct mlx5_list *list __rte_unused, - struct mlx5_list_entry *entry __rte_unused, - void *cb_ctx) +flow_dv_sample_create_cb(void *tool_ctx __rte_unused, void *cb_ctx) { struct mlx5_flow_cb_ctx *ctx = cb_ctx; struct rte_eth_dev *dev = ctx->dev; @@ -10851,7 +10841,7 @@ flow_dv_sample_create_cb(struct mlx5_list *list __rte_unused, } struct mlx5_list_entry * -flow_dv_sample_clone_cb(struct mlx5_list *list __rte_unused, +flow_dv_sample_clone_cb(void *tool_ctx __rte_unused, struct mlx5_list_entry *entry __rte_unused, void *cb_ctx) { @@ -10877,16 +10867,15 @@ flow_dv_sample_clone_cb(struct mlx5_list *list __rte_unused, } void -flow_dv_sample_clone_free_cb(struct mlx5_list *list __rte_unused, - struct mlx5_list_entry *entry) +flow_dv_sample_clone_free_cb(void *tool_ctx __rte_unused, + struct mlx5_list_entry *entry) { struct mlx5_flow_dv_sample_resource *resource = - container_of(entry, typeof(*resource), entry); + container_of(entry, typeof(*resource), entry); struct rte_eth_dev *dev = resource->dev; struct mlx5_priv *priv = dev->data->dev_private; - mlx5_ipool_free(priv->sh->ipool[MLX5_IPOOL_SAMPLE], - resource->idx); + mlx5_ipool_free(priv->sh->ipool[MLX5_IPOOL_SAMPLE], resource->idx); } /** @@ -10929,14 +10918,14 @@ flow_dv_sample_resource_register(struct rte_eth_dev *dev, } int -flow_dv_dest_array_match_cb(struct mlx5_list *list __rte_unused, +flow_dv_dest_array_match_cb(void *tool_ctx __rte_unused, struct mlx5_list_entry *entry, void *cb_ctx) { struct mlx5_flow_cb_ctx *ctx = cb_ctx; struct mlx5_flow_dv_dest_array_resource *ctx_resource = ctx->data; struct rte_eth_dev *dev = ctx->dev; struct mlx5_flow_dv_dest_array_resource *resource = - container_of(entry, typeof(*resource), entry); + container_of(entry, typeof(*resource), entry); uint32_t idx = 0; if (ctx_resource->num_of_dest == resource->num_of_dest && @@ -10958,9 +10947,7 @@ flow_dv_dest_array_match_cb(struct mlx5_list *list __rte_unused, } struct mlx5_list_entry * -flow_dv_dest_array_create_cb(struct mlx5_list *list __rte_unused, - struct mlx5_list_entry *entry __rte_unused, - void *cb_ctx) +flow_dv_dest_array_create_cb(void *tool_ctx __rte_unused, void *cb_ctx) { struct mlx5_flow_cb_ctx *ctx = cb_ctx; struct rte_eth_dev *dev = ctx->dev; @@ -11065,9 +11052,9 @@ flow_dv_dest_array_create_cb(struct mlx5_list *list __rte_unused, } struct mlx5_list_entry * -flow_dv_dest_array_clone_cb(struct mlx5_list *list __rte_unused, - struct mlx5_list_entry *entry __rte_unused, - void *cb_ctx) +flow_dv_dest_array_clone_cb(void *tool_ctx __rte_unused, + struct mlx5_list_entry *entry __rte_unused, + void *cb_ctx) { struct mlx5_flow_cb_ctx *ctx = cb_ctx; struct rte_eth_dev *dev = ctx->dev; @@ -11093,8 +11080,8 @@ flow_dv_dest_array_clone_cb(struct mlx5_list *list __rte_unused, } void -flow_dv_dest_array_clone_free_cb(struct mlx5_list *list __rte_unused, - struct mlx5_list_entry *entry) +flow_dv_dest_array_clone_free_cb(void *tool_ctx __rte_unused, + struct mlx5_list_entry *entry) { struct mlx5_flow_dv_dest_array_resource *resource = container_of(entry, typeof(*resource), entry); @@ -13568,7 +13555,7 @@ flow_dv_apply(struct rte_eth_dev *dev, struct rte_flow *flow, } void -flow_dv_matcher_remove_cb(struct mlx5_list *list __rte_unused, +flow_dv_matcher_remove_cb(void *tool_ctx __rte_unused, struct mlx5_list_entry *entry) { struct mlx5_flow_dv_matcher *resource = container_of(entry, @@ -13710,10 +13697,9 @@ flow_dv_modify_hdr_resource_release(struct rte_eth_dev *dev, } void -flow_dv_port_id_remove_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry) +flow_dv_port_id_remove_cb(void *tool_ctx, struct mlx5_list_entry *entry) { - struct mlx5_dev_ctx_shared *sh = list->ctx; + struct mlx5_dev_ctx_shared *sh = tool_ctx; struct mlx5_flow_dv_port_id_action_resource *resource = container_of(entry, typeof(*resource), entry); @@ -13767,10 +13753,9 @@ flow_dv_shared_rss_action_release(struct rte_eth_dev *dev, uint32_t srss) } void -flow_dv_push_vlan_remove_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry) +flow_dv_push_vlan_remove_cb(void *tool_ctx, struct mlx5_list_entry *entry) { - struct mlx5_dev_ctx_shared *sh = list->ctx; + struct mlx5_dev_ctx_shared *sh = tool_ctx; struct mlx5_flow_dv_push_vlan_action_resource *resource = container_of(entry, typeof(*resource), entry); @@ -13839,7 +13824,7 @@ flow_dv_fate_resource_release(struct rte_eth_dev *dev, } void -flow_dv_sample_remove_cb(struct mlx5_list *list __rte_unused, +flow_dv_sample_remove_cb(void *tool_ctx __rte_unused, struct mlx5_list_entry *entry) { struct mlx5_flow_dv_sample_resource *resource = container_of(entry, @@ -13887,7 +13872,7 @@ flow_dv_sample_resource_release(struct rte_eth_dev *dev, } void -flow_dv_dest_array_remove_cb(struct mlx5_list *list __rte_unused, +flow_dv_dest_array_remove_cb(void *tool_ctx __rte_unused, struct mlx5_list_entry *entry) { struct mlx5_flow_dv_dest_array_resource *resource = diff --git a/drivers/net/mlx5/mlx5_rx.h b/drivers/net/mlx5/mlx5_rx.h index 5450ddd388..3f2b99fb65 100644 --- a/drivers/net/mlx5/mlx5_rx.h +++ b/drivers/net/mlx5/mlx5_rx.h @@ -222,17 +222,14 @@ int mlx5_ind_table_obj_modify(struct rte_eth_dev *dev, struct mlx5_ind_table_obj *ind_tbl, uint16_t *queues, const uint32_t queues_n, bool standalone); -struct mlx5_list_entry *mlx5_hrxq_create_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry __rte_unused, void *cb_ctx); -int mlx5_hrxq_match_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry, +struct mlx5_list_entry *mlx5_hrxq_create_cb(void *tool_ctx, void *cb_ctx); +int mlx5_hrxq_match_cb(void *tool_ctx, struct mlx5_list_entry *entry, void *cb_ctx); -void mlx5_hrxq_remove_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry); -struct mlx5_list_entry *mlx5_hrxq_clone_cb(struct mlx5_list *list, +void mlx5_hrxq_remove_cb(void *tool_ctx, struct mlx5_list_entry *entry); +struct mlx5_list_entry *mlx5_hrxq_clone_cb(void *tool_ctx, struct mlx5_list_entry *entry, void *cb_ctx __rte_unused); -void mlx5_hrxq_clone_free_cb(struct mlx5_list *list, +void mlx5_hrxq_clone_free_cb(void *tool_ctx __rte_unused, struct mlx5_list_entry *entry); uint32_t mlx5_hrxq_get(struct rte_eth_dev *dev, struct mlx5_flow_rss_desc *rss_desc); diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index aa9e973d10..7893b3edd4 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -2093,25 +2093,10 @@ mlx5_ind_table_obj_modify(struct rte_eth_dev *dev, return ret; } -/** - * Match an Rx Hash queue. - * - * @param list - * mlx5 list pointer. - * @param entry - * Hash queue entry pointer. - * @param cb_ctx - * Context of the callback function. - * - * @return - * 0 if match, none zero if not match. - */ int -mlx5_hrxq_match_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry, - void *cb_ctx) +mlx5_hrxq_match_cb(void *tool_ctx, struct mlx5_list_entry *entry, void *cb_ctx) { - struct rte_eth_dev *dev = list->ctx; + struct rte_eth_dev *dev = tool_ctx; struct mlx5_flow_cb_ctx *ctx = cb_ctx; struct mlx5_flow_rss_desc *rss_desc = ctx->data; struct mlx5_hrxq *hrxq = container_of(entry, typeof(*hrxq), entry); @@ -2251,10 +2236,9 @@ __mlx5_hrxq_remove(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq) * Hash queue entry pointer. */ void -mlx5_hrxq_remove_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry) +mlx5_hrxq_remove_cb(void *tool_ctx, struct mlx5_list_entry *entry) { - struct rte_eth_dev *dev = list->ctx; + struct rte_eth_dev *dev = tool_ctx; struct mlx5_hrxq *hrxq = container_of(entry, typeof(*hrxq), entry); __mlx5_hrxq_remove(dev, hrxq); @@ -2305,25 +2289,10 @@ __mlx5_hrxq_create(struct rte_eth_dev *dev, return NULL; } -/** - * Create an Rx Hash queue. - * - * @param list - * mlx5 list pointer. - * @param entry - * Hash queue entry pointer. - * @param cb_ctx - * Context of the callback function. - * - * @return - * queue entry on success, NULL otherwise. - */ struct mlx5_list_entry * -mlx5_hrxq_create_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry __rte_unused, - void *cb_ctx) +mlx5_hrxq_create_cb(void *tool_ctx, void *cb_ctx) { - struct rte_eth_dev *dev = list->ctx; + struct rte_eth_dev *dev = tool_ctx; struct mlx5_flow_cb_ctx *ctx = cb_ctx; struct mlx5_flow_rss_desc *rss_desc = ctx->data; struct mlx5_hrxq *hrxq; @@ -2333,11 +2302,10 @@ mlx5_hrxq_create_cb(struct mlx5_list *list, } struct mlx5_list_entry * -mlx5_hrxq_clone_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry, +mlx5_hrxq_clone_cb(void *tool_ctx, struct mlx5_list_entry *entry, void *cb_ctx __rte_unused) { - struct rte_eth_dev *dev = list->ctx; + struct rte_eth_dev *dev = tool_ctx; struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_hrxq *hrxq; uint32_t hrxq_idx = 0; @@ -2351,10 +2319,9 @@ mlx5_hrxq_clone_cb(struct mlx5_list *list, } void -mlx5_hrxq_clone_free_cb(struct mlx5_list *list, - struct mlx5_list_entry *entry) +mlx5_hrxq_clone_free_cb(void *tool_ctx, struct mlx5_list_entry *entry) { - struct rte_eth_dev *dev = list->ctx; + struct rte_eth_dev *dev = tool_ctx; struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_hrxq *hrxq = container_of(entry, typeof(*hrxq), entry);