diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 298191ce7705..d166fb2e04b4 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -682,6 +682,7 @@ struct sge_nm_rxq { uint32_t fl_db_val; u_int fl_hwidx:4; + u_int fl_db_saved; u_int nid; /* netmap ring # for this queue */ /* infrequently used items after this */ diff --git a/sys/dev/cxgbe/t4_netmap.c b/sys/dev/cxgbe/t4_netmap.c index 897835a1eed0..6ca1a5e4ed81 100644 --- a/sys/dev/cxgbe/t4_netmap.c +++ b/sys/dev/cxgbe/t4_netmap.c @@ -89,6 +89,10 @@ SYSCTL_INT(_hw_cxgbe, OID_AUTO, nm_holdoff_tmr_idx, CTLFLAG_RWTUN, static int nm_cong_drop = 1; TUNABLE_INT("hw.cxgbe.nm_cong_drop", &nm_cong_drop); +int starve_fl = 0; +SYSCTL_INT(_hw_cxgbe, OID_AUTO, starve_fl, CTLFLAG_RWTUN, + &starve_fl, 0, "Don't ring fl db for netmap rx queues."); + static int alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq, int cong) { @@ -806,6 +810,13 @@ cxgbe_netmap_rxsync(struct netmap_kring *kring, int flags) kring->nr_kflags &= ~NKR_PENDINTR; } + if (nm_rxq->fl_db_saved > 0 && starve_fl == 0) { + wmb(); + t4_write_reg(sc, sc->sge_kdoorbell_reg, + nm_rxq->fl_db_val | V_PIDX(nm_rxq->fl_db_saved)); + nm_rxq->fl_db_saved = 0; + } + /* Userspace done with buffers from kring->nr_hwcur to head */ n = head >= kring->nr_hwcur ? head - kring->nr_hwcur : kring->nkr_num_slots - kring->nr_hwcur + head; @@ -842,8 +853,12 @@ cxgbe_netmap_rxsync(struct netmap_kring *kring, int flags) } if (++dbinc == 8 && n >= 32) { wmb(); - t4_write_reg(sc, sc->sge_kdoorbell_reg, - nm_rxq->fl_db_val | V_PIDX(dbinc)); + if (starve_fl) + nm_rxq->fl_db_saved += dbinc; + else { + t4_write_reg(sc, sc->sge_kdoorbell_reg, + nm_rxq->fl_db_val | V_PIDX(dbinc)); + } dbinc = 0; } } @@ -851,8 +866,12 @@ cxgbe_netmap_rxsync(struct netmap_kring *kring, int flags) if (dbinc > 0) { wmb(); - t4_write_reg(sc, sc->sge_kdoorbell_reg, - nm_rxq->fl_db_val | V_PIDX(dbinc)); + if (starve_fl) + nm_rxq->fl_db_saved += dbinc; + else { + t4_write_reg(sc, sc->sge_kdoorbell_reg, + nm_rxq->fl_db_val | V_PIDX(dbinc)); + } } }