bnx: It does not make sense to have ret-ring size larger than prod-ring
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Thu, 28 Mar 2013 07:35:19 +0000 (15:35 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Thu, 28 Mar 2013 07:35:19 +0000 (15:35 +0800)
sys/dev/netif/bnx/if_bnx.c
sys/dev/netif/bnx/if_bnxvar.h

index af2311f..cdbbc45 100644 (file)
@@ -1346,7 +1346,7 @@ bnx_blockinit(struct bnx_softc *sc)
        RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_lo, taddr.bge_addr_lo);
        RCB_WRITE_4(sc, vrcb, bge_nicaddr, 0);
        RCB_WRITE_4(sc, vrcb, bge_maxlen_flags,
-           BGE_RCB_MAXLEN_FLAGS(sc->bnx_return_ring_cnt, 0));
+           BGE_RCB_MAXLEN_FLAGS(BNX_RETURN_RING_CNT, 0));
 
        /* Set random backoff seed for TX */
        CSR_WRITE_4(sc, BGE_TX_RANDOM_BACKOFF,
@@ -1852,13 +1852,6 @@ bnx_attach(device_t dev)
                goto fail;
        }
 
-       if (BNX_IS_57765_PLUS(sc)) {
-               sc->bnx_return_ring_cnt = BGE_RETURN_RING_CNT;
-       } else {
-               /* 5705/5750 limits RX return ring to 512 entries. */
-               sc->bnx_return_ring_cnt = BGE_RETURN_RING_CNT_5705;
-       }
-
        error = bnx_dma_alloc(sc);
        if (error)
                goto fail;
@@ -2397,7 +2390,7 @@ bnx_rxeof(struct bnx_softc *sc, uint16_t rx_prod, int count)
            &sc->bnx_ldata.bnx_rx_return_ring[sc->bnx_rx_saved_considx];
 
                rxidx = cur_rx->bge_idx;
-               BNX_INC(sc->bnx_rx_saved_considx, sc->bnx_return_ring_cnt);
+               BNX_INC(sc->bnx_rx_saved_considx, BNX_RETURN_RING_CNT);
 
                if (cur_rx->bge_flags & BGE_RXBDFLAG_VLAN_TAG) {
                        have_tag = 1;
@@ -3568,7 +3561,7 @@ bnx_dma_alloc(struct bnx_softc *sc)
         * Create DMA stuffs for RX return ring.
         */
        error = bnx_dma_block_alloc(sc,
-           BGE_RX_RTN_RING_SZ(sc->bnx_return_ring_cnt),
+           BGE_RX_RTN_RING_SZ(BNX_RETURN_RING_CNT),
            &sc->bnx_cdata.bnx_rx_return_ring_tag,
            &sc->bnx_cdata.bnx_rx_return_ring_map,
            (void *)&sc->bnx_ldata.bnx_rx_return_ring,
index 5e3de08..0af7b57 100644 (file)
@@ -221,7 +221,6 @@ struct bnx_softc {
        struct bnx_chain_data   bnx_cdata;      /* mbufs */
        uint16_t                bnx_tx_saved_considx;
        uint16_t                bnx_rx_saved_considx;
-       uint16_t                bnx_return_ring_cnt;
        uint16_t                bnx_std;        /* current std ring head */
        uint16_t                bnx_jumbo;      /* current jumo ring head */
        SLIST_HEAD(__bnx_jfreehead, bnx_jslot)  bnx_jfree_listhead;
@@ -298,4 +297,7 @@ struct bnx_softc {
 /* Number of segments sent before writing to TX related registers */
 #define BNX_TX_WREG_NSEGS      8
 
+/* Return ring descriptor count */
+#define BNX_RETURN_RING_CNT    512
+
 #endif /* !_IF_BNXVAR_H_ */