All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gagandeep Singh <g.singh@nxp.com>
To: dev@dpdk.org
Cc: hemant.agrawal@nxp.com, stable@dpdk.org,
	Gagandeep Singh <g.singh@nxp.com>
Subject: [PATCH v4 2/9] net/enetc: fix queue initialization
Date: Mon, 29 Jun 2026 10:48:12 +0530	[thread overview]
Message-ID: <20260629051819.989176-3-g.singh@nxp.com> (raw)
In-Reply-To: <20260629051819.989176-1-g.singh@nxp.com>

Hardware can misbehave if the user tries to reset the consumer and
producer indexes without resetting the ring.

This patch adds the ring reset step before resetting the indexes.

Fixes: 6c9c5aadc0e0 ("net/enetc: support ENETC4 queue API")
Cc: stable@dpdk.org

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/net/enetc/enetc4_ethdev.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/enetc/enetc4_ethdev.c b/drivers/net/enetc/enetc4_ethdev.c
index 78eba70..154fc09 100644
--- a/drivers/net/enetc/enetc4_ethdev.c
+++ b/drivers/net/enetc/enetc4_ethdev.c
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2024 NXP
+ * Copyright 2024-2026 NXP
  */
 
 #include <stdbool.h>
@@ -279,6 +279,7 @@ enetc4_tx_queue_setup(struct rte_eth_dev *dev,
 		     const struct rte_eth_txconf *tx_conf)
 {
 	int err;
+	uint32_t tx_data;
 	struct enetc_bdr *tx_ring;
 	struct rte_eth_dev_data *data = dev->data;
 	struct enetc_eth_adapter *priv =
@@ -301,6 +302,10 @@ enetc4_tx_queue_setup(struct rte_eth_dev *dev,
 		goto fail;
 
 	tx_ring->ndev = dev;
+	/* reset queue */
+	tx_data = enetc4_txbdr_rd(&priv->hw.hw, tx_ring->index, ENETC_TBMR);
+	tx_data &= ~ENETC_TBMR_EN;
+	enetc4_txbdr_wr(&priv->hw.hw, tx_ring->index, ENETC_TBMR, tx_data);
 	enetc4_setup_txbdr(&priv->hw.hw, tx_ring);
 	data->tx_queues[queue_idx] = tx_ring;
 	tx_ring->tx_deferred_start = tx_conf->tx_deferred_start;
@@ -427,6 +432,7 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 		     struct rte_mempool *mb_pool)
 {
 	int err = 0;
+	uint32_t rx_enable;
 	struct enetc_bdr *rx_ring;
 	struct rte_eth_dev_data *data =  dev->data;
 	struct enetc_eth_adapter *adapter =
@@ -450,6 +456,10 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 		goto fail;
 
 	rx_ring->ndev = dev;
+	/* reset queue */
+	rx_enable = enetc4_rxbdr_rd(&adapter->hw.hw, rx_ring->index, ENETC_RBMR);
+	rx_enable &= ~ENETC_RBMR_EN;
+	enetc4_rxbdr_wr(&adapter->hw.hw, rx_ring->index, ENETC_RBMR, rx_enable);
 	enetc4_setup_rxbdr(&adapter->hw.hw, rx_ring, mb_pool);
 	data->rx_queues[rx_queue_id] = rx_ring;
 	rx_ring->rx_deferred_start = rx_conf->rx_deferred_start;
-- 
2.25.1


  parent reply	other threads:[~2026-06-29  5:22 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-19 18:44 [PATCH 00/10] NXP ENETC driver related changes Gagandeep Singh
2026-06-19 18:44 ` [PATCH 01/10] net/enetc: fix TX BD structure Gagandeep Singh
2026-06-19 18:44 ` [PATCH 02/10] net/enetc: fix TX BDs flag overwrite issue Gagandeep Singh
2026-06-19 18:44 ` [PATCH 03/10] net/enetc: fix queue initialization Gagandeep Singh
2026-06-19 18:44 ` [PATCH 04/10] net/enetc: support ESP packet type in packet parsing Gagandeep Singh
2026-06-19 18:44 ` [PATCH 05/10] net/enetc: update random MAC generation code Gagandeep Singh
2026-06-19 18:44 ` [PATCH 06/10] net/enetc: support scatter-gather Gagandeep Singh
2026-06-19 18:44 ` [PATCH 07/10] net/enetc: add option to disable VSI messaging Gagandeep Singh
2026-06-19 18:44 ` [PATCH 08/10] net/enetc: add devargs to control VSI-PSI timeout and delay Gagandeep Singh
2026-06-19 18:44 ` [PATCH 09/10] net/enetc: set user configurable priority to TX rings Gagandeep Singh
2026-06-19 18:44 ` [PATCH 10/10] net/enetc4: add cacheable BD ring support with SW cache maintenance Gagandeep Singh
2026-06-19 21:43 ` [PATCH 00/10] NXP ENETC driver related changes Stephen Hemminger
2026-06-22 11:36   ` Gagandeep Singh
2026-06-22 11:35 ` [PATCH v2 0/9] ENETC driver related changes series Gagandeep Singh
2026-06-22 11:35   ` [PATCH v2 1/9] net/enetc: fix TX BD structure Gagandeep Singh
2026-06-22 11:35   ` [PATCH v2 2/9] net/enetc: fix queue initialization Gagandeep Singh
2026-06-22 11:35   ` [PATCH v2 3/9] net/enetc: support ESP packet type in packet parsing Gagandeep Singh
2026-06-22 11:35   ` [PATCH v2 4/9] net/enetc: update random MAC generation code Gagandeep Singh
2026-06-22 11:35   ` [PATCH v2 5/9] net/enetc: support scatter-gather Gagandeep Singh
2026-06-22 11:35   ` [PATCH v2 6/9] net/enetc: add option to disable VSI messaging Gagandeep Singh
2026-06-22 11:35   ` [PATCH v2 7/9] net/enetc: add devargs to control VSI-PSI timeout and delay Gagandeep Singh
2026-06-22 11:35   ` [PATCH v2 8/9] net/enetc: set user configurable priority to TX rings Gagandeep Singh
2026-06-22 11:35   ` [PATCH v2 9/9] net/enetc4: add cacheable BD ring support with SW cache maintenance Gagandeep Singh
2026-06-22 15:06   ` [PATCH v2 0/9] ENETC driver related changes series Stephen Hemminger
2026-06-23  6:02     ` Gagandeep Singh
2026-06-23  5:59   ` [PATCH v3 " Gagandeep Singh
2026-06-23  5:59     ` [PATCH v3 1/9] net/enetc: fix TX BD structure Gagandeep Singh
2026-06-23  5:59     ` [PATCH v3 2/9] net/enetc: fix queue initialization Gagandeep Singh
2026-06-23  5:59     ` [PATCH v3 3/9] net/enetc: support ESP packet type in packet parsing Gagandeep Singh
2026-06-23  5:59     ` [PATCH v3 4/9] net/enetc: update random MAC generation code Gagandeep Singh
2026-06-23  6:00     ` [PATCH v3 5/9] net/enetc: support scatter-gather Gagandeep Singh
2026-06-23  6:00     ` [PATCH v3 6/9] net/enetc: add option to disable VSI messaging Gagandeep Singh
2026-06-23  6:00     ` [PATCH v3 7/9] net/enetc: add devargs to control VSI-PSI timeout and delay Gagandeep Singh
2026-06-23  6:00     ` [PATCH v3 8/9] net/enetc: set user configurable priority to TX rings Gagandeep Singh
2026-06-23  6:00     ` [PATCH v3 9/9] net/enetc4: add cacheable BD ring support with SW cache maintenance Gagandeep Singh
2026-06-23 15:46     ` [PATCH v3 0/9] ENETC driver related changes series Stephen Hemminger
2026-06-23 17:21       ` Gagandeep Singh
2026-06-23 17:32         ` Stephen Hemminger
2026-06-28 22:24     ` Stephen Hemminger
2026-06-28 22:40     ` Stephen Hemminger
2026-06-29  5:19       ` Gagandeep Singh
2026-06-29  5:05     ` [PATCH v4 " Gagandeep Singh
2026-06-29  5:05       ` [PATCH v4 1/9] net/enetc: fix TX BD structure Gagandeep Singh
2026-06-29  5:05       ` [PATCH v4 2/9] net/enetc: fix queue initialization Gagandeep Singh
2026-06-29  5:05       ` [PATCH v4 3/9] net/enetc: support ESP packet type in packet parsing Gagandeep Singh
2026-06-29  5:05       ` [PATCH v4 4/9] net/enetc: update random MAC generation code Gagandeep Singh
2026-06-29  5:05       ` [PATCH v4 5/9] net/enetc: support scatter-gather Gagandeep Singh
2026-06-29  5:05       ` [PATCH v4 6/9] net/enetc: add option to disable VSI messaging Gagandeep Singh
2026-06-29  5:05       ` [PATCH v4 7/9] net/enetc: add devargs to control VSI-PSI timeout and delay Gagandeep Singh
2026-06-29  5:05       ` [PATCH v4 8/9] net/enetc: set user configurable priority to TX rings Gagandeep Singh
2026-06-29  5:05       ` [PATCH v4 9/9] net/enetc4: add cacheable BD ring support with SW cache maintenance Gagandeep Singh
2026-06-29  5:18     ` [PATCH v4 0/9] ENETC driver related changes series Gagandeep Singh
2026-06-29  5:18       ` [PATCH v4 1/9] net/enetc: fix TX BD structure Gagandeep Singh
2026-06-29  5:18       ` Gagandeep Singh [this message]
2026-06-29  5:18       ` [PATCH v4 3/9] net/enetc: support ESP packet type in packet parsing Gagandeep Singh
2026-06-29  5:18       ` [PATCH v4 4/9] net/enetc: update random MAC generation code Gagandeep Singh
2026-06-29  5:18       ` [PATCH v4 5/9] net/enetc: support scatter-gather Gagandeep Singh
2026-06-29  5:18       ` [PATCH v4 6/9] net/enetc: add option to disable VSI messaging Gagandeep Singh
2026-06-29  5:18       ` [PATCH v4 7/9] net/enetc: add devargs to control VSI-PSI timeout and delay Gagandeep Singh
2026-06-29  5:18       ` [PATCH v4 8/9] net/enetc: set user configurable priority to TX rings Gagandeep Singh
2026-06-29  5:18       ` [PATCH v4 9/9] net/enetc4: add cacheable BD ring support with SW cache maintenance Gagandeep Singh
2026-06-29 19:00       ` [PATCH v4 0/9] ENETC driver related changes series Stephen Hemminger

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=20260629051819.989176-3-g.singh@nxp.com \
    --to=g.singh@nxp.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=stable@dpdk.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.