DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rahul Bhansali <rbhansali@marvell.com>
To: <dev@dpdk.org>, Nithin Dabilpuram <ndabilpuram@marvell.com>,
	Kiran Kumar K <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Satha Rao <skoteshwar@marvell.com>,
	Harman Kalra <hkalra@marvell.com>
Cc: <jerinj@marvell.com>, Rahul Bhansali <rbhansali@marvell.com>
Subject: [PATCH 2/2] net/cnxk: avoid NPC Rx and MCAM entries disable
Date: Thu, 27 Jun 2024 14:38:59 +0530	[thread overview]
Message-ID: <20240627090859.2860207-2-rbhansali@marvell.com> (raw)
In-Reply-To: <20240627090859.2860207-1-rbhansali@marvell.com>

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 <rbhansali@marvell.com>
---
 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


  reply	other threads:[~2024-06-27  9:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-27  9:08 [PATCH 1/2] common/cnxk: enable second pass RQ in mask config Rahul Bhansali
2024-06-27  9:08 ` Rahul Bhansali [this message]
2024-07-02 13:57   ` [PATCH 2/2] net/cnxk: avoid NPC Rx and MCAM entries disable Jerin Jacob
2024-07-02 14:40 ` [PATCH v2 1/2] common/cnxk: enable second pass RQ in mask config Rahul Bhansali
2024-07-02 14:40   ` [PATCH v2 2/2] net/cnxk: fix to avoid NPC Rx and MCAM disable Rahul Bhansali
2024-07-03  7:49     ` Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240627090859.2860207-2-rbhansali@marvell.com \
    --to=rbhansali@marvell.com \
    --cc=dev@dpdk.org \
    --cc=hkalra@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).