Changeset View
Changeset View
Standalone View
Standalone View
head/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 493 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 |