Lines Matching defs:txq

210 	struct netfront_txq 	*txq;
422 XN_TX_LOCK(&np->txq[i]);
427 XN_TX_UNLOCK(&np->txq[i]);
447 XN_TX_LOCK(&info->txq[i]);
452 XN_TX_UNLOCK(&info->txq[i]);
464 struct netfront_txq *txq,
473 KASSERT(rxq->id == txq->id, ("Mismatch between RX and TX queue ids"));
475 KASSERT(rxq->xen_intr_handle == txq->xen_intr_handle,
488 err = xs_printf(*xst, path, "tx-ring-ref","%u", txq->ring_ref);
554 &info->txq[0], &xst, false);
567 &info->txq[i], &xst, true);
633 xn_txq_start(struct netfront_txq *txq)
635 struct netfront_info *np = txq->info;
638 XN_TX_LOCK_ASSERT(txq);
639 if (!drbr_empty(ifp, txq->br))
640 xn_txq_mq_start_locked(txq, NULL);
644 xn_txq_intr(struct netfront_txq *txq)
647 XN_TX_LOCK(txq);
648 if (RING_HAS_UNCONSUMED_RESPONSES(&txq->ring))
649 xn_txeof(txq);
650 xn_txq_start(txq);
651 XN_TX_UNLOCK(txq);
657 struct netfront_txq *txq = xtxq;
659 XN_TX_LOCK(txq);
660 xn_txq_start(txq);
661 XN_TX_UNLOCK(txq);
767 disconnect_txq(struct netfront_txq *txq)
770 xn_release_tx_bufs(txq);
771 gnttab_free_grant_references(txq->gref_head);
772 gnttab_end_foreign_access(txq->ring_ref, NULL);
773 xen_intr_unbind(&txq->xen_intr_handle);
777 destroy_txq(struct netfront_txq *txq)
780 free(txq->ring.sring, M_DEVBUF);
781 buf_ring_free(txq->br, M_DEVBUF);
782 taskqueue_drain_all(txq->tq);
783 taskqueue_free(txq->tq);
792 destroy_txq(&np->txq[i]);
794 free(np->txq, M_DEVBUF);
795 np->txq = NULL;
805 struct netfront_txq *txq;
807 info->txq = malloc(sizeof(struct netfront_txq) * num_queues,
811 txq = &info->txq[q];
813 txq->id = q;
814 txq->info = info;
816 txq->ring_ref = GRANT_REF_INVALID;
817 txq->ring.sring = NULL;
819 snprintf(txq->name, XN_QUEUE_NAME_LEN, "xntx_%u", q);
821 mtx_init(&txq->lock, txq->name, "netfront transmit lock",
825 txq->mbufs[i] = (void *) ((u_long) i+1);
826 txq->grant_ref[i] = GRANT_REF_INVALID;
828 txq->mbufs[NET_TX_RING_SIZE] = (void *)0;
833 &txq->gref_head) != 0) {
842 FRONT_RING_INIT(&txq->ring, txs, PAGE_SIZE);
845 &txq->ring_ref);
851 txq->br = buf_ring_alloc(NET_TX_RING_SIZE, M_DEVBUF,
852 M_WAITOK, &txq->lock);
853 TASK_INIT(&txq->defrtask, 0, xn_txq_tq_deferred, txq);
855 txq->tq = taskqueue_create(txq->name, M_WAITOK,
856 taskqueue_thread_enqueue, &txq->tq);
858 error = taskqueue_start_threads(&txq->tq, 1, PI_NET,
859 "%s txq %d", device_get_nameunit(dev), txq->id);
862 txq->id);
868 &info->txq[q], INTR_TYPE_NET | INTR_MPSAFE | INTR_ENTROPY,
869 &txq->xen_intr_handle);
880 taskqueue_drain_all(txq->tq);
882 buf_ring_free(txq->br, M_DEVBUF);
883 taskqueue_free(txq->tq);
884 gnttab_end_foreign_access(txq->ring_ref, NULL);
886 gnttab_free_grant_references(txq->gref_head);
887 free(txq->ring.sring, M_DEVBUF);
890 disconnect_txq(&info->txq[q]);
891 destroy_txq(&info->txq[q]);
894 free(info->txq, M_DEVBUF);
905 if (info->txq)
924 info->rxq[q].xen_intr_handle = info->txq[q].xen_intr_handle;
1005 xn_tx_slot_available(struct netfront_txq *txq)
1008 return (RING_FREE_REQUESTS(&txq->ring) > (MAX_TX_REQ_FRAGS + 2));
1012 xn_release_tx_bufs(struct netfront_txq *txq)
1019 m = txq->mbufs[i];
1029 gnttab_end_foreign_access_ref(txq->grant_ref[i]);
1030 gnttab_release_grant_reference(&txq->gref_head,
1031 txq->grant_ref[i]);
1032 txq->grant_ref[i] = GRANT_REF_INVALID;
1033 add_id_to_freelist(txq->mbufs, i);
1034 txq->mbufs_cnt--;
1035 if (txq->mbufs_cnt < 0) {
1258 xn_txeof(struct netfront_txq *txq)
1265 struct netfront_info *np = txq->info;
1267 XN_TX_LOCK_ASSERT(txq);
1275 prod = txq->ring.sring->rsp_prod;
1278 for (i = txq->ring.rsp_cons; i != prod; i++) {
1279 txr = RING_GET_RESPONSE(&txq->ring, i);
1288 m = txq->mbufs[id];
1296 txq->grant_ref[id]) != 0)) {
1300 gnttab_end_foreign_access_ref(txq->grant_ref[id]);
1302 &txq->gref_head, txq->grant_ref[id]);
1303 txq->grant_ref[id] = GRANT_REF_INVALID;
1305 txq->mbufs[id] = NULL;
1306 add_id_to_freelist(txq->mbufs, id);
1307 txq->mbufs_cnt--;
1309 /* Only mark the txq active if we've freed up at least one slot to try */
1312 txq->ring.rsp_cons = prod;
1323 txq->ring.sring->rsp_event =
1324 prod + ((txq->ring.sring->req_prod - prod) >> 1) + 1;
1327 } while (prod != txq->ring.sring->rsp_prod);
1329 if (txq->full &&
1330 ((txq->ring.sring->req_prod - prod) < NET_TX_RING_SIZE)) {
1331 txq->full = false;
1332 xn_txq_start(txq);
1339 struct netfront_txq *txq = xsc;
1340 struct netfront_info *np = txq->info;
1341 struct netfront_rxq *rxq = &np->rxq[txq->id];
1345 xn_txq_intr(txq);
1528 xn_assemble_tx_request(struct netfront_txq *txq, struct mbuf *m_head)
1531 struct netfront_info *np = txq->info;
1594 KASSERT((txq->mbufs_cnt + nfrags) <= NET_TX_RING_SIZE,
1596 "(%d)!", __func__, (int) txq->mbufs_cnt,
1612 tx = RING_GET_REQUEST(&txq->ring, txq->ring.req_prod_pvt);
1613 id = get_id_from_freelist(txq->mbufs);
1617 txq->mbufs_cnt++;
1618 if (txq->mbufs_cnt > NET_TX_RING_SIZE)
1621 txq->mbufs[id] = m;
1623 ref = gnttab_claim_grant_reference(&txq->gref_head);
1628 tx->gref = txq->grant_ref[id] = ref;
1662 RING_GET_REQUEST(&txq->ring,
1663 ++txq->ring.req_prod_pvt);
1682 txq->ring.req_prod_pvt++;
1691 xn_txeof(txq);
1925 struct netfront_txq *txq;
1947 txq = &np->txq[i];
1948 xn_release_tx_bufs(txq);
1972 struct netfront_txq *txq;
1976 txq = &np->txq[i];
1978 xen_intr_signal(txq->xen_intr_handle);
1979 XN_TX_LOCK(txq);
1980 xn_txeof(txq);
1981 XN_TX_UNLOCK(txq);
2087 xn_txq_mq_start_locked(struct netfront_txq *txq, struct mbuf *m)
2094 np = txq->info;
2095 br = txq->br;
2099 XN_TX_LOCK_ASSERT(txq);
2115 if (!xn_tx_slot_available(txq)) {
2120 error = xn_assemble_tx_request(txq, m);
2127 RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&txq->ring, notify);
2129 xen_intr_signal(txq->xen_intr_handle);
2134 if (RING_FULL(&txq->ring))
2135 txq->full = true;
2144 struct netfront_txq *txq;
2161 txq = &np->txq[i];
2163 if (XN_TX_TRYLOCK(txq) != 0) {
2164 error = xn_txq_mq_start_locked(txq, m);
2165 XN_TX_UNLOCK(txq);
2167 error = drbr_enqueue(ifp, txq->br, m);
2168 taskqueue_enqueue(txq->tq, &txq->defrtask);
2178 struct netfront_txq *txq;
2185 txq = &np->txq[i];
2187 XN_TX_LOCK(txq);
2188 while ((m = buf_ring_dequeue_sc(txq->br)) != NULL)
2190 XN_TX_UNLOCK(txq);
2273 free(np->txq, M_DEVBUF);
2286 XN_TX_LOCK(&np->txq[i]);
2291 XN_TX_UNLOCK(&np->txq[i]);
2296 disconnect_txq(&np->txq[i]);