Changeset View
Changeset View
Standalone View
Standalone View
sys/net/iflib.c
Show First 20 Lines • Show All 637 Lines • ▼ Show 20 Lines | |||||
SYSCTL_INT(_net_iflib, OID_AUTO, encap_pad_mbuf_fail, CTLFLAG_RD, | SYSCTL_INT(_net_iflib, OID_AUTO, encap_pad_mbuf_fail, CTLFLAG_RD, | ||||
&iflib_encap_pad_mbuf_fail, 0, "# runt frame pad failures"); | &iflib_encap_pad_mbuf_fail, 0, "# runt frame pad failures"); | ||||
SYSCTL_INT(_net_iflib, OID_AUTO, encap_txq_avail_fail, CTLFLAG_RD, | SYSCTL_INT(_net_iflib, OID_AUTO, encap_txq_avail_fail, CTLFLAG_RD, | ||||
&iflib_encap_txq_avail_fail, 0, "# txq avail failures"); | &iflib_encap_txq_avail_fail, 0, "# txq avail failures"); | ||||
SYSCTL_INT(_net_iflib, OID_AUTO, encap_txd_encap_fail, CTLFLAG_RD, | SYSCTL_INT(_net_iflib, OID_AUTO, encap_txd_encap_fail, CTLFLAG_RD, | ||||
&iflib_encap_txd_encap_fail, 0, "# driver encap failures"); | &iflib_encap_txd_encap_fail, 0, "# driver encap failures"); | ||||
static int iflib_task_fn_rxs; | static int iflib_task_fn_rxs; | ||||
static int iflib_task_fn_txs; | |||||
static int iflib_rx_intr_enables; | static int iflib_rx_intr_enables; | ||||
static int iflib_fast_intrs; | static int iflib_fast_intrs; | ||||
static int iflib_fast_intr_rxtxs; | |||||
static int iflib_fast_intr_ctxs; | |||||
static int iflib_rx_unavail; | static int iflib_rx_unavail; | ||||
static int iflib_rx_ctx_inactive; | static int iflib_rx_ctx_inactive; | ||||
static int iflib_rx_if_input; | static int iflib_rx_if_input; | ||||
static int iflib_rxd_flush; | static int iflib_rxd_flush; | ||||
static int iflib_verbose_debug; | static int iflib_verbose_debug; | ||||
SYSCTL_INT(_net_iflib, OID_AUTO, task_fn_rx, CTLFLAG_RD, | SYSCTL_INT(_net_iflib, OID_AUTO, task_fn_rx, CTLFLAG_RD, | ||||
&iflib_task_fn_rxs, 0, "# task_fn_rx calls"); | &iflib_task_fn_rxs, 0, "# task_fn_rx calls"); | ||||
SYSCTL_INT(_net_iflib, OID_AUTO, task_fn_tx, CTLFLAG_RD, | |||||
&iflib_task_fn_txs, 0, "# task_fn_tx calls"); | |||||
SYSCTL_INT(_net_iflib, OID_AUTO, rx_intr_enables, CTLFLAG_RD, | SYSCTL_INT(_net_iflib, OID_AUTO, rx_intr_enables, CTLFLAG_RD, | ||||
&iflib_rx_intr_enables, 0, "# RX intr enables"); | &iflib_rx_intr_enables, 0, "# RX intr enables"); | ||||
SYSCTL_INT(_net_iflib, OID_AUTO, fast_intrs, CTLFLAG_RD, | SYSCTL_INT(_net_iflib, OID_AUTO, fast_intrs, CTLFLAG_RD, | ||||
&iflib_fast_intrs, 0, "# fast_intr calls"); | &iflib_fast_intrs, 0, "# fast_intr calls"); | ||||
SYSCTL_INT(_net_iflib, OID_AUTO, fast_intr_rxtxs, CTLFLAG_RD, | |||||
&iflib_fast_intr_rxtxs, 0, "# fast_intr_rxtx calls"); | |||||
SYSCTL_INT(_net_iflib, OID_AUTO, fast_intr_ctxs, CTLFLAG_RD, | |||||
&iflib_fast_intr_ctxs, 0, "# fast_intr_ctx calls"); | |||||
SYSCTL_INT(_net_iflib, OID_AUTO, rx_unavail, CTLFLAG_RD, | SYSCTL_INT(_net_iflib, OID_AUTO, rx_unavail, CTLFLAG_RD, | ||||
&iflib_rx_unavail, 0, "# times rxeof called with no available data"); | &iflib_rx_unavail, 0, "# times rxeof called with no available data"); | ||||
SYSCTL_INT(_net_iflib, OID_AUTO, rx_ctx_inactive, CTLFLAG_RD, | SYSCTL_INT(_net_iflib, OID_AUTO, rx_ctx_inactive, CTLFLAG_RD, | ||||
&iflib_rx_ctx_inactive, 0, "# times rxeof called with inactive context"); | &iflib_rx_ctx_inactive, 0, "# times rxeof called with inactive context"); | ||||
SYSCTL_INT(_net_iflib, OID_AUTO, rx_if_input, CTLFLAG_RD, | SYSCTL_INT(_net_iflib, OID_AUTO, rx_if_input, CTLFLAG_RD, | ||||
&iflib_rx_if_input, 0, "# times rxeof called if_input"); | &iflib_rx_if_input, 0, "# times rxeof called if_input"); | ||||
SYSCTL_INT(_net_iflib, OID_AUTO, rxd_flush, CTLFLAG_RD, | SYSCTL_INT(_net_iflib, OID_AUTO, rxd_flush, CTLFLAG_RD, | ||||
&iflib_rxd_flush, 0, "# times rxd_flush called"); | &iflib_rxd_flush, 0, "# times rxd_flush called"); | ||||
SYSCTL_INT(_net_iflib, OID_AUTO, verbose_debug, CTLFLAG_RW, | SYSCTL_INT(_net_iflib, OID_AUTO, verbose_debug, CTLFLAG_RW, | ||||
&iflib_verbose_debug, 0, "enable verbose debugging"); | &iflib_verbose_debug, 0, "enable verbose debugging"); | ||||
#define DBG_COUNTER_INC(name) atomic_add_int(&(iflib_ ## name), 1) | #define DBG_COUNTER_INC(name) atomic_add_int(&(iflib_ ## name), 1) | ||||
static void | static void | ||||
iflib_debug_reset(void) | iflib_debug_reset(void) | ||||
{ | { | ||||
iflib_tx_seen = iflib_tx_sent = iflib_tx_encap = iflib_rx_allocs = | iflib_tx_seen = iflib_tx_sent = iflib_tx_encap = iflib_rx_allocs = | ||||
iflib_fl_refills = iflib_fl_refills_large = iflib_tx_frees = | iflib_fl_refills = iflib_fl_refills_large = iflib_tx_frees = | ||||
iflib_txq_drain_flushing = iflib_txq_drain_oactive = | iflib_txq_drain_flushing = iflib_txq_drain_oactive = | ||||
iflib_txq_drain_notready = | iflib_txq_drain_notready = | ||||
iflib_encap_load_mbuf_fail = iflib_encap_pad_mbuf_fail = | iflib_encap_load_mbuf_fail = iflib_encap_pad_mbuf_fail = | ||||
iflib_encap_txq_avail_fail = iflib_encap_txd_encap_fail = | iflib_encap_txq_avail_fail = iflib_encap_txd_encap_fail = | ||||
iflib_task_fn_rxs = iflib_rx_intr_enables = iflib_fast_intrs = | iflib_task_fn_rxs = iflib_task_fn_txs = iflib_rx_intr_enables = | ||||
iflib_rx_unavail = | iflib_fast_intrs = iflib_fast_intr_rxtxs = iflib_fast_intr_ctxs = | ||||
iflib_rx_ctx_inactive = iflib_rx_if_input = | iflib_rx_unavail = iflib_rx_ctx_inactive = iflib_rx_if_input = | ||||
iflib_rxd_flush = 0; | iflib_rxd_flush = 0; | ||||
} | } | ||||
#else | #else | ||||
#define DBG_COUNTER_INC(name) | #define DBG_COUNTER_INC(name) | ||||
static void iflib_debug_reset(void) {} | static void iflib_debug_reset(void) {} | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 868 Lines • ▼ Show 20 Lines | iflib_fast_intr_rxtx(void *arg) | ||||
if_ctx_t ctx; | if_ctx_t ctx; | ||||
iflib_rxq_t rxq = (iflib_rxq_t)info->ifi_ctx; | iflib_rxq_t rxq = (iflib_rxq_t)info->ifi_ctx; | ||||
iflib_txq_t txq; | iflib_txq_t txq; | ||||
void *sc; | void *sc; | ||||
int i, cidx, result; | int i, cidx, result; | ||||
qidx_t txqid; | qidx_t txqid; | ||||
bool intr_enable, intr_legacy; | bool intr_enable, intr_legacy; | ||||
DBG_COUNTER_INC(fast_intrs); | DBG_COUNTER_INC(fast_intr_rxtxs); | ||||
if (info->ifi_filter != NULL) { | if (info->ifi_filter != NULL) { | ||||
result = info->ifi_filter(info->ifi_filter_arg); | result = info->ifi_filter(info->ifi_filter_arg); | ||||
if ((result & FILTER_SCHEDULE_THREAD) == 0) | if ((result & FILTER_SCHEDULE_THREAD) == 0) | ||||
return (result); | return (result); | ||||
} | } | ||||
ctx = rxq->ifr_ctx; | ctx = rxq->ifr_ctx; | ||||
sc = ctx->ifc_softc; | sc = ctx->ifc_softc; | ||||
Show All 34 Lines | |||||
static int | static int | ||||
iflib_fast_intr_ctx(void *arg) | iflib_fast_intr_ctx(void *arg) | ||||
{ | { | ||||
iflib_filter_info_t info = arg; | iflib_filter_info_t info = arg; | ||||
struct grouptask *gtask = info->ifi_task; | struct grouptask *gtask = info->ifi_task; | ||||
int result; | int result; | ||||
DBG_COUNTER_INC(fast_intrs); | DBG_COUNTER_INC(fast_intr_ctxs); | ||||
if (info->ifi_filter != NULL) { | if (info->ifi_filter != NULL) { | ||||
result = info->ifi_filter(info->ifi_filter_arg); | result = info->ifi_filter(info->ifi_filter_arg); | ||||
if ((result & FILTER_SCHEDULE_THREAD) == 0) | if ((result & FILTER_SCHEDULE_THREAD) == 0) | ||||
return (result); | return (result); | ||||
} | } | ||||
GROUPTASK_ENQUEUE(gtask); | GROUPTASK_ENQUEUE(gtask); | ||||
return (FILTER_HANDLED); | return (FILTER_HANDLED); | ||||
▲ Show 20 Lines • Show All 5,046 Lines • ▼ Show 20 Lines | if (tx_queues != rx_queues) | ||||
"queue equality override not set, capping rx_queues at %d and tx_queues at %d\n", | "queue equality override not set, capping rx_queues at %d and tx_queues at %d\n", | ||||
min(rx_queues, tx_queues), min(rx_queues, tx_queues)); | min(rx_queues, tx_queues), min(rx_queues, tx_queues)); | ||||
#endif | #endif | ||||
tx_queues = min(rx_queues, tx_queues); | tx_queues = min(rx_queues, tx_queues); | ||||
rx_queues = min(rx_queues, tx_queues); | rx_queues = min(rx_queues, tx_queues); | ||||
} | } | ||||
vectors = rx_queues + admincnt; | vectors = rx_queues + admincnt; | ||||
if (scctx->isc_tx_irq) { | |||||
vectors += tx_queues; | |||||
} | |||||
if (msgs < vectors) { | if (msgs < vectors) { | ||||
device_printf(dev, | device_printf(dev, | ||||
"insufficient number of MSI-X vectors " | "insufficient number of MSI-X vectors " | ||||
"(supported %d, need %d)\n", msgs, vectors); | "(supported %d, need %d)\n", msgs, vectors); | ||||
goto msi; | goto msi; | ||||
} | } | ||||
device_printf(dev, "Using %d RX queues %d TX queues\n", rx_queues, | |||||
tx_queues); | |||||
msgs = vectors; | msgs = vectors; | ||||
device_printf(dev, "Using %d RX queues %d TX queues msgs %d\n", | |||||
rx_queues, tx_queues, msgs); | |||||
if ((err = pci_alloc_msix(dev, &vectors)) == 0) { | if ((err = pci_alloc_msix(dev, &vectors)) == 0) { | ||||
if (vectors != msgs) { | if (vectors != msgs) { | ||||
device_printf(dev, | device_printf(dev, | ||||
"Unable to allocate sufficient MSI-X vectors " | "Unable to allocate sufficient MSI-X vectors " | ||||
"(got %d, need %d)\n", vectors, msgs); | "(got %d, need %d)\n", vectors, msgs); | ||||
pci_release_msi(dev); | pci_release_msi(dev); | ||||
if (bar != -1) { | if (bar != -1) { | ||||
bus_release_resource(dev, SYS_RES_MEMORY, bar, | bus_release_resource(dev, SYS_RES_MEMORY, bar, | ||||
▲ Show 20 Lines • Show All 344 Lines • ▼ Show 20 Lines | |||||
void | void | ||||
iflib_request_reset(if_ctx_t ctx) | iflib_request_reset(if_ctx_t ctx) | ||||
{ | { | ||||
STATE_LOCK(ctx); | STATE_LOCK(ctx); | ||||
ctx->ifc_flags |= IFC_DO_RESET; | ctx->ifc_flags |= IFC_DO_RESET; | ||||
STATE_UNLOCK(ctx); | STATE_UNLOCK(ctx); | ||||
} | |||||
void | |||||
iflib_enable_tx_irq(if_ctx_t ctx) | |||||
{ | |||||
ctx->ifc_softc_ctx.isc_tx_irq = 1; | |||||
} | } | ||||
#ifndef __NO_STRICT_ALIGNMENT | #ifndef __NO_STRICT_ALIGNMENT | ||||
static struct mbuf * | static struct mbuf * | ||||
iflib_fixup_rx(struct mbuf *m) | iflib_fixup_rx(struct mbuf *m) | ||||
{ | { | ||||
struct mbuf *n; | struct mbuf *n; | ||||
▲ Show 20 Lines • Show All 108 Lines • Show Last 20 Lines |