Lines Matching defs:rxq
312 aprint_error(": failed to init rxq: %d\n", error);
608 struct bcmeth_rxqueue * const rxq = &sc->sc_rxq;
616 bcmeth_write_4(sc, rxq->rxq_reg_rcvctl,
617 bcmeth_read_4(sc, rxq->rxq_reg_rcvctl) & ~RCVCTL_ENABLE);
628 uint32_t rx0 = bcmeth_read_4(sc, rxq->rxq_reg_rcvsts0);
694 struct bcmeth_rxqueue *rxq,
698 bus_dmamap_sync(sc->sc_dmat, rxq->rxq_descmap,
699 (rxdb - rxq->rxq_first) * sizeof(*rxdb), count * sizeof(*rxdb),
706 struct bcmeth_rxqueue *rxq,
710 bus_dmamap_sync(sc->sc_dmat, rxq->rxq_descmap,
711 (rxdb - rxq->rxq_first) * sizeof(*rxdb), count * sizeof(*rxdb),
942 struct bcmeth_rxqueue *rxq)
944 struct gmac_rxdb *producer = rxq->rxq_producer;
947 while (rxq->rxq_inuse < rxq->rxq_threshold) {
964 *rxq->rxq_mtail = m;
965 rxq->rxq_mtail = &m->m_next;
968 rxq->rxq_inuse++;
969 if (++producer == rxq->rxq_last) {
971 bcmeth_rxq_desc_presync(sc, rxq, rxq->rxq_producer,
972 rxq->rxq_last - rxq->rxq_producer);
973 producer = rxq->rxq_producer = rxq->rxq_first;
979 if (producer != rxq->rxq_producer) {
980 bcmeth_rxq_desc_presync(sc, rxq, rxq->rxq_producer,
981 producer - rxq->rxq_producer);
982 rxq->rxq_producer = producer;
984 bcmeth_write_4(sc, rxq->rxq_reg_rcvptr,
985 rxq->rxq_descmap->dm_segs[0].ds_addr
1033 struct bcmeth_rxqueue *rxq,
1037 struct gmac_rxdb *consumer = rxq->rxq_consumer;
1042 if (consumer == rxq->rxq_producer) {
1043 KASSERT(rxq->rxq_inuse == 0);
1047 uint32_t rcvsts0 = bcmeth_read_4(sc, rxq->rxq_reg_rcvsts0);
1049 if (consumer == rxq->rxq_first + currdscr) {
1052 bcmeth_rxq_desc_postsync(sc, rxq, consumer, 1);
1060 KASSERT(rxq->rxq_mhead != NULL);
1061 bus_dmamap_t map = M_GETCTX(rxq->rxq_mhead, bus_dmamap_t);
1064 memcpy(&rxsts, rxq->rxq_mhead->m_data, 4);
1068 currdscr, consumer - rxq->rxq_first);
1081 struct mbuf *m = rxq->rxq_mhead;
1084 if (++consumer == rxq->rxq_last) {
1085 consumer = rxq->rxq_first;
1087 KASSERTMSG(consumer != rxq->rxq_first + currdscr,
1090 consumer - rxq->rxq_first);
1097 if ((rxq->rxq_mhead = m_last->m_next) == NULL)
1098 rxq->rxq_mtail = &rxq->rxq_mhead;
1116 consumer - rxq->rxq_first, desc_count, rxsts);
1143 if (++consumer == rxq->rxq_last) {
1146 rxq->rxq_consumer = rxq->rxq_first;
1148 rxq->rxq_consumer = consumer;
1150 rxq->rxq_inuse -= rxconsumed;
1163 consumer = rxq->rxq_consumer;
1172 if (++consumer == rxq->rxq_last) {
1174 consumer = rxq->rxq_first;
1181 rxq->rxq_consumer = consumer;
1182 rxq->rxq_inuse -= rxconsumed;
1193 struct bcmeth_rxqueue *rxq,
1198 if ((m = rxq->rxq_mhead) != NULL) {
1212 rxq->rxq_mhead = NULL;
1213 rxq->rxq_mtail = &rxq->rxq_mhead;
1214 rxq->rxq_inuse = 0;
1220 struct bcmeth_rxqueue *rxq)
1225 bcmeth_rxq_desc_postsync(sc, rxq, rxq->rxq_first,
1226 rxq->rxq_last - rxq->rxq_first);
1232 for (rxdb = rxq->rxq_first; rxdb < rxq
1244 rxq->rxq_consumer = rxq->rxq_first;
1245 rxq->rxq_producer = rxq->rxq_first;
1246 rxq->rxq_inuse = 0;
1247 if (rxq->rxq_threshold < BCMETH_MINRXMBUFS)
1248 rxq->rxq_threshold = BCMETH_MINRXMBUFS;
1255 bcmeth_write_4(sc, rxq->rxq_reg_rcvaddrlo,
1256 rxq->rxq_descmap->dm_segs[0].ds_addr);
1262 struct bcmeth_rxqueue *rxq,
1265 size_t desc_count = BCMETH_RINGSIZE / sizeof(rxq->rxq_first[0]);
1272 &rxq->rxq_descmap_seg, &rxq->rxq_descmap, &descs);
1277 rxq->rxq_first = descs;
1278 rxq->rxq_last = rxq->rxq_first + desc_count;
1279 rxq->rxq_consumer = descs;
1280 rxq->rxq_producer = descs;
1282 bcmeth_rxq_purge(sc, rxq, true);
1283 bcmeth_rxq_reset(sc, rxq);
1285 rxq->rxq_reg_rcvaddrlo = GMAC_RCVADDR_LOW;
1286 rxq->rxq_reg_rcvctl = GMAC_RCVCONTROL;
1287 rxq->rxq_reg_rcvptr = GMAC_RCVPTR;
1288 rxq->rxq_reg_rcvsts0 = GMAC_RCVSTATUS0;
1289 rxq->rxq_reg_rcvsts1 = GMAC_RCVSTATUS1;
1791 struct bcmeth_rxqueue * const rxq = &sc->sc_rxq;
1794 uint32_t rcvsts0 = bcmeth_read_4(sc, rxq->rxq_reg_rcvsts0);
1796 if (descs < rxq->rxq_consumer - rxq->rxq_first) {
1801 descs += rxq->rxq_last - rxq->rxq_consumer;
1803 descs -= rxq->rxq_consumer - rxq->rxq_first;
1975 struct bcmeth_rxqueue * const rxq = &sc->sc_rxq;
1976 size_t threshold = 5 * rxq->rxq_threshold / 4;
1977 if (threshold >= rxq->rxq_last - rxq->rxq_first) {
1978 threshold = rxq->rxq_last - rxq->rxq_first - 1;
1984 rxq->rxq_threshold, threshold);
1985 rxq->rxq_threshold = threshold;