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 6D6A145B96; Mon, 21 Oct 2024 23:40:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5796C4042F; Mon, 21 Oct 2024 23:40:40 +0200 (CEST) Received: from egress-ip11b.ess.de.barracuda.com (egress-ip11b.ess.de.barracuda.com [18.185.115.215]) by mails.dpdk.org (Postfix) with ESMTP id 5120440611 for ; Mon, 21 Oct 2024 23:40:37 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2111.outbound.protection.outlook.com [104.47.17.111]) by mx-outbound19-70.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 21 Oct 2024 21:40:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cRt4i8uEEH+c3jmQTBZ6O8w6CwR61b8e9dnBfZYZa4Fevaf2YcQ5eVaw6/YO+gKTKK04JvquOlHyDDV9l1jauGGGElKugfX4F84qvU+hEQcHYfjImoDYHZpqC4/GCwuRNzqmCjtkkGd8wrLT6n1eKeeq8986jumKj4PRE7eF3F893F17b52P0vVNKUXXKI/Q+CMWr/X2MUpSY1NBQtWE79td2Z3jxPJGYqHUfUc0pR9sI+dh1Aa3B4NH8W0aNbp1OqOYCLB87JCbMbCxCXke5ziRdC1AJMe0WD5LaD0U+7scNz2pnyStfCyGQb9QiN7anAgkOd5m5bhp9xuBILYUPg== 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=7FQ2qmqAgzN0DRTc7CkF8nD2V13/fW/u1ts2DZNBmhQ=; b=kPTpr4CMxuhAzPY5mSp45wIMDzfUdaGW8dsOrqPSdWRIhnD8irLiW5iG3mudOm9+l3bh4EqJff3V+csQv+RJmRM28GMobik9JrrAwPTzPxSnQlVS6Re1lQd45Doc0YWdUgp+TYph8HYdeR/DROjIULTdegXsC07UJ0XxO31frN5eKCCw/qVnV6I3RSuL3hZb8e3KKdlKz4P5ptq9tADWZPMyI6RB4qeWwlW4amz/UCfqrDcEGiHilv+YmgFGK2X+n1nu8f+SDN6s4zedXV9Wylp7aAcmOs8GbN5lJow7Q21IqXxO2KmxBjKzTO4N/uuyG28WuMcGFRzXBChTtE8Aqw== 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=7FQ2qmqAgzN0DRTc7CkF8nD2V13/fW/u1ts2DZNBmhQ=; b=nr/sTWdvkP2JQNCQhJsmpIhTiWel3V8XI7JQadSOT2YeoYf1RyJt5dz4tpVEdGmc+JL/RvwhGX9v9NnoJeF4qai+1+BOEGOW3Dw6QM5w30lW7U5LOn7oyPl4zNDGLN31eGrWBa5fr4LXC2xeg/nC4Ln1v4qw1Iq9YwTkh+L/vrY= Received: from AS9PR04CA0153.eurprd04.prod.outlook.com (2603:10a6:20b:48a::27) by VI1P190MB0687.EURP190.PROD.OUTLOOK.COM (2603:10a6:800:11c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 21:06:20 +0000 Received: from AMS0EPF000001A8.eurprd05.prod.outlook.com (2603:10a6:20b:48a:cafe::e5) by AS9PR04CA0153.outlook.office365.com (2603:10a6:20b:48a::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Mon, 21 Oct 2024 21:06:20 +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 AMS0EPF000001A8.mail.protection.outlook.com (10.167.16.148) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 21:06:19 +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, Danylo Vodopianov Subject: [PATCH v1 69/73] net/ntnic: add thread termination Date: Mon, 21 Oct 2024 23:05:11 +0200 Message-ID: <20241021210527.2075431-70-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241021210527.2075431-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF000001A8:EE_|VI1P190MB0687:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 7096466e-c704-434c-98de-08dcf214360d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q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jTN4?= =?us-ascii?Q?Ryooy9n5D0Gydj5pfaS3lDFB4NmSTsdOW3Z4Vdudeyj7kdrsaGJn2O+ho+Rv?= =?us-ascii?Q?XoKTS25u9OwTW5QlWl07bWCWfpXeAH74FZWQiiPGYEWOCG30QbamK+HVcSNW?= =?us-ascii?Q?TKH1z0jjD3VT+G7dGIiiphFh1sopLg3HxLPCEghsIV+OxQf0Igi1b0hTqz4M?= =?us-ascii?Q?r1OxKnKuPT2sjnp5qEZDyGzDNjHP/MEegWJUrpcC46toF7sACJUT3phtEKw0?= =?us-ascii?Q?0p2fL2iVCW76IR/0OxmdpVYvWrL5gdQqNAyKJejlmkXjtydo00YeVBU2jJjI?= =?us-ascii?Q?nuqqC4byJYGeT3Avllyq6U3VTiUK85sQno/SvSWiSZEqBL+xJjydRHfh79rd?= =?us-ascii?Q?HhpHMLx6ohxyDCd1AQZWBvLyRZUFsUXWkzL1+JVKjKdiJ0vadb5WMk1avvxj?= =?us-ascii?Q?1ESMptjExVPaME8RjT804OiOGgkGM83wz7DXsm7086xF7hsTNw1OUiM36OEx?= =?us-ascii?Q?lex3vl6qzG8Kfb/eQFsIWlU0SvU6HKLrua6XSHUGJF0mbC4AUw=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)(36860700013)(376014)(82310400026)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ehFRIVS+eYtHdue3fhmwUKkeXVovbx8cphymVbJVz+5AdCAXylHUb0jm16kRlXHPuRcPQK8boQ3prNYqryZNJglWL00c059yInKdfcGAZyENK6fwA/ftJDSvSKAUvWHUCH+QiBEkVi4+tKCkvptMQi/bMy/DZ7rwuZxwd7FURchIt7J5Rjzgh35+1neHsWg6jDMLLZ6llbvQUBPbR8XKM8uqTmOTaQ+FCOm7tpk9lwZS3Gom5c1DoSsnKya3ERz8uJuQ9X2/eOzSVKJ2pxyOxLaxuj03koIIdQmmWcrAEl6HWq1NQPQNuUFfqe2EUizKohloyhZfdjnEPLpC88oztFO5M8l2O1j8lWWi13vd2YFkzoZCGIKgCZ4CNTc7W5pHTeiKlIU71fMNwiWjBQj3x/pyUdBwrafeRbOFCqELJXMd4RSockhBTreT0IEEh6Sqmvc7VFXTFC+egG3PaY4N97mbNnYagZPgFi9213cJeeDr3gLzUACPcyZXcIhDzTy2KcqvrNHeqhBrN7GH6F+TLbkffCcxIODYrdttZmSSiGHir1r5urAxHEC2xQXWc1rjuH0Hg24zc87d3/l2YhlhfIFTrf4uMbFlZg+a1DS4/x2ctpz0FVpDZ/N5jyVRzCoBi0LL7vR1wkEJj+LDZP6KQi2pW6Xy7Py7fXYEFJJGn2E= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 21:06:19.8333 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7096466e-c704-434c-98de-08dcf214360d 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: AMS0EPF000001A8.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1P190MB0687 X-OriginatorOrg: napatech.com X-BESS-ID: 1729546836-304934-12651-46832-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.111 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqbmFhZAVgZQ0CQl1cTS3NDS0N LMxMLAONUo0SzZzMzYNC3V0DTR0iRNqTYWAGPjTWJBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259883 [from cloudscan10-204.eu-central-1a.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 | 12 +++ 5 files changed, 100 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 fc192ff05d..ad916a7bcc 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 @@ -46,6 +46,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 6cac8da17e..15374d3045 100644 --- a/drivers/net/ntnic/ntnic_ethdev.c +++ b/drivers/net/ntnic/ntnic_ethdev.c @@ -1416,6 +1416,18 @@ drv_deinit(struct drv_s *p_drv) p_drv->ntdrv.b_shutdown = true; THREAD_JOIN(p_nt_drv->stat_thread); + if (fpga_info->profile == FPGA_INFO_PROFILE_INLINE) { + 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(); + } + if (fpga_info->profile == FPGA_INFO_PROFILE_INLINE) { THREAD_JOIN(p_nt_drv->flm_thread); profile_inline_ops->flm_free_queues(); -- 2.45.0