Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/cxgbe/t4_main.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 620 Lines • ▼ Show 20 Lines | |||||
static int cxgbe_uninit_synchronized(struct vi_info *); | static int cxgbe_uninit_synchronized(struct vi_info *); | ||||
static void quiesce_txq(struct adapter *, struct sge_txq *); | static void quiesce_txq(struct adapter *, struct sge_txq *); | ||||
static void quiesce_wrq(struct adapter *, struct sge_wrq *); | static void quiesce_wrq(struct adapter *, struct sge_wrq *); | ||||
static void quiesce_iq(struct adapter *, struct sge_iq *); | static void quiesce_iq(struct adapter *, struct sge_iq *); | ||||
static void quiesce_fl(struct adapter *, struct sge_fl *); | static void quiesce_fl(struct adapter *, struct sge_fl *); | ||||
static int t4_alloc_irq(struct adapter *, struct irq *, int rid, | static int t4_alloc_irq(struct adapter *, struct irq *, int rid, | ||||
driver_intr_t *, void *, char *); | driver_intr_t *, void *, char *); | ||||
static int t4_free_irq(struct adapter *, struct irq *); | static int t4_free_irq(struct adapter *, struct irq *); | ||||
static void t4_init_atid_table(struct adapter *); | |||||
static void t4_free_atid_table(struct adapter *); | |||||
static void get_regs(struct adapter *, struct t4_regdump *, uint8_t *); | static void get_regs(struct adapter *, struct t4_regdump *, uint8_t *); | ||||
static void vi_refresh_stats(struct adapter *, struct vi_info *); | static void vi_refresh_stats(struct adapter *, struct vi_info *); | ||||
static void cxgbe_refresh_stats(struct adapter *, struct port_info *); | static void cxgbe_refresh_stats(struct adapter *, struct port_info *); | ||||
static void cxgbe_tick(void *); | static void cxgbe_tick(void *); | ||||
static void cxgbe_sysctls(struct port_info *); | static void cxgbe_sysctls(struct port_info *); | ||||
static int sysctl_int_array(SYSCTL_HANDLER_ARGS); | static int sysctl_int_array(SYSCTL_HANDLER_ARGS); | ||||
static int sysctl_bitfield_8b(SYSCTL_HANDLER_ARGS); | static int sysctl_bitfield_8b(SYSCTL_HANDLER_ARGS); | ||||
static int sysctl_bitfield_16b(SYSCTL_HANDLER_ARGS); | static int sysctl_bitfield_16b(SYSCTL_HANDLER_ARGS); | ||||
▲ Show 20 Lines • Show All 594 Lines • ▼ Show 20 Lines | s->eqmap = malloc(s->neq * sizeof(struct sge_eq *), M_CXGBE, | ||||
M_ZERO | M_WAITOK); | M_ZERO | M_WAITOK); | ||||
sc->irq = malloc(sc->intr_count * sizeof(struct irq), M_CXGBE, | sc->irq = malloc(sc->intr_count * sizeof(struct irq), M_CXGBE, | ||||
M_ZERO | M_WAITOK); | M_ZERO | M_WAITOK); | ||||
t4_init_l2t(sc, M_WAITOK); | t4_init_l2t(sc, M_WAITOK); | ||||
t4_init_smt(sc, M_WAITOK); | t4_init_smt(sc, M_WAITOK); | ||||
t4_init_tx_sched(sc); | t4_init_tx_sched(sc); | ||||
t4_init_atid_table(sc); | |||||
#ifdef RATELIMIT | #ifdef RATELIMIT | ||||
t4_init_etid_table(sc); | t4_init_etid_table(sc); | ||||
#endif | #endif | ||||
#ifdef INET6 | #ifdef INET6 | ||||
t4_init_clip_table(sc); | t4_init_clip_table(sc); | ||||
#endif | #endif | ||||
if (sc->vres.key.size != 0) | if (sc->vres.key.size != 0) | ||||
sc->key_map = vmem_create("T4TLS key map", sc->vres.key.start, | sc->key_map = vmem_create("T4TLS key map", sc->vres.key.start, | ||||
▲ Show 20 Lines • Show All 288 Lines • ▼ Show 20 Lines | t4_detach_common(device_t dev) | ||||
if (sc->msix_res) | if (sc->msix_res) | ||||
bus_release_resource(dev, SYS_RES_MEMORY, sc->msix_rid, | bus_release_resource(dev, SYS_RES_MEMORY, sc->msix_rid, | ||||
sc->msix_res); | sc->msix_res); | ||||
if (sc->l2t) | if (sc->l2t) | ||||
t4_free_l2t(sc->l2t); | t4_free_l2t(sc->l2t); | ||||
if (sc->smt) | if (sc->smt) | ||||
t4_free_smt(sc->smt); | t4_free_smt(sc->smt); | ||||
t4_free_atid_table(sc); | |||||
#ifdef RATELIMIT | #ifdef RATELIMIT | ||||
t4_free_etid_table(sc); | t4_free_etid_table(sc); | ||||
#endif | #endif | ||||
if (sc->key_map) | if (sc->key_map) | ||||
vmem_destroy(sc->key_map); | vmem_destroy(sc->key_map); | ||||
#ifdef INET6 | #ifdef INET6 | ||||
t4_destroy_clip_table(sc); | t4_destroy_clip_table(sc); | ||||
#endif | #endif | ||||
Show All 12 Lines | #endif | ||||
free(sc->sge.rxq, M_CXGBE); | free(sc->sge.rxq, M_CXGBE); | ||||
free(sc->sge.txq, M_CXGBE); | free(sc->sge.txq, M_CXGBE); | ||||
free(sc->sge.ctrlq, M_CXGBE); | free(sc->sge.ctrlq, M_CXGBE); | ||||
free(sc->sge.iqmap, M_CXGBE); | free(sc->sge.iqmap, M_CXGBE); | ||||
free(sc->sge.eqmap, M_CXGBE); | free(sc->sge.eqmap, M_CXGBE); | ||||
free(sc->tids.ftid_tab, M_CXGBE); | free(sc->tids.ftid_tab, M_CXGBE); | ||||
free(sc->tids.hpftid_tab, M_CXGBE); | free(sc->tids.hpftid_tab, M_CXGBE); | ||||
free_hftid_hash(&sc->tids); | free_hftid_hash(&sc->tids); | ||||
free(sc->tids.atid_tab, M_CXGBE); | |||||
free(sc->tids.tid_tab, M_CXGBE); | free(sc->tids.tid_tab, M_CXGBE); | ||||
free(sc->tt.tls_rx_ports, M_CXGBE); | free(sc->tt.tls_rx_ports, M_CXGBE); | ||||
t4_destroy_dma_tag(sc); | t4_destroy_dma_tag(sc); | ||||
callout_drain(&sc->sfl_callout); | callout_drain(&sc->sfl_callout); | ||||
if (mtx_initialized(&sc->tids.ftid_lock)) { | if (mtx_initialized(&sc->tids.ftid_lock)) { | ||||
mtx_destroy(&sc->tids.ftid_lock); | mtx_destroy(&sc->tids.ftid_lock); | ||||
cv_destroy(&sc->tids.ftid_cv); | cv_destroy(&sc->tids.ftid_cv); | ||||
▲ Show 20 Lines • Show All 1,244 Lines • ▼ Show 20 Lines | while (addr < mw_end && len > 0) { | ||||
len -= 4; | len -= 4; | ||||
} | } | ||||
rw_runlock(&mw->mw_lock); | rw_runlock(&mw->mw_lock); | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
int | static void | ||||
alloc_atid_tab(struct tid_info *t, int flags) | t4_init_atid_table(struct adapter *sc) | ||||
{ | { | ||||
struct tid_info *t; | |||||
int i; | int i; | ||||
MPASS(t->natids > 0); | t = &sc->tids; | ||||
if (t->natids == 0) | |||||
return; | |||||
MPASS(t->atid_tab == NULL); | MPASS(t->atid_tab == NULL); | ||||
t->atid_tab = malloc(t->natids * sizeof(*t->atid_tab), M_CXGBE, | t->atid_tab = malloc(t->natids * sizeof(*t->atid_tab), M_CXGBE, | ||||
M_ZERO | flags); | M_ZERO | M_WAITOK); | ||||
if (t->atid_tab == NULL) | |||||
return (ENOMEM); | |||||
mtx_init(&t->atid_lock, "atid lock", NULL, MTX_DEF); | mtx_init(&t->atid_lock, "atid lock", NULL, MTX_DEF); | ||||
t->afree = t->atid_tab; | t->afree = t->atid_tab; | ||||
t->atids_in_use = 0; | t->atids_in_use = 0; | ||||
for (i = 1; i < t->natids; i++) | for (i = 1; i < t->natids; i++) | ||||
t->atid_tab[i - 1].next = &t->atid_tab[i]; | t->atid_tab[i - 1].next = &t->atid_tab[i]; | ||||
t->atid_tab[t->natids - 1].next = NULL; | t->atid_tab[t->natids - 1].next = NULL; | ||||
return (0); | |||||
} | } | ||||
void | static void | ||||
free_atid_tab(struct tid_info *t) | t4_free_atid_table(struct adapter *sc) | ||||
{ | { | ||||
struct tid_info *t; | |||||
t = &sc->tids; | |||||
KASSERT(t->atids_in_use == 0, | KASSERT(t->atids_in_use == 0, | ||||
("%s: %d atids still in use.", __func__, t->atids_in_use)); | ("%s: %d atids still in use.", __func__, t->atids_in_use)); | ||||
if (mtx_initialized(&t->atid_lock)) | if (mtx_initialized(&t->atid_lock)) | ||||
mtx_destroy(&t->atid_lock); | mtx_destroy(&t->atid_lock); | ||||
free(t->atid_tab, M_CXGBE); | free(t->atid_tab, M_CXGBE); | ||||
t->atid_tab = NULL; | t->atid_tab = NULL; | ||||
▲ Show 20 Lines • Show All 8,038 Lines • Show Last 20 Lines |