summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--share/man/man4/cxgbe.44
-rw-r--r--sys/dev/cxgbe/t4_main.c92
2 files changed, 50 insertions, 46 deletions
diff --git a/share/man/man4/cxgbe.4 b/share/man/man4/cxgbe.4
index 2a01a65..9ee9f84 100644
--- a/share/man/man4/cxgbe.4
+++ b/share/man/man4/cxgbe.4
@@ -167,6 +167,10 @@ Tunables can be set at the
.Xr loader 8
prompt before booting the kernel or stored in
.Xr loader.conf 5 .
+There are multiple tunables that control the number of queues of various
+types.
+A negative value for such a tunable instructs the driver to create
+up to that many queues if there are enough CPU cores available.
.Bl -tag -width indent
.It Va hw.cxgbe.ntxq10g
Number of tx queues used for a 10Gb or higher-speed port.
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 97505e8..ef3db2e 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -232,8 +232,8 @@ SLIST_HEAD(, uld_info) t4_uld_list;
* Tunables. See tweak_tunables() too.
*
* Each tunable is set to a default value here if it's known at compile-time.
- * Otherwise it is set to -1 as an indication to tweak_tunables() that it should
- * provide a reasonable default when the driver is loaded.
+ * Otherwise it is set to -n as an indication to tweak_tunables() that it should
+ * provide a reasonable default (upto n) when the driver is loaded.
*
* Tunables applicable to both T4 and T5 are under hw.cxgbe. Those specific to
* T5 are under hw.cxl.
@@ -243,27 +243,27 @@ SLIST_HEAD(, uld_info) t4_uld_list;
* Number of queues for tx and rx, 10G and 1G, NIC and offload.
*/
#define NTXQ_10G 16
-int t4_ntxq10g = -1;
+int t4_ntxq10g = -NTXQ_10G;
TUNABLE_INT("hw.cxgbe.ntxq10g", &t4_ntxq10g);
#define NRXQ_10G 8
-int t4_nrxq10g = -1;
+int t4_nrxq10g = -NRXQ_10G;
TUNABLE_INT("hw.cxgbe.nrxq10g", &t4_nrxq10g);
#define NTXQ_1G 4
-int t4_ntxq1g = -1;
+int t4_ntxq1g = -NTXQ_1G;
TUNABLE_INT("hw.cxgbe.ntxq1g", &t4_ntxq1g);
#define NRXQ_1G 2
-int t4_nrxq1g = -1;
+int t4_nrxq1g = -NRXQ_1G;
TUNABLE_INT("hw.cxgbe.nrxq1g", &t4_nrxq1g);
#define NTXQ_VI 1
-static int t4_ntxq_vi = -1;
+static int t4_ntxq_vi = -NTXQ_VI;
TUNABLE_INT("hw.cxgbe.ntxq_vi", &t4_ntxq_vi);
#define NRXQ_VI 1
-static int t4_nrxq_vi = -1;
+static int t4_nrxq_vi = -NRXQ_VI;
TUNABLE_INT("hw.cxgbe.nrxq_vi", &t4_nrxq_vi);
static int t4_rsrv_noflowq = 0;
@@ -271,37 +271,37 @@ TUNABLE_INT("hw.cxgbe.rsrv_noflowq", &t4_rsrv_noflowq);
#ifdef TCP_OFFLOAD
#define NOFLDTXQ_10G 8
-static int t4_nofldtxq10g = -1;
+static int t4_nofldtxq10g = -NOFLDTXQ_10G;
TUNABLE_INT("hw.cxgbe.nofldtxq10g", &t4_nofldtxq10g);
#define NOFLDRXQ_10G 2
-static int t4_nofldrxq10g = -1;
+static int t4_nofldrxq10g = -NOFLDRXQ_10G;
TUNABLE_INT("hw.cxgbe.nofldrxq10g", &t4_nofldrxq10g);
#define NOFLDTXQ_1G 2
-static int t4_nofldtxq1g = -1;
+static int t4_nofldtxq1g = -NOFLDTXQ_1G;
TUNABLE_INT("hw.cxgbe.nofldtxq1g", &t4_nofldtxq1g);
#define NOFLDRXQ_1G 1
-static int t4_nofldrxq1g = -1;
+static int t4_nofldrxq1g = -NOFLDRXQ_1G;
TUNABLE_INT("hw.cxgbe.nofldrxq1g", &t4_nofldrxq1g);
#define NOFLDTXQ_VI 1
-static int t4_nofldtxq_vi = -1;
+static int t4_nofldtxq_vi = -NOFLDTXQ_VI;
TUNABLE_INT("hw.cxgbe.nofldtxq_vi", &t4_nofldtxq_vi);
#define NOFLDRXQ_VI 1
-static int t4_nofldrxq_vi = -1;
+static int t4_nofldrxq_vi = -NOFLDRXQ_VI;
TUNABLE_INT("hw.cxgbe.nofldrxq_vi", &t4_nofldrxq_vi);
#endif
#ifdef DEV_NETMAP
#define NNMTXQ_VI 2
-static int t4_nnmtxq_vi = -1;
+static int t4_nnmtxq_vi = -NNMTXQ_VI;
TUNABLE_INT("hw.cxgbe.nnmtxq_vi", &t4_nnmtxq_vi);
#define NNMRXQ_VI 2
-static int t4_nnmrxq_vi = -1;
+static int t4_nnmrxq_vi = -NNMRXQ_VI;
TUNABLE_INT("hw.cxgbe.nnmrxq_vi", &t4_nnmrxq_vi);
#endif
@@ -9553,6 +9553,22 @@ uld_active(struct adapter *sc, int uld_id)
#endif
/*
+ * t = ptr to tunable.
+ * nc = number of CPUs.
+ * c = compiled in default for that tunable.
+ */
+static void
+calculate_nqueues(int *t, int nc, const int c)
+{
+ int nq;
+
+ if (*t > 0)
+ return;
+ nq = *t < 0 ? -*t : c;
+ *t = min(nc, nq);
+}
+
+/*
* Come up with reasonable defaults for some of the tunables, provided they're
* not set by the user (in which case we'll use the values as is).
*/
@@ -9565,7 +9581,7 @@ tweak_tunables(void)
#ifdef RSS
t4_ntxq10g = rss_getnumbuckets();
#else
- t4_ntxq10g = min(nc, NTXQ_10G);
+ calculate_nqueues(&t4_ntxq10g, nc, NTXQ_10G);
#endif
}
@@ -9574,18 +9590,17 @@ tweak_tunables(void)
/* XXX: way too many for 1GbE? */
t4_ntxq1g = rss_getnumbuckets();
#else
- t4_ntxq1g = min(nc, NTXQ_1G);
+ calculate_nqueues(&t4_ntxq1g, nc, NTXQ_1G);
#endif
}
- if (t4_ntxq_vi < 1)
- t4_ntxq_vi = min(nc, NTXQ_VI);
+ calculate_nqueues(&t4_ntxq_vi, nc, NTXQ_VI);
if (t4_nrxq10g < 1) {
#ifdef RSS
t4_nrxq10g = rss_getnumbuckets();
#else
- t4_nrxq10g = min(nc, NRXQ_10G);
+ calculate_nqueues(&t4_nrxq10g, nc, NRXQ_10G);
#endif
}
@@ -9594,31 +9609,19 @@ tweak_tunables(void)
/* XXX: way too many for 1GbE? */
t4_nrxq1g = rss_getnumbuckets();
#else
- t4_nrxq1g = min(nc, NRXQ_1G);
+ calculate_nqueues(&t4_nrxq1g, nc, NRXQ_1G);
#endif
}
- if (t4_nrxq_vi < 1)
- t4_nrxq_vi = min(nc, NRXQ_VI);
+ calculate_nqueues(&t4_nrxq_vi, nc, NRXQ_VI);
#ifdef TCP_OFFLOAD
- if (t4_nofldtxq10g < 1)
- t4_nofldtxq10g = min(nc, NOFLDTXQ_10G);
-
- if (t4_nofldtxq1g < 1)
- t4_nofldtxq1g = min(nc, NOFLDTXQ_1G);
-
- if (t4_nofldtxq_vi < 1)
- t4_nofldtxq_vi = min(nc, NOFLDTXQ_VI);
-
- if (t4_nofldrxq10g < 1)
- t4_nofldrxq10g = min(nc, NOFLDRXQ_10G);
-
- if (t4_nofldrxq1g < 1)
- t4_nofldrxq1g = min(nc, NOFLDRXQ_1G);
-
- if (t4_nofldrxq_vi < 1)
- t4_nofldrxq_vi = min(nc, NOFLDRXQ_VI);
+ calculate_nqueues(&t4_nofldtxq10g, nc, NOFLDTXQ_10G);
+ calculate_nqueues(&t4_nofldtxq1g, nc, NOFLDTXQ_1G);
+ calculate_nqueues(&t4_nofldtxq_vi, nc, NOFLDTXQ_VI);
+ calculate_nqueues(&t4_nofldrxq10g, nc, NOFLDRXQ_10G);
+ calculate_nqueues(&t4_nofldrxq1g, nc, NOFLDRXQ_1G);
+ calculate_nqueues(&t4_nofldrxq_vi, nc, NOFLDRXQ_VI);
if (t4_toecaps_allowed == -1)
t4_toecaps_allowed = FW_CAPS_CONFIG_TOE;
@@ -9645,11 +9648,8 @@ tweak_tunables(void)
#endif
#ifdef DEV_NETMAP
- if (t4_nnmtxq_vi < 1)
- t4_nnmtxq_vi = min(nc, NNMTXQ_VI);
-
- if (t4_nnmrxq_vi < 1)
- t4_nnmrxq_vi = min(nc, NNMRXQ_VI);
+ calculate_nqueues(&t4_nnmtxq_vi, nc, NNMTXQ_VI);
+ calculate_nqueues(&t4_nnmrxq_vi, nc, NNMRXQ_VI);
#endif
if (t4_tmr_idx_10g < 0 || t4_tmr_idx_10g >= SGE_NTIMERS)
OpenPOWER on IntegriCloud