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 BFA1D43A4A; Fri, 2 Feb 2024 06:21:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 966E54026E; Fri, 2 Feb 2024 06:21:54 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id D40844021D; Fri, 2 Feb 2024 06:21:52 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 4121WNkJ011534; Thu, 1 Feb 2024 21:21:51 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=pfpt0220; bh=04DCgM9C AQq86OinM5efHVoNE36Gs4QrTo13oE9CgJg=; b=WO7rY+8lF9zb++HtXChY1c76 a9VT9XjYyjqrXkiOJSOjatbLK8jsGcb6OI0a4t4V7J33oVBMbC1rqcG4teY3vtaF ibnABu994GkWVRKERlJdjrNlT5ZlZIUvJXCpwz3JnCdDG1pxt17+m7EZELVK9t6V kFWpTXMtWAKau1osCBuU59RNwNk0sLVLUR3OyNnqbpSQi5D0uqWgZvL806qXyF8q bRUF/h5L6v/YqBinikz8NB0hmt23RshpwgoMXc4VbPEj4oZBx7mTlPfICkJnhri9 C3hKmYV4q0cPmMb4Cm29ZuCJjwsRyBKc3xsG4W0ISlKrAgTQuSrFL0jW63DA+Q== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3w0ptnghaw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 01 Feb 2024 21:21:51 -0800 (PST) Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 1 Feb 2024 21:21:42 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Thu, 1 Feb 2024 21:21:42 -0800 Received: from cavium-OptiPlex-3070-BM17.. (unknown [10.28.34.33]) by maili.marvell.com (Postfix) with ESMTP id 3DB613F707D; Thu, 1 Feb 2024 21:21:40 -0800 (PST) From: To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Satheesh Paul , Subject: [dpdk-dev] [PATCH] net/cnxk: fix aged flows query Date: Fri, 2 Feb 2024 10:51:37 +0530 Message-ID: <20240202052137.1324084-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-ORIG-GUID: tes-IJJz9Rq9Q0KQBgrIdPPVtNep4VWv X-Proofpoint-GUID: tes-IJJz9Rq9Q0KQBgrIdPPVtNep4VWv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-01_10,2024-01-31_01,2023-05-22_02 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: Satheesh Paul After all aged flows are destroyed, the aged_flows bitmap is free-ed. Querying aged flows tries to access this bitmap resulting in a segmentation fault. Fixing this by not accessing the bitmap if no aged flows are present. Fixes: 357f5ebc8a24 ("common/cnxk: support flow aging") Cc: stable@dpdk.org Signed-off-by: Satheesh Paul Reviewed-by: Kiran Kumar K --- drivers/common/cnxk/roc_npc_aging.c | 4 ++++ drivers/net/cnxk/cnxk_flow.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/drivers/common/cnxk/roc_npc_aging.c b/drivers/common/cnxk/roc_npc_aging.c index 254dd2139b..e0f2dc2291 100644 --- a/drivers/common/cnxk/roc_npc_aging.c +++ b/drivers/common/cnxk/roc_npc_aging.c @@ -234,8 +234,11 @@ npc_age_flow_list_entry_delete(struct roc_npc *roc_npc, { struct npc *npc = roc_npc_to_npc_priv(roc_npc); struct npc_age_flow_list_head *list; + struct roc_npc_flow_age *flow_age; struct npc_age_flow_entry *curr; + flow_age = &roc_npc->flow_age; + list = &npc->age_flow_list; curr = TAILQ_FIRST(list); @@ -244,6 +247,7 @@ npc_age_flow_list_entry_delete(struct roc_npc *roc_npc, while (curr) { if (flow->mcam_id == curr->flow->mcam_id) { + plt_bitmap_clear(flow_age->aged_flows, flow->mcam_id); TAILQ_REMOVE(list, curr, next); plt_free(curr); break; diff --git a/drivers/net/cnxk/cnxk_flow.c b/drivers/net/cnxk/cnxk_flow.c index a92b61c332..4deccd1a67 100644 --- a/drivers/net/cnxk/cnxk_flow.c +++ b/drivers/net/cnxk/cnxk_flow.c @@ -616,6 +616,9 @@ cnxk_flow_get_aged_flows(struct rte_eth_dev *eth_dev, void **context, flow_age = &roc_npc->flow_age; + if (!flow_age->age_flow_refcnt) + return 0; + do { sn = plt_seqcount_read_begin(&flow_age->seq_cnt); -- 2.39.2