patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 18.11 0/3] bnxt patches for 18.11
@ 2020-10-16  9:20 Kalesh A P
  2020-10-16  9:20 ` [dpdk-stable] [PATCH 18.11 1/3] net/bnxt: fix for memleak during queue restart Kalesh A P
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Kalesh A P @ 2020-10-16  9:20 UTC (permalink / raw)
  To: stable

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Hi Kevin,

I have back ported few of the conflicting patches to 18.11 stable.
Other patches in the list, you can ignore and those are not needed.

Kalesh AP (1):
  net/bnxt: fix flow error on filter creation

Rahul Gupta (2):
  net/bnxt: fix for memleak during queue restart
  net/bnxt: fix to advance producer index

 drivers/net/bnxt/bnxt_flow.c | 12 ++++++++++++
 drivers/net/bnxt/bnxt_hwrm.c | 12 ------------
 drivers/net/bnxt/bnxt_rxr.c  | 36 +++++++++++++++++++++---------------
 3 files changed, 33 insertions(+), 27 deletions(-)

-- 
2.10.1


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

* [dpdk-stable] [PATCH 18.11 1/3] net/bnxt: fix for memleak during queue restart
  2020-10-16  9:20 [dpdk-stable] [PATCH 18.11 0/3] bnxt patches for 18.11 Kalesh A P
@ 2020-10-16  9:20 ` Kalesh A P
  2020-10-16  9:20 ` [dpdk-stable] [PATCH 18.11 2/3] net/bnxt: fix to advance producer index Kalesh A P
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Kalesh A P @ 2020-10-16  9:20 UTC (permalink / raw)
  To: stable

From: Rahul Gupta <rahul.gupta@broadcom.com>

[ upstream commit d256c73c11229c0a7eae32a7e0baaa7a457000e1 ]

During port 0 rxq 1 start ie queue start,
bnxt_free_hwrm_rx_ring() we are clearing the pointers to mbuf array.
Due to this we overwrite the queue with fresh mbuf allocations
causing previously allocated mbufs to leak.
Add a check before allocating mbuf to replenish only empty mbuf slots
in the RxQ.

Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 12 ------------
 drivers/net/bnxt/bnxt_rxr.c  | 44 +++++++++++++++++++++++++-------------------
 2 files changed, 25 insertions(+), 31 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index cfb4cb6..0f1f4d1 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1929,23 +1929,11 @@ void bnxt_free_hwrm_rx_ring(struct bnxt *bp, int queue_index)
 				    HWRM_RING_FREE_INPUT_RING_TYPE_RX);
 		ring->fw_ring_id = INVALID_HW_RING_ID;
 		bp->grp_info[queue_index].rx_fw_ring_id = INVALID_HW_RING_ID;
-		memset(rxr->rx_desc_ring, 0,
-		       rxr->rx_ring_struct->ring_size *
-		       sizeof(*rxr->rx_desc_ring));
-		memset(rxr->rx_buf_ring, 0,
-		       rxr->rx_ring_struct->ring_size *
-		       sizeof(*rxr->rx_buf_ring));
-		rxr->rx_prod = 0;
 	}
 	ring = rxr->ag_ring_struct;
 	if (ring->fw_ring_id != INVALID_HW_RING_ID) {
 		bnxt_hwrm_ring_free(bp, ring,
 				    HWRM_RING_FREE_INPUT_RING_TYPE_RX);
-		ring->fw_ring_id = INVALID_HW_RING_ID;
-		memset(rxr->ag_buf_ring, 0,
-		       rxr->ag_ring_struct->ring_size *
-		       sizeof(*rxr->ag_buf_ring));
-		rxr->ag_prod = 0;
 		bp->grp_info[queue_index].ag_fw_ring_id = INVALID_HW_RING_ID;
 	}
 	if (cpr->cp_ring_struct->fw_ring_id != INVALID_HW_RING_ID)
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 3a1d223..b73561b 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -768,14 +768,16 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 
 	prod = rxr->rx_prod;
 	for (i = 0; i < ring->ring_size; i++) {
-		if (bnxt_alloc_rx_data(rxq, rxr, prod) != 0) {
-			PMD_DRV_LOG(WARNING,
-				"init'ed rx ring %d with %d/%d mbufs only\n",
-				rxq->queue_id, i, ring->ring_size);
-			break;
+		if (unlikely(!(rxr->rx_buf_ring[i].mbuf))) {
+			if (bnxt_alloc_rx_data(rxq, rxr, prod) != 0) {
+				PMD_DRV_LOG(WARNING,
+					    "init'ed rx ring %d with %d/%d mbufs only\n",
+					    rxq->queue_id, i, ring->ring_size);
+				break;
+			}
+			rxr->rx_prod = prod;
+			prod = RING_NEXT(rxr->rx_ring_struct, prod);
 		}
-		rxr->rx_prod = prod;
-		prod = RING_NEXT(rxr->rx_ring_struct, prod);
 	}
 
 	ring = rxr->ag_ring_struct;
@@ -784,24 +786,28 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 	prod = rxr->ag_prod;
 
 	for (i = 0; i < ring->ring_size; i++) {
-		if (bnxt_alloc_ag_data(rxq, rxr, prod) != 0) {
-			PMD_DRV_LOG(WARNING,
-			"init'ed AG ring %d with %d/%d mbufs only\n",
-			rxq->queue_id, i, ring->ring_size);
-			break;
+		if (unlikely(!(rxr->ag_buf_ring[i].mbuf))) {
+			if (bnxt_alloc_ag_data(rxq, rxr, prod) != 0) {
+				PMD_DRV_LOG(WARNING,
+					    "init'ed AG ring %d with %d/%d mbufs only\n",
+					    rxq->queue_id, i, ring->ring_size);
+				break;
+			}
+			rxr->ag_prod = prod;
+			prod = RING_NEXT(rxr->ag_ring_struct, prod);
 		}
-		rxr->ag_prod = prod;
-		prod = RING_NEXT(rxr->ag_ring_struct, prod);
 	}
 	PMD_DRV_LOG(DEBUG, "AGG Done!\n");
 
 	if (rxr->tpa_info) {
 		for (i = 0; i < BNXT_TPA_MAX; i++) {
-			rxr->tpa_info[i].mbuf =
-				__bnxt_alloc_rx_data(rxq->mb_pool);
-			if (!rxr->tpa_info[i].mbuf) {
-				rte_atomic64_inc(&rxq->rx_mbuf_alloc_fail);
-				return -ENOMEM;
+			if (unlikely(!(rxr->tpa_info[i].mbuf))) {
+				rxr->tpa_info[i].mbuf =
+					__bnxt_alloc_rx_data(rxq->mb_pool);
+				if (!rxr->tpa_info[i].mbuf) {
+					rte_atomic64_inc(&rxq->rx_mbuf_alloc_fail);
+					return -ENOMEM;
+				}
 			}
 		}
 	}
-- 
2.10.1


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

* [dpdk-stable] [PATCH 18.11 2/3] net/bnxt: fix to advance producer index
  2020-10-16  9:20 [dpdk-stable] [PATCH 18.11 0/3] bnxt patches for 18.11 Kalesh A P
  2020-10-16  9:20 ` [dpdk-stable] [PATCH 18.11 1/3] net/bnxt: fix for memleak during queue restart Kalesh A P
