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.

MFC after:	3 days
This commit is contained in:
Navdeep Parhar 2015-07-06 20:56:59 +00:00
parent 41f7622b64
commit 9af71ab3bc
3 changed files with 16 additions and 6 deletions

View File

@ -1052,7 +1052,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;

View File

@ -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);
@ -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 */

View File

@ -2903,12 +2903,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);
@ -2922,7 +2922,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);