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 D949345480 for ; Mon, 17 Jun 2024 13:28:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D2222402AC; Mon, 17 Jun 2024 13:28:04 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id D20054028B; Mon, 17 Jun 2024 13:28:02 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45H9JqOE019583; Mon, 17 Jun 2024 04:28:01 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=pfpt0220; bh=tb3jaAM5/Wp7rTXWmOb++1V CDWQ5y5PHPOy8kVKuENw=; b=iX2o99HX38XZNpzQXLBmtysgZ8qLJVCAmS4IW47 Ip0xFynn6jdGHNnsFCWF2m15yOU3B7ryuOGN+3y6mjUvCCHxPYDBuFCTuHw2nN80 uleXZnFzkBTBTJKmHiEiufbracISdx+r/86uIjnfR6K6Fi+pkdCHZhSTxGVK+ukK ECW/Thc6lmBnn+E/nIF9D9tXb68jGoavUpoYAN4oXNbCZpYNQWWXS286JXMqxcDM Bn3RJ6VqQjNCYmLhQhnpWX6z+JXZ6xuR1UdEQqcfFu8K1C7a1wT+3Ac/tIoHA9T0 FtSLr5F+d/aXJxggkUebZjbsHzA7eCUOoElCr6lz8HUpzrg== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3ytjdt8c4e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jun 2024 04:28:01 -0700 (PDT) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 04:28:00 -0700 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 04:28:00 -0700 Received: from cavium-OptiPlex-3070-BM17.. (unknown [10.28.34.33]) by maili.marvell.com (Postfix) with ESMTP id 7F8895B6963; Mon, 17 Jun 2024 04:27:57 -0700 (PDT) From: To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Harman Kalra CC: , , Jerin Jacob Subject: [dpdk-dev] [PATCH] common/cnxk: fix flow aging application exit Date: Mon, 17 Jun 2024 16:57:54 +0530 Message-ID: <20240617112754.4080314-1-psatheesh@marvell.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: vnxz_T5CZaV1hJu4czUsNw_-bCKzvQZV X-Proofpoint-ORIG-GUID: vnxz_T5CZaV1hJu4czUsNw_-bCKzvQZV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-17_10,2024-06-17_01,2024-05-17_01 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org From: Kiran Kumar K If flow aging is enabled application termination may take time equivalent to aging timeout. This is because on termination flow thread uses a sleep call which is uninterruptible. Fixes: 357f5ebc8a24 ("common/cnxk: support flow aging") Cc: stable@dpdk.org Signed-off-by: Kiran Kumar K Signed-off-by: Harman Kalra Reviewed-by: Jerin Jacob --- drivers/common/cnxk/roc_npc_aging.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/common/cnxk/roc_npc_aging.c b/drivers/common/cnxk/roc_npc_aging.c index 15f6e61d76..66c953135a 100644 --- a/drivers/common/cnxk/roc_npc_aging.c +++ b/drivers/common/cnxk/roc_npc_aging.c @@ -133,6 +133,21 @@ npc_mcam_get_hit_status(struct npc *npc, uint64_t *mcam_ids, uint16_t start_id, return rc; } +static void +npc_age_wait_until(struct roc_npc_flow_age *flow_age) +{ +#define NPC_AGE_WAIT_TIMEOUT_MS 1000 +#define NPC_AGE_WAIT_TIMEOUT_US (NPC_AGE_WAIT_TIMEOUT_MS * NPC_AGE_WAIT_TIMEOUT_MS) + uint64_t timeout = 0; + uint64_t sleep = 10 * NPC_AGE_WAIT_TIMEOUT_MS; + + do { + plt_delay_us(sleep); + timeout += sleep; + } while (!flow_age->aged_flows_get_thread_exit && + (timeout < (flow_age->aging_poll_freq * NPC_AGE_WAIT_TIMEOUT_US))); +} + uint32_t npc_aged_flows_get(void *args) { @@ -197,7 +212,7 @@ npc_aged_flows_get(void *args) plt_seqcount_write_end(&flow_age->seq_cnt); lbl_sleep: - sleep(flow_age->aging_poll_freq); + npc_age_wait_until(flow_age); } return 0; -- 2.39.2