Lines Matching refs:bf

505 	struct malo_rxbuf *bf;  in malo_rxdma_setup()  local
518 bf = malloc(bsize, M_MALODEV, M_NOWAIT | M_ZERO); in malo_rxdma_setup()
519 if (bf == NULL) { in malo_rxdma_setup()
524 sc->malo_rxdma.dd_bufptr = bf; in malo_rxdma_setup()
528 for (i = 0; i < malo_rxbuf; i++, bf++, ds++) { in malo_rxdma_setup()
529 bf->bf_desc = ds; in malo_rxdma_setup()
530 bf->bf_daddr = DS2PHYS(&sc->malo_rxdma, ds); in malo_rxdma_setup()
532 &bf->bf_dmamap); in malo_rxdma_setup()
540 STAILQ_INSERT_TAIL(&sc->malo_rxbuf, bf, bf_list); in malo_rxdma_setup()
549 struct malo_txbuf *bf; in malo_txdma_setup() local
560 bf = malloc(bsize, M_MALODEV, M_NOWAIT | M_ZERO); in malo_txdma_setup()
561 if (bf == NULL) { in malo_txdma_setup()
566 txq->dma.dd_bufptr = bf; in malo_txdma_setup()
571 for (i = 0; i < malo_txbuf; i++, bf++, ds += MALO_TXDESC) { in malo_txdma_setup()
572 bf->bf_desc = ds; in malo_txdma_setup()
573 bf->bf_daddr = DS2PHYS(&txq->dma, ds); in malo_txdma_setup()
575 &bf->bf_dmamap); in malo_txdma_setup()
582 STAILQ_INSERT_TAIL(&txq->free, bf, bf_list); in malo_txdma_setup()
602 struct malo_rxbuf *bf; in malo_rxdma_cleanup() local
604 STAILQ_FOREACH(bf, &sc->malo_rxbuf, bf_list) { in malo_rxdma_cleanup()
605 if (bf->bf_m != NULL) { in malo_rxdma_cleanup()
606 m_freem(bf->bf_m); in malo_rxdma_cleanup()
607 bf->bf_m = NULL; in malo_rxdma_cleanup()
609 if (bf->bf_dmamap != NULL) { in malo_rxdma_cleanup()
610 bus_dmamap_destroy(sc->malo_dmat, bf->bf_dmamap); in malo_rxdma_cleanup()
611 bf->bf_dmamap = NULL; in malo_rxdma_cleanup()
626 struct malo_txbuf *bf; in malo_txdma_cleanup() local
629 STAILQ_FOREACH(bf, &txq->free, bf_list) { in malo_txdma_cleanup()
630 if (bf->bf_m != NULL) { in malo_txdma_cleanup()
631 m_freem(bf->bf_m); in malo_txdma_cleanup()
632 bf->bf_m = NULL; in malo_txdma_cleanup()
634 ni = bf->bf_node; in malo_txdma_cleanup()
635 bf->bf_node = NULL; in malo_txdma_cleanup()
642 if (bf->bf_dmamap != NULL) { in malo_txdma_cleanup()
643 bus_dmamap_destroy(sc->malo_dmat, bf->bf_dmamap); in malo_txdma_cleanup()
644 bf->bf_dmamap = NULL; in malo_txdma_cleanup()
737 struct malo_txbuf *bf, *bn; in malo_txq_init() local
744 STAILQ_FOREACH(bf, &txq->free, bf_list) { in malo_txq_init()
745 bf->bf_txq = txq; in malo_txq_init()
747 ds = bf->bf_desc; in malo_txq_init()
748 bn = STAILQ_NEXT(bf, bf_list); in malo_txq_init()
772 struct malo_txbuf *bf; in malo_getbuf() local
775 bf = STAILQ_FIRST(&txq->free); in malo_getbuf()
776 if (bf != NULL) { in malo_getbuf()
781 if (bf == NULL) { in malo_getbuf()
786 return bf; in malo_getbuf()
790 malo_tx_dmasetup(struct malo_softc *sc, struct malo_txbuf *bf, struct mbuf *m0) in malo_tx_dmasetup() argument
799 error = bus_dmamap_load_mbuf_sg(sc->malo_dmat, bf->bf_dmamap, m0, in malo_tx_dmasetup()
800 bf->bf_segs, &bf->bf_nseg, in malo_tx_dmasetup()
804 bf->bf_nseg = MALO_TXDESC + 1; in malo_tx_dmasetup()
823 error = bus_dmamap_load_mbuf_sg(sc->malo_dmat, bf->bf_dmamap, m0, in malo_tx_dmasetup()
824 bf->bf_segs, &bf->bf_nseg, in malo_tx_dmasetup()
831 KASSERT(bf->bf_nseg <= MALO_TXDESC, in malo_tx_dmasetup()
832 ("too many segments after defrag; nseg %u", bf->bf_nseg)); in malo_tx_dmasetup()
833 } else if (bf->bf_nseg == 0) { /* null packet, discard */ in malo_tx_dmasetup()
840 bus_dmamap_sync(sc->malo_dmat, bf->bf_dmamap, BUS_DMASYNC_PREWRITE); in malo_tx_dmasetup()
841 bf->bf_m = m0; in malo_tx_dmasetup()
848 malo_printrxbuf(const struct malo_rxbuf *bf, u_int ix) in malo_printrxbuf() argument
850 const struct malo_rxdesc *ds = bf->bf_desc; in malo_printrxbuf()
855 " RATE:%02x QOS:%04x\n", ix, ds, (uintmax_t)bf->bf_daddr, in malo_printrxbuf()
865 malo_printtxbuf(const struct malo_txbuf *bf, u_int qnum, u_int ix) in malo_printtxbuf() argument
867 const struct malo_txdesc *ds = bf->bf_desc; in malo_printtxbuf()
871 printf(" (DS.V:%p DS.P:0x%jx)\n", ds, (uintmax_t)bf->bf_daddr); in malo_printtxbuf()
918 struct malo_txbuf *bf; in malo_tx_processq() local
928 bf = STAILQ_FIRST(&txq->active); in malo_tx_processq()
929 if (bf == NULL) { in malo_tx_processq()
933 ds = bf->bf_desc; in malo_tx_processq()
945 malo_printtxbuf(bf, txq->qnum, nreaped); in malo_tx_processq()
947 ni = bf->bf_node; in malo_tx_processq()
971 m_adj(bf->bf_m, sizeof(uint16_t)); in malo_tx_processq()
972 ieee80211_tx_complete(ni, bf->bf_m, in malo_tx_processq()
975 m_freem(bf->bf_m); in malo_tx_processq()
980 bus_dmamap_sync(sc->malo_dmat, bf->bf_dmamap, in malo_tx_processq()
982 bus_dmamap_unload(sc->malo_dmat, bf->bf_dmamap); in malo_tx_processq()
983 bf->bf_m = NULL; in malo_tx_processq()
984 bf->bf_node = NULL; in malo_tx_processq()
987 STAILQ_INSERT_TAIL(&txq->free, bf, bf_list); in malo_tx_processq()
1022 struct malo_txbuf *bf, struct mbuf *m0) in malo_tx_start() argument
1129 error = malo_tx_dmasetup(sc, bf, m0); in malo_tx_start()
1132 bf->bf_node = ni; /* NB: held reference */ in malo_tx_start()
1133 m0 = bf->bf_m; /* NB: may have changed */ in malo_tx_start()
1140 ds = bf->bf_desc; in malo_tx_start()
1141 txq = bf->bf_txq; in malo_tx_start()
1144 ds->pktptr = htole32(bf->bf_segs[0].ds_addr); in malo_tx_start()
1145 ds->pktlen = htole16(bf->bf_segs[0].ds_len); in malo_tx_start()
1183 STAILQ_INSERT_TAIL(&txq->active, bf, bf_list); in malo_tx_start()
1217 struct malo_txbuf *bf = NULL; in malo_start() local
1228 bf = malo_getbuf(sc, txq); in malo_start()
1229 if (bf == NULL) { in malo_start()
1237 if (malo_tx_start(sc, ni, bf, m)) { in malo_start()
1240 if (bf != NULL) { in malo_start()
1241 bf->bf_m = NULL; in malo_start()
1242 bf->bf_node = NULL; in malo_start()
1244 STAILQ_INSERT_HEAD(&txq->free, bf, bf_list); in malo_start()
1327 malo_getrxmbuf(struct malo_softc *sc, struct malo_rxbuf *bf) in malo_getrxmbuf() argument
1339 error = bus_dmamap_load(sc->malo_dmat, bf->bf_dmamap, in malo_getrxmbuf()
1348 bf->bf_data = paddr; in malo_getrxmbuf()
1349 bus_dmamap_sync(sc->malo_dmat, bf->bf_dmamap, BUS_DMASYNC_PREWRITE); in malo_getrxmbuf()
1355 malo_rxbuf_init(struct malo_softc *sc, struct malo_rxbuf *bf) in malo_rxbuf_init() argument
1359 ds = bf->bf_desc; in malo_rxbuf_init()
1360 if (bf->bf_m == NULL) { in malo_rxbuf_init()
1361 bf->bf_m = malo_getrxmbuf(sc, bf); in malo_rxbuf_init()
1362 if (bf->bf_m == NULL) { in malo_rxbuf_init()
1380 ds->physbuffdata = htole32(bf->bf_data); in malo_rxbuf_init()
1395 struct malo_rxbuf *bf, *prev; in malo_startrecv() local
1404 STAILQ_FOREACH(bf, &sc->malo_rxbuf, bf_list) { in malo_startrecv()
1405 int error = malo_rxbuf_init(sc, bf); in malo_startrecv()
1414 ds->physnext = htole32(bf->bf_daddr); in malo_startrecv()
1416 prev = bf; in malo_startrecv()
1561 struct malo_txbuf *bf; in malo_tx_draintxq() local
1570 bf = STAILQ_FIRST(&txq->active); in malo_tx_draintxq()
1571 if (bf == NULL) { in malo_tx_draintxq()
1581 mtod(bf->bf_m, const struct malo_txrec *); in malo_tx_draintxq()
1582 malo_printtxbuf(bf, txq->qnum, ix); in malo_tx_draintxq()
1584 bf->bf_m->m_len - sizeof(tr->fwlen), 0, -1); in malo_tx_draintxq()
1587 bus_dmamap_unload(sc->malo_dmat, bf->bf_dmamap); in malo_tx_draintxq()
1588 ni = bf->bf_node; in malo_tx_draintxq()
1589 bf->bf_node = NULL; in malo_tx_draintxq()
1596 m_freem(bf->bf_m); in malo_tx_draintxq()
1597 bf->bf_m = NULL; in malo_tx_draintxq()
1600 STAILQ_INSERT_TAIL(&txq->free, bf, bf_list); in malo_tx_draintxq()
1757 struct malo_txbuf *bf; in malo_raw_xmit() local
1772 bf = malo_getbuf(sc, txq); in malo_raw_xmit()
1773 if (bf == NULL) { in malo_raw_xmit()
1781 if (malo_tx_start(sc, ni, bf, m) != 0) { in malo_raw_xmit()
1782 bf->bf_m = NULL; in malo_raw_xmit()
1783 bf->bf_node = NULL; in malo_raw_xmit()
1785 STAILQ_INSERT_HEAD(&txq->free, bf, bf_list); in malo_raw_xmit()
1927 struct malo_rxbuf *bf; in malo_rx_proc() local
1949 bf = sc->malo_rxnext; in malo_rx_proc()
1951 if (bf == NULL) { in malo_rx_proc()
1952 bf = STAILQ_FIRST(&sc->malo_rxbuf); in malo_rx_proc()
1955 ds = bf->bf_desc; in malo_rx_proc()
1956 if (bf->bf_m == NULL) { in malo_rx_proc()
1966 (void)malo_rxbuf_init(sc, bf); in malo_rx_proc()
1978 malo_printrxbuf(bf, 0); in malo_rx_proc()
1989 bus_dmamap_sync(sc->malo_dmat, bf->bf_dmamap, in malo_rx_proc()
1997 m = bf->bf_m; in malo_rx_proc()
2019 mnew = malo_getrxmbuf(sc, bf); in malo_rx_proc()
2029 bf->bf_m = mnew; in malo_rx_proc()
2064 (void) malo_rxbuf_init(sc, bf); in malo_rx_proc()
2065 bf = STAILQ_NEXT(bf, bf_list); in malo_rx_proc()
2069 sc->malo_rxnext = bf; in malo_rx_proc()