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 6D34245BA3; Tue, 22 Oct 2024 19:32:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F108B40B91; Tue, 22 Oct 2024 19:31:41 +0200 (CEST) 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 83C954068E for ; Tue, 22 Oct 2024 19:31:39 +0200 (CEST) Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02lp2113.outbound.protection.outlook.com [104.47.11.113]) by mx-outbound40-26.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 22 Oct 2024 17:31:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=q/usQJs9xK3BCCUVEAiaaRzIXkwBnYtRItMFd/LKhbsR5vkYy9P/I9RJUnKekQdTC0c57EA/FssUwRRXrod6DRlkvPb5iW1ZjYRqLaNGyVEouzf/8h7qJhaG/NCY/f3/vMkPGBn5F/PR21LOoaWV2eIvc+mfguKBwHvmhDN3zhHh6zUD07W2g+4M8U1WpYl05t1v9+WyxI7dtSZetw5ZRdLMIPbOJureE6J/uheECuIlmjqFHjaIpSMiE0VmN821CzQvgidbwkxcXITeykrlrtZ92OnpfUC113GQSH8NvtTuWD0LDA/eIx0SgEBurg9qw79HDIeRVMF1lqYNmjtXjw== 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=Rokpp/qGUuju5IN8H8yB24+QzTwK2+0aKAPafgsOCLM=; b=G9LnwpamlFOcpkVJ9vtWUx8WpclI9TqPnhBJTkU8zp0r7QgD0zE3eIAk95USJN+RFDZe26M9IDh5wTXgNRZiB6UDVeDmxvxxy2zJ5pvkgOXuSfYft4s4To49NWG7Yl0dsS8SzMAytkuWcMPfNPyQdY4zyevWGedM4lepllGyWCv4V3nj411dRphyNpwy/YGTt5gypf1NZ8gHFg46YcqGhuDmIXjjZyzGD0cl5rVQUMQzAKivWr/CJaD5kzvVmUs1NFkh+uGKrzHLM8OGqmQR/LielnrhguV/aySlCKBOAOksuBEGcPitV5Qsi4J1he1FEBiWMlCPceGUv20HbCYCzQ== 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=Rokpp/qGUuju5IN8H8yB24+QzTwK2+0aKAPafgsOCLM=; b=bJDyBC1IkNEP05Mll2Hl8+4k44SDsV7XzKp6VdiQzEmmrBxtZbaFjmLITCy/Qf+mVnyL2fTv9PonJPZHMPDlsxh3eRHdZcG6U052fvUsI5qF2EpclUsA3CSs5Fa+RKKjElYaJWqFjwaVnYUtSpemd6j6tibXx6UmR/pZqimjUYQ= Received: from DB9PR06CA0019.eurprd06.prod.outlook.com (2603:10a6:10:1db::24) by AS8P190MB2008.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:52e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 16:57:18 +0000 Received: from DU2PEPF0001E9C2.eurprd03.prod.outlook.com (2603:10a6:10:1db:cafe::4c) by DB9PR06CA0019.outlook.office365.com (2603:10a6:10:1db::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Tue, 22 Oct 2024 16:57:18 +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 DU2PEPF0001E9C2.mail.protection.outlook.com (10.167.8.71) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Tue, 22 Oct 2024 16:57:17 +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 v2 69/73] net/ntnic: add thread termination Date: Tue, 22 Oct 2024 18:55:26 +0200 Message-ID: <20241022165541.3186140-70-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241022165541.3186140-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241022165541.3186140-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF0001E9C2:EE_|AS8P190MB2008:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 9ecec2b8-edfa-4456-fc63-08dcf2ba9668 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?ku5hWcCckmqGy7RN0sJUMOIZ+VfE/z+rh+rwPmieCwD9bZOM/XwS/jDNCKSl?= =?us-ascii?Q?UV0lpjnmDobUuiwWPKC+eOgjHOtIPMDjKXyJwxD4J9FwvmV8C4WmyCUVn2dM?= =?us-ascii?Q?56YKkiRVkBCO2HpKOazMebDlKT+FlmVzJK7lBmzVRLxI+HxtJ19fKKUek8hL?= =?us-ascii?Q?KSofwxHBo8EGaIsBwyKe6WImcFBNNjlTC3hfntGLoX7YFaKooG1hFIzVyTWC?= =?us-ascii?Q?+7xndXPEnQ8sVQVBt7c1v4pcKHsssDyM9qu8pJ46yTkfANRw0nQaIp/NyCtN?= =?us-ascii?Q?LDseIndq6AIVIlqBAagMzCnYT21TIlm6DOIklRM2oc3PQ9xK6iHY7RX7LL4j?= =?us-ascii?Q?YDQT5uRcDdFf02qwT6CnLjy8gpPq357YnEy68IdkMVCWUxgq0r4DOF4zhnqL?= =?us-ascii?Q?h0cNz04SoQd2XMYFbaLBhoo6CnKU2cT9CJrXYX533lleizzuuNksm32wWuRv?= =?us-ascii?Q?aWJCqgvFCsNWfEqsZQ7OXyG8N8pzUQhdWjeqcsKLV2EHOLJ0AACq/RgPgRG8?= =?us-ascii?Q?mTFNVxhZ0W0DHdU5qTU7qCxciVLe6jgmzV27aEsrFdcWcqtba4ZH9blf8oA/?= =?us-ascii?Q?KMC2bUibhbmzImmfFk/xV+VgnZ/8HkfD9ooN/BcCft6iWm23Git7dgx6Qmmv?= =?us-ascii?Q?XPH8X10d2uv8YVA0OJrSnBEAONnZX7to/AzKP8r0umUzICDlk40pGqi1IgsI?= =?us-ascii?Q?jBC1p5G0+6O2VDQvr5gaooUzx8AcExvWzWFJpLjBgpjb/q4lRGV9iZx6W/PW?= =?us-ascii?Q?Zfg2jxcN0uO4FBDXc6B23hged0lPnswXM8wFaTeC80ShOIGSoIVWrBOSrhei?= =?us-ascii?Q?zGTD4bgbAX4LXGbNYLoy4ilTBY4F9IGEnm8ymyTqdWhX82fIUxn6ivkU+cJd?= =?us-ascii?Q?nV25lafVV7W/N/ivg5u86H0XPShREczaTSmfD7UTPKYo6VFn/nNLgtYA3hq/?= =?us-ascii?Q?UbvIpJLKJkBtrdrTjFnns/fymAvJqjT8ibZnIPJjmA/oVJ4PbO1k5x0Pksu3?= =?us-ascii?Q?Yeqc2CBtWPSoqIgEsQHW8/7nF9xEXsPwU5JjI5NdF3JNa/MBa+uep81i0JfU?= =?us-ascii?Q?7/Qnq3QI2FjOa0dbxQc03MH0Ef91Gouh+zkAsW7hwZSKTc1qRrZ+3ozvN+rc?= =?us-ascii?Q?OqPcLVLtRuHB3ExlpTmNaIS/FkE29m+vX/qJj0h4duI5G8/vYKOJ/rH++ZmA?= =?us-ascii?Q?iMi8zhHkWnL1wNuunqS+qehpHvwH/YNamhrZaKaHl/57q0Zn4hCt85W1haUF?= =?us-ascii?Q?liks4C20vRkvWoSmtm2kmR40xoMXY+GjRI6NuXgkVF8jY9ZlU0L88oSm+4PO?= =?us-ascii?Q?7a703MszJ0uS2tPJr59v8qUN+LpZyTpfGQ7GNIIZ36xkzVN37z9BCv6EdFda?= =?us-ascii?Q?MW1/+4FV837t2tVDbUzCvFLccUhznHWqn6s7OqmCQRl5i8OpAg=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: AT/oB0Sy9ssN1OzP1fa2c3+cRcBeoEBdedXaqAk81OF15+IffLyLMl9HA3BuT0B0Qo863WPrww36V47YfLpff5Qw5e8kYO+XUgez3q7ZvMAY3KJi7kgSoqpZGqNmUslIKCeF1ddP1DoN08gAFEz04TEDuPLOh+LtPMCHmAADuGG1rgBzxYHAPTng+pn8WecQJsz0kynJZVjZIyCreB25RfKX1qCuJjeCzvyclZ9BuvNnYsbwZx4wtEtGJsOox1eKzIGSijCaQF8M3jjjfQcV75A590FCBe3jYZO6gNkLep66pREZsTpWBUURy5KM4qsMhQcYWLalte74V0/o7S4hvqJ1S9Czj7T+7dGFy9Pxazl8iQJWXBGoSIzTeO2XKNE6RX0eHRQGbrj6blu1bNJlPqpyfEUh6zpP9Egufcs2En40666g3Wr65xAMtg70w+1I8FCc9iqyraZz8uHrYqfkBoMlNFHgrBkQHByQgMfEE/msgN5OOpJXggeql1wGXIIZBlWVO14WpQAJRIJhP8ZWAP+1SKGZdLW9oOcYlDOmmqffVuyaFQnFnvdT3K60Y56G3JEVIVmnohBefUJokZp1fIGyxPvgcghe7SqG0TmnHzjNvTQDu4hKhEmZ1aVxbA5z6hjwTdZDSQol83imPB+sZUR9WptkVrzqRq1gvOIYjEs= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 16:57:17.7944 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9ecec2b8-edfa-4456-fc63-08dcf2ba9668 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: DU2PEPF0001E9C2.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8P190MB2008 X-OriginatorOrg: napatech.com X-BESS-ID: 1729618298-310266-12658-14465-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.11.113 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqbmFhZAVgZQ0NzcNDnFyCwtyc TINNXCMM082cg4ySjZ3NA80TzJ0CxNqTYWACGbHM9BAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259902 [from cloudscan16-191.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 | 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 51126dfded..f4b071ebbb 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