Changeset View
Changeset View
Standalone View
Standalone View
sys/net/iflib.c
Show First 20 Lines • Show All 3,438 Lines • ▼ Show 20 Lines | if (__predict_false(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_OACTIVE)) { | ||||
callout_stop(&txq->ift_timer); | callout_stop(&txq->ift_timer); | ||||
CALLOUT_UNLOCK(txq); | CALLOUT_UNLOCK(txq); | ||||
DBG_COUNTER_INC(txq_drain_oactive); | DBG_COUNTER_INC(txq_drain_oactive); | ||||
return (0); | return (0); | ||||
} | } | ||||
if (reclaimed) | if (reclaimed) | ||||
txq->ift_qstatus = IFLIB_QUEUE_IDLE; | txq->ift_qstatus = IFLIB_QUEUE_IDLE; | ||||
consumed = mcast_sent = bytes_sent = pkt_sent = 0; | consumed = mcast_sent = bytes_sent = pkt_sent = 0; | ||||
count = MIN(avail, TX_BATCH_SIZE); | count = avail; | ||||
#ifdef INVARIANTS | #ifdef INVARIANTS | ||||
gallatin: I'd rather not add a function call and a possible cache miss to get the MTU on every drain. I… | |||||
Done Inline ActionsYeah, it was something I was planning on doing if this helped on the weaker hardware, but it seems that just increasing the number of packets in a drain may not be enough. shurd: Yeah, it was something I was planning on doing if this helped on the weaker hardware, but it… | |||||
if (iflib_verbose_debug) | if (iflib_verbose_debug) | ||||
printf("%s avail=%d ifc_flags=%x txq_avail=%d ", __FUNCTION__, | printf("%s avail=%d ifc_flags=%x txq_avail=%d ", __FUNCTION__, | ||||
avail, ctx->ifc_flags, TXQ_AVAIL(txq)); | avail, ctx->ifc_flags, TXQ_AVAIL(txq)); | ||||
#endif | #endif | ||||
do_prefetch = (ctx->ifc_flags & IFC_PREFETCH); | do_prefetch = (ctx->ifc_flags & IFC_PREFETCH); | ||||
avail = TXQ_AVAIL(txq); | avail = TXQ_AVAIL(txq); | ||||
err = 0; | err = 0; | ||||
for (desc_used = i = 0; i < count && avail > MAX_TX_DESC(ctx) + 2; i++) { | for (desc_used = i = 0; i < count && avail > MAX_TX_DESC(ctx) + 2; i++) { | ||||
▲ Show 20 Lines • Show All 1,695 Lines • ▼ Show 20 Lines | for (txconf = i = 0, cpu = CPU_FIRST(); i < ntxqsets; i++, txconf++, txq++, cpu = CPU_NEXT(cpu)) { | ||||
snprintf(txq->ift_mtx_name, MTX_NAME_LEN, "%s:tx(%d):callout", | snprintf(txq->ift_mtx_name, MTX_NAME_LEN, "%s:tx(%d):callout", | ||||
device_get_nameunit(dev), txq->ift_id); | device_get_nameunit(dev), txq->ift_id); | ||||
mtx_init(&txq->ift_mtx, txq->ift_mtx_name, NULL, MTX_DEF); | mtx_init(&txq->ift_mtx, txq->ift_mtx_name, NULL, MTX_DEF); | ||||
callout_init_mtx(&txq->ift_timer, &txq->ift_mtx, 0); | callout_init_mtx(&txq->ift_timer, &txq->ift_mtx, 0); | ||||
snprintf(txq->ift_db_mtx_name, MTX_NAME_LEN, "%s:tx(%d):db", | snprintf(txq->ift_db_mtx_name, MTX_NAME_LEN, "%s:tx(%d):db", | ||||
device_get_nameunit(dev), txq->ift_id); | device_get_nameunit(dev), txq->ift_id); | ||||
err = ifmp_ring_alloc(&txq->ift_br, 2048, txq, iflib_txq_drain, | err = ifmp_ring_alloc(&txq->ift_br, scctx->isc_ntxd[txq->ift_br_offset]/2, txq, iflib_txq_drain, | ||||
iflib_txq_can_drain, M_IFLIB, M_WAITOK); | iflib_txq_can_drain, M_IFLIB, M_WAITOK); | ||||
if (err) { | if (err) { | ||||
/* XXX free any allocated rings */ | /* XXX free any allocated rings */ | ||||
device_printf(dev, "Unable to allocate buf_ring\n"); | device_printf(dev, "Unable to allocate buf_ring\n"); | ||||
goto err_tx_desc; | goto err_tx_desc; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,230 Lines • Show Last 20 Lines |
I'd rather not add a function call and a possible cache miss to get the MTU on every drain. I think part of the reason that abdicate is beneficial is that the costs of the drain are ammortized, so we don't want to make it more expensive.
Maybe we could pre-calculate this value at every mtu update, and avoid the min() and potential cache miss to peek into the txrx_budget?
(these comments on misses are speculative, i have not analyzed it carefully)