Lines Matching full:cd
744 struct sge_chain_data *cd; in sge_dma_alloc() local
750 cd = &sc->sge_cdata; in sge_dma_alloc()
763 &cd->sge_tag); in sge_dma_alloc()
771 error = bus_dma_tag_create(cd->sge_tag, in sge_dma_alloc()
781 &cd->sge_rx_tag); in sge_dma_alloc()
788 error = bus_dmamem_alloc(cd->sge_rx_tag, (void **)&ld->sge_rx_ring, in sge_dma_alloc()
790 &cd->sge_rx_dmamap); in sge_dma_alloc()
796 error = bus_dmamap_load(cd->sge_rx_tag, cd->sge_rx_dmamap, in sge_dma_alloc()
805 error = bus_dma_tag_create(cd->sge_tag, in sge_dma_alloc()
815 &cd->sge_tx_tag); in sge_dma_alloc()
822 error = bus_dmamem_alloc(cd->sge_tx_tag, (void **)&ld->sge_tx_ring, in sge_dma_alloc()
824 &cd->sge_tx_dmamap); in sge_dma_alloc()
830 error = bus_dmamap_load(cd->sge_tx_tag, cd->sge_tx_dmamap, in sge_dma_alloc()
840 error = bus_dma_tag_create(cd->sge_tag, 1, 0, BUS_SPACE_MAXADDR, in sge_dma_alloc()
842 SGE_TSO_MAXSEGSIZE, 0, NULL, NULL, &cd->sge_txmbuf_tag); in sge_dma_alloc()
850 error = bus_dma_tag_create(cd->sge_tag, SGE_RX_BUF_ALIGN, 0, in sge_dma_alloc()
852 MCLBYTES, 0, NULL, NULL, &cd->sge_rxmbuf_tag); in sge_dma_alloc()
861 txd = &cd->sge_txdesc[i]; in sge_dma_alloc()
865 error = bus_dmamap_create(cd->sge_txmbuf_tag, 0, in sge_dma_alloc()
874 error = bus_dmamap_create(cd->sge_rxmbuf_tag, 0, &cd->sge_rx_spare_map); in sge_dma_alloc()
882 rxd = &cd->sge_rxdesc[i]; in sge_dma_alloc()
885 error = bus_dmamap_create(cd->sge_rxmbuf_tag, 0, in sge_dma_alloc()
900 struct sge_chain_data *cd; in sge_dma_free() local
906 cd = &sc->sge_cdata; in sge_dma_free()
909 if (cd->sge_rx_tag != NULL) { in sge_dma_free()
911 bus_dmamap_unload(cd->sge_rx_tag, cd->sge_rx_dmamap); in sge_dma_free()
913 bus_dmamem_free(cd->sge_rx_tag, ld->sge_rx_ring, in sge_dma_free()
914 cd->sge_rx_dmamap); in sge_dma_free()
917 bus_dma_tag_destroy(cd->sge_rx_tag); in sge_dma_free()
918 cd->sge_rx_tag = NULL; in sge_dma_free()
921 if (cd->sge_tx_tag != NULL) { in sge_dma_free()
923 bus_dmamap_unload(cd->sge_tx_tag, cd->sge_tx_dmamap); in sge_dma_free()
925 bus_dmamem_free(cd->sge_tx_tag, ld->sge_tx_ring, in sge_dma_free()
926 cd->sge_tx_dmamap); in sge_dma_free()
929 bus_dma_tag_destroy(cd->sge_tx_tag); in sge_dma_free()
930 cd->sge_tx_tag = NULL; in sge_dma_free()
933 if (cd->sge_rxmbuf_tag != NULL) { in sge_dma_free()
935 rxd = &cd->sge_rxdesc[i]; in sge_dma_free()
937 bus_dmamap_destroy(cd->sge_rxmbuf_tag, in sge_dma_free()
942 if (cd->sge_rx_spare_map != NULL) { in sge_dma_free()
943 bus_dmamap_destroy(cd->sge_rxmbuf_tag, in sge_dma_free()
944 cd->sge_rx_spare_map); in sge_dma_free()
945 cd->sge_rx_spare_map = NULL; in sge_dma_free()
947 bus_dma_tag_destroy(cd->sge_rxmbuf_tag); in sge_dma_free()
948 cd->sge_rxmbuf_tag = NULL; in sge_dma_free()
951 if (cd->sge_txmbuf_tag != NULL) { in sge_dma_free()
953 txd = &cd->sge_txdesc[i]; in sge_dma_free()
955 bus_dmamap_destroy(cd->sge_txmbuf_tag, in sge_dma_free()
960 bus_dma_tag_destroy(cd->sge_txmbuf_tag); in sge_dma_free()
961 cd->sge_txmbuf_tag = NULL; in sge_dma_free()
963 if (cd->sge_tag != NULL) in sge_dma_free()
964 bus_dma_tag_destroy(cd->sge_tag); in sge_dma_free()
965 cd->sge_tag = NULL; in sge_dma_free()
975 struct sge_chain_data *cd; in sge_list_tx_init() local
979 cd = &sc->sge_cdata; in sge_list_tx_init()
982 bus_dmamap_sync(cd->sge_tx_tag, cd->sge_tx_dmamap, in sge_list_tx_init()
984 cd->sge_tx_prod = 0; in sge_list_tx_init()
985 cd->sge_tx_cons = 0; in sge_list_tx_init()
986 cd->sge_tx_cnt = 0; in sge_list_tx_init()
993 struct sge_chain_data *cd; in sge_list_tx_free() local
998 cd = &sc->sge_cdata; in sge_list_tx_free()
1000 txd = &cd->sge_txdesc[i]; in sge_list_tx_free()
1002 bus_dmamap_sync(cd->sge_txmbuf_tag, txd->tx_dmamap, in sge_list_tx_free()
1004 bus_dmamap_unload(cd->sge_txmbuf_tag, txd->tx_dmamap); in sge_list_tx_free()
1022 struct sge_chain_data *cd; in sge_list_rx_init() local
1026 cd = &sc->sge_cdata; in sge_list_rx_init()
1027 cd->sge_rx_cons = 0; in sge_list_rx_init()
1033 bus_dmamap_sync(cd->sge_rx_tag, cd->sge_rx_dmamap, in sge_list_rx_init()
1041 struct sge_chain_data *cd; in sge_list_rx_free() local
1046 cd = &sc->sge_cdata; in sge_list_rx_free()
1048 rxd = &cd->sge_rxdesc[i]; in sge_list_rx_free()
1050 bus_dmamap_sync(cd->sge_rxmbuf_tag, rxd->rx_dmamap, in sge_list_rx_free()
1052 bus_dmamap_unload(cd->sge_rxmbuf_tag, in sge_list_rx_free()
1069 struct sge_chain_data *cd; in sge_newbuf() local
1077 cd = &sc->sge_cdata; in sge_newbuf()
1083 error = bus_dmamap_load_mbuf_sg(cd->sge_rxmbuf_tag, in sge_newbuf()
1084 cd->sge_rx_spare_map, m, segs, &nsegs, 0); in sge_newbuf()
1090 rxd = &cd->sge_rxdesc[prod]; in sge_newbuf()
1092 bus_dmamap_sync(cd->sge_rxmbuf_tag, rxd->rx_dmamap, in sge_newbuf()
1094 bus_dmamap_unload(cd->sge_rxmbuf_tag, rxd->rx_dmamap); in sge_newbuf()
1097 rxd->rx_dmamap = cd->sge_rx_spare_map; in sge_newbuf()
1098 cd->sge_rx_spare_map = map; in sge_newbuf()
1099 bus_dmamap_sync(cd->sge_rxmbuf_tag, rxd->rx_dmamap, in sge_newbuf()
1135 struct sge_chain_data *cd; in sge_rxeof() local
1143 cd = &sc->sge_cdata; in sge_rxeof()
1145 bus_dmamap_sync(cd->sge_rx_tag, cd->sge_rx_dmamap, in sge_rxeof()
1147 cons = cd->sge_rx_cons; in sge_rxeof()
1168 m = cd->sge_rxdesc[cons].rx_m; in sge_rxeof()
1211 bus_dmamap_sync(cd->sge_rx_tag, cd->sge_rx_dmamap, in sge_rxeof()
1213 cd->sge_rx_cons = cons; in sge_rxeof()
1226 struct sge_chain_data *cd; in sge_txeof() local
1235 cd = &sc->sge_cdata; in sge_txeof()
1237 if (cd->sge_tx_cnt == 0) in sge_txeof()
1239 bus_dmamap_sync(cd->sge_tx_tag, cd->sge_tx_dmamap, in sge_txeof()
1241 cons = cd->sge_tx_cons; in sge_txeof()
1242 prod = cd->sge_tx_prod; in sge_txeof()
1266 txd = &cd->sge_txdesc[cons]; in sge_txeof()
1274 bus_dmamap_sync(cd->sge_txmbuf_tag, txd->tx_dmamap, in sge_txeof()
1276 bus_dmamap_unload(cd->sge_txmbuf_tag, txd->tx_dmamap); in sge_txeof()
1279 cd->sge_tx_cnt -= txd->tx_ndesc; in sge_txeof()
1280 KASSERT(cd->sge_tx_cnt >= 0, in sge_txeof()
1285 cd->sge_tx_cons = cons; in sge_txeof()
1286 if (cd->sge_tx_cnt == 0) in sge_txeof()