@ 2020-10-16  9:20 ` Kalesh A P
  2020-10-16  9:20 ` [dpdk-stable] [PATCH 18.11 3/3] net/bnxt: fix flow error on filter creation Kalesh A P
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Kalesh A P @ 2020-10-16  9:20 UTC (permalink / raw)
  To: stable

From: Rahul Gupta <rahul.gupta@broadcom.com>

[ upstream commit 20cb28a0ec7fb0c49807c63e6f57b5e0cdb36065 ]

When a queue is started after deferred_start, then increment raw_prod
irrespective of new mbuf is allocated or old mbufs are used.

Fixes: 20f9c70ffa33 ("net/bnxt: fix for memleak during queue restart")

Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_rxr.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index b73561b..24c760e 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -775,9 +775,9 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 					    rxq->queue_id, i, ring->ring_size);
 				break;
 			}
-			rxr->rx_prod = prod;
-			prod = RING_NEXT(rxr->rx_ring_struct, prod);
 		}
+		rxr->rx_prod = prod;
+		prod = RING_NEXT(rxr->rx_ring_struct, prod);
 	}
 
 	ring = rxr->ag_ring_struct;
@@ -793,9 +793,9 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 					    rxq->queue_id, i, ring->ring_size);
 				break;
 			}
-			rxr->ag_prod = prod;
-			prod = RING_NEXT(rxr->ag_ring_struct, prod);
 		}
