aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/cxgbe
diff options
context:
space:
mode:
authorScott Long <scottl@FreeBSD.org>2014-02-06 18:40:38 +0000
committerScott Long <scottl@FreeBSD.org>2014-02-06 18:40:38 +0000
commitf7a74e061b4d2a9e19701771fbcb449eb4a69848 (patch)
tree09c309ec088addbdd3520c989cefa94ee121ca05 /sys/dev/cxgbe
parentd642560225aeb2d21e64c897f11409b73b3a633c (diff)
downloadsrc-f7a74e061b4d2a9e19701771fbcb449eb4a69848.tar.gz
src-f7a74e061b4d2a9e19701771fbcb449eb4a69848.zip
Add a new sysctl, dev.cxgbe.N.rsrv_noflow, and a companion tunable,
hw.cxgbe.rsrv_noflow. When set, queue 0 of the port is reserved for TX packets without a flowid. The hash value of packets with a flowid is bumped up by 1. The intent is to provide a private queue for link-level packets like LACP that is unlikely to overflow or suffer deep queue latency. Reviewed by: np Obtained from: Netflix MFC after: 3 days
Notes
Notes: svn path=/head/; revision=261558
Diffstat (limited to 'sys/dev/cxgbe')
-rw-r--r--sys/dev/cxgbe/adapter.h1
-rw-r--r--sys/dev/cxgbe/t4_main.c36
2 files changed, 36 insertions, 1 deletions
diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h
index 9a235ceb6a75..9a9b3dbe4f4d 100644
--- a/sys/dev/cxgbe/adapter.h
+++ b/sys/dev/cxgbe/adapter.h
@@ -215,6 +215,7 @@ struct port_info {
/* These need to be int as they are used in sysctl */
int ntxq; /* # of tx queues */
int first_txq; /* index of first tx queue */
+ int rsrv_noflowq; /* Reserve queue 0 for non-flowid packets */
int nrxq; /* # of rx queues */
int first_rxq; /* index of first rx queue */
#ifdef TCP_OFFLOAD
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 567e222740da..714a00c705be 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -197,6 +197,9 @@ TUNABLE_INT("hw.cxgbe.ntxq1g", &t4_ntxq1g);
static int t4_nrxq1g = -1;
TUNABLE_INT("hw.cxgbe.nrxq1g", &t4_nrxq1g);
+static int t4_rsrv_noflowq = 0;
+TUNABLE_INT("hw.cxgbe.rsrv_noflowq", &t4_rsrv_noflowq);
+
#ifdef TCP_OFFLOAD
#define NOFLDTXQ_10G 8
static int t4_nofldtxq10g = -1;
@@ -299,6 +302,7 @@ struct intrs_and_queues {
int nrxq10g; /* # of NIC rxq's for each 10G port */
int ntxq1g; /* # of NIC txq's for each 1G port */
int nrxq1g; /* # of NIC rxq's for each 1G port */
+ int rsrv_noflowq; /* Flag whether to reserve queue 0 */
#ifdef TCP_OFFLOAD
int nofldtxq10g; /* # of TOE txq's for each 10G port */
int nofldrxq10g; /* # of TOE rxq's for each 10G port */
@@ -375,6 +379,7 @@ static int cxgbe_sysctls(struct port_info *);
static int sysctl_int_array(SYSCTL_HANDLER_ARGS);
static int sysctl_bitfield(SYSCTL_HANDLER_ARGS);
static int sysctl_btphy(SYSCTL_HANDLER_ARGS);
+static int sysctl_noflowq(SYSCTL_HANDLER_ARGS);
static int sysctl_holdoff_tmr_idx(SYSCTL_HANDLER_ARGS);
static int sysctl_holdoff_pktc_idx(SYSCTL_HANDLER_ARGS);
static int sysctl_qsize_rxq(SYSCTL_HANDLER_ARGS);
@@ -783,6 +788,11 @@ t4_attach(device_t dev)
pi->ntxq = iaq.ntxq1g;
}
+ if (pi->ntxq > 1)
+ pi->rsrv_noflowq = iaq.rsrv_noflowq ? 1 : 0;
+ else
+ pi->rsrv_noflowq = 0;
+
rqidx += pi->nrxq;
tqidx += pi->ntxq;
@@ -1283,7 +1293,8 @@ cxgbe_transmit(struct ifnet *ifp, struct mbuf *m)
}
if (m->m_flags & M_FLOWID)
- txq += (m->m_pkthdr.flowid % pi->ntxq);
+ txq += ((m->m_pkthdr.flowid % (pi->ntxq - pi->rsrv_noflowq))
+ + pi->rsrv_noflowq);
br = txq->br;
if (TXQ_TRYLOCK(txq) == 0) {
@@ -1735,6 +1746,7 @@ cfg_itype_and_nqueues(struct adapter *sc, int n10g, int n1g,
iaq->ntxq1g = t4_ntxq1g;
iaq->nrxq10g = nrxq10g = t4_nrxq10g;
iaq->nrxq1g = nrxq1g = t4_nrxq1g;
+ iaq->rsrv_noflowq = t4_rsrv_noflowq;
#ifdef TCP_OFFLOAD
if (is_offload(sc)) {
iaq->nofldtxq10g = t4_nofldtxq10g;
@@ -4548,6 +4560,9 @@ cxgbe_sysctls(struct port_info *pi)
&pi->first_rxq, 0, "index of first rx queue");
SYSCTL_ADD_INT(ctx, children, OID_AUTO, "first_txq", CTLFLAG_RD,
&pi->first_txq, 0, "index of first tx queue");
+ SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "rsrv_noflowq", CTLTYPE_INT |
+ CTLFLAG_RW, pi, 0, sysctl_noflowq, "IU",
+ "Reserve queue 0 for non-flowid packets");
#ifdef TCP_OFFLOAD
if (is_offload(sc)) {
@@ -4802,6 +4817,25 @@ sysctl_btphy(SYSCTL_HANDLER_ARGS)
}
static int
+sysctl_noflowq(SYSCTL_HANDLER_ARGS)
+{
+ struct port_info *pi = arg1;
+ int rc, val;
+
+ val = pi->rsrv_noflowq;
+ rc = sysctl_handle_int(oidp, &val, 0, req);
+ if (rc != 0 || req->newptr == NULL)
+ return (rc);
+
+ if ((val >= 1) && (pi->ntxq > 1))
+ pi->rsrv_noflowq = 1;
+ else
+ pi->rsrv_noflowq = 0;
+
+ return (rc);
+}
+
+static int
sysctl_holdoff_tmr_idx(SYSCTL_HANDLER_ARGS)
{
struct port_info *pi = arg1;