Add stat counters for Jumbo Frames using SGE ring.

Also remove the checks for IFCAP_LRO in bxe_alloc_fp_buffers() and bxe_pf_rx_q_prep() since both TPA and Jumbo can use SGE ring.

Submitted by:gary.zambrano@qlogic.com
Approved by:davidcs@freebsd.org
MFC after:5 days
This commit is contained in:
David C Somayajulu 2015-05-22 01:44:07 +00:00
parent 86b9457f5b
commit bfdeba0cb3
3 changed files with 51 additions and 46 deletions

View file

@ -27,7 +27,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#define BXE_DRIVER_VERSION "1.78.78"
#define BXE_DRIVER_VERSION "1.78.79"
#include "bxe.h"
#include "ecore_sp.h"
@ -472,6 +472,8 @@ static const struct {
4, STATS_FLAGS_FUNC, "rx_pkts"},
{ STATS_OFFSET32(rx_tpa_pkts),
4, STATS_FLAGS_FUNC, "rx_tpa_pkts"},
{ STATS_OFFSET32(rx_jumbo_sge_pkts),
4, STATS_FLAGS_FUNC, "rx_jumbo_sge_pkts"},
{ STATS_OFFSET32(rx_soft_errors),
4, STATS_FLAGS_FUNC, "rx_soft_errors"},
{ STATS_OFFSET32(rx_hw_csum_errors),
@ -583,6 +585,8 @@ static const struct {
4, "rx_pkts"},
{ Q_STATS_OFFSET32(rx_tpa_pkts),
4, "rx_tpa_pkts"},
{ Q_STATS_OFFSET32(rx_jumbo_sge_pkts),
4, "rx_jumbo_sge_pkts"},
{ Q_STATS_OFFSET32(rx_soft_errors),
4, "rx_soft_errors"},
{ Q_STATS_OFFSET32(rx_hw_csum_errors),
@ -3466,6 +3470,7 @@ bxe_rxeof(struct bxe_softc *sc,
rc = bxe_service_rxsgl(fp, len, lenonbd, m, cqe_fp);
if (rc)
break;
fp->eth_q_stats.rx_jumbo_sge_pkts++;
}
/* assign packet to this interface interface */
@ -6844,42 +6849,40 @@ bxe_alloc_fp_buffers(struct bxe_softc *sc)
fp->rx_cq_prod = cqe_ring_prod;
fp->eth_q_stats.rx_calls = fp->eth_q_stats.rx_pkts = 0;
if (if_getcapenable(sc->ifp) & IFCAP_LRO) {
max_agg_queues = MAX_AGG_QS(sc);
max_agg_queues = MAX_AGG_QS(sc);
fp->tpa_enable = TRUE;
fp->tpa_enable = TRUE;
/* fill the TPA pool */
for (j = 0; j < max_agg_queues; j++) {
rc = bxe_alloc_rx_tpa_mbuf(fp, j);
if (rc != 0) {
BLOGE(sc, "mbuf alloc fail for fp[%02d] TPA queue %d\n",
/* fill the TPA pool */
for (j = 0; j < max_agg_queues; j++) {
rc = bxe_alloc_rx_tpa_mbuf(fp, j);
if (rc != 0) {
BLOGE(sc, "mbuf alloc fail for fp[%02d] TPA queue %d\n",
i, j);
fp->tpa_enable = FALSE;
goto bxe_alloc_fp_buffers_error;
}
fp->rx_tpa_info[j].state = BXE_TPA_STATE_STOP;
}
if (fp->tpa_enable) {
/* fill the RX SGE chain */
ring_prod = 0;
for (j = 0; j < RX_SGE_USABLE; j++) {
rc = bxe_alloc_rx_sge_mbuf(fp, ring_prod);
if (rc != 0) {
BLOGE(sc, "mbuf alloc fail for fp[%02d] SGE %d\n",
i, ring_prod);
fp->tpa_enable = FALSE;
ring_prod = 0;
goto bxe_alloc_fp_buffers_error;
}
fp->rx_tpa_info[j].state = BXE_TPA_STATE_STOP;
ring_prod = RX_SGE_NEXT(ring_prod);
}
if (fp->tpa_enable) {
/* fill the RX SGE chain */
ring_prod = 0;
for (j = 0; j < RX_SGE_USABLE; j++) {
rc = bxe_alloc_rx_sge_mbuf(fp, ring_prod);
if (rc != 0) {
BLOGE(sc, "mbuf alloc fail for fp[%02d] SGE %d\n",
i, ring_prod);
fp->tpa_enable = FALSE;
ring_prod = 0;
goto bxe_alloc_fp_buffers_error;
}
ring_prod = RX_SGE_NEXT(ring_prod);
}
fp->rx_sge_prod = ring_prod;
}
fp->rx_sge_prod = ring_prod;
}
}
@ -11763,29 +11766,27 @@ bxe_pf_rx_q_prep(struct bxe_softc *sc,
uint16_t sge_sz = 0;
uint16_t tpa_agg_size = 0;
if (if_getcapenable(sc->ifp) & IFCAP_LRO) {
pause->sge_th_lo = SGE_TH_LO(sc);
pause->sge_th_hi = SGE_TH_HI(sc);
pause->sge_th_lo = SGE_TH_LO(sc);
pause->sge_th_hi = SGE_TH_HI(sc);
/* validate SGE ring has enough to cross high threshold */
if (sc->dropless_fc &&
/* validate SGE ring has enough to cross high threshold */
if (sc->dropless_fc &&
(pause->sge_th_hi + FW_PREFETCH_CNT) >
(RX_SGE_USABLE_PER_PAGE * RX_SGE_NUM_PAGES)) {
BLOGW(sc, "sge ring threshold limit\n");
}
/* minimum max_aggregation_size is 2*MTU (two full buffers) */
tpa_agg_size = (2 * sc->mtu);
if (tpa_agg_size < sc->max_aggregation_size) {
tpa_agg_size = sc->max_aggregation_size;
}
max_sge = SGE_PAGE_ALIGN(sc->mtu) >> SGE_PAGE_SHIFT;
max_sge = ((max_sge + PAGES_PER_SGE - 1) &
(~(PAGES_PER_SGE - 1))) >> PAGES_PER_SGE_SHIFT;
sge_sz = (uint16_t)min(SGE_PAGES, 0xffff);
BLOGW(sc, "sge ring threshold limit\n");
}
/* minimum max_aggregation_size is 2*MTU (two full buffers) */
tpa_agg_size = (2 * sc->mtu);
if (tpa_agg_size < sc->max_aggregation_size) {
tpa_agg_size = sc->max_aggregation_size;
}
max_sge = SGE_PAGE_ALIGN(sc->mtu) >> SGE_PAGE_SHIFT;
max_sge = ((max_sge + PAGES_PER_SGE - 1) &
(~(PAGES_PER_SGE - 1))) >> PAGES_PER_SGE_SHIFT;
sge_sz = (uint16_t)min(SGE_PAGES, 0xffff);
/* pause - not for e1 */
if (!CHIP_IS_E1(sc)) {
pause->bd_th_lo = BD_TH_LO(sc);

View file

@ -1227,6 +1227,7 @@ bxe_drv_stats_update(struct bxe_softc *sc)
UPDATE_ESTAT_QSTAT(rx_calls);
UPDATE_ESTAT_QSTAT(rx_pkts);
UPDATE_ESTAT_QSTAT(rx_tpa_pkts);
UPDATE_ESTAT_QSTAT(rx_jumbo_sge_pkts);
UPDATE_ESTAT_QSTAT(rx_soft_errors);
UPDATE_ESTAT_QSTAT(rx_hw_csum_errors);
UPDATE_ESTAT_QSTAT(rx_ofld_frames_csum_ip);

View file

@ -218,6 +218,7 @@ struct bxe_eth_stats {
uint32_t rx_calls;
uint32_t rx_pkts;
uint32_t rx_tpa_pkts;
uint32_t rx_jumbo_sge_pkts;
uint32_t rx_soft_errors;
uint32_t rx_hw_csum_errors;
uint32_t rx_ofld_frames_csum_ip;
@ -318,6 +319,7 @@ struct bxe_eth_q_stats {
uint32_t rx_calls;
uint32_t rx_pkts;
uint32_t rx_tpa_pkts;
uint32_t rx_jumbo_sge_pkts;
uint32_t rx_soft_errors;
uint32_t rx_hw_csum_errors;
uint32_t rx_ofld_frames_csum_ip;
@ -411,6 +413,7 @@ struct bxe_eth_q_stats_old {
uint32_t rx_calls_old;
uint32_t rx_pkts_old;
uint32_t rx_tpa_pkts_old;
uint32_t rx_jumbo_sge_pkts_old;
uint32_t rx_soft_errors_old;
uint32_t rx_hw_csum_errors_old;
uint32_t rx_ofld_frames_csum_ip_old;