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 985D741F41; Thu, 27 Jun 2024 11:09:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BF0ED40BA0; Thu, 27 Jun 2024 11:09:13 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id D14A140B9C for ; Thu, 27 Jun 2024 11:09:11 +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 45R2wY7d003288 for ; Thu, 27 Jun 2024 02:09:10 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=1 WnLbFQiAbT7yztdyJrU84N4u9VpGTLG8SjLnHGt7vE=; b=aoMCXLtRLbLN2i/jF ro4Gg1IDZ7xprzApGWGG4mHFnyxJ1ctT2jDkpaKuMdHtWo/91XEF1+T6VlzuvAvk krr7d/B+0WUIeCw/Y6LmgzadFP32ydmpdgDyfOMUa96uzADflpMkR1FrIlC8yyC5 o59rtKJPKeBOJ5k4FbQJEbppUsF5cMoO2j39d5tBy25cNfkxWXY2qgFYm/n5XfeR /0lT8ylBmgkyM8Z4Wcso5tSixeJtp+j0mPG5efZP56pFVquVlWd2RNDxv++f39eV NcW8sV7ERekjO4kDtJlgtvVF4/7ahwTJH6dZiMaGEt661A9e5C6RX1st8pQ9Oim5 dARRQ== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 400yrt13pw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 27 Jun 2024 02:09:10 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 27 Jun 2024 02:09:09 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 27 Jun 2024 02:09:09 -0700 Received: from localhost.localdomain (unknown [10.28.36.158]) by maili.marvell.com (Postfix) with ESMTP id 31EE13F707D; Thu, 27 Jun 2024 02:09:06 -0700 (PDT) From: Rahul Bhansali To: , Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Harman Kalra CC: , Rahul Bhansali Subject: [PATCH 2/2] net/cnxk: avoid NPC Rx and MCAM entries disable Date: Thu, 27 Jun 2024 14:38:59 +0530 Message-ID: <20240627090859.2860207-2-rbhansali@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240627090859.2860207-1-rbhansali@marvell.com> References: <20240627090859.2860207-1-rbhansali@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: UjghUNQon79rdxcvqVLRmWIcKjM4BDyi X-Proofpoint-ORIG-GUID: UjghUNQon79rdxcvqVLRmWIcKjM4BDyi 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-27_05,2024-06-25_01,2024-05-17_01 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 For inline IPsec, Rx misses are observed during dev stop process. There can be a situation of 2nd pass packets are being dropped and can cause a buffer leak. To handle such case, will avoid NPC Rx and MCAM entries disable in dev stop. These will be handled in dev close routine. Signed-off-by: Rahul Bhansali --- drivers/net/cnxk/cnxk_ethdev.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c index db8feca620..38746c81c5 100644 --- a/drivers/net/cnxk/cnxk_ethdev.c +++ b/drivers/net/cnxk/cnxk_ethdev.c @@ -1625,18 +1625,26 @@ cnxk_nix_dev_stop(struct rte_eth_dev *eth_dev) int count, i, j, rc; void *rxq; - /* Disable all the NPC entries */ - rc = roc_npc_mcam_enable_all_entries(&dev->npc, 0); - if (rc) - return rc; + /* In case of Inline IPSec, will need to avoid disabling the MCAM rules and NPC Rx + * in this routine to continue processing of second pass inflight packets if any. + * Drop of second pass packets will leak first pass buffers on some platforms + * due to hardware limitations. + */ + if (roc_feature_nix_has_second_pass_drop() || + !(dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SECURITY)) { + /* Disable all the NPC entries */ + rc = roc_npc_mcam_enable_all_entries(&dev->npc, 0); + if (rc) + return rc; + + /* Disable Rx via NPC */ + roc_nix_npc_rx_ena_dis(&dev->nix, false); + } /* Stop link change events */ if (!roc_nix_is_vf_or_sdp(&dev->nix)) roc_nix_mac_link_event_start_stop(&dev->nix, false); - /* Disable Rx via NPC */ - roc_nix_npc_rx_ena_dis(&dev->nix, false); - roc_nix_inl_outb_soft_exp_poll_switch(&dev->nix, false); /* Stop inline device RQ first */ @@ -2047,6 +2055,11 @@ cnxk_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool reset) /* Clear the flag since we are closing down */ dev->configured = 0; + /* Disable all the NPC entries */ + rc = roc_npc_mcam_enable_all_entries(&dev->npc, 0); + if (rc) + return rc; + roc_nix_npc_rx_ena_dis(nix, false); /* Restore 802.3 Flow control configuration */ -- 2.25.1