Lines Matching defs:txq
136 #define GE_TXDSYNC(sc, txq, n, ops) \
137 bus_dmamap_sync((sc)->sc_dmat, (txq)->txq_desc_mem.gdm_map, \
138 (n) * sizeof((txq)->txq_descs[0]), sizeof((txq)->txq_descs[0]), \
140 #define GE_TXDPRESYNC(sc, txq, n) \
141 GE_TXDSYNC(sc, txq, n, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE)
142 #define GE_TXDPOSTSYNC(sc, txq, n) \
143 GE_TXDSYNC(sc, txq, n, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE)
731 struct gfe_txqueue * const txq = &sc->sc_txq[GE_TXPRIO_HI];
738 curtxdnum = (GE_READ(sc, txq->txq_ectdp) -
739 txq->txq_desc_busaddr) / sizeof(txq->txq_descs[0]);
740 GE_TXDPOSTSYNC(sc, txq, txq->txq_fi);
741 GE_TXDPOSTSYNC(sc, txq, curtxdnum);
743 txq->txq_fi, txq->txq_descs[txq->txq_fi].ed_cmdsts,
744 txq->txq_lo, curtxdnum, txq->txq_descs[curtxdnum].ed_cmdsts,
746 GE_TXDPRESYNC(sc, txq, txq->txq_fi);
747 GE_TXDPRESYNC(sc, txq, curtxdnum);
1190 struct gfe_txqueue * const txq = &sc->sc_txq[txprio];
1191 volatile struct gt_eth_desc * const txd = &txq->txq_descs[txq->txq_lo];
1200 * if the txq is not yet created.
1203 if (txq == NULL || (m = txq->txq_pendq.ifq_head) == NULL) {
1212 if (GE_TXDESC_MAX == txq->txq_nactive + 2) {
1213 volatile struct gt_eth_desc * const txd2 = &txq->txq_descs[txq->txq_fi];
1216 GE_TXDPOSTSYNC(sc, txq, txq->txq_fi);
1228 nextin = txq->txq_fi + 1;
1231 GE_TXDPOSTSYNC(sc, txq, nextin);
1232 if (gt32toh(txq->txq_descs[nextin].ed_cmdsts) & TX_CMD_O) {
1233 GE_TXDPRESYNC(sc, txq, txq->txq_fi);
1234 GE_TXDPRESYNC(sc, txq, nextin);
1240 device_xname(sc->sc_dev), txq->txq_fi);
1243 if (++txq->txq_fi == GE_TXDESC_MAX)
1244 txq->txq_fi = 0;
1245 txq->txq_inptr = gt32toh(txd2->ed_bufptr) - txq->txq_buf_busaddr;
1247 txq->txq_inptr += roundup(pktlen, dcache_line_size);
1248 txq->txq_nactive--;
1263 if (txq->txq_outptr + buflen > GE_TXBUF_SIZE) {
1264 txq->txq_ei_gapcount += GE_TXBUF_SIZE - txq->txq_outptr;
1265 txq->txq_outptr = 0;
1272 if (txq->txq_nactive > 0 && txq->txq_outptr <= txq->txq_inptr &&
1273 txq->txq_outptr + buflen > txq->txq_inptr) {
1274 intrmask |= txq->txq_intrbits &
1293 (char *)txq->txq_buf_mem.gdm_kva + (int)txq->txq_outptr);
1294 bus_dmamap_sync(sc->sc_dmat, txq->txq_buf_mem.gdm_map,
1295 txq->txq_outptr, buflen, BUS_DMASYNC_PREWRITE);
1296 txd->ed_bufptr = htogt32(txq->txq_buf_busaddr + txq->txq_outptr);
1298 GE_TXDPRESYNC(sc, txq, txq->txq_lo);
1304 txq->txq_ei_gapcount += buflen;
1305 if (txq->txq_ei_gapcount > 2 * GE_TXBUF_SIZE / 3) {
1307 txq->txq_ei_gapcount = 0;
1312 GE_DPRINTF(sc, ("([%d]->%08lx.%08lx.%08lx.%08lx)", txq->txq_lo,
1316 GE_TXDPRESYNC(sc, txq, txq->txq_lo);
1318 txq->txq_outptr += buflen;
1323 txq->txq_esdcmrbits & (ETH_ESDCMR_TXDH | ETH_ESDCMR_TXDL));
1325 GE_DPRINTF(sc, ("(%d)", txq->txq_lo));
1330 txq->txq_nactive++;
1331 if (++txq->txq_lo == GE_TXDESC_MAX)
1332 txq->txq_lo = 0;
1337 IF_DEQUEUE(&txq->txq_pendq, m);
1347 intrmask |= txq->txq_intrbits & (ETH_IR_TxEndHigh | ETH_IR_TxEndLow);
1361 struct gfe_txqueue * const txq = &sc->sc_txq[txprio];
1366 if (txq == NULL) {
1371 while (txq->txq_nactive > 0) {
1373 volatile struct gt_eth_desc *txd = &txq->txq_descs[txq->txq_fi];
1377 GE_TXDPOSTSYNC(sc, txq, txq->txq_fi);
1381 if (txq->txq_nactive == 1) {
1382 GE_TXDPRESYNC(sc, txq, txq->txq_fi);
1395 nextin = txq->txq_fi + 1;
1398 GE_TXDPOSTSYNC(sc, txq, nextin);
1399 if (gt32toh(txq->txq_descs[nextin].ed_cmdsts) & TX_CMD_O) {
1400 GE_TXDPRESYNC(sc, txq, txq->txq_fi);
1401 GE_TXDPRESYNC(sc, txq, nextin);
1407 device_xname(sc->sc_dev), txq->txq_fi);
1412 txq->txq_lo,
1416 GE_DPRINTF(sc, ("(%d)", txq->txq_fi));
1417 if (++txq->txq_fi == GE_TXDESC_MAX)
1418 txq->txq_fi = 0;
1419 txq->txq_inptr = gt32toh(txd->ed_bufptr) - txq->txq_buf_busaddr;
1421 bus_dmamap_sync(sc->sc_dmat, txq->txq_buf_mem.gdm_map,
1422 txq->txq_inptr, pktlen, BUS_DMASYNC_POSTWRITE);
1423 txq->txq_inptr += roundup(pktlen, dcache_line_size);
1433 --txq->txq_nactive;
1435 if (txq->txq_nactive != 0)
1437 device_xname(sc->sc_dev), txprio, txq->txq_nactive);
1440 ~(txq->txq_intrbits & (ETH_IR_TxEndHigh | ETH_IR_TxEndLow));
1442 ~(txq->txq_intrbits & (ETH_IR_TxBufferHigh | ETH_IR_TxBufferLow));
1450 struct gfe_txqueue * const txq = &sc->sc_txq[txprio];
1455 error = gfe_dmamem_alloc(sc, &txq->txq_desc_mem, 1,
1461 error = gfe_dmamem_alloc(sc, &txq->txq_buf_mem, 1, GE_TXBUF_SIZE, 0);
1463 gfe_dmamem_free(sc, &txq->txq_desc_mem);
1474 struct gfe_txqueue * const txq = &sc->sc_txq[txprio];
1488 KASSERT(txq->txq_desc_mem.gdm_kva != NULL);
1489 KASSERT(txq->txq_buf_mem.gdm_kva != NULL);
1498 txq->txq_descs =
1499 (volatile struct gt_eth_desc *) txq->txq_desc_mem.gdm_kva;
1500 txq->txq_desc_busaddr = txq->txq_desc_mem.gdm_map->dm_segs[0].ds_addr;
1501 txq->txq_buf_busaddr = txq->txq_buf_mem.gdm_map->dm_segs[0].ds_addr;
1503 txq->txq_pendq.ifq_maxlen = 10;
1504 txq->txq_ei_gapcount = 0;
1505 txq->txq_nactive = 0;
1506 txq->txq_fi = 0;
1507 txq->txq_lo = 0;
1508 txq->txq_inptr = GE_TXBUF_SIZE;
1509 txq->txq_outptr = 0;
1510 for (i = 0, txd = txq->txq_descs,
1511 addr = txq->txq_desc_busaddr + sizeof(*txd);
1519 txq->txq_descs[GE_TXDESC_MAX-1].ed_nxtptr =
1520 htogt32(txq->txq_desc_busaddr);
1521 bus_dmamap_sync(sc->sc_dmat, txq->txq_desc_mem.gdm_map, 0,
1526 txq->txq_intrbits = ETH_IR_TxEndHigh | ETH_IR_TxBufferHigh;
1527 txq->txq_esdcmrbits = ETH_ESDCMR_TXDH;
1528 txq->txq_epsrbits = ETH_EPSR_TxHigh;
1529 txq->txq_ectdp = ETH_ECTDP1;
1530 GE_WRITE(sc, ETH_ECTDP1, txq->txq_desc_busaddr);
1534 txq->txq_intrbits = ETH_IR_TxEndLow | ETH_IR_TxBufferLow;
1535 txq->txq_esdcmrbits = ETH_ESDCMR_TXDL;
1536 txq->txq_epsrbits = ETH_EPSR_TxLow;
1537 txq->txq_ectdp = ETH_ECTDP0;
1538 GE_WRITE(sc, ETH_ECTDP0, txq->txq_desc_busaddr);
1545 GE_DPRINTF(sc, ("(ectdp=%#x", txq->txq_ectdp));
1546 GE_WRITE(sc->sc_dev, txq->txq_ectdp, txq->txq_desc_busaddr);
1566 struct gfe_txqueue * const txq = &sc->sc_txq[txprio];
1569 if (txq == NULL) {
1580 gfe_dmamem_free(sc, &txq->txq_desc_mem);
1581 gfe_dmamem_free(sc, &txq->txq_buf_mem);