From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <3chas3@gmail.com> Received: from mail-qg0-f48.google.com (mail-qg0-f48.google.com [209.85.192.48]) by dpdk.org (Postfix) with ESMTP id 2200E8DB1 for ; Wed, 9 Dec 2015 23:11:11 +0100 (CET) Received: by qgeb1 with SMTP id b1so103999118qge.1 for ; Wed, 09 Dec 2015 14:11:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=qs8ddwAEu6mTBTly55ONDxBNIzEq1Xf4xF6+k+pm2no=; b=ue0NmWkON8AdZMInhcTg3dIKCdxtczxiLU7HLkMDlnXd2kEzK115iVf4ygDOtWSbQI 4fghNcL3cJX0XE16h3HFlYnFyb1XUbQTEj+uUXKhnuclKOCfeIX8XMdKgtf/nq3h4azj AOG0Fn2eOmorywo+1nom01rKO5j+k951D8kON8GCl/3Rj5aS7DCHWfepJZK9vu38fLuG CpQdNfr7bLmmS6BcFv9exzloMs9149hEtUoutvokk4hK6Xl8kiswGwowoBsX2SmHjHA1 mCgu/TrUQgE3cU4A2ihiDvuPWm28Xo9DdB+DLZ6ZWs1mV9arVdfbz/djqakGJeriItwr U+uA== X-Received: by 10.141.0.194 with SMTP id b185mr1891837qhd.23.1449699070633; Wed, 09 Dec 2015 14:11:10 -0800 (PST) Received: from foobar.home (pool-71-163-182-126.washdc.fios.verizon.net. [71.163.182.126]) by smtp.gmail.com with ESMTPSA id d129sm4625175qka.31.2015.12.09.14.11.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 14:11:10 -0800 (PST) From: Chas Williams <3chas3@gmail.com> To: dev@dpdk.org Date: Wed, 9 Dec 2015 17:11:04 -0500 Message-Id: <1449699064-808-1-git-send-email-3chas3@gmail.com> X-Mailer: git-send-email 2.1.0 Subject: [dpdk-dev] [PATCH] bnx2x: always reinitialize the rx queue indices X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2015 22:11:11 -0000 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