net/bnxt: update ring group after ring stop start

Message ID 20210818053902.71231-1-ajit.khaparde@broadcom.com (mailing list archive)
State Accepted, archived
Delegated to: Ajit Khaparde
Headers
Series net/bnxt: update ring group after ring stop start |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build success github build: passed
ci/Intel-compilation success Compilation OK
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-x86_64-unit-testing fail Testing issues
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-aarch64-unit-testing fail Testing issues
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS

Commit Message

Ajit Khaparde Aug. 18, 2021, 5:39 a.m. UTC
  A Rx ring stop start sequence may result in the FW returning
a different set of Rx ring and AGG ring IDs. If the ring group
is not updated with the new IDs, the HW sees the host driver using
incorrect BD types for the Rx ring and AGG ring. This can cause
the chip to go into a bad state or encounter RE_flush issue
or leak MBUFs in the HW.

Fix this by issuing a bnxt_hwrm_ring_grp_free() and an
bnxt_hwrm_ring_grp_alloc() to refresh the ring group information.

Fixes: 9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 3 +++
 drivers/net/bnxt/bnxt_ring.c | 6 ++++++
 2 files changed, 9 insertions(+)
  

Comments

Ajit Khaparde Aug. 19, 2021, 4:49 a.m. UTC | #1
On Tue, Aug 17, 2021 at 10:39 PM Ajit Khaparde <ajit.khaparde@broadcom.com>
wrote:

> A Rx ring stop start sequence may result in the FW returning
> a different set of Rx ring and AGG ring IDs. If the ring group
> is not updated with the new IDs, the HW sees the host driver using
> incorrect BD types for the Rx ring and AGG ring. This can cause
> the chip to go into a bad state or encounter RE_flush issue
> or leak MBUFs in the HW.
>
> Fix this by issuing a bnxt_hwrm_ring_grp_free() and an
> bnxt_hwrm_ring_grp_alloc() to refresh the ring group information.
>
> Fixes: 9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
>
Patch applied to dpdk-next-net-brcm for-next-net branch.


> ---
>  drivers/net/bnxt/bnxt_hwrm.c | 3 +++
>  drivers/net/bnxt/bnxt_ring.c | 6 ++++++
>  2 files changed, 9 insertions(+)
>
> diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
> index 73deb41f81..eb9de45cb9 100644
> --- a/drivers/net/bnxt/bnxt_hwrm.c
> +++ b/drivers/net/bnxt/bnxt_hwrm.c
> @@ -2717,6 +2717,9 @@ void bnxt_free_hwrm_rx_ring(struct bnxt *bp, int
> queue_index)
>         struct bnxt_ring *ring = rxr->rx_ring_struct;
>         struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
>
> +       if (BNXT_HAS_RING_GRPS(bp))
> +               bnxt_hwrm_ring_grp_free(bp, queue_index);
> +
>         bnxt_hwrm_ring_free(bp, ring,
>                             HWRM_RING_FREE_INPUT_RING_TYPE_RX,
>                             cpr->cp_ring_struct->fw_ring_id);
> diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
> index b05c470766..957b175f1b 100644
> --- a/drivers/net/bnxt/bnxt_ring.c
> +++ b/drivers/net/bnxt/bnxt_ring.c
> @@ -631,6 +631,12 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int
> queue_index)
>         if (rc)
>                 goto err_out;
>
> +       if (BNXT_HAS_RING_GRPS(bp)) {
> +               rc = bnxt_hwrm_ring_grp_alloc(bp, queue_index);
> +               if (rc)
> +                       goto err_out;
> +       }
> +
>         if (rxq->rx_started) {
>                 if (bnxt_init_one_rx_ring(rxq)) {
>                         PMD_DRV_LOG(ERR, "bnxt_init_one_rx_ring
> failed!\n");
> --
> 2.21.1 (Apple Git-122.3)
>
>
  

Patch

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 73deb41f81..eb9de45cb9 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -2717,6 +2717,9 @@  void bnxt_free_hwrm_rx_ring(struct bnxt *bp, int queue_index)
 	struct bnxt_ring *ring = rxr->rx_ring_struct;
 	struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
 
+	if (BNXT_HAS_RING_GRPS(bp))
+		bnxt_hwrm_ring_grp_free(bp, queue_index);
+
 	bnxt_hwrm_ring_free(bp, ring,
 			    HWRM_RING_FREE_INPUT_RING_TYPE_RX,
 			    cpr->cp_ring_struct->fw_ring_id);
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index b05c470766..957b175f1b 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -631,6 +631,12 @@  int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)
 	if (rc)
 		goto err_out;
 
+	if (BNXT_HAS_RING_GRPS(bp)) {
+		rc = bnxt_hwrm_ring_grp_alloc(bp, queue_index);
+		if (rc)
+			goto err_out;
+	}
+
 	if (rxq->rx_started) {
 		if (bnxt_init_one_rx_ring(rxq)) {
 			PMD_DRV_LOG(ERR, "bnxt_init_one_rx_ring failed!\n");