diff options
author | np <np@FreeBSD.org> | 2015-08-04 04:00:36 +0000 |
---|---|---|
committer | np <np@FreeBSD.org> | 2015-08-04 04:00:36 +0000 |
commit | 84fadb8369de638f4c3fdfc967e46a69c7ce40ed (patch) | |
tree | 910c8c9478be087fe769c9ca900bd5890d844994 | |
parent | 79c68b3bae787ed4e791c7378acfadfa8e9a7968 (diff) | |
download | FreeBSD-src-84fadb8369de638f4c3fdfc967e46a69c7ce40ed.zip FreeBSD-src-84fadb8369de638f4c3fdfc967e46a69c7ce40ed.tar.gz |
MFC r284988, r285220, and r285221.
r284988:
cxgbe(4): request an automatic tx update when a netmap tx queue idles.
The NIC tx queues already do this.
r285220:
cxgbe(4): Do not override the the global defaults for congestion drops.
The hw.cxgbe.cong_drop knob is not affected by this change because the
driver sets up congestion drop on a per-queue basis.
r285221:
cxgbe(4): Add a new knob that controls the congestion response of netmap
rx queues. The default is to drop rather than backpressure.
This decouples the congestion settings of NIC and netmap rx queues.
-rw-r--r-- | sys/dev/cxgbe/adapter.h | 2 | ||||
-rw-r--r-- | sys/dev/cxgbe/t4_netmap.c | 15 | ||||
-rw-r--r-- | sys/dev/cxgbe/t4_sge.c | 26 |
3 files changed, 18 insertions, 25 deletions
diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 0ecdf07..f37d08b 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -1045,7 +1045,7 @@ void t4_update_fl_bufsize(struct ifnet *); int parse_pkt(struct mbuf **); void *start_wrq_wr(struct sge_wrq *, int, struct wrq_cookie *); void commit_wrq_wr(struct sge_wrq *, void *, struct wrq_cookie *); -int tnl_cong(struct port_info *); +int tnl_cong(struct port_info *, int); /* t4_tracer.c */ struct t4_tracer; diff --git a/sys/dev/cxgbe/t4_netmap.c b/sys/dev/cxgbe/t4_netmap.c index c739146..f54a67f 100644 --- a/sys/dev/cxgbe/t4_netmap.c +++ b/sys/dev/cxgbe/t4_netmap.c @@ -77,6 +77,15 @@ int holdoff_tmr_idx = 2; SYSCTL_INT(_hw_cxgbe, OID_AUTO, nm_holdoff_tmr_idx, CTLFLAG_RWTUN, &holdoff_tmr_idx, 0, "Holdoff timer index for netmap rx queues."); +/* + * Congestion drops. + * -1: no congestion feedback (not recommended). + * 0: backpressure the channel instead of dropping packets right away. + * 1: no backpressure, drop packets for the congested queue immediately. + */ +static int nm_cong_drop = 1; +TUNABLE_INT("hw.cxgbe.nm_cong_drop", &nm_cong_drop); + /* netmap ifnet routines */ static void cxgbe_nm_init(void *); static int cxgbe_nm_ioctl(struct ifnet *, unsigned long, caddr_t); @@ -405,8 +414,8 @@ alloc_nm_txq_hwq(struct port_info *pi, struct sge_nm_txq *nm_txq) V_FW_EQ_ETH_CMD_VFN(0)); c.alloc_to_len16 = htobe32(F_FW_EQ_ETH_CMD_ALLOC | F_FW_EQ_ETH_CMD_EQSTART | FW_LEN16(c)); - c.autoequiqe_to_viid = htobe32(F_FW_EQ_ETH_CMD_AUTOEQUEQE | - V_FW_EQ_ETH_CMD_VIID(pi->nm_viid)); + c.autoequiqe_to_viid = htobe32(F_FW_EQ_ETH_CMD_AUTOEQUIQE | + F_FW_EQ_ETH_CMD_AUTOEQUEQE | V_FW_EQ_ETH_CMD_VIID(pi->nm_viid)); c.fetchszm_to_iqid = htobe32(V_FW_EQ_ETH_CMD_HOSTFCMODE(X_HOSTFCMODE_NONE) | V_FW_EQ_ETH_CMD_PCIECHN(pi->tx_chan) | F_FW_EQ_ETH_CMD_FETCHRO | @@ -503,7 +512,7 @@ cxgbe_netmap_on(struct adapter *sc, struct port_info *pi, struct ifnet *ifp, nm_set_native_flags(na); for_each_nm_rxq(pi, i, nm_rxq) { - alloc_nm_rxq_hwq(pi, nm_rxq, tnl_cong(pi)); + alloc_nm_rxq_hwq(pi, nm_rxq, tnl_cong(pi, nm_cong_drop)); nm_rxq->fl_hwidx = hwidx; slot = netmap_reset(na, NR_RX, i, 0); MPASS(slot != NULL); /* XXXNM: error check, not assert */ diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index a704a8d..5c7eb48 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -471,12 +471,6 @@ t4_tweak_chip_settings(struct adapter *sc) V_TIMERVALUE5(us_to_core_ticks(sc, intr_timer[5])); t4_write_reg(sc, A_SGE_TIMER_VALUE_4_AND_5, v); - if (cong_drop == 0) { - m = F_TUNNELCNGDROP0 | F_TUNNELCNGDROP1 | F_TUNNELCNGDROP2 | - F_TUNNELCNGDROP3; - t4_set_reg_field(sc, A_TP_PARA_REG3, m, 0); - } - /* 4K, 16K, 64K, 256K DDP "page sizes" */ v = V_HPZ0(0) | V_HPZ1(2) | V_HPZ2(4) | V_HPZ3(6); t4_write_reg(sc, A_ULP_RX_TDDP_PSZ, v); @@ -684,17 +678,6 @@ t4_read_chip_settings(struct adapter *sc) s->timer_val[4] = G_TIMERVALUE4(r) / core_ticks_per_usec(sc); s->timer_val[5] = G_TIMERVALUE5(r) / core_ticks_per_usec(sc); - if (cong_drop == 0) { - m = F_TUNNELCNGDROP0 | F_TUNNELCNGDROP1 | F_TUNNELCNGDROP2 | - F_TUNNELCNGDROP3; - r = t4_read_reg(sc, A_TP_PARA_REG3); - if (r & m) { - device_printf(sc->dev, - "invalid TP_PARA_REG3(0x%x)\n", r); - rc = EINVAL; - } - } - v = V_HPZ0(0) | V_HPZ1(2) | V_HPZ2(4) | V_HPZ3(6); r = t4_read_reg(sc, A_ULP_RX_TDDP_PSZ); if (r != v) { @@ -2915,12 +2898,12 @@ free_mgmtq(struct adapter *sc) } int -tnl_cong(struct port_info *pi) +tnl_cong(struct port_info *pi, int drop) { - if (cong_drop == -1) + if (drop == -1) return (-1); - else if (cong_drop == 1) + else if (drop == 1) return (0); else return (pi->rx_chan_map); @@ -2934,7 +2917,8 @@ alloc_rxq(struct port_info *pi, struct sge_rxq *rxq, int intr_idx, int idx, struct sysctl_oid_list *children; char name[16]; - rc = alloc_iq_fl(pi, &rxq->iq, &rxq->fl, intr_idx, tnl_cong(pi)); + rc = alloc_iq_fl(pi, &rxq->iq, &rxq->fl, intr_idx, + tnl_cong(pi, cong_drop)); if (rc != 0) return (rc); |