DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chas Williams <3chas3@gmail.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] bnx2x: always reinitialize the rx queue indices
Date: Wed,  9 Dec 2015 17:11:04 -0500	[thread overview]
Message-ID: <1449699064-808-1-git-send-email-3chas3@gmail.com> (raw)

If you stop and start the driver, the rx queue will have the previous
index values when programming the adapter.  Therefore, we should always
reset the queue indices when the rx ring is setup.  Note:  We need to
clear (write) the status block's completion queue index since it is
possibly in a read cache.

Tidy some init code to make it clearer what the defaults are.

Signed-off-by: Chas Williams <3chas3@gmail.com>
---
 drivers/net/bnx2x/bnx2x.c      | 16 +++++++++++-----
 drivers/net/bnx2x/bnx2x_rxtx.c |  2 +-
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index 294711f..d6e28a5 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -5005,11 +5005,17 @@ static void bnx2x_init_rx_rings(struct bnx2x_softc *sc)
 			return;
 		}
 
-/*
- * Activate the BD ring...
- * Warning, this will generate an interrupt (to the TSTORM)
- * so this can only be done after the chip is initialized
- */
+		rxq->rx_bd_head = 0;
+		rxq->rx_bd_tail = rxq->nb_rx_desc;
+		rxq->rx_cq_head = 0;
+		rxq->rx_cq_tail = TOTAL_RCQ_ENTRIES(rxq);
+		*fp->rx_cq_cons_sb = 0;
+
+		/*
+		 * Activate the BD ring...
+		 * Warning, this will generate an interrupt (to the TSTORM)
+		 * so this can only be done after the chip is initialized
+		 */
 		bnx2x_update_rx_prod(sc, fp, rxq->rx_bd_tail, rxq->rx_cq_tail);
 
 		if (i != 0) {
diff --git a/drivers/net/bnx2x/bnx2x_rxtx.c b/drivers/net/bnx2x/bnx2x_rxtx.c
index 9379127..89d93a1 100644
--- a/drivers/net/bnx2x/bnx2x_rxtx.c
+++ b/drivers/net/bnx2x/bnx2x_rxtx.c
@@ -156,7 +156,7 @@ bnx2x_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	rxq->pkt_first_seg = NULL;
 	rxq->pkt_last_seg = NULL;
 	rxq->rx_bd_head = 0;
-	rxq->rx_bd_tail = idx;
+	rxq->rx_bd_tail = rxq->nb_rx_desc;
 
 	/* Allocate CQ chain. */
 	dma_size = BNX2X_RX_CHAIN_PAGE_SZ * rxq->nb_cq_pages;
-- 
2.1.0

             reply	other threads:[~2015-12-09 22:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-09 22:11 Chas Williams [this message]
2015-12-13  0:25 ` Thomas Monjalon

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=1449699064-808-1-git-send-email-3chas3@gmail.com \
    --to=3chas3@gmail.com \
    --cc=dev@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 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).