Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F103020874
D25541.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
D25541.diff
View Options
Index: head/sys/net/iflib.c
===================================================================
--- head/sys/net/iflib.c
+++ head/sys/net/iflib.c
@@ -730,6 +730,26 @@
DEBUGNET_DEFINE(iflib);
+static int
+iflib_num_rx_descs(if_ctx_t ctx)
+{
+ if_softc_ctx_t scctx = &ctx->ifc_softc_ctx;
+ if_shared_ctx_t sctx = ctx->ifc_sctx;
+ uint16_t first_rxq = (sctx->isc_flags & IFLIB_HAS_RXCQ) ? 1 : 0;
+
+ return scctx->isc_nrxd[first_rxq];
+}
+
+static int
+iflib_num_tx_descs(if_ctx_t ctx)
+{
+ if_softc_ctx_t scctx = &ctx->ifc_softc_ctx;
+ if_shared_ctx_t sctx = ctx->ifc_sctx;
+ uint16_t first_txq = (sctx->isc_flags & IFLIB_HAS_TXCQ) ? 1 : 0;
+
+ return scctx->isc_ntxd[first_txq];
+}
+
#ifdef DEV_NETMAP
#include <sys/selinfo.h>
#include <net/netmap.h>
@@ -1165,7 +1185,6 @@
iflib_netmap_attach(if_ctx_t ctx)
{
struct netmap_adapter na;
- if_softc_ctx_t scctx = &ctx->ifc_softc_ctx;
bzero(&na, sizeof(na));
@@ -1174,8 +1193,8 @@
MPASS(ctx->ifc_softc_ctx.isc_ntxqsets);
MPASS(ctx->ifc_softc_ctx.isc_nrxqsets);
- na.num_tx_desc = scctx->isc_ntxd[0];
- na.num_rx_desc = scctx->isc_nrxd[0];
+ na.num_tx_desc = iflib_num_tx_descs(ctx);
+ na.num_rx_desc = iflib_num_rx_descs(ctx);
na.nm_txsync = iflib_netmap_txsync;
na.nm_rxsync = iflib_netmap_rxsync;
na.nm_register = iflib_netmap_register;
@@ -4590,7 +4609,7 @@
kobjop_desc_t kobj_desc;
kobj_method_t *kobj_method;
int err, msix, rid;
- uint16_t main_rxq, main_txq;
+ int num_txd, num_rxd;
ctx = malloc(sizeof(* ctx), M_IFLIB, M_WAITOK|M_ZERO);
@@ -4640,21 +4659,20 @@
if (scctx->isc_nrxqsets == 0 || (scctx->isc_nrxqsets_max && scctx->isc_nrxqsets_max < scctx->isc_nrxqsets))
scctx->isc_nrxqsets = scctx->isc_nrxqsets_max;
- main_txq = (sctx->isc_flags & IFLIB_HAS_TXCQ) ? 1 : 0;
- main_rxq = (sctx->isc_flags & IFLIB_HAS_RXCQ) ? 1 : 0;
+ num_txd = iflib_num_tx_descs(ctx);
+ num_rxd = iflib_num_rx_descs(ctx);
/* 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]);
+ num_txd, num_rxd);
- if (scctx->isc_tx_nsegments > scctx->isc_ntxd[main_txq] /
- MAX_SINGLE_PACKET_FRACTION)
- scctx->isc_tx_nsegments = max(1, scctx->isc_ntxd[main_txq] /
+ if (scctx->isc_tx_nsegments > num_txd / MAX_SINGLE_PACKET_FRACTION)
+ scctx->isc_tx_nsegments = max(1, num_txd /
MAX_SINGLE_PACKET_FRACTION);
- if (scctx->isc_tx_tso_segments_max > scctx->isc_ntxd[main_txq] /
+ if (scctx->isc_tx_tso_segments_max > num_txd /
MAX_SINGLE_PACKET_FRACTION)
scctx->isc_tx_tso_segments_max = max(1,
- scctx->isc_ntxd[main_txq] / MAX_SINGLE_PACKET_FRACTION);
+ num_txd / MAX_SINGLE_PACKET_FRACTION);
/* TSO parameters - dig these out of the data sheet - simply correspond to tag setup */
if (if_getcapabilities(ifp) & IFCAP_TSO) {
@@ -4831,14 +4849,13 @@
iflib_pseudo_register(device_t dev, if_shared_ctx_t sctx, if_ctx_t *ctxp,
struct iflib_cloneattach_ctx *clctx)
{
+ int num_txd, num_rxd;
int err;
if_ctx_t ctx;
if_t ifp;
if_softc_ctx_t scctx;
int i;
void *sc;
- uint16_t main_txq;
- uint16_t main_rxq;
ctx = malloc(sizeof(*ctx), M_IFLIB, M_WAITOK|M_ZERO);
sc = malloc(sctx->isc_driver->size, M_IFLIB, M_WAITOK|M_ZERO);
@@ -4924,21 +4941,20 @@
if (scctx->isc_nrxqsets == 0 || (scctx->isc_nrxqsets_max && scctx->isc_nrxqsets_max < scctx->isc_nrxqsets))
scctx->isc_nrxqsets = scctx->isc_nrxqsets_max;
- main_txq = (sctx->isc_flags & IFLIB_HAS_TXCQ) ? 1 : 0;
- main_rxq = (sctx->isc_flags & IFLIB_HAS_RXCQ) ? 1 : 0;
+ num_txd = iflib_num_tx_descs(ctx);
+ num_rxd = iflib_num_rx_descs(ctx);
/* 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]);
+ num_txd, num_rxd);
- if (scctx->isc_tx_nsegments > scctx->isc_ntxd[main_txq] /
- MAX_SINGLE_PACKET_FRACTION)
- scctx->isc_tx_nsegments = max(1, scctx->isc_ntxd[main_txq] /
+ if (scctx->isc_tx_nsegments > num_txd / MAX_SINGLE_PACKET_FRACTION)
+ scctx->isc_tx_nsegments = max(1, num_txd /
MAX_SINGLE_PACKET_FRACTION);
- if (scctx->isc_tx_tso_segments_max > scctx->isc_ntxd[main_txq] /
+ if (scctx->isc_tx_tso_segments_max > num_txd /
MAX_SINGLE_PACKET_FRACTION)
scctx->isc_tx_tso_segments_max = max(1,
- scctx->isc_ntxd[main_txq] / MAX_SINGLE_PACKET_FRACTION);
+ num_txd / MAX_SINGLE_PACKET_FRACTION);
/* TSO parameters - dig these out of the data sheet - simply correspond to tag setup */
if (if_getcapabilities(ifp) & IFCAP_TSO) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 20, 10:18 PM (21 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14748497
Default Alt Text
D25541.diff (4 KB)
Attached To
Mode
D25541: iflib: initialize netmap with the correct number of descriptors
Attached
Detach File
Event Timeline
Log In to Comment