[v2,2/2] net/cnxk: fix to avoid NPC Rx and MCAM disable

Message ID 20240702144033.3345075-2-rbhansali@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [v2,1/2] common/cnxk: enable second pass RQ in mask config |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing fail Testing issues

Commit Message

Rahul Bhansali July 2, 2024, 2:40 p.m. UTC
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 <rbhansali@marvell.com>
---
Changes in v2: added fixes tag

 drivers/net/cnxk/cnxk_ethdev.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

--
2.25.1
  

Comments

Jerin Jacob July 3, 2024, 7:49 a.m. UTC | #1
On Tue, Jul 2, 2024 at 8:28 PM Rahul Bhansali <rbhansali@marvell.com> wrote:
>
> 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 <rbhansali@marvell.com>
> ---
> Changes in v2: added fixes tag

Series applied to dpdk-next-net-mrvl/for-main. Thanks
  

Patch

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 */