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 58F9045BB5; Wed, 23 Oct 2024 20:33:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E718042EF2; Wed, 23 Oct 2024 20:33:37 +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 3FB4142EF2 for ; Wed, 23 Oct 2024 20:33:34 +0200 (CEST) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03lp2173.outbound.protection.outlook.com [104.47.51.173]) by mx-outbound15-83.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 23 Oct 2024 18:33:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=I5Ke8+71+io7XYvX3dDJkreOMXCBDNrfzXb8GUiTtNfHhE5h2vwmzO4vFZTg/6pislUGAyrVqOL6j32NeeYRlaRhZEQk21gs1cSNYIHnRvyRGgYbXzxJnqYmvNqzGj/bDzSBdX1v0hizlUKEQC1YRJ/zn855Ne8mEZXTHGFF9AuC7ZTiXT8rZ38Uv6sq2n0vPWYPLMEHSbDPF4WAKg0U56cQDZ0uCzQEe2IBOFVbeL3Cx0tBlsiLyWK01wev1ba9wMa3gNQAW0E8jeBKAqpejoOF/Bcmptqsxk5rwsWSbi/vFuiDRZFLhzyWoo4hqgG9JV0CSQ8FBRfzmfHUsr4a1w== 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=JK2qeKke7A5hF8P5zuoflpkG1q+H2oH85pcvoAzYOIY=; b=n/HA3asUEwbkWPti+osRnScsfqgMIqDKeXNd2t5JZ4vbWNem9ojXs/1xL6sxu5TjIentMmuTupgwGVr1vnW7R+Awdb9jZCFyRqGhhNYTE7BjW/w4/2jq31mMgCfvE3wdC0v9GBXw35nPFA8fuxxbHjZafYmcZvQ4URb4v/nM9P/6uz8FHJ5+GXaUVkd11ZgGfwB3NVpgKDIxT8wWxblwCuPumlgFT1fNwiigqmbyKFD//DehP6aIDtA25GmkJuGFxlIf4SOPWdOJmx7CUfwz0T3zI6YH98ZmCB2HIQTuuperzFU8oJhrpWWFRqcUgFcojP0sHLD9Gs+UGxfzFq6Sgg== 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=JK2qeKke7A5hF8P5zuoflpkG1q+H2oH85pcvoAzYOIY=; b=LJ7FPRTlxvREL80XbiQDV7zrB+0GcW08SexeMjiw5LbRTTH7Cgk8GI6uP3QgaBEUHd0y6ljqk+pnzt+p3GmJsbCvN7eOn+vGLAT2RLyflEJfGfdgtoJJf1Gvjtg8iZefgzYwNljfdStCBkSRXr4Oh1wcnCGOcpw/56hjTrPXEng= Received: from DU7PR01CA0012.eurprd01.prod.exchangelabs.com (2603:10a6:10:50f::15) by AM7P190MB0710.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:114::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.18; Wed, 23 Oct 2024 17:01:46 +0000 Received: from DB5PEPF00014B9E.eurprd02.prod.outlook.com (2603:10a6:10:50f:cafe::51) by DU7PR01CA0012.outlook.office365.com (2603:10a6:10:50f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Wed, 23 Oct 2024 17:01:46 +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 DB5PEPF00014B9E.mail.protection.outlook.com (10.167.8.171) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Wed, 23 Oct 2024 17:01:45 +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 v3 69/73] net/ntnic: add termination thread Date: Wed, 23 Oct 2024 19:00:17 +0200 Message-ID: <20241023170032.314155-70-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241023170032.314155-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241023170032.314155-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB5PEPF00014B9E:EE_|AM7P190MB0710:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 60cf485b-8fee-44ee-b864-08dcf3846096 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?eqlXa+zT+6r45Rlsv+xdy9neRasSqiKnwOqTTf9sMIMVK1g9+3lNe3zXBvM8?= =?us-ascii?Q?obxw4dA0M5ewQz9/qV4+/Y2jlf3oAzREAt6jjebRogwe1k7E1bTJgH1Kv6qW?= =?us-ascii?Q?4ccfrmb2v3kdeFi9zxzTrP1DZexblS/xZ5a3z7QZunnm/yrkrMSq6Nv9Kuel?= =?us-ascii?Q?QDhOgnFFNMlqNZ5y0roE7Q2ErNTJv6RIbTY0gcY20nYPSa7aNMnWayPgrfEL?= =?us-ascii?Q?MMntVOn19XBZUZGqBVQy34Y4I7VLc+DIbuqf4FEyJfagWsqDm2+rEt7Ip3bY?= =?us-ascii?Q?jjdmiSGqEzPmaXmv8zaN2x/bQrEwRDFbMrddzkDPY4yewoihogF+YCZJP/RS?= =?us-ascii?Q?uFJRJ1ZFEnu7rqHF2uScZK4Z5WTuzbsZS/nbhErlH/zKPkVSS1z62AVBNOQY?= =?us-ascii?Q?zMbvqlIkfOcW58zDboKsK87yofc384ViJNTLL3xdeTEWAg5l1uh1c2cohfiL?= =?us-ascii?Q?hatsvGRjcozF76nkBQPkUcWDQF+kFC8a53+cTTSsuZFcKpXj0Zx0WKD8Cb+O?= =?us-ascii?Q?O5TFGkowywHwF413X9TmVGOCnx08xiznVHuILH28PYGtOomk78Fxoy6DH848?= =?us-ascii?Q?MHM+PA+mvIPlxjUaicpNEd45mz3byNLHuZbfMBHs2QRs3wOgXG+rcUBi3XZv?= =?us-ascii?Q?VY3gNYD15pid6qoCoanai9my20S568YWXC3HrLjOUHbaMUyDS0qR4FSPEHaC?= =?us-ascii?Q?tkRcA97b6j7xrdh7LzFMKBA5HiYCEaX4T75nbVU/l9CszhAn86EGl5gxSSGT?= =?us-ascii?Q?co9eAIIlI9lqj2ou6MYjkizI0iVvT0pJ35+0grC/guzdJqpJ6exD8zHjC0ps?= =?us-ascii?Q?vO5OS+TzA8rOPBSv/5hQEwPDu74T+gHE1yxglFWiJzoYJq3k8zaytnh9h4Qd?= =?us-ascii?Q?6SZtTpWkrL20EUXYxBPpgEDAH440M2ayRxFWvBVXVZA7clbIDi6/jFFDiOsd?= =?us-ascii?Q?wFnbs6v9oFvu4cy502ql42KP5SWinLJzcfA0K9dCK1A6GubIeyTpUcHc2qKB?= =?us-ascii?Q?6ylRwDBmPfTPqhC/x3fn/IdCE2PEvK8Y2mRvwApjUGWSo09dPIGOrB0zeicl?= =?us-ascii?Q?xCG55bM7N61nFQly7JDhmbFQ3nX5H4V0Mm/AzVSKNwF4thRwGQ+0Z2oqzFmJ?= =?us-ascii?Q?ms9Ky8RjCYfoLVHMxeWyKZosS5cVNk5CODK7q/TBEFxVZzubzU5IPfkI+ofj?= =?us-ascii?Q?Bld73OdT7JEyMFEQW0fraqLCzKBHU+h6NvjrDrktWYPpVU/wSi6BDnWCivuz?= =?us-ascii?Q?qUgZw7/pueKBj5b+AX7rgZ9sG/qmLFeB2ZEkWdvxUd56PPwayZ5znko1LKw1?= =?us-ascii?Q?otbVAsoJYzB0HEPI7bw+rl8ykVXWuKcpO28CxNuIQp8HS+GL9G156iDTEfhR?= =?us-ascii?Q?s9sLK6YZneb5pLroN0zOH+i7TDuBujdENDlxxw51N2tyZvOseA=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)(376014)(36860700013)(1800799024)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: m1hEHGBtm2oG0/iBbHmAZ8B9iiXKAwumuX5+QGhujvrb+kSwDOvUPXHYJEkRGSXS/QwS/VrT6Goy45Y0omykCE1Td7L1IWzlLiWOhcmSVYB5XXmLC55u+OmO6L7TQYvL9NzsXKYuY735Qy5lG6TuhYc6w8kkniCFYYT0IDj/S76BVvYb4UYrCgDXQVFskfzs5wrGRQh8Li47UC8y+keufPxWLb8Z0Nlz2CvsoznsgmEImAamGPje0BQJH6UT7UfWIFywOw49cxnG2lRLZAKDV5dkanAq3exbeKHSxd0CUtc7wt3N56EF1tW+k6XprVC6nILcRolFLDl3hxUegK8HqLFZKBc3+SCdT/Oe+2voAyHCU6mAAK06AJ5v2aEJKcmpXUDlXN9tyNYeM3lzPpyDBVJ2qdAi7UShpbTm+JlNx5GSE5bF+2Kyck27GhhEmofLs9AMtOd5uOG8UDDlXDdFHjkhkvr0Ra87peUqXJbAd8lNGIsviG6MKQYyiRCQuV85bky2u8T14t9Zowr9UEyBAPki7+Q/08jGykkI0xHotSV5vp9Z82AMPYEWXMUiBuaabERkELlCQx4lwYhblQIWAPdpwBKm6+jVZFgNZV0+eZmTNNog3WfCmXAI97lGydPmjeTkHmvHTDZ4tPQg4asozUUis0zz7AKzR6QJMO2iNiQ= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 17:01:45.8834 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 60cf485b-8fee-44ee-b864-08dcf3846096 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: DB5PEPF00014B9E.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7P190MB0710 X-OriginatorOrg: napatech.com X-BESS-ID: 1729708413-303923-12642-48080-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.51.173 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqamJoZAVgZQMM3MwtA42dzY1D TR1NwiydLUMsncwNgg1dTMxDQ52TJJqTYWAPewwJpBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259926 [from cloudscan12-179.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 | 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 6cac8da17e..eca67dbd62 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