Date: Fri, 15 Jun 2018 23:42:22 +0000 (UTC) From: Navdeep Parhar <np@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335243 - head/sys/dev/cxgbe Message-ID: <201806152342.w5FNgMpU041074@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: np Date: Fri Jun 15 23:42:22 2018 New Revision: 335243 URL: https://svnweb.freebsd.org/changeset/base/335243 Log: cxgbe(4): Add a hw.cxgbe.starve_fl sysctl that can be used to starve the freelists of netmap receive queues. This is primarily to test various congestion scenarios in the chip. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_netmap.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Fri Jun 15 21:36:16 2018 (r335242) +++ head/sys/dev/cxgbe/adapter.h Fri Jun 15 23:42:22 2018 (r335243) @@ -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 */ Modified: head/sys/dev/cxgbe/t4_netmap.c ============================================================================== --- head/sys/dev/cxgbe/t4_netmap.c Fri Jun 15 21:36:16 2018 (r335242) +++ head/sys/dev/cxgbe/t4_netmap.c Fri Jun 15 23:42:22 2018 (r335243) @@ -89,6 +89,10 @@ SYSCTL_INT(_hw_cxgbe, OID_AUTO, nm_holdoff_tmr_idx, CT 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 fl 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 fl } 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 fl 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)); + } } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806152342.w5FNgMpU041074>