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 7D79B4554D; Tue, 2 Jul 2024 16:41:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6B1F840A73; Tue, 2 Jul 2024 16:41: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 C6B7740A72 for ; Tue, 2 Jul 2024 16:41: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 4626FkwU020987; Tue, 2 Jul 2024 07:41:00 -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=A bCbw+9v4jP3yAoWJqjLY728ipCJkSqUlyf7NNbz1IE=; b=Ecvj1OQtbLyHL3fBQ ILfg8yE7MVODr+LT/P13bT4Z5cng8j3u87tT+ey5FESNo+umqyhBqJONbqkBMnfy XANQmcyWpbTP8klI0qav1Az1NEBAvGrEY79t4Mks5kt6F3thZqTmZBXpTeaierKq rwurISvEsdsknNdS5UUL4dW+tfUjVrIBl6qjlPmOrXC/Qojel8mtJL7TuE67qTED GgsTsIwYsTQf2bzwByUYvwAtynA7kJzxXPFVslG9iSy5YmF7uo3nzdavDYoWMtEp CgLoZY/ylPNojZJX4H/BgCmLgEbV1Nyv4bTEGiob0BuVPvx4YeEFlbY7o8rHDRLJ ZSqJQ== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 404c49a1h3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Jul 2024 07:41:00 -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; Tue, 2 Jul 2024 07:40:59 -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; Tue, 2 Jul 2024 07:40:59 -0700 Received: from localhost.localdomain (unknown [10.28.36.158]) by maili.marvell.com (Postfix) with ESMTP id 8E3B83F709C; Tue, 2 Jul 2024 07:40:56 -0700 (PDT) From: Rahul Bhansali To: , Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Harman Kalra , Ray Kinsella , Satheesh Paul CC: , Rahul Bhansali Subject: [PATCH v2 2/2] net/cnxk: fix to avoid NPC Rx and MCAM disable Date: Tue, 2 Jul 2024 20:10:33 +0530 Message-ID: <20240702144033.3345075-2-rbhansali@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240702144033.3345075-1-rbhansali@marvell.com> References: <20240627090859.2860207-1-rbhansali@marvell.com> <20240702144033.3345075-1-rbhansali@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: N5PxF_QqOPhDuwOdzbwqjt1Gs6kTfyzk X-Proofpoint-GUID: N5PxF_QqOPhDuwOdzbwqjt1Gs6kTfyzk 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-07-02_10,2024-07-02_02,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. Fixes: fbc0fa749919 ("net/cnxk: keep flow rules across restart") Signed-off-by: Rahul Bhansali --- Changes in v2: added fixes tag 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