DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] common/cnxk: enable second pass RQ in mask config
@ 2024-06-27  9:08 Rahul Bhansali
  2024-06-27  9:08 ` [PATCH 2/2] net/cnxk: avoid NPC Rx and MCAM entries disable Rahul Bhansali
  2024-07-02 14:40 ` [PATCH v2 1/2] common/cnxk: enable second pass RQ in mask config Rahul Bhansali
  0 siblings, 2 replies; 6+ messages in thread
From: Rahul Bhansali @ 2024-06-27  9:08 UTC (permalink / raw)
  To: dev, Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori,
	Satha Rao, Harman Kalra
  Cc: jerinj, Rahul Bhansali

This will enable second pass RQ and drop interrupt by default in
mask configuration to avoid buffer leak possibilities during dev
stop and interrupts to indicate drops if any.

Signed-off-by: Rahul Bhansali <rbhansali@marvell.com>
---
 drivers/common/cnxk/roc_features.h | 6 ++++++
 drivers/common/cnxk/roc_nix_inl.c  | 9 ++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/common/cnxk/roc_features.h b/drivers/common/cnxk/roc_features.h
index 3b512be132..6abb35c296 100644
--- a/drivers/common/cnxk/roc_features.h
+++ b/drivers/common/cnxk/roc_features.h
@@ -90,4 +90,10 @@ roc_feature_nix_has_rx_inject(void)
 	return (roc_model_is_cn10ka_b0() || roc_model_is_cn10kb());
 }
 
+static inline bool
+roc_feature_nix_has_second_pass_drop(void)
+{
+	return 0;
+}
+
 #endif
diff --git a/drivers/common/cnxk/roc_nix_inl.c b/drivers/common/cnxk/roc_nix_inl.c
index 74a688abbd..a984ac56d9 100644
--- a/drivers/common/cnxk/roc_nix_inl.c
+++ b/drivers/common/cnxk/roc_nix_inl.c
@@ -734,6 +734,13 @@ nix_inl_rq_mask_cfg(struct roc_nix *roc_nix, bool enable)
 	msk_req->rq_set.xqe_drop_ena = 0;
 	msk_req->rq_set.spb_ena = 1;
 
+	if (!roc_feature_nix_has_second_pass_drop()) {
+		msk_req->rq_set.ena = 1;
+		msk_req->rq_set.rq_int_ena = 1;
+		msk_req->rq_mask.ena = 0;
+		msk_req->rq_mask.rq_int_ena = 0;
+	}
+
 	msk_req->rq_mask.len_ol3_dis = 0;
 	msk_req->rq_mask.len_ol4_dis = 0;
 	msk_req->rq_mask.len_il3_dis = 0;
@@ -1467,7 +1474,7 @@ roc_nix_inl_rq_ena_dis(struct roc_nix *roc_nix, bool enable)
 	if (!idev)
 		return -EFAULT;
 
