Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/cxgbe/t4_sge.c
Show All 12 Lines | |||||
void | void | ||||
t4_sge_sysctls(struct adapter *sc, struct sysctl_ctx_list *ctx, | t4_sge_sysctls(struct adapter *sc, struct sysctl_ctx_list *ctx, | ||||
struct sysctl_oid_list *children) | struct sysctl_oid_list *children) | ||||
{ | { | ||||
struct sge_params *sp = &sc->params.sge; | struct sge_params *sp = &sc->params.sge; | ||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "buffer_sizes", | SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "buffer_sizes", | ||||
CTLTYPE_STRING | CTLFLAG_RD, sc, 0, sysctl_bufsizes, "A", | CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, 0, | ||||
"freelist buffer sizes"); | sysctl_bufsizes, "A", "freelist buffer sizes"); | ||||
SYSCTL_ADD_INT(ctx, children, OID_AUTO, "fl_pktshift", CTLFLAG_RD, | SYSCTL_ADD_INT(ctx, children, OID_AUTO, "fl_pktshift", CTLFLAG_RD, | ||||
NULL, sp->fl_pktshift, "payload DMA offset in rx buffer (bytes)"); | NULL, sp->fl_pktshift, "payload DMA offset in rx buffer (bytes)"); | ||||
SYSCTL_ADD_INT(ctx, children, OID_AUTO, "fl_pad", CTLFLAG_RD, | SYSCTL_ADD_INT(ctx, children, OID_AUTO, "fl_pad", CTLFLAG_RD, | ||||
NULL, sp->pad_boundary, "payload pad boundary (bytes)"); | NULL, sp->pad_boundary, "payload pad boundary (bytes)"); | ||||
SYSCTL_ADD_INT(ctx, children, OID_AUTO, "spg_len", CTLFLAG_RD, | SYSCTL_ADD_INT(ctx, children, OID_AUTO, "spg_len", CTLFLAG_RD, | ||||
Show All 24 Lines | |||||
/* | /* | ||||
* XXX: General purpose rx queues, one per port. | * XXX: General purpose rx queues, one per port. | ||||
*/ | */ | ||||
/* | /* | ||||
* Control queues, one per port. | * Control queues, one per port. | ||||
*/ | */ | ||||
oid = SYSCTL_ADD_NODE(&sc->ctx, children, OID_AUTO, "ctrlq", | oid = SYSCTL_ADD_NODE(&sc->ctx, children, OID_AUTO, "ctrlq", | ||||
CTLFLAG_RD, NULL, "control queues"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "control queues"); | ||||
for_each_port(sc, i) { | for_each_port(sc, i) { | ||||
struct sge_wrq *ctrlq = &sc->sge.ctrlq[i]; | struct sge_wrq *ctrlq = &sc->sge.ctrlq[i]; | ||||
rc = alloc_ctrlq(sc, ctrlq, i, oid); | rc = alloc_ctrlq(sc, ctrlq, i, oid); | ||||
if (rc != 0) | if (rc != 0) | ||||
return (rc); | return (rc); | ||||
} | } | ||||
Show All 24 Lines | |||||
MPASS(!forwarding_intr_to_fwq(sc)); | MPASS(!forwarding_intr_to_fwq(sc)); | ||||
/* | /* | ||||
* We don't have buffers to back the netmap rx queues | * We don't have buffers to back the netmap rx queues | ||||
* right now so we create the queues in a way that | * right now so we create the queues in a way that | ||||
* doesn't set off any congestion signal in the chip. | * doesn't set off any congestion signal in the chip. | ||||
*/ | */ | ||||
oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, "nm_rxq", | oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, "nm_rxq", | ||||
CTLFLAG_RD, NULL, "rx queues"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "rx queues"); | ||||
for_each_nm_rxq(vi, i, nm_rxq) { | for_each_nm_rxq(vi, i, nm_rxq) { | ||||
rc = alloc_nm_rxq(vi, nm_rxq, intr_idx, i, oid); | rc = alloc_nm_rxq(vi, nm_rxq, intr_idx, i, oid); | ||||
if (rc != 0) | if (rc != 0) | ||||
goto done; | goto done; | ||||
intr_idx++; | intr_idx++; | ||||
} | } | ||||
oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, "nm_txq", | oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, "nm_txq", | ||||
CTLFLAG_RD, NULL, "tx queues"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "tx queues"); | ||||
for_each_nm_txq(vi, i, nm_txq) { | for_each_nm_txq(vi, i, nm_txq) { | ||||
iqidx = vi->first_nm_rxq + (i % vi->nnmrxq); | iqidx = vi->first_nm_rxq + (i % vi->nnmrxq); | ||||
rc = alloc_nm_txq(vi, nm_txq, iqidx, i, oid); | rc = alloc_nm_txq(vi, nm_txq, iqidx, i, oid); | ||||
if (rc != 0) | if (rc != 0) | ||||
goto done; | goto done; | ||||
} | } | ||||
} | } | ||||
/* Normal rx queues and netmap rx queues share the same interrupts. */ | /* Normal rx queues and netmap rx queues share the same interrupts. */ | ||||
intr_idx = saved_idx; | intr_idx = saved_idx; | ||||
#endif | #endif | ||||
/* | /* | ||||
* Allocate rx queues first because a default iqid is required when | * Allocate rx queues first because a default iqid is required when | ||||
* creating a tx queue. | * creating a tx queue. | ||||
*/ | */ | ||||
maxp = mtu_to_max_payload(sc, mtu); | maxp = mtu_to_max_payload(sc, mtu); | ||||
oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, "rxq", | oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, "rxq", | ||||
CTLFLAG_RD, NULL, "rx queues"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "rx queues"); | ||||
for_each_rxq(vi, i, rxq) { | for_each_rxq(vi, i, rxq) { | ||||
init_iq(&rxq->iq, sc, vi->tmr_idx, vi->pktc_idx, vi->qsize_rxq); | init_iq(&rxq->iq, sc, vi->tmr_idx, vi->pktc_idx, vi->qsize_rxq); | ||||
snprintf(name, sizeof(name), "%s rxq%d-fl", | snprintf(name, sizeof(name), "%s rxq%d-fl", | ||||
device_get_nameunit(vi->dev), i); | device_get_nameunit(vi->dev), i); | ||||
init_fl(sc, &rxq->fl, vi->qsize_rxq / 8, maxp, name); | init_fl(sc, &rxq->fl, vi->qsize_rxq / 8, maxp, name); | ||||
rc = alloc_rxq(vi, rxq, | rc = alloc_rxq(vi, rxq, | ||||
forwarding_intr_to_fwq(sc) ? -1 : intr_idx, i, oid); | forwarding_intr_to_fwq(sc) ? -1 : intr_idx, i, oid); | ||||
if (rc != 0) | if (rc != 0) | ||||
goto done; | goto done; | ||||
intr_idx++; | intr_idx++; | ||||
} | } | ||||
#ifdef DEV_NETMAP | #ifdef DEV_NETMAP | ||||
if (ifp->if_capabilities & IFCAP_NETMAP) | if (ifp->if_capabilities & IFCAP_NETMAP) | ||||
intr_idx = saved_idx + max(vi->nrxq, vi->nnmrxq); | intr_idx = saved_idx + max(vi->nrxq, vi->nnmrxq); | ||||
#endif | #endif | ||||
#ifdef TCP_OFFLOAD | #ifdef TCP_OFFLOAD | ||||
oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, "ofld_rxq", | oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, "ofld_rxq", | ||||
CTLFLAG_RD, NULL, "rx queues for offloaded TCP connections"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "rx queues for offloaded TCP connections"); | ||||
for_each_ofld_rxq(vi, i, ofld_rxq) { | for_each_ofld_rxq(vi, i, ofld_rxq) { | ||||
init_iq(&ofld_rxq->iq, sc, vi->ofld_tmr_idx, vi->ofld_pktc_idx, | init_iq(&ofld_rxq->iq, sc, vi->ofld_tmr_idx, vi->ofld_pktc_idx, | ||||
vi->qsize_rxq); | vi->qsize_rxq); | ||||
snprintf(name, sizeof(name), "%s ofld_rxq%d-fl", | snprintf(name, sizeof(name), "%s ofld_rxq%d-fl", | ||||
device_get_nameunit(vi->dev), i); | device_get_nameunit(vi->dev), i); | ||||
init_fl(sc, &ofld_rxq->fl, vi->qsize_rxq / 8, maxp, name); | init_fl(sc, &ofld_rxq->fl, vi->qsize_rxq / 8, maxp, name); | ||||
rc = alloc_ofld_rxq(vi, ofld_rxq, | rc = alloc_ofld_rxq(vi, ofld_rxq, | ||||
forwarding_intr_to_fwq(sc) ? -1 : intr_idx, i, oid); | forwarding_intr_to_fwq(sc) ? -1 : intr_idx, i, oid); | ||||
if (rc != 0) | if (rc != 0) | ||||
goto done; | goto done; | ||||
intr_idx++; | intr_idx++; | ||||
} | } | ||||
#endif | #endif | ||||
/* | /* | ||||
* Now the tx queues. | * Now the tx queues. | ||||
*/ | */ | ||||
oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, "txq", CTLFLAG_RD, | oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, "txq", | ||||
NULL, "tx queues"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "tx queues"); | ||||
for_each_txq(vi, i, txq) { | for_each_txq(vi, i, txq) { | ||||
iqidx = vi->first_rxq + (i % vi->nrxq); | iqidx = vi->first_rxq + (i % vi->nrxq); | ||||
snprintf(name, sizeof(name), "%s txq%d", | snprintf(name, sizeof(name), "%s txq%d", | ||||
device_get_nameunit(vi->dev), i); | device_get_nameunit(vi->dev), i); | ||||
init_eq(sc, &txq->eq, EQ_ETH, vi->qsize_txq, pi->tx_chan, | init_eq(sc, &txq->eq, EQ_ETH, vi->qsize_txq, pi->tx_chan, | ||||
sc->sge.rxq[iqidx].iq.cntxt_id, name); | sc->sge.rxq[iqidx].iq.cntxt_id, name); | ||||
rc = alloc_txq(vi, txq, i, oid); | rc = alloc_txq(vi, txq, i, oid); | ||||
if (rc != 0) | if (rc != 0) | ||||
goto done; | goto done; | ||||
} | } | ||||
#if defined(TCP_OFFLOAD) || defined(RATELIMIT) | #if defined(TCP_OFFLOAD) || defined(RATELIMIT) | ||||
oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, "ofld_txq", | oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, "ofld_txq", | ||||
CTLFLAG_RD, NULL, "tx queues for TOE/ETHOFLD"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "tx queues for TOE/ETHOFLD"); | ||||
for_each_ofld_txq(vi, i, ofld_txq) { | for_each_ofld_txq(vi, i, ofld_txq) { | ||||
struct sysctl_oid *oid2; | struct sysctl_oid *oid2; | ||||
snprintf(name, sizeof(name), "%s ofld_txq%d", | snprintf(name, sizeof(name), "%s ofld_txq%d", | ||||
device_get_nameunit(vi->dev), i); | device_get_nameunit(vi->dev), i); | ||||
if (vi->nofldrxq > 0) { | if (vi->nofldrxq > 0) { | ||||
iqidx = vi->first_ofld_rxq + (i % vi->nofldrxq); | iqidx = vi->first_ofld_rxq + (i % vi->nofldrxq); | ||||
init_eq(sc, &ofld_txq->eq, EQ_OFLD, vi->qsize_txq, | init_eq(sc, &ofld_txq->eq, EQ_OFLD, vi->qsize_txq, | ||||
pi->tx_chan, sc->sge.ofld_rxq[iqidx].iq.cntxt_id, | pi->tx_chan, sc->sge.ofld_rxq[iqidx].iq.cntxt_id, | ||||
name); | name); | ||||
} else { | } else { | ||||
iqidx = vi->first_rxq + (i % vi->nrxq); | iqidx = vi->first_rxq + (i % vi->nrxq); | ||||
init_eq(sc, &ofld_txq->eq, EQ_OFLD, vi->qsize_txq, | init_eq(sc, &ofld_txq->eq, EQ_OFLD, vi->qsize_txq, | ||||
pi->tx_chan, sc->sge.rxq[iqidx].iq.cntxt_id, name); | pi->tx_chan, sc->sge.rxq[iqidx].iq.cntxt_id, name); | ||||
} | } | ||||
snprintf(name, sizeof(name), "%d", i); | snprintf(name, sizeof(name), "%d", i); | ||||
oid2 = SYSCTL_ADD_NODE(&vi->ctx, SYSCTL_CHILDREN(oid), OID_AUTO, | oid2 = SYSCTL_ADD_NODE(&vi->ctx, SYSCTL_CHILDREN(oid), OID_AUTO, | ||||
name, CTLFLAG_RD, NULL, "offload tx queue"); | name, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "offload tx queue"); | ||||
rc = alloc_wrq(sc, vi, ofld_txq, oid2); | rc = alloc_wrq(sc, vi, ofld_txq, oid2); | ||||
if (rc != 0) | if (rc != 0) | ||||
goto done; | goto done; | ||||
} | } | ||||
#endif | #endif | ||||
done: | done: | ||||
if (rc) | if (rc) | ||||
Show All 24 Lines | |||||
{ | { | ||||
struct sysctl_oid_list *children = SYSCTL_CHILDREN(oid); | struct sysctl_oid_list *children = SYSCTL_CHILDREN(oid); | ||||
SYSCTL_ADD_UAUTO(ctx, children, OID_AUTO, "ba", CTLFLAG_RD, &iq->ba, | SYSCTL_ADD_UAUTO(ctx, children, OID_AUTO, "ba", CTLFLAG_RD, &iq->ba, | ||||
"bus address of descriptor ring"); | "bus address of descriptor ring"); | ||||
SYSCTL_ADD_INT(ctx, children, OID_AUTO, "dmalen", CTLFLAG_RD, NULL, | SYSCTL_ADD_INT(ctx, children, OID_AUTO, "dmalen", CTLFLAG_RD, NULL, | ||||
iq->qsize * IQ_ESIZE, "descriptor ring size in bytes"); | iq->qsize * IQ_ESIZE, "descriptor ring size in bytes"); | ||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "abs_id", | SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "abs_id", | ||||
CTLTYPE_INT | CTLFLAG_RD, &iq->abs_id, 0, sysctl_uint16, "I", | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, &iq->abs_id, 0, | ||||
"absolute id of the queue"); | sysctl_uint16, "I", "absolute id of the queue"); | ||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", | SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", | ||||
CTLTYPE_INT | CTLFLAG_RD, &iq->cntxt_id, 0, sysctl_uint16, "I", | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, &iq->cntxt_id, 0, | ||||
"SGE context id of the queue"); | sysctl_uint16, "I", "SGE context id of the queue"); | ||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cidx", | SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cidx", | ||||
CTLTYPE_INT | CTLFLAG_RD, &iq->cidx, 0, sysctl_uint16, "I", | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, &iq->cidx, 0, | ||||
"consumer index"); | sysctl_uint16, "I", "consumer index"); | ||||
} | } | ||||
static void | static void | ||||
add_fl_sysctls(struct adapter *sc, struct sysctl_ctx_list *ctx, | add_fl_sysctls(struct adapter *sc, struct sysctl_ctx_list *ctx, | ||||
struct sysctl_oid *oid, struct sge_fl *fl) | struct sysctl_oid *oid, struct sge_fl *fl) | ||||
{ | { | ||||
struct sysctl_oid_list *children = SYSCTL_CHILDREN(oid); | struct sysctl_oid_list *children = SYSCTL_CHILDREN(oid); | ||||
oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "fl", CTLFLAG_RD, NULL, | oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "fl", | ||||
"freelist"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "freelist"); | ||||
children = SYSCTL_CHILDREN(oid); | children = SYSCTL_CHILDREN(oid); | ||||
SYSCTL_ADD_UAUTO(ctx, children, OID_AUTO, "ba", CTLFLAG_RD, | SYSCTL_ADD_UAUTO(ctx, children, OID_AUTO, "ba", CTLFLAG_RD, | ||||
&fl->ba, "bus address of descriptor ring"); | &fl->ba, "bus address of descriptor ring"); | ||||
SYSCTL_ADD_INT(ctx, children, OID_AUTO, "dmalen", CTLFLAG_RD, NULL, | SYSCTL_ADD_INT(ctx, children, OID_AUTO, "dmalen", CTLFLAG_RD, NULL, | ||||
fl->sidx * EQ_ESIZE + sc->params.sge.spg_len, | fl->sidx * EQ_ESIZE + sc->params.sge.spg_len, | ||||
"desc ring size in bytes"); | "desc ring size in bytes"); | ||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", | SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", | ||||
CTLTYPE_INT | CTLFLAG_RD, &fl->cntxt_id, 0, sysctl_uint16, "I", | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, &fl->cntxt_id, 0, | ||||
"SGE context id of the freelist"); | sysctl_uint16, "I", "SGE context id of the freelist"); | ||||
SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "padding", CTLFLAG_RD, NULL, | SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "padding", CTLFLAG_RD, NULL, | ||||
fl_pad ? 1 : 0, "padding enabled"); | fl_pad ? 1 : 0, "padding enabled"); | ||||
SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "packing", CTLFLAG_RD, NULL, | SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "packing", CTLFLAG_RD, NULL, | ||||
fl->flags & FL_BUF_PACKING ? 1 : 0, "packing enabled"); | fl->flags & FL_BUF_PACKING ? 1 : 0, "packing enabled"); | ||||
SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "cidx", CTLFLAG_RD, &fl->cidx, | SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "cidx", CTLFLAG_RD, &fl->cidx, | ||||
0, "consumer index"); | 0, "consumer index"); | ||||
if (fl->flags & FL_BUF_PACKING) { | if (fl->flags & FL_BUF_PACKING) { | ||||
SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "rx_offset", | SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "rx_offset", | ||||
Show All 24 Lines | |||||
intr_idx = sc->intr_count > 1 ? 1 : 0; | intr_idx = sc->intr_count > 1 ? 1 : 0; | ||||
rc = alloc_iq_fl(&sc->port[0]->vi[0], fwq, NULL, intr_idx, -1); | rc = alloc_iq_fl(&sc->port[0]->vi[0], fwq, NULL, intr_idx, -1); | ||||
if (rc != 0) { | if (rc != 0) { | ||||
device_printf(sc->dev, | device_printf(sc->dev, | ||||
"failed to create firmware event queue: %d\n", rc); | "failed to create firmware event queue: %d\n", rc); | ||||
return (rc); | return (rc); | ||||
} | } | ||||
oid = SYSCTL_ADD_NODE(&sc->ctx, children, OID_AUTO, "fwq", CTLFLAG_RD, | oid = SYSCTL_ADD_NODE(&sc->ctx, children, OID_AUTO, "fwq", | ||||
NULL, "firmware event queue"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "firmware event queue"); | ||||
add_iq_sysctls(&sc->ctx, oid, fwq); | add_iq_sysctls(&sc->ctx, oid, fwq); | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
free_fwq(struct adapter *sc) | free_fwq(struct adapter *sc) | ||||
{ | { | ||||
Show All 10 Lines | |||||
snprintf(name, sizeof(name), "%s ctrlq%d", device_get_nameunit(sc->dev), | snprintf(name, sizeof(name), "%s ctrlq%d", device_get_nameunit(sc->dev), | ||||
idx); | idx); | ||||
init_eq(sc, &ctrlq->eq, EQ_CTRL, CTRL_EQ_QSIZE, sc->port[idx]->tx_chan, | init_eq(sc, &ctrlq->eq, EQ_CTRL, CTRL_EQ_QSIZE, sc->port[idx]->tx_chan, | ||||
sc->sge.fwq.cntxt_id, name); | sc->sge.fwq.cntxt_id, name); | ||||
children = SYSCTL_CHILDREN(oid); | children = SYSCTL_CHILDREN(oid); | ||||
snprintf(name, sizeof(name), "%d", idx); | snprintf(name, sizeof(name), "%d", idx); | ||||
oid = SYSCTL_ADD_NODE(&sc->ctx, children, OID_AUTO, name, CTLFLAG_RD, | oid = SYSCTL_ADD_NODE(&sc->ctx, children, OID_AUTO, name, | ||||
NULL, "ctrl queue"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "ctrl queue"); | ||||
rc = alloc_wrq(sc, NULL, ctrlq, oid); | rc = alloc_wrq(sc, NULL, ctrlq, oid); | ||||
return (rc); | return (rc); | ||||
} | } | ||||
int | int | ||||
tnl_cong(struct port_info *pi, int drop) | tnl_cong(struct port_info *pi, int drop) | ||||
{ | { | ||||
Show All 24 Lines | |||||
#endif | #endif | ||||
if (vi->ifp->if_capenable & IFCAP_HWRXTSTMP) | if (vi->ifp->if_capenable & IFCAP_HWRXTSTMP) | ||||
rxq->iq.flags |= IQ_RX_TIMESTAMP; | rxq->iq.flags |= IQ_RX_TIMESTAMP; | ||||
rxq->ifp = vi->ifp; | rxq->ifp = vi->ifp; | ||||
children = SYSCTL_CHILDREN(oid); | children = SYSCTL_CHILDREN(oid); | ||||
snprintf(name, sizeof(name), "%d", idx); | snprintf(name, sizeof(name), "%d", idx); | ||||
oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, name, CTLFLAG_RD, | oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, name, | ||||
NULL, "rx queue"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "rx queue"); | ||||
children = SYSCTL_CHILDREN(oid); | children = SYSCTL_CHILDREN(oid); | ||||
add_iq_sysctls(&vi->ctx, oid, &rxq->iq); | add_iq_sysctls(&vi->ctx, oid, &rxq->iq); | ||||
#if defined(INET) || defined(INET6) | #if defined(INET) || defined(INET6) | ||||
SYSCTL_ADD_U64(&vi->ctx, children, OID_AUTO, "lro_queued", CTLFLAG_RD, | SYSCTL_ADD_U64(&vi->ctx, children, OID_AUTO, "lro_queued", CTLFLAG_RD, | ||||
&rxq->lro.lro_queued, 0, NULL); | &rxq->lro.lro_queued, 0, NULL); | ||||
SYSCTL_ADD_U64(&vi->ctx, children, OID_AUTO, "lro_flushed", CTLFLAG_RD, | SYSCTL_ADD_U64(&vi->ctx, children, OID_AUTO, "lro_flushed", CTLFLAG_RD, | ||||
&rxq->lro.lro_flushed, 0, NULL); | &rxq->lro.lro_flushed, 0, NULL); | ||||
Show All 24 Lines | |||||
rc = alloc_iq_fl(vi, &ofld_rxq->iq, &ofld_rxq->fl, intr_idx, 0); | rc = alloc_iq_fl(vi, &ofld_rxq->iq, &ofld_rxq->fl, intr_idx, 0); | ||||
if (rc != 0) | if (rc != 0) | ||||
return (rc); | return (rc); | ||||
children = SYSCTL_CHILDREN(oid); | children = SYSCTL_CHILDREN(oid); | ||||
snprintf(name, sizeof(name), "%d", idx); | snprintf(name, sizeof(name), "%d", idx); | ||||
oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, name, CTLFLAG_RD, | oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, name, | ||||
NULL, "rx queue"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "rx queue"); | ||||
add_iq_sysctls(&vi->ctx, oid, &ofld_rxq->iq); | add_iq_sysctls(&vi->ctx, oid, &ofld_rxq->iq); | ||||
add_fl_sysctls(pi->adapter, &vi->ctx, oid, &ofld_rxq->fl); | add_fl_sysctls(pi->adapter, &vi->ctx, oid, &ofld_rxq->fl); | ||||
return (rc); | return (rc); | ||||
} | } | ||||
static int | static int | ||||
free_ofld_rxq(struct vi_info *vi, struct sge_ofld_rxq *ofld_rxq) | free_ofld_rxq(struct vi_info *vi, struct sge_ofld_rxq *ofld_rxq) | ||||
Show All 24 Lines | |||||
nm_rxq->fl_sidx = na->num_rx_desc; | nm_rxq->fl_sidx = na->num_rx_desc; | ||||
nm_rxq->intr_idx = intr_idx; | nm_rxq->intr_idx = intr_idx; | ||||
nm_rxq->iq_cntxt_id = INVALID_NM_RXQ_CNTXT_ID; | nm_rxq->iq_cntxt_id = INVALID_NM_RXQ_CNTXT_ID; | ||||
ctx = &vi->ctx; | ctx = &vi->ctx; | ||||
children = SYSCTL_CHILDREN(oid); | children = SYSCTL_CHILDREN(oid); | ||||
snprintf(name, sizeof(name), "%d", idx); | snprintf(name, sizeof(name), "%d", idx); | ||||
oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, name, CTLFLAG_RD, NULL, | oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, name, | ||||
"rx queue"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "rx queue"); | ||||
children = SYSCTL_CHILDREN(oid); | children = SYSCTL_CHILDREN(oid); | ||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "abs_id", | SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "abs_id", | ||||
CTLTYPE_INT | CTLFLAG_RD, &nm_rxq->iq_abs_id, 0, sysctl_uint16, | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, &nm_rxq->iq_abs_id, | ||||
"I", "absolute id of the queue"); | 0, sysctl_uint16, "I", "absolute id of the queue"); | ||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", | SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", | ||||
CTLTYPE_INT | CTLFLAG_RD, &nm_rxq->iq_cntxt_id, 0, sysctl_uint16, | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, &nm_rxq->iq_cntxt_id, | ||||
"I", "SGE context id of the queue"); | 0, sysctl_uint16, "I", "SGE context id of the queue"); | ||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cidx", | SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cidx", | ||||
CTLTYPE_INT | CTLFLAG_RD, &nm_rxq->iq_cidx, 0, sysctl_uint16, "I", | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, &nm_rxq->iq_cidx, 0, | ||||
"consumer index"); | sysctl_uint16, "I", "consumer index"); | ||||
children = SYSCTL_CHILDREN(oid); | children = SYSCTL_CHILDREN(oid); | ||||
oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "fl", CTLFLAG_RD, NULL, | oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "fl", | ||||
"freelist"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "freelist"); | ||||
children = SYSCTL_CHILDREN(oid); | children = SYSCTL_CHILDREN(oid); | ||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", | SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", | ||||
CTLTYPE_INT | CTLFLAG_RD, &nm_rxq->fl_cntxt_id, 0, sysctl_uint16, | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, &nm_rxq->fl_cntxt_id, | ||||
"I", "SGE context id of the freelist"); | 0, sysctl_uint16, "I", "SGE context id of the freelist"); | ||||
SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "cidx", CTLFLAG_RD, | SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "cidx", CTLFLAG_RD, | ||||
&nm_rxq->fl_cidx, 0, "consumer index"); | &nm_rxq->fl_cidx, 0, "consumer index"); | ||||
SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "pidx", CTLFLAG_RD, | SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "pidx", CTLFLAG_RD, | ||||
&nm_rxq->fl_pidx, 0, "producer index"); | &nm_rxq->fl_pidx, 0, "producer index"); | ||||
return (rc); | return (rc); | ||||
} | } | ||||
Show All 24 Lines | |||||
V_TXPKT_VF(vi->vin) | V_TXPKT_VF_VLD(vi->vfvld)); | V_TXPKT_VF(vi->vin) | V_TXPKT_VF_VLD(vi->vfvld)); | ||||
if (sc->params.fw_vers >= FW_VERSION32(1, 24, 11, 0)) | if (sc->params.fw_vers >= FW_VERSION32(1, 24, 11, 0)) | ||||
nm_txq->op_pkd = htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS2_WR)); | nm_txq->op_pkd = htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS2_WR)); | ||||
else | else | ||||
nm_txq->op_pkd = htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS_WR)); | nm_txq->op_pkd = htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS_WR)); | ||||
nm_txq->cntxt_id = INVALID_NM_TXQ_CNTXT_ID; | nm_txq->cntxt_id = INVALID_NM_TXQ_CNTXT_ID; | ||||
snprintf(name, sizeof(name), "%d", idx); | snprintf(name, sizeof(name), "%d", idx); | ||||
oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, name, CTLFLAG_RD, | oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, name, | ||||
NULL, "netmap tx queue"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "netmap tx queue"); | ||||
children = SYSCTL_CHILDREN(oid); | children = SYSCTL_CHILDREN(oid); | ||||
SYSCTL_ADD_UINT(&vi->ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, | SYSCTL_ADD_UINT(&vi->ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, | ||||
&nm_txq->cntxt_id, 0, "SGE context id of the queue"); | &nm_txq->cntxt_id, 0, "SGE context id of the queue"); | ||||
SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "cidx", | SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "cidx", | ||||
CTLTYPE_INT | CTLFLAG_RD, &nm_txq->cidx, 0, sysctl_uint16, "I", | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, &nm_txq->cidx, 0, | ||||
"consumer index"); | sysctl_uint16, "I", "consumer index"); | ||||
SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "pidx", | SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "pidx", | ||||
CTLTYPE_INT | CTLFLAG_RD, &nm_txq->pidx, 0, sysctl_uint16, "I", | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, &nm_txq->pidx, 0, | ||||
"producer index"); | sysctl_uint16, "I", "producer index"); | ||||
return (rc); | return (rc); | ||||
} | } | ||||
static int | static int | ||||
free_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm_txq) | free_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm_txq) | ||||
{ | { | ||||
struct adapter *sc = vi->pi->adapter; | struct adapter *sc = vi->pi->adapter; | ||||
Show All 24 Lines | |||||
SYSCTL_ADD_UAUTO(ctx, children, OID_AUTO, "ba", CTLFLAG_RD, | SYSCTL_ADD_UAUTO(ctx, children, OID_AUTO, "ba", CTLFLAG_RD, | ||||
&wrq->eq.ba, "bus address of descriptor ring"); | &wrq->eq.ba, "bus address of descriptor ring"); | ||||
SYSCTL_ADD_INT(ctx, children, OID_AUTO, "dmalen", CTLFLAG_RD, NULL, | SYSCTL_ADD_INT(ctx, children, OID_AUTO, "dmalen", CTLFLAG_RD, NULL, | ||||
wrq->eq.sidx * EQ_ESIZE + sc->params.sge.spg_len, | wrq->eq.sidx * EQ_ESIZE + sc->params.sge.spg_len, | ||||
"desc ring size in bytes"); | "desc ring size in bytes"); | ||||
SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, | SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, | ||||
&wrq->eq.cntxt_id, 0, "SGE context id of the queue"); | &wrq->eq.cntxt_id, 0, "SGE context id of the queue"); | ||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cidx", | SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cidx", | ||||
CTLTYPE_INT | CTLFLAG_RD, &wrq->eq.cidx, 0, sysctl_uint16, "I", | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, &wrq->eq.cidx, 0, | ||||
"consumer index"); | sysctl_uint16, "I", "consumer index"); | ||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "pidx", | SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "pidx", | ||||
CTLTYPE_INT | CTLFLAG_RD, &wrq->eq.pidx, 0, sysctl_uint16, "I", | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, &wrq->eq.pidx, 0, | ||||
"producer index"); | sysctl_uint16, "I", "producer index"); | ||||
SYSCTL_ADD_INT(ctx, children, OID_AUTO, "sidx", CTLFLAG_RD, NULL, | SYSCTL_ADD_INT(ctx, children, OID_AUTO, "sidx", CTLFLAG_RD, NULL, | ||||
wrq->eq.sidx, "status page index"); | wrq->eq.sidx, "status page index"); | ||||
SYSCTL_ADD_UQUAD(ctx, children, OID_AUTO, "tx_wrs_direct", CTLFLAG_RD, | SYSCTL_ADD_UQUAD(ctx, children, OID_AUTO, "tx_wrs_direct", CTLFLAG_RD, | ||||
&wrq->tx_wrs_direct, "# of work requests (direct)"); | &wrq->tx_wrs_direct, "# of work requests (direct)"); | ||||
SYSCTL_ADD_UQUAD(ctx, children, OID_AUTO, "tx_wrs_copied", CTLFLAG_RD, | SYSCTL_ADD_UQUAD(ctx, children, OID_AUTO, "tx_wrs_copied", CTLFLAG_RD, | ||||
&wrq->tx_wrs_copied, "# of work requests (copied)"); | &wrq->tx_wrs_copied, "# of work requests (copied)"); | ||||
SYSCTL_ADD_UQUAD(ctx, children, OID_AUTO, "tx_wrs_sspace", CTLFLAG_RD, | SYSCTL_ADD_UQUAD(ctx, children, OID_AUTO, "tx_wrs_sspace", CTLFLAG_RD, | ||||
&wrq->tx_wrs_ss, "# of work requests (copied from scratch space)"); | &wrq->tx_wrs_ss, "# of work requests (copied from scratch space)"); | ||||
Show All 24 Lines | |||||
txq->cpl_ctrl0 = htobe32(V_TXPKT_OPCODE(CPL_TX_PKT_XT) | | txq->cpl_ctrl0 = htobe32(V_TXPKT_OPCODE(CPL_TX_PKT_XT) | | ||||
V_TXPKT_INTF(pi->tx_chan) | V_TXPKT_PF(sc->pf) | | V_TXPKT_INTF(pi->tx_chan) | V_TXPKT_PF(sc->pf) | | ||||
V_TXPKT_VF(vi->vin) | V_TXPKT_VF_VLD(vi->vfvld)); | V_TXPKT_VF(vi->vin) | V_TXPKT_VF_VLD(vi->vfvld)); | ||||
txq->tc_idx = -1; | txq->tc_idx = -1; | ||||
txq->sdesc = malloc(eq->sidx * sizeof(struct tx_sdesc), M_CXGBE, | txq->sdesc = malloc(eq->sidx * sizeof(struct tx_sdesc), M_CXGBE, | ||||
M_ZERO | M_WAITOK); | M_ZERO | M_WAITOK); | ||||
snprintf(name, sizeof(name), "%d", idx); | snprintf(name, sizeof(name), "%d", idx); | ||||
oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, name, CTLFLAG_RD, | oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, name, | ||||
NULL, "tx queue"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "tx queue"); | ||||
children = SYSCTL_CHILDREN(oid); | children = SYSCTL_CHILDREN(oid); | ||||
SYSCTL_ADD_UAUTO(&vi->ctx, children, OID_AUTO, "ba", CTLFLAG_RD, | SYSCTL_ADD_UAUTO(&vi->ctx, children, OID_AUTO, "ba", CTLFLAG_RD, | ||||
&eq->ba, "bus address of descriptor ring"); | &eq->ba, "bus address of descriptor ring"); | ||||
SYSCTL_ADD_INT(&vi->ctx, children, OID_AUTO, "dmalen", CTLFLAG_RD, NULL, | SYSCTL_ADD_INT(&vi->ctx, children, OID_AUTO, "dmalen", CTLFLAG_RD, NULL, | ||||
eq->sidx * EQ_ESIZE + sc->params.sge.spg_len, | eq->sidx * EQ_ESIZE + sc->params.sge.spg_len, | ||||
"desc ring size in bytes"); | "desc ring size in bytes"); | ||||
SYSCTL_ADD_UINT(&vi->ctx, children, OID_AUTO, "abs_id", CTLFLAG_RD, | SYSCTL_ADD_UINT(&vi->ctx, children, OID_AUTO, "abs_id", CTLFLAG_RD, | ||||
&eq->abs_id, 0, "absolute id of the queue"); | &eq->abs_id, 0, "absolute id of the queue"); | ||||
SYSCTL_ADD_UINT(&vi->ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, | SYSCTL_ADD_UINT(&vi->ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, | ||||
&eq->cntxt_id, 0, "SGE context id of the queue"); | &eq->cntxt_id, 0, "SGE context id of the queue"); | ||||
SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "cidx", | SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "cidx", | ||||
CTLTYPE_INT | CTLFLAG_RD, &eq->cidx, 0, sysctl_uint16, "I", | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, &eq->cidx, 0, | ||||
"consumer index"); | sysctl_uint16, "I", "consumer index"); | ||||
SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "pidx", | SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "pidx", | ||||
CTLTYPE_INT | CTLFLAG_RD, &eq->pidx, 0, sysctl_uint16, "I", | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, &eq->pidx, 0, | ||||
"producer index"); | sysctl_uint16, "I", "producer index"); | ||||
SYSCTL_ADD_INT(&vi->ctx, children, OID_AUTO, "sidx", CTLFLAG_RD, NULL, | SYSCTL_ADD_INT(&vi->ctx, children, OID_AUTO, "sidx", CTLFLAG_RD, NULL, | ||||
eq->sidx, "status page index"); | eq->sidx, "status page index"); | ||||
SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "tc", | SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "tc", | ||||
CTLTYPE_INT | CTLFLAG_RW, vi, idx, sysctl_tc, "I", | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, vi, idx, sysctl_tc, | ||||
"traffic class (-1 means none)"); | "I", "traffic class (-1 means none)"); | ||||
SYSCTL_ADD_UQUAD(&vi->ctx, children, OID_AUTO, "txcsum", CTLFLAG_RD, | SYSCTL_ADD_UQUAD(&vi->ctx, children, OID_AUTO, "txcsum", CTLFLAG_RD, | ||||
&txq->txcsum, "# of times hardware assisted with checksum"); | &txq->txcsum, "# of times hardware assisted with checksum"); | ||||
SYSCTL_ADD_UQUAD(&vi->ctx, children, OID_AUTO, "vlan_insertion", | SYSCTL_ADD_UQUAD(&vi->ctx, children, OID_AUTO, "vlan_insertion", | ||||
CTLFLAG_RD, &txq->vlan_insertion, | CTLFLAG_RD, &txq->vlan_insertion, | ||||
"# of times hardware inserted 802.1Q tag"); | "# of times hardware inserted 802.1Q tag"); | ||||
SYSCTL_ADD_UQUAD(&vi->ctx, children, OID_AUTO, "tso_wrs", CTLFLAG_RD, | SYSCTL_ADD_UQUAD(&vi->ctx, children, OID_AUTO, "tso_wrs", CTLFLAG_RD, | ||||
&txq->tso_wrs, "# of TSO work requests"); | &txq->tso_wrs, "# of TSO work requests"); | ||||
Show All 12 Lines |