Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/cxgbe/t4_sge.c
Show First 20 Lines • Show All 1,026 Lines • ▼ Show 20 Lines | if (!(sc->flags & IS_VF)) { | ||||
for_each_port(sc, i) | for_each_port(sc, i) | ||||
free_wrq(sc, &sc->sge.ctrlq[i]); | free_wrq(sc, &sc->sge.ctrlq[i]); | ||||
} | } | ||||
free_fwq(sc); | free_fwq(sc); | ||||
return (0); | return (0); | ||||
} | } | ||||
/* Maximum payload that can be delivered with a single iq descriptor */ | /* Maximum payload that could arrive with a single iq descriptor. */ | ||||
static inline int | static inline int | ||||
mtu_to_max_payload(struct adapter *sc, int mtu) | max_rx_payload(struct adapter *sc, struct ifnet *ifp, const bool ofld) | ||||
{ | { | ||||
int maxp; | |||||
/* large enough even when hw VLAN extraction is disabled */ | /* large enough even when hw VLAN extraction is disabled */ | ||||
return (sc->params.sge.fl_pktshift + ETHER_HDR_LEN + | maxp = sc->params.sge.fl_pktshift + ETHER_HDR_LEN + | ||||
ETHER_VLAN_ENCAP_LEN + mtu); | ETHER_VLAN_ENCAP_LEN + ifp->if_mtu; | ||||
if (ofld && sc->tt.tls && sc->cryptocaps & FW_CAPS_CONFIG_TLSKEYS && | |||||
maxp < sc->params.tp.max_rx_pdu) | |||||
maxp = sc->params.tp.max_rx_pdu; | |||||
return (maxp); | |||||
} | } | ||||
int | int | ||||
t4_setup_vi_queues(struct vi_info *vi) | t4_setup_vi_queues(struct vi_info *vi) | ||||
{ | { | ||||
int rc = 0, i, intr_idx, iqidx; | int rc = 0, i, intr_idx, iqidx; | ||||
struct sge_rxq *rxq; | struct sge_rxq *rxq; | ||||
struct sge_txq *txq; | struct sge_txq *txq; | ||||
Show All 9 Lines | #ifdef DEV_NETMAP | ||||
struct sge_nm_txq *nm_txq; | struct sge_nm_txq *nm_txq; | ||||
#endif | #endif | ||||
char name[16]; | char name[16]; | ||||
struct port_info *pi = vi->pi; | struct port_info *pi = vi->pi; | ||||
struct adapter *sc = pi->adapter; | struct adapter *sc = pi->adapter; | ||||
struct ifnet *ifp = vi->ifp; | struct ifnet *ifp = vi->ifp; | ||||
struct sysctl_oid *oid = device_get_sysctl_tree(vi->dev); | struct sysctl_oid *oid = device_get_sysctl_tree(vi->dev); | ||||
struct sysctl_oid_list *children = SYSCTL_CHILDREN(oid); | struct sysctl_oid_list *children = SYSCTL_CHILDREN(oid); | ||||
int maxp, mtu = ifp->if_mtu; | int maxp; | ||||
/* Interrupt vector to start from (when using multiple vectors) */ | /* Interrupt vector to start from (when using multiple vectors) */ | ||||
intr_idx = vi->first_intr; | intr_idx = vi->first_intr; | ||||
#ifdef DEV_NETMAP | #ifdef DEV_NETMAP | ||||
saved_idx = intr_idx; | saved_idx = intr_idx; | ||||
if (ifp->if_capabilities & IFCAP_NETMAP) { | if (ifp->if_capabilities & IFCAP_NETMAP) { | ||||
Show All 27 Lines | #ifdef DEV_NETMAP | ||||
/* 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 = max_rx_payload(sc, ifp, false); | ||||
oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, "rxq", | oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, "rxq", | ||||
CTLFLAG_RD | CTLFLAG_MPSAFE, 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 | ||||
maxp = max_rx_payload(sc, ifp, true); | |||||
oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, "ofld_rxq", | oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, "ofld_rxq", | ||||
CTLFLAG_RD | CTLFLAG_MPSAFE, 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", | ||||
▲ Show 20 Lines • Show All 997 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
struct vi_info *vi = ifp->if_softc; | struct vi_info *vi = ifp->if_softc; | ||||
struct adapter *sc = vi->adapter; | struct adapter *sc = vi->adapter; | ||||
struct sge_rxq *rxq; | struct sge_rxq *rxq; | ||||
#ifdef TCP_OFFLOAD | #ifdef TCP_OFFLOAD | ||||
struct sge_ofld_rxq *ofld_rxq; | struct sge_ofld_rxq *ofld_rxq; | ||||
#endif | #endif | ||||
struct sge_fl *fl; | struct sge_fl *fl; | ||||
int i, maxp, mtu = ifp->if_mtu; | int i, maxp; | ||||
maxp = mtu_to_max_payload(sc, mtu); | maxp = max_rx_payload(sc, ifp, false); | ||||
for_each_rxq(vi, i, rxq) { | for_each_rxq(vi, i, rxq) { | ||||
fl = &rxq->fl; | fl = &rxq->fl; | ||||
FL_LOCK(fl); | FL_LOCK(fl); | ||||
fl->zidx = find_refill_source(sc, maxp, | fl->zidx = find_refill_source(sc, maxp, | ||||
fl->flags & FL_BUF_PACKING); | fl->flags & FL_BUF_PACKING); | ||||
FL_UNLOCK(fl); | FL_UNLOCK(fl); | ||||
} | } | ||||
#ifdef TCP_OFFLOAD | #ifdef TCP_OFFLOAD | ||||
maxp = max_rx_payload(sc, ifp, true); | |||||
for_each_ofld_rxq(vi, i, ofld_rxq) { | for_each_ofld_rxq(vi, i, ofld_rxq) { | ||||
fl = &ofld_rxq->fl; | fl = &ofld_rxq->fl; | ||||
FL_LOCK(fl); | FL_LOCK(fl); | ||||
fl->zidx = find_refill_source(sc, maxp, | fl->zidx = find_refill_source(sc, maxp, | ||||
fl->flags & FL_BUF_PACKING); | fl->flags & FL_BUF_PACKING); | ||||
FL_UNLOCK(fl); | FL_UNLOCK(fl); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 4,114 Lines • Show Last 20 Lines |