Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109520014
D19880.id57245.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D19880.id57245.diff
View Options
Index: head/sys/net/iflib.c
===================================================================
--- head/sys/net/iflib.c
+++ head/sys/net/iflib.c
@@ -4387,9 +4387,6 @@
scctx->isc_txrx_budget_bytes_max = IFLIB_MAX_TX_BYTES;
scctx->isc_tx_qdepth = IFLIB_DEFAULT_TX_QDEPTH;
- /*
- * XXX sanity check that ntxd & nrxd are a power of 2
- */
if (ctx->ifc_sysctl_ntxqs != 0)
scctx->isc_ntxqsets = ctx->ifc_sysctl_ntxqs;
if (ctx->ifc_sysctl_nrxqs != 0)
@@ -4420,6 +4417,11 @@
i, scctx->isc_nrxd[i], sctx->isc_nrxd_max[i]);
scctx->isc_nrxd[i] = sctx->isc_nrxd_max[i];
}
+ if (!powerof2(scctx->isc_nrxd[i])) {
+ device_printf(dev, "nrxd%d: %d is not a power of 2 - using default value of %d\n",
+ i, scctx->isc_nrxd[i], sctx->isc_nrxd_default[i]);
+ scctx->isc_nrxd[i] = sctx->isc_nrxd_default[i];
+ }
}
for (i = 0; i < sctx->isc_ntxqs; i++) {
@@ -4433,6 +4435,11 @@
i, scctx->isc_ntxd[i], sctx->isc_ntxd_max[i]);
scctx->isc_ntxd[i] = sctx->isc_ntxd_max[i];
}
+ if (!powerof2(scctx->isc_ntxd[i])) {
+ device_printf(dev, "ntxd%d: %d is not a power of 2 - using default value of %d\n",
+ i, scctx->isc_ntxd[i], sctx->isc_ntxd_default[i]);
+ scctx->isc_ntxd[i] = sctx->isc_ntxd_default[i];
+ }
}
}
@@ -4543,7 +4550,7 @@
if_softc_ctx_t scctx;
kobjop_desc_t kobj_desc;
kobj_method_t *kobj_method;
- int err, i, msix, rid;
+ int err, msix, rid;
uint16_t main_rxq, main_txq;
ctx = malloc(sizeof(* ctx), M_IFLIB, M_WAITOK|M_ZERO);
@@ -4598,23 +4605,6 @@
/* XXX change for per-queue sizes */
device_printf(dev, "Using %d TX descriptors and %d RX descriptors\n",
scctx->isc_ntxd[main_txq], scctx->isc_nrxd[main_rxq]);
- for (i = 0; i < sctx->isc_nrxqs; i++) {
- if (!powerof2(scctx->isc_nrxd[i])) {
- /* round down instead? */
- device_printf(dev,
- "# RX descriptors must be a power of 2\n");
- err = EINVAL;
- goto fail_iflib_detach;
- }
- }
- for (i = 0; i < sctx->isc_ntxqs; i++) {
- if (!powerof2(scctx->isc_ntxd[i])) {
- device_printf(dev,
- "# TX descriptors must be a power of 2");
- err = EINVAL;
- goto fail_iflib_detach;
- }
- }
if (scctx->isc_tx_nsegments > scctx->isc_ntxd[main_txq] /
MAX_SINGLE_PACKET_FRACTION)
@@ -4790,7 +4780,6 @@
fail_queues:
iflib_tx_structures_free(ctx);
iflib_rx_structures_free(ctx);
-fail_iflib_detach:
IFDI_DETACH(ctx);
fail_unlock:
CTX_UNLOCK(ctx);
@@ -4833,9 +4822,6 @@
scctx = &ctx->ifc_softc_ctx;
ifp = ctx->ifc_ifp;
- /*
- * XXX sanity check that ntxd & nrxd are a power of 2
- */
iflib_reset_qvalues(ctx);
CTX_LOCK(ctx);
if ((err = IFDI_ATTACH_PRE(ctx)) != 0) {
@@ -4899,23 +4885,6 @@
/* XXX change for per-queue sizes */
device_printf(dev, "Using %d TX descriptors and %d RX descriptors\n",
scctx->isc_ntxd[main_txq], scctx->isc_nrxd[main_rxq]);
- for (i = 0; i < sctx->isc_nrxqs; i++) {
- if (!powerof2(scctx->isc_nrxd[i])) {
- /* round down instead? */
- device_printf(dev,
- "# RX descriptors must be a power of 2\n");
- err = EINVAL;
- goto fail_iflib_detach;
- }
- }
- for (i = 0; i < sctx->isc_ntxqs; i++) {
- if (!powerof2(scctx->isc_ntxd[i])) {
- device_printf(dev,
- "# TX descriptors must be a power of 2");
- err = EINVAL;
- goto fail_iflib_detach;
- }
- }
if (scctx->isc_tx_nsegments > scctx->isc_ntxd[main_txq] /
MAX_SINGLE_PACKET_FRACTION)
@@ -5305,6 +5274,8 @@
static void
_iflib_assert(if_shared_ctx_t sctx)
{
+ int i;
+
MPASS(sctx->isc_tx_maxsize);
MPASS(sctx->isc_tx_maxsegsize);
@@ -5312,12 +5283,25 @@
MPASS(sctx->isc_rx_nsegments);
MPASS(sctx->isc_rx_maxsegsize);
- MPASS(sctx->isc_nrxd_min[0]);
- MPASS(sctx->isc_nrxd_max[0]);
- MPASS(sctx->isc_nrxd_default[0]);
- MPASS(sctx->isc_ntxd_min[0]);
- MPASS(sctx->isc_ntxd_max[0]);
- MPASS(sctx->isc_ntxd_default[0]);
+ MPASS(sctx->isc_nrxqs >= 1 && sctx->isc_nrxqs <= 8);
+ for (i = 0; i < sctx->isc_nrxqs; i++) {
+ MPASS(sctx->isc_nrxd_min[i]);
+ MPASS(powerof2(sctx->isc_nrxd_min[i]));
+ MPASS(sctx->isc_nrxd_max[i]);
+ MPASS(powerof2(sctx->isc_nrxd_max[i]));
+ MPASS(sctx->isc_nrxd_default[i]);
+ MPASS(powerof2(sctx->isc_nrxd_default[i]));
+ }
+
+ MPASS(sctx->isc_ntxqs >= 1 && sctx->isc_ntxqs <= 8);
+ for (i = 0; i < sctx->isc_ntxqs; i++) {
+ MPASS(sctx->isc_ntxd_min[i]);
+ MPASS(powerof2(sctx->isc_ntxd_min[i]));
+ MPASS(sctx->isc_ntxd_max[i]);
+ MPASS(powerof2(sctx->isc_ntxd_max[i]));
+ MPASS(sctx->isc_ntxd_default[i]);
+ MPASS(powerof2(sctx->isc_ntxd_default[i]));
+ }
}
static void
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Feb 7, 4:12 AM (20 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16505701
Default Alt Text
D19880.id57245.diff (4 KB)
Attached To
Mode
D19880: iflib: use default ntxd and nrxd when user value is not power of 2
Attached
Detach File
Event Timeline
Log In to Comment