-	if (roc_feature_nix_has_inl_rq_mask()) {
+	if (roc_feature_nix_has_inl_rq_mask() && enable) {
 		rc = nix_inl_rq_mask_cfg(roc_nix, enable);
 		if (rc) {
 			plt_err("Failed to get rq mask rc=%d", rc);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/2] net/cnxk: avoid NPC Rx and MCAM entries disable
  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
  2024-07-02 13:57   ` Jerin Jacob
  2024-07-02 14:40 ` [PATCH v2 1/2] common/cnxk: enable second pass RQ in mask config Rahul Bhansali
  1 sibling, 1 reply; 6+ messages in thread
From: Rahul Bhansali @ 2024-06-27  9:08 UTC (permalink / raw)
  To: dev, Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori,
	Satha Rao, Harman Kalra
  Cc: jerinj, Rahul Bhansali

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] net/cnxk: avoid NPC Rx and MCAM entries disable
  2024-06-27  9:08 ` [PATCH 2/2] net/cnxk: avoid NPC Rx and MCAM entries disable Rahul Bhansali
@ 2024-07-02 13:57   ` Jerin Jacob
  0 siblings, 0 replies; 6+ messages in thread
From: Jerin Jacob @ 2024-07-02 13:57 UTC (permalink / raw)
  To: Rahul Bhansali
  Cc: dev, Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori,
	Satha Rao, Harman Kalra, jerinj

On Thu, Jun 27, 2024 at 2:47 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.
>
> Signed-off-by: Rahul Bhansali <rbhansali@marvell.com>

Since it is a fix, Please send the next version with Fixes: tag and
update git commit to make as fix.


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/2] common/cnxk: enable second pass RQ in mask config
  2024-06-27  9:08 [PATCH 1/2] common/cnxk: enable second pass RQ in mask config Rahul Bhansali
  2024-06-27  9:08 ` [PATCH 2/2] net/cnxk: avoid NPC Rx and MCAM entries disable Rahul Bhansali
@ 2024-07-02 14:40 ` Rahul Bhansali
  2024-07-02 14:40   ` [PATCH v2 2/2] net/cnxk: fix to avoid NPC Rx and MCAM disable Rahul Bhansali
  1 sibling, 1 reply; 6+ messages in thread
From: Rahul Bhansali @ 2024-07-02 14:40 UTC (permalink / raw)
  To: dev, Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori,
	Satha Rao, Harman Kalra
  Cc: jerinj, Rahul Bhansali

This will enable second pass RQ and drop interrupt by default in
mask configuration to avoid buffer leak possibilities during dev
stop and interrupts to indicate drops if any.

Signed-off-by: Rahul Bhansali <rbhansali@marvell.com>
---
Changes in v2: No change.

 drivers/common/cnxk/roc_features.h | 6 ++++++
 drivers/common/cnxk/roc_nix_inl.c  | 9 ++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/common/cnxk/roc_features.h b/drivers/common/cnxk/roc_features.h
index 3b512be132..6abb35c296 100644
--- a/drivers/common/cnxk/roc_features.h
+++ b/drivers/common/cnxk/roc_features.h
@@ -90,4 +90,10 @@ roc_feature_nix_has_rx_inject(void)
 	return (roc_model_is_cn10ka_b0() || roc_model_is_cn10kb());
 }

+static inline bool
+roc_feature_nix_has_second_pass_drop(void)
+{
+	return 0;
+}
+
 #endif
diff --git a/drivers/common/cnxk/roc_nix_inl.c b/drivers/common/cnxk/roc_nix_inl.c
index 74a688abbd..a984ac56d9 100644
--- a/drivers/common/cnxk/roc_nix_inl.c
+++ b/drivers/common/cnxk/roc_nix_inl.c
@@ -734,6 +734,13 @@ nix_inl_rq_mask_cfg(struct roc_nix *roc_nix, bool enable)
 	msk_req->rq_set.xqe_drop_ena = 0;
 	msk_req->rq_set.spb_ena = 1;

+	if (!roc_feature_nix_has_second_pass_drop()) {
+		msk_req->rq_set.ena = 1;
+		msk_req->rq_set.rq_int_ena = 1;
+		msk_req->rq_mask.ena = 0;
+		msk_req->rq_mask.rq_int_ena = 0;
+	}
+
 	msk_req->rq_mask.len_ol3_dis = 0;
 	msk_req->rq_mask.len_ol4_dis = 0;
 	msk_req->rq_mask.len_il3_dis = 0;
@@ -1467,7 +1474,7 @@ roc_nix_inl_rq_ena_dis(struct roc_nix *roc_nix, bool enable)
 	if (!idev)
 		return -EFAULT;

-	if (roc_feature_nix_has_inl_rq_mask()) {
+	if (roc_feature_nix_has_inl_rq_mask() && enable) {
 		rc = nix_inl_rq_mask_cfg(roc_nix, enable);
 		if (rc) {
 			plt_err("Failed to get rq mask rc=%d", rc);
--
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] net/cnxk: fix to avoid NPC Rx and MCAM disable
  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   ` Rahul Bhansali
  2024-07-03  7:49     ` Jerin Jacob
  0 siblings, 1 reply; 6+ messages in thread
From: Rahul Bhansali @ 2024-07-02 14:40 UTC (permalink / raw)
  To: dev, Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori,
	Satha Rao, Harman Kalra, Ray Kinsella, Satheesh Paul
  Cc: jerinj, Rahul Bhansali

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(-)

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] net/cnxk: fix to avoid NPC Rx and MCAM disable
  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
  0 siblings, 0 replies; 6+ messages in thread
From: Jerin Jacob @ 2024-07-03  7:49 UTC (permalink / raw)
  To: Rahul Bhansali
  Cc: dev, Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori,
	Satha Rao, Harman Kalra, Ray Kinsella, Satheesh Paul, jerinj

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-07-03  7:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-27  9:08 [PATCH 1/2] common/cnxk: enable second pass RQ in mask config Rahul Bhansali
2024-06-27  9:08 ` [PATCH 2/2] net/cnxk: avoid NPC Rx and MCAM entries disable Rahul Bhansali
2024-07-02 13:57   ` 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

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).