Index: head/sys/dev/cxgbe/adapter.h =================================================================== --- head/sys/dev/cxgbe/adapter.h +++ head/sys/dev/cxgbe/adapter.h @@ -1160,8 +1160,6 @@ void vi_sysctls(struct vi_info *); void vi_tick(void *); int rw_via_memwin(struct adapter *, int, uint32_t, uint32_t *, int, int); -int alloc_atid_tab(struct tid_info *, int); -void free_atid_tab(struct tid_info *); int alloc_atid(struct adapter *, void *); void *lookup_atid(struct adapter *, int); void free_atid(struct adapter *, int); Index: head/sys/dev/cxgbe/t4_filter.c =================================================================== --- head/sys/dev/cxgbe/t4_filter.c +++ head/sys/dev/cxgbe/t4_filter.c @@ -891,11 +891,6 @@ if (rc != 0) goto done; } - if (__predict_false(sc->tids.atid_tab == NULL)) { - rc = alloc_atid_tab(&sc->tids, M_NOWAIT); - if (rc != 0) - goto done; - } } else if (separate_hpfilter_region(sc) && t->fs.prio && __predict_false(ti->hpftid_tab == NULL)) { MPASS(ti->nhpftids != 0); Index: head/sys/dev/cxgbe/t4_main.c =================================================================== --- head/sys/dev/cxgbe/t4_main.c +++ head/sys/dev/cxgbe/t4_main.c @@ -626,6 +626,8 @@ static int t4_alloc_irq(struct adapter *, struct irq *, int rid, driver_intr_t *, void *, char *); 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 vi_refresh_stats(struct adapter *, struct vi_info *); static void cxgbe_refresh_stats(struct adapter *, struct port_info *); @@ -1236,6 +1238,7 @@ t4_init_l2t(sc, M_WAITOK); t4_init_smt(sc, M_WAITOK); t4_init_tx_sched(sc); + t4_init_atid_table(sc); #ifdef RATELIMIT t4_init_etid_table(sc); #endif @@ -1540,6 +1543,7 @@ t4_free_l2t(sc->l2t); if (sc->smt) t4_free_smt(sc->smt); + t4_free_atid_table(sc); #ifdef RATELIMIT t4_free_etid_table(sc); #endif @@ -1568,7 +1572,6 @@ free(sc->tids.ftid_tab, M_CXGBE); free(sc->tids.hpftid_tab, M_CXGBE); free_hftid_hash(&sc->tids); - free(sc->tids.atid_tab, M_CXGBE); free(sc->tids.tid_tab, M_CXGBE); free(sc->tt.tls_rx_ports, M_CXGBE); t4_destroy_dma_tag(sc); @@ -2829,31 +2832,34 @@ return (0); } -int -alloc_atid_tab(struct tid_info *t, int flags) +static void +t4_init_atid_table(struct adapter *sc) { + struct tid_info *t; int i; - MPASS(t->natids > 0); + t = &sc->tids; + if (t->natids == 0) + return; + MPASS(t->atid_tab == NULL); t->atid_tab = malloc(t->natids * sizeof(*t->atid_tab), M_CXGBE, - M_ZERO | flags); - if (t->atid_tab == NULL) - return (ENOMEM); + M_ZERO | M_WAITOK); mtx_init(&t->atid_lock, "atid lock", NULL, MTX_DEF); t->afree = t->atid_tab; t->atids_in_use = 0; for (i = 1; i < t->natids; i++) t->atid_tab[i - 1].next = &t->atid_tab[i]; t->atid_tab[t->natids - 1].next = NULL; - - return (0); } -void -free_atid_tab(struct tid_info *t) +static void +t4_free_atid_table(struct adapter *sc) { + struct tid_info *t; + + t = &sc->tids; KASSERT(t->atids_in_use == 0, ("%s: %d atids still in use.", __func__, t->atids_in_use)); Index: head/sys/dev/cxgbe/tom/t4_tom.c =================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c +++ head/sys/dev/cxgbe/tom/t4_tom.c @@ -1368,7 +1368,6 @@ { free_tid_tab(t); - free_atid_tab(t); free_stid_tab(t); } @@ -1378,10 +1377,6 @@ int rc; rc = alloc_tid_tab(t, M_NOWAIT); - if (rc != 0) - goto failed; - - rc = alloc_atid_tab(t, M_NOWAIT); if (rc != 0) goto failed;