Page MenuHomeFreeBSD

D25254.id73550.diff
No OneTemporary

D25254.id73550.diff

Index: sys/net/iflib.c
===================================================================
--- sys/net/iflib.c
+++ sys/net/iflib.c
@@ -1189,7 +1189,7 @@
return (netmap_attach(&na));
}
-static void
+static int
iflib_netmap_txq_init(if_ctx_t ctx, iflib_txq_t txq)
{
struct netmap_adapter *na = NA(ctx->ifc_ifp);
@@ -1197,7 +1197,7 @@
slot = netmap_reset(na, NR_TX, txq->ift_id, 0);
if (slot == NULL)
- return;
+ return (0);
for (int i = 0; i < ctx->ifc_softc_ctx.isc_ntxd[0]; i++) {
/*
@@ -1211,21 +1211,24 @@
netmap_load_map(na, txq->ift_buf_tag, txq->ift_sds.ifsd_map[i],
NMB(na, slot + si));
}
+ return (1);
}
-static void
+static int
iflib_netmap_rxq_init(if_ctx_t ctx, iflib_rxq_t rxq)
{
struct netmap_adapter *na = NA(ctx->ifc_ifp);
- struct netmap_kring *kring = na->rx_rings[rxq->ifr_id];
+ struct netmap_kring *kring;
struct netmap_slot *slot;
uint32_t nm_i;
slot = netmap_reset(na, NR_RX, rxq->ifr_id, 0);
if (slot == NULL)
- return;
+ return (0);
+ kring = na->rx_rings[rxq->ifr_id];
nm_i = netmap_idx_n2k(kring, 0);
netmap_fl_refill(rxq, kring, nm_i, true);
+ return (1);
}
static void
@@ -1256,8 +1259,8 @@
#define iflib_netmap_detach(ifp) netmap_detach(ifp)
#else
-#define iflib_netmap_txq_init(ctx, txq)
-#define iflib_netmap_rxq_init(ctx, rxq)
+#define iflib_netmap_txq_init(ctx, txq) (0)
+#define iflib_netmap_rxq_init(ctx, rxq) (0)
#define iflib_netmap_detach(ifp)
#define iflib_netmap_attach(ctx) (0)
@@ -2367,10 +2370,8 @@
IFDI_INIT(ctx);
MPASS(if_getdrvflags(ifp) == i);
for (i = 0, rxq = ctx->ifc_rxqs; i < sctx->isc_nrxqsets; i++, rxq++) {
- /* XXX this should really be done on a per-queue basis */
- if (if_getcapenable(ifp) & IFCAP_NETMAP) {
- MPASS(rxq->ifr_id == i);
- iflib_netmap_rxq_init(ctx, rxq);
+ if (iflib_netmap_rxq_init(ctx, rxq) > 0) {
+ /* This rxq is in netmap mode. Skip normal init. */
continue;
}
for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++) {

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 10, 4:57 AM (12 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15739588
Default Alt Text
D25254.id73550.diff (1 KB)

Event Timeline