bnx2x: fix restart
authorChas Williams <3chas3@gmail.com>
Wed, 9 Dec 2015 22:11:04 +0000 (17:11 -0500)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Sun, 13 Dec 2015 00:44:51 +0000 (01:44 +0100)
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
drivers/net/bnx2x/bnx2x_rxtx.c

index 2dc2a47..a5f4069 100644 (file)
@@ -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) {
index 9379127..89d93a1 100644 (file)
@@ -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;