Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/cxgbe/t4_sge.c
Show First 20 Lines • Show All 2,143 Lines • ▼ Show 20 Lines | #endif | ||||
/* Doorbell must have caught up to the pidx. */ | /* Doorbell must have caught up to the pidx. */ | ||||
MPASS(eq->pidx == eq->dbidx); | MPASS(eq->pidx == eq->dbidx); | ||||
} | } | ||||
void | void | ||||
t4_update_fl_bufsize(struct ifnet *ifp) | t4_update_fl_bufsize(struct ifnet *ifp) | ||||
{ | { | ||||
struct vi_info *vi = ifp->if_softc; | struct vi_info *vi = ifp->if_softc; | ||||
struct adapter *sc = vi->pi->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, mtu = ifp->if_mtu; | ||||
maxp = mtu_to_max_payload(sc, mtu); | maxp = mtu_to_max_payload(sc, mtu); | ||||
▲ Show 20 Lines • Show All 715 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
static u_int | static u_int | ||||
eth_tx(struct mp_ring *r, u_int cidx, u_int pidx) | eth_tx(struct mp_ring *r, u_int cidx, u_int pidx) | ||||
{ | { | ||||
struct sge_txq *txq = r->cookie; | struct sge_txq *txq = r->cookie; | ||||
struct sge_eq *eq = &txq->eq; | struct sge_eq *eq = &txq->eq; | ||||
struct ifnet *ifp = txq->ifp; | struct ifnet *ifp = txq->ifp; | ||||
struct vi_info *vi = ifp->if_softc; | struct vi_info *vi = ifp->if_softc; | ||||
struct port_info *pi = vi->pi; | struct adapter *sc = vi->adapter; | ||||
struct adapter *sc = pi->adapter; | |||||
u_int total, remaining; /* # of packets */ | u_int total, remaining; /* # of packets */ | ||||
u_int available, dbdiff; /* # of hardware descriptors */ | u_int available, dbdiff; /* # of hardware descriptors */ | ||||
u_int n, next_cidx; | u_int n, next_cidx; | ||||
struct mbuf *m0, *tail; | struct mbuf *m0, *tail; | ||||
struct txpkts txp; | struct txpkts txp; | ||||
struct fw_eth_tx_pkts_wr *wr; /* any fw WR struct will do */ | struct fw_eth_tx_pkts_wr *wr; /* any fw WR struct will do */ | ||||
remaining = IDXDIFF(pidx, cidx, r->size); | remaining = IDXDIFF(pidx, cidx, r->size); | ||||
▲ Show 20 Lines • Show All 599 Lines • ▼ Show 20 Lines | else | ||||
return (pi->rx_e_chan_map); | return (pi->rx_e_chan_map); | ||||
} | } | ||||
static int | static int | ||||
alloc_rxq(struct vi_info *vi, struct sge_rxq *rxq, int intr_idx, int idx, | alloc_rxq(struct vi_info *vi, struct sge_rxq *rxq, int intr_idx, int idx, | ||||
struct sysctl_oid *oid) | struct sysctl_oid *oid) | ||||
{ | { | ||||
int rc; | int rc; | ||||
struct adapter *sc = vi->pi->adapter; | struct adapter *sc = vi->adapter; | ||||
struct sysctl_oid_list *children; | struct sysctl_oid_list *children; | ||||
char name[16]; | char name[16]; | ||||
rc = alloc_iq_fl(vi, &rxq->iq, &rxq->fl, intr_idx, | rc = alloc_iq_fl(vi, &rxq->iq, &rxq->fl, intr_idx, | ||||
tnl_cong(vi->pi, cong_drop)); | tnl_cong(vi->pi, cong_drop)); | ||||
if (rc != 0) | if (rc != 0) | ||||
return (rc); | return (rc); | ||||
▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | |||||
alloc_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq, int intr_idx, | alloc_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq, int intr_idx, | ||||
int idx, struct sysctl_oid *oid) | int idx, struct sysctl_oid *oid) | ||||
{ | { | ||||
int rc; | int rc; | ||||
struct sysctl_oid_list *children; | struct sysctl_oid_list *children; | ||||
struct sysctl_ctx_list *ctx; | struct sysctl_ctx_list *ctx; | ||||
char name[16]; | char name[16]; | ||||
size_t len; | size_t len; | ||||
struct adapter *sc = vi->pi->adapter; | struct adapter *sc = vi->adapter; | ||||
struct netmap_adapter *na = NA(vi->ifp); | struct netmap_adapter *na = NA(vi->ifp); | ||||
MPASS(na != NULL); | MPASS(na != NULL); | ||||
len = vi->qsize_rxq * IQ_ESIZE; | len = vi->qsize_rxq * IQ_ESIZE; | ||||
rc = alloc_ring(sc, len, &nm_rxq->iq_desc_tag, &nm_rxq->iq_desc_map, | rc = alloc_ring(sc, len, &nm_rxq->iq_desc_tag, &nm_rxq->iq_desc_map, | ||||
&nm_rxq->iq_ba, (void **)&nm_rxq->iq_desc); | &nm_rxq->iq_ba, (void **)&nm_rxq->iq_desc); | ||||
if (rc != 0) | if (rc != 0) | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | alloc_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq, int intr_idx, | ||||
return (rc); | return (rc); | ||||
} | } | ||||
static int | static int | ||||
free_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq) | free_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq) | ||||
{ | { | ||||
struct adapter *sc = vi->pi->adapter; | struct adapter *sc = vi->adapter; | ||||
if (vi->flags & VI_INIT_DONE) | if (vi->flags & VI_INIT_DONE) | ||||
MPASS(nm_rxq->iq_cntxt_id == INVALID_NM_RXQ_CNTXT_ID); | MPASS(nm_rxq->iq_cntxt_id == INVALID_NM_RXQ_CNTXT_ID); | ||||
else | else | ||||
MPASS(nm_rxq->iq_cntxt_id == 0); | MPASS(nm_rxq->iq_cntxt_id == 0); | ||||
free_ring(sc, nm_rxq->iq_desc_tag, nm_rxq->iq_desc_map, nm_rxq->iq_ba, | free_ring(sc, nm_rxq->iq_desc_tag, nm_rxq->iq_desc_map, nm_rxq->iq_ba, | ||||
nm_rxq->iq_desc); | nm_rxq->iq_desc); | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "pidx", | ||||
sysctl_uint16, "I", "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->adapter; | ||||
if (vi->flags & VI_INIT_DONE) | if (vi->flags & VI_INIT_DONE) | ||||
MPASS(nm_txq->cntxt_id == INVALID_NM_TXQ_CNTXT_ID); | MPASS(nm_txq->cntxt_id == INVALID_NM_TXQ_CNTXT_ID); | ||||
else | else | ||||
MPASS(nm_txq->cntxt_id == 0); | MPASS(nm_txq->cntxt_id == 0); | ||||
free_ring(sc, nm_txq->desc_tag, nm_txq->desc_map, nm_txq->ba, | free_ring(sc, nm_txq->desc_tag, nm_txq->desc_map, nm_txq->ba, | ||||
nm_txq->desc); | nm_txq->desc); | ||||
▲ Show 20 Lines • Show All 371 Lines • ▼ Show 20 Lines | alloc_txq(struct vi_info *vi, struct sge_txq *txq, int idx, | ||||
else | else | ||||
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); | ||||
txp = &txq->txp; | |||||
txp->score = 5; | |||||
MPASS(nitems(txp->mb) >= sc->params.max_pkts_per_eth_tx_pkts_wr); | |||||
txq->txp.max_npkt = min(nitems(txp->mb), | |||||
sc->params.max_pkts_per_eth_tx_pkts_wr); | |||||
snprintf(name, sizeof(name), "%d", idx); | snprintf(name, sizeof(name), "%d", idx); | ||||
oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, name, | oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, name, | ||||
CTLFLAG_RD | CTLFLAG_MPSAFE, 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, | ||||
▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | #endif | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
free_txq(struct vi_info *vi, struct sge_txq *txq) | free_txq(struct vi_info *vi, struct sge_txq *txq) | ||||
{ | { | ||||
int rc; | int rc; | ||||
struct adapter *sc = vi->pi->adapter; | struct adapter *sc = vi->adapter; | ||||
struct sge_eq *eq = &txq->eq; | struct sge_eq *eq = &txq->eq; | ||||
rc = free_eq(sc, eq); | rc = free_eq(sc, eq); | ||||
if (rc) | if (rc) | ||||
return (rc); | return (rc); | ||||
sglist_free(txq->gl); | sglist_free(txq->gl); | ||||
free(txq->sdesc, M_CXGBE); | free(txq->sdesc, M_CXGBE); | ||||
▲ Show 20 Lines • Show All 1,786 Lines • Show Last 20 Lines |