Lines Matching full:bf

507 	struct malo_rxbuf *bf;  in malo_rxdma_setup()  local
520 bf = malloc(bsize, M_MALODEV, M_NOWAIT | M_ZERO); in malo_rxdma_setup()
521 if (bf == NULL) { in malo_rxdma_setup()
526 sc->malo_rxdma.dd_bufptr = bf; in malo_rxdma_setup()
530 for (i = 0; i < malo_rxbuf; i++, bf++, ds++) { in malo_rxdma_setup()
531 bf->bf_desc = ds; in malo_rxdma_setup()
532 bf->bf_daddr = DS2PHYS(&sc->malo_rxdma, ds); in malo_rxdma_setup()
534 &bf->bf_dmamap); in malo_rxdma_setup()
542 STAILQ_INSERT_TAIL(&sc->malo_rxbuf, bf, bf_list); in malo_rxdma_setup()
551 struct malo_txbuf *bf; in malo_txdma_setup() local
562 bf = malloc(bsize, M_MALODEV, M_NOWAIT | M_ZERO); in malo_txdma_setup()
563 if (bf == NULL) { in malo_txdma_setup()
568 txq->dma.dd_bufptr = bf; in malo_txdma_setup()
573 for (i = 0; i < malo_txbuf; i++, bf++, ds += MALO_TXDESC) { in malo_txdma_setup()
574 bf->bf_desc = ds; in malo_txdma_setup()
575 bf->bf_daddr = DS2PHYS(&txq->dma, ds); in malo_txdma_setup()
577 &bf->bf_dmamap); in malo_txdma_setup()
584 STAILQ_INSERT_TAIL(&txq->free, bf, bf_list); in malo_txdma_setup()
604 struct malo_rxbuf *bf; in malo_rxdma_cleanup() local
606 STAILQ_FOREACH(bf, &sc->malo_rxbuf, bf_list) { in malo_rxdma_cleanup()
607 if (bf->bf_m != NULL) { in malo_rxdma_cleanup()
608 m_freem(bf->bf_m); in malo_rxdma_cleanup()
609 bf->bf_m = NULL; in malo_rxdma_cleanup()
611 if (bf->bf_dmamap != NULL) { in malo_rxdma_cleanup()
612 bus_dmamap_destroy(sc->malo_dmat, bf->bf_dmamap); in malo_rxdma_cleanup()
613 bf->bf_dmamap = NULL; in malo_rxdma_cleanup()
628 struct malo_txbuf *bf; in malo_txdma_cleanup() local
631 STAILQ_FOREACH(bf, &txq->free, bf_list) { in malo_txdma_cleanup()
632 if (bf->bf_m != NULL) { in malo_txdma_cleanup()
633 m_freem(bf->bf_m); in malo_txdma_cleanup()
634 bf->bf_m = NULL; in malo_txdma_cleanup()
636 ni = bf->bf_node; in malo_txdma_cleanup()
637 bf->bf_node = NULL; in malo_txdma_cleanup()
644 if (bf->bf_dmamap != NULL) { in malo_txdma_cleanup()
645 bus_dmamap_destroy(sc->malo_dmat, bf->bf_dmamap); in malo_txdma_cleanup()
646 bf->bf_dmamap = NULL; in malo_txdma_cleanup()
739 struct malo_txbuf *bf, *bn; in malo_txq_init() local
746 STAILQ_FOREACH(bf, &txq->free, bf_list) { in malo_txq_init()
747 bf->bf_txq = txq; in malo_txq_init()
749 ds = bf->bf_desc; in malo_txq_init()
750 bn = STAILQ_NEXT(bf, bf_list); in malo_txq_init()
774 struct malo_txbuf *bf; in malo_getbuf() local
777 bf = STAILQ_FIRST(&txq->free); in malo_getbuf()
778 if (bf != NULL) { in malo_getbuf()
783 if (bf == NULL) { in malo_getbuf()
788 return bf; in malo_getbuf()
792 malo_tx_dmasetup(struct malo_softc *sc, struct malo_txbuf *bf, struct mbuf *m0) in malo_tx_dmasetup() argument
801 error = bus_dmamap_load_mbuf_sg(sc->malo_dmat, bf->bf_dmamap, m0, in malo_tx_dmasetup()
802 bf->bf_segs, &bf->bf_nseg, in malo_tx_dmasetup()
806 bf->bf_nseg = MALO_TXDESC + 1; in malo_tx_dmasetup()
825 error = bus_dmamap_load_mbuf_sg(sc->malo_dmat, bf->bf_dmamap, m0, in malo_tx_dmasetup()
826 bf->bf_segs, &bf->bf_nseg, in malo_tx_dmasetup()
833 KASSERT(bf->bf_nseg <= MALO_TXDESC, in malo_tx_dmasetup()
834 ("too many segments after defrag; nseg %u", bf->bf_nseg)); in malo_tx_dmasetup()
835 } else if (bf->bf_nseg == 0) { /* null packet, discard */ in malo_tx_dmasetup()
842 bus_dmamap_sync(sc->malo_dmat, bf->bf_dmamap, BUS_DMASYNC_PREWRITE); in malo_tx_dmasetup()
843 bf->bf_m = m0; in malo_tx_dmasetup()
850 malo_printrxbuf(const struct malo_rxbuf *bf, u_int ix) in malo_printrxbuf() argument
852 const struct malo_rxdesc *ds = bf->bf_desc; in malo_printrxbuf()
857 " RATE:%02x QOS:%04x\n", ix, ds, (uintmax_t)bf->bf_daddr, in malo_printrxbuf()
867 malo_printtxbuf(const struct malo_txbuf *bf, u_int qnum, u_int ix) in malo_printtxbuf() argument
869 const struct malo_txdesc *ds = bf->bf_desc; in malo_printtxbuf()
873 printf(" (DS.V:%p DS.P:0x%jx)\n", ds, (uintmax_t)bf->bf_daddr); in malo_printtxbuf()
920 struct malo_txbuf *bf; in malo_tx_processq() local
930 bf = STAILQ_FIRST(&txq->active); in malo_tx_processq()
931 if (bf == NULL) { in malo_tx_processq()
935 ds = bf->bf_desc; in malo_tx_processq()
947 malo_printtxbuf(bf, txq->qnum, nreaped); in malo_tx_processq()
949 ni = bf->bf_node; in malo_tx_processq()
973 m_adj(bf->bf_m, sizeof(uint16_t)); in malo_tx_processq()
974 ieee80211_tx_complete(ni, bf->bf_m, in malo_tx_processq()
977 m_freem(bf->bf_m); in malo_tx_processq()
982 bus_dmamap_sync(sc->malo_dmat, bf->bf_dmamap, in malo_tx_processq()
984 bus_dmamap_unload(sc->malo_dmat, bf->bf_dmamap); in malo_tx_processq()
985 bf->bf_m = NULL; in malo_tx_processq()
986 bf->bf_node = NULL; in malo_tx_processq()
989 STAILQ_INSERT_TAIL(&txq->free, bf, bf_list); in malo_tx_processq()
1024 struct malo_txbuf *bf, struct mbuf *m0) in malo_tx_start() argument
1133 error = malo_tx_dmasetup(sc, bf, m0); in malo_tx_start()
1136 bf->bf_node = ni; /* NB: held reference */ in malo_tx_start()
1137 m0 = bf->bf_m; /* NB: may have changed */ in malo_tx_start()
1144 ds = bf->bf_desc; in malo_tx_start()
1145 txq = bf->bf_txq; in malo_tx_start()
1148 ds->pktptr = htole32(bf->bf_segs[0].ds_addr); in malo_tx_start()
1149 ds->pktlen = htole16(bf->bf_segs[0].ds_len); in malo_tx_start()
1187 STAILQ_INSERT_TAIL(&txq->active, bf, bf_list); in malo_tx_start()
1221 struct malo_txbuf *bf = NULL; in malo_start() local
1232 bf = malo_getbuf(sc, txq); in malo_start()
1233 if (bf == NULL) { in malo_start()
1241 if (malo_tx_start(sc, ni, bf, m)) { in malo_start()
1244 if (bf != NULL) { in malo_start()
1245 bf->bf_m = NULL; in malo_start()
1246 bf->bf_node = NULL; in malo_start()
1248 STAILQ_INSERT_HEAD(&txq->free, bf, bf_list); in malo_start()
1331 malo_getrxmbuf(struct malo_softc *sc, struct malo_rxbuf *bf) in malo_getrxmbuf() argument
1343 error = bus_dmamap_load(sc->malo_dmat, bf->bf_dmamap, in malo_getrxmbuf()
1352 bf->bf_data = paddr; in malo_getrxmbuf()
1353 bus_dmamap_sync(sc->malo_dmat, bf->bf_dmamap, BUS_DMASYNC_PREWRITE); in malo_getrxmbuf()
1359 malo_rxbuf_init(struct malo_softc *sc, struct malo_rxbuf *bf) in malo_rxbuf_init() argument
1363 ds = bf->bf_desc; in malo_rxbuf_init()
1364 if (bf->bf_m == NULL) { in malo_rxbuf_init()
1365 bf->bf_m = malo_getrxmbuf(sc, bf); in malo_rxbuf_init()
1366 if (bf->bf_m == NULL) { in malo_rxbuf_init()
1384 ds->physbuffdata = htole32(bf->bf_data); in malo_rxbuf_init()
1399 struct malo_rxbuf *bf, *prev; in malo_startrecv() local
1408 STAILQ_FOREACH(bf, &sc->malo_rxbuf, bf_list) { in malo_startrecv()
1409 int error = malo_rxbuf_init(sc, bf); in malo_startrecv()
1418 ds->physnext = htole32(bf->bf_daddr); in malo_startrecv()
1420 prev = bf; in malo_startrecv()
1565 struct malo_txbuf *bf; in malo_tx_draintxq() local
1574 bf = STAILQ_FIRST(&txq->active); in malo_tx_draintxq()
1575 if (bf == NULL) { in malo_tx_draintxq()
1585 mtod(bf->bf_m, const struct malo_txrec *); in malo_tx_draintxq()
1586 malo_printtxbuf(bf, txq->qnum, ix); in malo_tx_draintxq()
1588 bf->bf_m->m_len - sizeof(tr->fwlen), 0, -1); in malo_tx_draintxq()
1591 bus_dmamap_unload(sc->malo_dmat, bf->bf_dmamap); in malo_tx_draintxq()
1592 ni = bf->bf_node; in malo_tx_draintxq()
1593 bf->bf_node = NULL; in malo_tx_draintxq()
1600 m_freem(bf->bf_m); in malo_tx_draintxq()
1601 bf->bf_m = NULL; in malo_tx_draintxq()
1604 STAILQ_INSERT_TAIL(&txq->free, bf, bf_list); in malo_tx_draintxq()
1761 struct malo_txbuf *bf; in malo_raw_xmit() local
1776 bf = malo_getbuf(sc, txq); in malo_raw_xmit()
1777 if (bf == NULL) { in malo_raw_xmit()
1785 if (malo_tx_start(sc, ni, bf, m) != 0) { in malo_raw_xmit()
1786 bf->bf_m = NULL; in malo_raw_xmit()
1787 bf->bf_node = NULL; in malo_raw_xmit()
1789 STAILQ_INSERT_HEAD(&txq->free, bf, bf_list); in malo_raw_xmit()
1931 struct malo_rxbuf *bf; in malo_rx_proc() local
1953 bf = sc->malo_rxnext; in malo_rx_proc()
1955 if (bf == NULL) { in malo_rx_proc()
1956 bf = STAILQ_FIRST(&sc->malo_rxbuf); in malo_rx_proc()
1959 ds = bf->bf_desc; in malo_rx_proc()
1960 if (bf->bf_m == NULL) { in malo_rx_proc()
1970 (void)malo_rxbuf_init(sc, bf); in malo_rx_proc()
1982 malo_printrxbuf(bf, 0); in malo_rx_proc()
1993 bus_dmamap_sync(sc->malo_dmat, bf->bf_dmamap, in malo_rx_proc()
2001 m = bf->bf_m; in malo_rx_proc()
2023 mnew = malo_getrxmbuf(sc, bf); in malo_rx_proc()
2033 bf->bf_m = mnew; in malo_rx_proc()
2068 (void) malo_rxbuf_init(sc, bf); in malo_rx_proc()
2069 bf = STAILQ_NEXT(bf, bf_list); in malo_rx_proc()
2073 sc->malo_rxnext = bf; in malo_rx_proc()