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 858D445BCC; Thu, 31 Oct 2024 00:14:46 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BC29243549; Thu, 31 Oct 2024 00:14:24 +0100 (CET) Received: from egress-ip42a.ess.de.barracuda.com (egress-ip42a.ess.de.barracuda.com [18.185.115.201]) by mails.dpdk.org (Postfix) with ESMTP id 406E043527 for ; Thu, 31 Oct 2024 00:14:23 +0100 (CET) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2106.outbound.protection.outlook.com [104.47.17.106]) by mx-outbound11-85.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 30 Oct 2024 23:14:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WvqIGF8+tWAIRWCsp5UxHsqdP3mEI6AIsQ4dks6xCZoebzLjsYVPq8hZ7+VZaaoHiFM4HW8erszInh2gWSHXDXogfIGUsDP/2Y6ONDknDc0Tjx0RiIaEZ7cS8hG5yJmERiBd04kLvld6EZmyN/Dc7+U9BgZxGkflCRL8lckvyJ08cUdyDUrTtR8eTWkpU6XpURyR8hswqbuPg1WI/U++Nmw8U5j19vGVTEO6pDSfYwvFHADOPMnax4e8oLXkEbUlmbqGOzKKltJs0VlWJ3RRUDR82VHOVTK8cXf5SF/wo4PGhse8W8C7N81j3X7KveJ0sWYxaUb8N4jZ3Elk61UncQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=uYCsnX+bN3S2b9lTp1BSuOS7kCJyYC8+fHX5/W01Q7E=; b=wNVVji66JzFr9e3+YRPCuRYuyndmGJ8Iu6r42U1IgsL507aZdI1LiKJ/7vs+RinKNXClOJdNFcZyFBaTez5SHbEivOvUH6ES7Qaql5yfWFEL/kfWkT8TamYkZwliR4U7ybugABGxiZE/ysrKWjybiRv329p6Mptgsi0d+hUkpYXteXn3bVy6Gc+LJ9QtZD0vmME4fi1GLZvuY+gK99oWc1zBnQN7PpfO9bEY44sbrFQ0ENLsFoQImf+CuwNQ7CrRr1kztVw8wX3Difim9yXobtZawEef1WleocnMBwL2b6RHDI0H/dDHW43YewAlmhob9pb+R/7O3oBIdM4U0ZhL9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 178.72.21.4) smtp.rcpttodomain=dpdk.org smtp.mailfrom=napatech.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=napatech.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=napatech.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uYCsnX+bN3S2b9lTp1BSuOS7kCJyYC8+fHX5/W01Q7E=; b=cFFKb8g2Hp1WtNH2wxXakSIP9SHqTJUqEdjgMV7hpy/CO5MM+Zgb66jrcmlJg3l8iCoMMSHEDMrqUHKcAIrYdGiWq08VLsu9FabiY77ph1Syur3uEj00tCR2I1lY2O3DpVGLB8YhvIkOZcamQT7J/D89efPpP8Iwe2TmPJGSemw= Received: from DUZPR01CA0011.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c3::19) by GVXP190MB1991.EURP190.PROD.OUTLOOK.COM (2603:10a6:150:3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Wed, 30 Oct 2024 21:40:59 +0000 Received: from DU2PEPF00028D13.eurprd03.prod.outlook.com (2603:10a6:10:3c3:cafe::ec) by DUZPR01CA0011.outlook.office365.com (2603:10a6:10:3c3::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20 via Frontend Transport; Wed, 30 Oct 2024 21:40:59 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 178.72.21.4) smtp.mailfrom=napatech.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=napatech.com; Received-SPF: Fail (protection.outlook.com: domain of napatech.com does not designate 178.72.21.4 as permitted sender) receiver=protection.outlook.com; client-ip=178.72.21.4; helo=localhost.localdomain; Received: from localhost.localdomain (178.72.21.4) by DU2PEPF00028D13.mail.protection.outlook.com (10.167.242.27) with Microsoft SMTP Server id 15.20.8114.16 via Frontend Transport; Wed, 30 Oct 2024 21:40:58 +0000 From: Serhii Iliushyk To: dev@dpdk.org Cc: mko-plv@napatech.com, sil-plv@napatech.com, ckm@napatech.com, andrew.rybchenko@oktetlabs.ru, ferruh.yigit@amd.com, stephen@networkplumber.org, Danylo Vodopianov Subject: [PATCH v5 68/80] net/ntnic: add termination thread Date: Wed, 30 Oct 2024 22:39:15 +0100 Message-ID: <20241030213940.3470062-69-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241030213940.3470062-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241030213940.3470062-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028D13:EE_|GVXP190MB1991:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: a3d8c28a-cfc3-424a-8234-08dcf92b8aff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|36860700013|1800799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0mNttg+EJXAcxQCIPxLyS7qPm4UsyuvPIeXXlbounNQClwiyB6xNeH?= =?us-ascii?Q?t99DqVxKwF9RIOh7xocZGHLCa/mHtiqBOhjSXqADrNTlI556+j9meImBexrj?= =?us-ascii?Q?MRXm3bQz8LGd+fpu698bKMJt8Nk3EoGsKId9IYmXV+6LWKfYCeT/np9JWKvZ?= =?us-ascii?Q?Dqru4F91JqnlDudZt8YUHy/8CIpA8h2vnla/upzRp2cf6KBYbbZVs6628IkA?= =?us-ascii?Q?ppI/PIhHqBhE+9iKVHxBpA6/qkjET0bZkJNbEYHvSqtk9qXS47Gute1vg0my?= =?us-ascii?Q?oWwkYEDNzl8RB4ObgXvnsSdApPJJmP8pkCXGpVYNMxQUJANs0E7I2pvcUNKF?= =?us-ascii?Q?zFFEXzZL99wfsEzjeosCkJK/3ZtpjBMHBwRhQm0lY95CMnzfIqxmCzVoITvO?= =?us-ascii?Q?FhTaQjDOFcxpM0tzzDZ4CVzFjM/6qkbmfxbB9qGR/f+u8oNIfmiyRoeSoGhx?= =?us-ascii?Q?VaaF6sQDNf15oZbWDRFeYBgEuXf0XXpE9W78fnoCe98WzeXFMR5H4+8KkFvA?= =?us-ascii?Q?HhJaXmSz2E9ffYW+g0UC463UwOIjS4iHBgcaDmKkbcaa/fXLbg=3D=3D?= X-Forefront-Antispam-Report: CIP:178.72.21.4; CTRY:DK; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:localhost.localdomain; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(376014)(36860700013)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: eLcvNpoqqrE6uwf2Ynv5tXyvbJDnyTvgbUjTAYQUGb07nvWDQSNUvZgmKfG+tkX3YkrbFPk+wrguTiNXzjfoK7FWFg4mjHhnPda3pzxjAyK6CTDR6MWp6B5mprDKmAqOS17eT/ZDRMRVFqE4jU9UEWEBbaEf0fV9zQi9nAOjXnFyzBlEkHCaVDrtNRzAMKvtSFMN8MceLdTVpdenv0AXUrYbHMOSlEkkwkEs01ujTVoncCCVN14RuG8ODWb6G3duoegQVQ5F9QSWPb+Au9sxsIgpxIgVWc5XR0TkGP7Z6guAhDDl1xWOXWayxhGbZH+ZSKNVJpwPqNoQPs4NZRb9pt76lU3ensfO41v9BPV7+3fS9o0KfmXnjm2D29llRpeJIDA+klauq8mgH7oyDBe94RDgzPiZ6qGfDuanvYdXHL/hZEWUd0jqQW/CnPg26h5GNmj4TVsSjMbB4r4lzhcvOGLDoE5wriQd23XSekAjyMfhQqqoV2VeFC9D6DWkOpEK+7/xKKgVFyl5zXBxT3vlsHSFAbuYh6HPt0O5CgpAInQLUOnaTf4/BJTMOgXqDRFiiDjPZhU9j6QEDcrNw/iuMjoxCw7uovmxIwzQkLTk4HNs+tK0eMRNTViDjM6BH25NioSX2Ab5qjdOtNOgzwc4abksAuYcPdJLyieMiabsMas= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 21:40:58.7241 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3d8c28a-cfc3-424a-8234-08dcf92b8aff X-MS-Exchange-CrossTenant-Id: c4540d0b-728a-4233-9da5-9ea30c7ec3ed X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=c4540d0b-728a-4233-9da5-9ea30c7ec3ed; Ip=[178.72.21.4]; Helo=[localhost.localdomain] X-MS-Exchange-CrossTenant-AuthSource: DU2PEPF00028D13.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXP190MB1991 X-OriginatorOrg: napatech.com X-BESS-ID: 1730330060-302901-12800-46847-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.106 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqamJoZAVgZQ0NDAxMDUKC3ZxC g50SjV3MTMwsQg2dQ0OdkgySgp0TBVqTYWAGuniblBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260092 [from cloudscan20-80.eu-central-1b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 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 From: Danylo Vodopianov Introduce clear_pdrv to unregister driver from global tracking. Modify drv_deinit to call clear_pdirv and ensure safe termination. Add flm sta and age event free. Signed-off-by: Danylo Vodopianov --- .../flow_api/profile_inline/flm_age_queue.c | 10 +++ .../flow_api/profile_inline/flm_age_queue.h | 1 + .../flow_api/profile_inline/flm_evt_queue.c | 76 +++++++++++++++++++ .../flow_api/profile_inline/flm_evt_queue.h | 1 + drivers/net/ntnic/ntnic_ethdev.c | 6 ++ 5 files changed, 94 insertions(+) diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c b/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c index 76bbd57f65..d916eccec7 100644 --- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c +++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c @@ -44,6 +44,16 @@ void flm_age_queue_free(uint8_t port, uint16_t caller_id) rte_ring_free(q); } +void flm_age_queue_free_all(void) +{ + int i; + int j; + + for (i = 0; i < MAX_EVT_AGE_PORTS; i++) + for (j = 0; j < MAX_EVT_AGE_QUEUES; j++) + flm_age_queue_free(i, j); +} + struct rte_ring *flm_age_queue_create(uint8_t port, uint16_t caller_id, unsigned int count) { char name[20]; diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h b/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h index 27154836c5..55c410ac86 100644 --- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h +++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h @@ -32,6 +32,7 @@ int flm_age_event_get(uint8_t port); void flm_age_event_set(uint8_t port); void flm_age_event_clear(uint8_t port); void flm_age_queue_free(uint8_t port, uint16_t caller_id); +void flm_age_queue_free_all(void); struct rte_ring *flm_age_queue_create(uint8_t port, uint16_t caller_id, unsigned int count); void flm_age_queue_put(uint16_t caller_id, struct flm_age_event_s *obj); int flm_age_queue_get(uint16_t caller_id, struct flm_age_event_s *obj); diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.c b/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.c index db9687714f..761609a0ea 100644 --- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.c +++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.c @@ -25,6 +25,82 @@ static struct rte_ring *stat_q_local[MAX_STAT_LCL_QUEUES]; /* Remote queues for flm status records */ static struct rte_ring *stat_q_remote[MAX_STAT_RMT_QUEUES]; +static void flm_inf_sta_queue_free(uint8_t port, uint8_t caller) +{ + struct rte_ring *q = NULL; + + /* If queues is not created, then ignore and return */ + switch (caller) { + case FLM_INFO_LOCAL: + if (port < MAX_INFO_LCL_QUEUES && info_q_local[port] != NULL) { + q = info_q_local[port]; + info_q_local[port] = NULL; + } + + break; + + case FLM_INFO_REMOTE: + if (port < MAX_INFO_RMT_QUEUES && info_q_remote[port] != NULL) { + q = info_q_remote[port]; + info_q_remote[port] = NULL; + } + + break; + + case FLM_STAT_LOCAL: + if (port < MAX_STAT_LCL_QUEUES && stat_q_local[port] != NULL) { + q = stat_q_local[port]; + stat_q_local[port] = NULL; + } + + break; + + case FLM_STAT_REMOTE: + if (port < MAX_STAT_RMT_QUEUES && stat_q_remote[port] != NULL) { + q = stat_q_remote[port]; + stat_q_remote[port] = NULL; + } + + break; + + default: + NT_LOG(ERR, FILTER, "FLM queue free illegal caller: %u", caller); + break; + } + + if (q) + rte_ring_free(q); +} + +void flm_inf_sta_queue_free_all(uint8_t caller) +{ + int count = 0; + + switch (caller) { + case FLM_INFO_LOCAL: + count = MAX_INFO_LCL_QUEUES; + break; + + case FLM_INFO_REMOTE: + count = MAX_INFO_RMT_QUEUES; + break; + + case FLM_STAT_LOCAL: + count = MAX_STAT_LCL_QUEUES; + break; + + case FLM_STAT_REMOTE: + count = MAX_STAT_RMT_QUEUES; + break; + + default: + NT_LOG(ERR, FILTER, "FLM queue free illegal caller: %u", caller); + return; + } + + for (int i = 0; i < count; i++) + flm_inf_sta_queue_free(i, caller); +} static struct rte_ring *flm_evt_queue_create(uint8_t port, uint8_t caller) { diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.h b/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.h index 3a61f844b6..d61b282472 100644 --- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.h +++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.h @@ -47,6 +47,7 @@ enum { #define FLM_EVT_ELEM_SIZE sizeof(struct flm_info_event_s) #define FLM_STAT_ELEM_SIZE sizeof(struct flm_status_event_s) +void flm_inf_sta_queue_free_all(uint8_t caller); int flm_inf_queue_get(uint8_t port, bool remote, struct flm_info_event_s *obj); int flm_sta_queue_put(uint8_t port, bool remote, struct flm_status_event_s *obj); diff --git a/drivers/net/ntnic/ntnic_ethdev.c b/drivers/net/ntnic/ntnic_ethdev.c index e0f455dc1b..cdf5c346b7 100644 --- a/drivers/net/ntnic/ntnic_ethdev.c +++ b/drivers/net/ntnic/ntnic_ethdev.c @@ -1420,6 +1420,12 @@ drv_deinit(struct drv_s *p_drv) THREAD_JOIN(p_nt_drv->flm_thread); profile_inline_ops->flm_free_queues(); THREAD_JOIN(p_nt_drv->port_event_thread); + /* Free all local flm event queues */ + flm_inf_sta_queue_free_all(FLM_INFO_LOCAL); + /* Free all remote flm event queues */ + flm_inf_sta_queue_free_all(FLM_INFO_REMOTE); + /* Free all aged flow event queues */ + flm_age_queue_free_all(); } /* stop adapter */ -- 2.45.0