+		rxr->ag_prod = prod;
+		prod = RING_NEXT(rxr->ag_ring_struct, prod);
 	}
 	PMD_DRV_LOG(DEBUG, "AGG Done!\n");
 
-- 
2.10.1


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

* [dpdk-stable] [PATCH 18.11 3/3] net/bnxt: fix flow error on filter creation
  2020-10-16  9:20 [dpdk-stable] [PATCH 18.11 0/3] bnxt patches for 18.11 Kalesh A P
  2020-10-16  9:20 ` [dpdk-stable] [PATCH 18.11 1/3] net/bnxt: fix for memleak during queue restart Kalesh A P
  2020-10-16  9:20 ` [dpdk-stable] [PATCH 18.11 2/3] net/bnxt: fix to advance producer index Kalesh A P
@ 2020-10-16  9:20 ` Kalesh A P
  2020-10-16 12:26 ` [dpdk-stable] [PATCH 18.11 0/3] bnxt patches for 18.11 Kevin Traynor
  2020-10-30 13:13 ` Kevin Traynor
  4 siblings, 0 replies; 6+ messages in thread
From: Kalesh A P @ 2020-10-16  9:20 UTC (permalink / raw)
  To: stable

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

[ upstream commit 87aefef133e3d670be365efdaa620f36d97ee4bd ]

If set_em_filter/set_ntuple_filter cmds fails for some reason,
driver is not filling the "rte_flow_error" string buffer.
This leads to a crash in testpmd while trying to print the
error message.

Fixes: 5c1171c97216 ("net/bnxt: refactor filter/flow")

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_flow.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
index df962d9..8d0483b 100644
--- a/drivers/net/bnxt/bnxt_flow.c
+++ b/drivers/net/bnxt/bnxt_flow.c
@@ -1055,12 +1055,24 @@ bnxt_flow_create(struct rte_eth_dev *dev,
 		filter->enables |=
 			HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_L2_FILTER_ID;
 		ret = bnxt_hwrm_set_em_filter(bp, filter->dst_id, filter);
+		if (ret != 0) {
+			rte_flow_error_set(error, -ret,
+					   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+					   "Failed to create EM filter");
+			goto free_filter;
+		}
 	}
 
 	if (filter->filter_type == HWRM_CFA_NTUPLE_FILTER) {
 		filter->enables |=
 			HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_L2_FILTER_ID;
 		ret = bnxt_hwrm_set_ntuple_filter(bp, filter->dst_id, filter);
+		if (ret != 0) {
+			rte_flow_error_set(error, -ret,
+					   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+					   "Failed to create ntuple filter");
+			goto free_filter;
+		}
 	}
 
 	for (i = 0; i < bp->nr_vnics; i++) {
-- 
2.10.1


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

* Re: [dpdk-stable] [PATCH 18.11 0/3] bnxt patches for 18.11
  2020-10-16  9:20 [dpdk-stable] [PATCH 18.11 0/3] bnxt patches for 18.11 Kalesh A P
                   ` (2 preceding siblings ...)
  2020-10-16  9:20 ` [dpdk-stable] [PATCH 18.11 3/3] net/bnxt: fix flow error on filter creation Kalesh A P
@ 2020-10-16 12:26 ` Kevin Traynor
  2020-10-30 13:13 ` Kevin Traynor
  4 siblings, 0 replies; 6+ messages in thread
From: Kevin Traynor @ 2020-10-16 12:26 UTC (permalink / raw)
  To: Kalesh A P, stable

On 16/10/2020 10:20, Kalesh A P wrote:
> From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> 
> Hi Kevin,
> 

Hi Kalesh,

> I have back ported few of the conflicting patches to 18.11 stable.
> Other patches in the list, you can ignore and those are not needed.
> 

Perfect, thanks. I will apply once I have run them through some build
checks and remove the others from the list.

Kevin.

> Kalesh AP (1):
>   net/bnxt: fix flow error on filter creation
> 
> Rahul Gupta (2):
>   net/bnxt: fix for memleak during queue restart
>   net/bnxt: fix to advance producer index
> 
>  drivers/net/bnxt/bnxt_flow.c | 12 ++++++++++++
>  drivers/net/bnxt/bnxt_hwrm.c | 12 ------------
>  drivers/net/bnxt/bnxt_rxr.c  | 36 +++++++++++++++++++++---------------
>  3 files changed, 33 insertions(+), 27 deletions(-)
> 


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

* Re: [dpdk-stable] [PATCH 18.11 0/3] bnxt patches for 18.11
  2020-10-16  9:20 [dpdk-stable] [PATCH 18.11 0/3] bnxt patches for 18.11 Kalesh A P
                   ` (3 preceding siblings ...)
  2020-10-16 12:26 ` [dpdk-stable] [PATCH 18.11 0/3] bnxt patches for 18.11 Kevin Traynor
@ 2020-10-30 13:13 ` Kevin Traynor
  4 siblings, 0 replies; 6+ messages in thread
