Lines Matching defs:txq

229 	struct netfront_txq 	*txq;
441 XN_TX_LOCK(&np->txq[i]);
446 XN_TX_UNLOCK(&np->txq[i]);
466 XN_TX_LOCK(&info->txq[i]);
471 XN_TX_UNLOCK(&info->txq[i]);
483 struct netfront_txq *txq,
492 KASSERT(rxq->id == txq->id, ("Mismatch between RX and TX queue ids"));
494 KASSERT(rxq->xen_intr_handle == txq->xen_intr_handle,
507 err = xs_printf(*xst, path, "tx-ring-ref","%u", txq->ring_ref);
573 &info->txq[0], &xst, false);
586 &info->txq[i], &xst, true);
652 xn_txq_start(struct netfront_txq *txq)
654 struct netfront_info *np = txq->info;
657 XN_TX_LOCK_ASSERT(txq);
658 if (!drbr_empty(ifp, txq->br))
659 xn_txq_mq_start_locked(txq, NULL);
663 xn_txq_intr(struct netfront_txq *txq)
666 XN_TX_LOCK(txq);
667 if (RING_HAS_UNCONSUMED_RESPONSES(&txq->ring))
668 xn_txeof(txq);
669 xn_txq_start(txq);
670 XN_TX_UNLOCK(txq);
676 struct netfront_txq *txq = xtxq;
678 XN_TX_LOCK(txq);
679 xn_txq_start(txq);
680 XN_TX_UNLOCK(txq);
786 disconnect_txq(struct netfront_txq *txq)
789 xn_release_tx_bufs(txq);
790 gnttab_free_grant_references(txq->gref_head);
791 gnttab_end_foreign_access(txq->ring_ref, NULL);
792 xen_intr_unbind(&txq->xen_intr_handle);
796 destroy_txq(struct netfront_txq *txq)
799 free(txq->ring.sring, M_DEVBUF);
800 buf_ring_free(txq->br, M_DEVBUF);
801 taskqueue_drain_all(txq->tq);
802 taskqueue_free(txq->tq);
811 destroy_txq(&np->txq[i]);
813 free(np->txq, M_DEVBUF);
814 np->txq = NULL;
824 struct netfront_txq *txq;
826 info->txq = malloc(sizeof(struct netfront_txq) * num_queues,
830 txq = &info->txq[q];
832 txq->id = q;
833 txq->info = info;
835 txq->ring_ref = GRANT_REF_INVALID;
836 txq->ring.sring = NULL;
838 snprintf(txq->name, XN_QUEUE_NAME_LEN, "xntx_%u", q);
840 mtx_init(&txq->lock, txq->name, "netfront transmit lock",
844 txq->mbufs[i] = (void *) ((u_long) i+1);
845 txq->grant_ref[i] = GRANT_REF_INVALID;
847 txq->mbufs[NET_TX_RING_SIZE] = (void *)0;
852 &txq->gref_head) != 0) {
861 FRONT_RING_INIT(&txq->ring, txs, PAGE_SIZE);
864 &txq->ring_ref);
870 txq->br = buf_ring_alloc(NET_TX_RING_SIZE, M_DEVBUF,
871 M_WAITOK, &txq->lock);
872 TASK_INIT(&txq->defrtask, 0, xn_txq_tq_deferred, txq);
874 txq->tq = taskqueue_create(txq->name, M_WAITOK,
875 taskqueue_thread_enqueue, &txq->tq);
877 error = taskqueue_start_threads(&txq->tq, 1, PI_NET,
878 "%s txq %d", device_get_nameunit(dev), txq->id);
881 txq->id);
887 &info->txq[q], INTR_TYPE_NET | INTR_MPSAFE | INTR_ENTROPY,
888 &txq->xen_intr_handle);
899 taskqueue_drain_all(txq->tq);
901 buf_ring_free(txq->br, M_DEVBUF);
902 taskqueue_free(txq->tq);
903 gnttab_end_foreign_access(txq->ring_ref, NULL);
905 gnttab_free_grant_references(txq->gref_head);
906 free(txq->ring.sring, M_DEVBUF);
909 disconnect_txq(&info->txq[q]);
910 destroy_txq(&info->txq[q]);
913 free(info->txq, M_DEVBUF);
924 if (info->txq)
943 info->rxq[q].xen_intr_handle = info->txq[q].xen_intr_handle;
1024 xn_tx_slot_available(struct netfront_txq *txq)
1027 return (RING_FREE_REQUESTS(&txq->ring) > (MAX_TX_REQ_FRAGS + 2));
1031 xn_release_tx_bufs(struct netfront_txq *txq)
1038 m = txq->mbufs[i];
1048 gnttab_end_foreign_access_ref(txq->grant_ref[i]);
1049 gnttab_release_grant_reference(&txq->gref_head,
1050 txq->grant_ref[i]);
1051 txq->grant_ref[i] = GRANT_REF_INVALID;
1052 add_id_to_freelist(txq->mbufs, i);
1053 txq->mbufs_cnt--;
1054 if (txq->mbufs_cnt < 0) {
1284 xn_txeof(struct netfront_txq *txq)
1291 struct netfront_info *np = txq->info;
1293 XN_TX_LOCK_ASSERT(txq);
1301 prod = txq->ring.sring->rsp_prod;
1304 for (i = txq->ring.rsp_cons; i != prod; i++) {
1305 txr = RING_GET_RESPONSE(&txq->ring, i);
1314 m = txq->mbufs[id];
1328 txq->grant_ref[id]) != 0)) {
1332 gnttab_end_foreign_access_ref(txq->grant_ref[id]);
1334 &txq->gref_head, txq->grant_ref[id]);
1335 txq->grant_ref[id] = GRANT_REF_INVALID;
1337 txq->mbufs[id] = NULL;
1338 add_id_to_freelist(txq->mbufs, id);
1339 txq->mbufs_cnt--;
1341 /* Only mark the txq active if we've freed up at least one slot to try */
1344 txq->ring.rsp_cons = prod;
1355 txq->ring.sring->rsp_event =
1356 prod + ((txq->ring.sring->req_prod - prod) >> 1) + 1;
1359 } while (prod != txq->ring.sring->rsp_prod);
1361 if (txq->full &&
1362 ((txq->ring.sring->req_prod - prod) < NET_TX_RING_SIZE)) {
1363 txq->full = false;
1364 xn_txq_start(txq);
1371 struct netfront_txq *txq = xsc;
1372 struct netfront_info *np = txq->info;
1373 struct netfront_rxq *rxq = &np->rxq[txq->id];
1377 xn_txq_intr(txq);
1560 xn_assemble_tx_request(struct netfront_txq *txq, struct mbuf *m_head)
1563 struct netfront_info *np = txq->info;
1626 KASSERT((txq->mbufs_cnt + nfrags) <= NET_TX_RING_SIZE,
1628 "(%d)!", __func__, (int) txq->mbufs_cnt,
1644 tx = RING_GET_REQUEST(&txq->ring, txq->ring.req_prod_pvt);
1645 id = get_id_from_freelist(txq->mbufs);
1649 txq->mbufs_cnt++;
1650 if (txq->mbufs_cnt > NET_TX_RING_SIZE)
1653 txq->mbufs[id] = m;
1655 ref = gnttab_claim_grant_reference(&txq->gref_head);
1660 tx->gref = txq->grant_ref[id] = ref;
1694 RING_GET_REQUEST(&txq->ring,
1695 ++txq->ring.req_prod_pvt);
1714 txq->ring.req_prod_pvt++;
1718 xn_txeof(txq);
1720 txq->stats.tx_bytes += m_head->m_pkthdr.len;
1721 txq->stats.tx_packets++;
1952 struct netfront_txq *txq;
1974 txq = &np->txq[i];
1975 xn_release_tx_bufs(txq);
1999 struct netfront_txq *txq;
2003 txq = &np->txq[i];
2005 xen_intr_signal(txq->xen_intr_handle);
2006 XN_TX_LOCK(txq);
2007 xn_txeof(txq);
2008 XN_TX_UNLOCK(txq);
2114 xn_txq_mq_start_locked(struct netfront_txq *txq, struct mbuf *m)
2121 np = txq->info;
2122 br = txq->br;
2126 XN_TX_LOCK_ASSERT(txq);
2142 if (!xn_tx_slot_available(txq)) {
2147 error = xn_assemble_tx_request(txq, m);
2154 RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&txq->ring, notify);
2156 xen_intr_signal(txq->xen_intr_handle);
2161 if (RING_FULL(&txq->ring))
2162 txq->full = true;
2171 struct netfront_txq *txq;
2188 txq = &np->txq[i];
2190 if (XN_TX_TRYLOCK(txq) != 0) {
2191 error = xn_txq_mq_start_locked(txq, m);
2192 XN_TX_UNLOCK(txq);
2194 error = drbr_enqueue(ifp, txq->br, m);
2195 taskqueue_enqueue(txq->tq, &txq->defrtask);
2205 struct netfront_txq *txq;
2212 txq = &np->txq[i];
2214 XN_TX_LOCK(txq);
2215 while ((m = buf_ring_dequeue_sc(txq->br)) != NULL)
2217 XN_TX_UNLOCK(txq);
2300 free(np->txq, M_DEVBUF);
2313 XN_TX_LOCK(&np->txq[i]);
2318 XN_TX_UNLOCK(&np->txq[i]);
2323 disconnect_txq(&np->txq[i]);