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 5963745BC0; Tue, 29 Oct 2024 18:15:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6084D42F3B; Tue, 29 Oct 2024 18:15:46 +0100 (CET) Received: from egress-ip42b.ess.de.barracuda.com (egress-ip42b.ess.de.barracuda.com [18.185.115.246]) by mails.dpdk.org (Postfix) with ESMTP id E8F4B42EDE for ; Tue, 29 Oct 2024 18:15:43 +0100 (CET) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2104.outbound.protection.outlook.com [104.47.18.104]) by mx-outbound17-86.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 29 Oct 2024 17:15:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Z3joLwSEeYlLgaZXK346ISeiytbDsYtV9D4UCk3W2c58gVSoX703S0tVPyfTYVmdYl3Hi0hNAdLIULIfEVsx7DT6loG/ROWpn2wmNiQ8fQko8j7n/SwK2lvs5QMH75nu0u3FeAyNBYwZy6WwrzGiUmpMrrmcTUBdoCy1D1wUZsBVTtEpJLHTKgPNsJ2hcV/G0dvTdIJ1+6BDhefSxStbKIf5SlXrXc2zydbDWTtLE23jHD1mIyrzvPHqmONT5OwdZcHh/OMgrOEMRAplZZ/lYToFZ7okrHvd0XOk1qe1IL2/B2Z6wbqF5ffO1rTWnTrjw9HMU59cEzN/5R60KW/v3w== 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=JJ121y3VVIK7jMK+vrlSSfe7ykmMosjltmIV0P4M8XDwfUxjnNRov6UbCuF81W4+hwt1Etw0F/CypPJDOExuWJWIqYlW1LtnD7Nfk7ZpCqxneWwQTi2BwHNE2sQi09A1dYQFIcPNDnpPkt5MUY1bVjlM75WKlQVBg4Pm8R2hs2PDnay14Rbwe6QZ6Dy9/GemYWEbCuWUoOgk5N7QNHp0IOE4sjE2yhFGDbquaSa00nZthLwsx+0rkHcZrT8sJ8K8mGq8CxMPkFeZ0NHUaBKiJ4TT09pz4BZgWFuvi+3gs5SBTsGxVVOgqTHao9M2mOHx9yXVx1+uXAz+2aD7n5D/FQ== 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=UfYKIIEq0ih4I+8/2gbZiJnysM6J6P4R7Jr54ihfC35EHQBVPVl/Z1ej83ypuj4x29Atz3V+T46Ad3qvOJqXzdsBumBwYux5ENiinKkkzBW7ZMVh2TWl6dLWx0w5kttp0uDYT76UMX2OBho+oWyKXlwmrVvt9m7Uq3GhyoTVEK8= Received: from DUZPR01CA0191.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b6::20) by PA4P190MB1232.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:101::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Tue, 29 Oct 2024 16:44:02 +0000 Received: from DU2PEPF00028D06.eurprd03.prod.outlook.com (2603:10a6:10:4b6:cafe::92) by DUZPR01CA0191.outlook.office365.com (2603:10a6:10:4b6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.29 via Frontend Transport; Tue, 29 Oct 2024 16:44:01 +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 DU2PEPF00028D06.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server id 15.20.8114.16 via Frontend Transport; Tue, 29 Oct 2024 16:44:00 +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 v4 69/86] net/ntnic: add termination thread Date: Tue, 29 Oct 2024 17:42:13 +0100 Message-ID: <20241029164243.1648775-70-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241029164243.1648775-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241029164243.1648775-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028D06:EE_|PA4P190MB1232:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: ff29fd75-34f2-4bb9-2068-08dcf838e451 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?N8L1+fbsexy0+5srl3DtOIcAOEwbdiqvXAOROY3P3OnoG1ptTFvv6i8ObWTV?= =?us-ascii?Q?dUNzvXlpn9yfe3EXbO4/LwgXRo2CmPBIeSAVKnz+HtweAhbzd6C99cZfoMia?= =?us-ascii?Q?d3+AsoCU+WBRCOUmuy0ZzJy0pF5pmjJspLveHRD+abuh5T5A3k5UeAtkGokX?= =?us-ascii?Q?wFQLchQ3z7lwoboln6+lxgZBW+6Sv5wfK6toE9++jjoWrfts3nxKJmtIVu9M?= =?us-ascii?Q?HLguiPLcc1MhsEcsYrsP3Q1O3FPdB/rV9aJd5XIlKoPLK24jlzNeE+b0SBG0?= =?us-ascii?Q?8ggueOytcmSriGXYH1DrtKa9/0jwru/MS3Gb3sPYpvTn5jm0iSAhi39rCOwd?= =?us-ascii?Q?6jS3H5BbtI6VNQSeXLbG3jE2hpuDYbuKg2SNO3WHfZ5dZ3BtHDOyA/rWGYEt?= =?us-ascii?Q?0XPzWvsgikRCReKb4t7Ycu8pYrF4yhgKnzMcVrC8bIss88lKyqqo4FoIMHmp?= =?us-ascii?Q?You6sRAbZobi3cEtnZwEmy53XRZbDKYDr0yaQFQRppvg6/SFNTKeo1Z2kJFB?= =?us-ascii?Q?NAq6TewnO9kVjqrdtNmvvhcZUgFOvDYr+8FjSrNlHehjbHzS4k/yU2kdj6x9?= =?us-ascii?Q?eKnPQA5OFOv6vAFRyfhjskFIkIIZTKWRCjRYwnVEiqOhactNjCU5FThYnWeX?= =?us-ascii?Q?SknhmfrxN69D/e8mEbnpI/5F0pgyHPeFCH+p3h1vz/5MN6Y7PngrS4AIdN8E?= =?us-ascii?Q?alYhxDIALLSUyIMcBv5pH+coTNInQLCxgFOqvc/w2dcheTb8E7WP1Vxb4wun?= =?us-ascii?Q?Qk4k0zJPkAKy/ddS4W8ptKnY6xmYgTEHJ+bJbcXoluNV+dRz5ZugP8vrdJjX?= =?us-ascii?Q?N+apmksOyS+4Fnwctf/t+QYpJnDg0cqB0OOwZXl9IV64RPsOu+O9fyN1bl19?= =?us-ascii?Q?loMtbv7GyMsti5mHuI/mfsFcyoz2fOcpJmX5PuMFWwCQxwvcJU8WRt4wDI4n?= =?us-ascii?Q?cm6csXr/YOZVJ6DYDSc9ydUG3zyUeEc2CIjzek39iqj/JRO7pz0DP1/YXieF?= =?us-ascii?Q?VOOf9sbSPY0pxNFri69odNmBR9XZ45W691GNHOiruGYco/qaCR9UvutYiQC3?= =?us-ascii?Q?RmU5nZlD8oRnABuY2q9n9nYddUw4o7wh1zXulwsAPPujXhqZ+aN1ic0iEnCj?= =?us-ascii?Q?Je25ljKfXi/WoIv+wAQ3I+lC36eBqA7h+7nb+dP+fC6KDT9dM4GcRt76V3pv?= =?us-ascii?Q?8xrSMEQr+GadEyymTIQyhBURzBXmh9stFZdYyOt0cofl5M28f5SrkITByBoF?= =?us-ascii?Q?SIwKJMGhctYjw4GFdhnrs76sO3VNIe5vMDrFCvhHvFYdkR1eAL2CqB1oju7B?= =?us-ascii?Q?mH7njOgBI7iCRqhR0UdVX+8H5slwAuLxLLHFcMmS+OSHNS3FXt21SkI8aJUG?= =?us-ascii?Q?D9PiYcxCMB0PrekcvuBs9r4TH5UdvnMYn/TLp7UM6BS2X/FS4A=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: kPfgCc4n5tX0InukXGqi1eLxbBNh3psbd6wCYNTwP88ZyR/7lPUijIzs9Y9bb7xHa0HYvc7YnDGNM9YBfI+Lg3H8fv3YqsknZ1ZxS2aZrkKwWwvUXURpCaiISQIiWW6jrcfWryc+OEHltVIFEaZOXN7nH9wuKzstlFUG6Hkq8/UMQOlVLKXAeWTt5ws2vpyghxUg3nYEq+DvvXKmLgM7pE8xd+f1sgNPoClBeUzg4l4tlz/eY+SchH/+Hfy89KMLkhD99t5ivlIIJBWHk1EQJMrjE7HSRdiFvoYoTfLTDxwyc5WYccTtcerJFYNs/u/4fJTUvagEwEqGeshFSAKdvwXULoOCdaRx/IsuWVILcMCb3+Gh0SlF2f3u8HKHgdgpEVZ/C9kt5GQdMilEYmACjlTOGOGG1Wnxkf7nVtTHbARqQ9Yk5XjKTl4e03UAz0O2s+SJ0p+EQ+VAY1OxoCxaWhO0/LL58lQpnBGh4FC+ju/hCh6NyIgueeWSsDNhoq8TBLR3UUWlThj6HtGoja+RPUKAVfO7R+MJg8vN9RzlJ5qAldbgjz0IQUL7HvOJNxbU5JGKMVrs8Uswgum7q6g7q6jL4UenmNWmbrDQ1Upc6fvEnEURxbiJu0xtIh7fxHwZS5dtir3DmJ35r8GmSplWIgH5VCb9+g/mRD073dsf3To= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 16:44:00.8553 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ff29fd75-34f2-4bb9-2068-08dcf838e451 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: DU2PEPF00028D06.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4P190MB1232 X-OriginatorOrg: napatech.com X-BESS-ID: 1730222139-304438-12709-31817-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.18.104 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.260064 [from cloudscan17-87.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