From: Kevin Traynor @ 2020-10-30 13:13 UTC (permalink / raw)
  To: Kalesh A P, stable

On 16/10/2020 10:20, Kalesh A P wrote:
> From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> 
> Hi Kevin,
> 
> I have back ported few of the conflicting patches to 18.11 stable.
> Other patches in the list, you can ignore and those are not needed.
> 
> Kalesh AP (1):
>   net/bnxt: fix flow error on filter creation
> 
> Rahul Gupta (2):
>   net/bnxt: fix for memleak during queue restart
>   net/bnxt: fix to advance producer index
> 
>  drivers/net/bnxt/bnxt_flow.c | 12 ++++++++++++
>  drivers/net/bnxt/bnxt_hwrm.c | 12 ------------
>  drivers/net/bnxt/bnxt_rxr.c  | 36 +++++++++++++++++++++---------------
>  3 files changed, 33 insertions(+), 27 deletions(-)
> 

Applied and removed other bnxt commits from failed list, thanks.


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

end of thread, other threads:[~2020-10-30 13:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-16  9:20 [dpdk-stable] [PATCH 18.11 0/3] bnxt patches for 18.11 Kalesh A P
2020-10-16  9:20 ` [dpdk-stable] [PATCH 18.11 1/3] net/bnxt: fix for memleak during queue restart Kalesh A P
2020-10-16  9:20 ` [dpdk-stable] [PATCH 18.11 2/3] net/bnxt: fix to advance producer index Kalesh A P
2020-10-16  9:20 ` [dpdk-stable] [PATCH 18.11 3/3] net/bnxt: fix flow error on filter creation Kalesh A P
2020-10-16 12:26 ` [dpdk-stable] [PATCH 18.11 0/3] bnxt patches for 18.11 Kevin Traynor
2020-10-30 13:13 ` Kevin Traynor

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