Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/ixl/ixl_txrx.c
Show First 20 Lines • Show All 509 Lines • ▼ Show 20 Lines | #endif | ||||
/* If clear is false just let caller know that there | /* If clear is false just let caller know that there | ||||
* are descriptors to reclaim */ | * are descriptors to reclaim */ | ||||
if (!clear) | if (!clear) | ||||
return (1); | return (1); | ||||
prev = txr->tx_cidx_processed; | prev = txr->tx_cidx_processed; | ||||
ntxd = scctx->isc_ntxd[0]; | ntxd = scctx->isc_ntxd[0]; | ||||
do { | do { | ||||
MPASS(prev != cur); | |||||
delta = (int32_t)cur - (int32_t)prev; | delta = (int32_t)cur - (int32_t)prev; | ||||
/* | |||||
* XXX This appears to be a hack for first-packet. | |||||
* A correct fix would prevent prev == cur in the first place. | |||||
*/ | |||||
MPASS(prev == 0 || delta != 0); | |||||
if (prev == 0 && cur == 0) | |||||
delta += 1; | |||||
if (delta < 0) | if (delta < 0) | ||||
delta += ntxd; | delta += ntxd; | ||||
MPASS(delta > 0); | |||||
#if 0 | #if 0 | ||||
device_printf(iflib_get_dev(vsi->ctx), | device_printf(iflib_get_dev(vsi->ctx), | ||||
"%s: (q%d) cidx_processed=%u cur=%u clear=%d delta=%d\n", | "%s: (q%d) cidx_processed=%u cur=%u clear=%d delta=%d\n", | ||||
__func__, txr->me, prev, cur, clear, delta); | __func__, txr->me, prev, cur, clear, delta); | ||||
#endif | #endif | ||||
processed += delta; | processed += delta; | ||||
prev = cur; | prev = cur; | ||||
rs_cidx = (rs_cidx + 1) & (ntxd-1); | rs_cidx = (rs_cidx + 1) & (ntxd-1); | ||||
▲ Show 20 Lines • Show All 252 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
if_softc_ctx_t scctx = vsi->shared; | if_softc_ctx_t scctx = vsi->shared; | ||||
struct ixl_tx_queue *tx_que; | struct ixl_tx_queue *tx_que; | ||||
int i, j; | int i, j; | ||||
for (i = 0, tx_que = vsi->tx_queues; i < vsi->num_tx_queues; i++, tx_que++) { | for (i = 0, tx_que = vsi->tx_queues; i < vsi->num_tx_queues; i++, tx_que++) { | ||||
struct tx_ring *txr = &tx_que->txr; | struct tx_ring *txr = &tx_que->txr; | ||||
txr->tx_rs_cidx = txr->tx_rs_pidx = txr->tx_cidx_processed = 0; | txr->tx_rs_cidx = txr->tx_rs_pidx; | ||||
/* Initialize the last processed descriptor to be the end of | |||||
* the ring, rather than the start, so that we avoid an | |||||
* off-by-one error when calculating how many descriptors are | |||||
* done in the credits_update function. | |||||
*/ | |||||
txr->tx_cidx_processed = scctx->isc_ntxd[0] - 1; | |||||
for (j = 0; j < scctx->isc_ntxd[0]; j++) | for (j = 0; j < scctx->isc_ntxd[0]; j++) | ||||
txr->tx_rsq[j] = QIDX_INVALID; | txr->tx_rsq[j] = QIDX_INVALID; | ||||
} | } | ||||
} | } | ||||
void | void | ||||
ixl_init_tx_cidx(struct ixl_vsi *vsi) | ixl_init_tx_cidx(struct ixl_vsi *vsi) | ||||
{ | { | ||||
if_softc_ctx_t scctx = vsi->shared; | |||||
struct ixl_tx_queue *tx_que; | struct ixl_tx_queue *tx_que; | ||||
int i; | int i; | ||||
for (i = 0, tx_que = vsi->tx_queues; i < vsi->num_tx_queues; i++, tx_que++) { | for (i = 0, tx_que = vsi->tx_queues; i < vsi->num_tx_queues; i++, tx_que++) { | ||||
struct tx_ring *txr = &tx_que->txr; | struct tx_ring *txr = &tx_que->txr; | ||||
txr->tx_cidx_processed = 0; | txr->tx_cidx_processed = scctx->isc_ntxd[0] - 1; | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* Input: bitmap of enum virtchnl_link_speed | * Input: bitmap of enum virtchnl_link_speed | ||||
*/ | */ | ||||
u64 | u64 | ||||
ixl_max_vc_speed_to_value(u8 link_speeds) | ixl_max_vc_speed_to_value(u8 link_speeds) | ||||
▲ Show 20 Lines • Show All 140 Lines • Show Last 20 Lines |