| 4033 | } |
| 4034 | |
| 4035 | static __rte_always_inline uint16_t |
| 4036 | virtio_dev_tx_async_packed(struct virtio_net *dev, struct vhost_virtqueue *vq, |
| 4037 | struct rte_mempool *mbuf_pool, struct rte_mbuf **pkts, |
| 4038 | uint16_t count, uint16_t dma_id, uint16_t vchan_id, bool legacy_ol_flags) |
| 4039 | __rte_shared_locks_required(&vq->access_lock) |
| 4040 | __rte_shared_locks_required(&vq->iotlb_lock) |
| 4041 | { |
| 4042 | uint32_t pkt_idx = 0; |
| 4043 | uint16_t slot_idx = 0; |
| 4044 | uint16_t nr_done_pkts = 0; |
| 4045 | uint16_t pkt_err = 0; |
| 4046 | uint32_t n_xfer; |
| 4047 | uint16_t i; |
| 4048 | struct vhost_async *async = vq->async; |
| 4049 | struct async_inflight_info *pkts_info = async->pkts_info; |
| 4050 | struct rte_mbuf *pkts_prealloc[MAX_PKT_BURST]; |
| 4051 | |
| 4052 | VHOST_LOG_DATA(dev->ifname, DEBUG, "(%d) about to dequeue %u buffers\n", dev->vid, count); |
| 4053 | |
| 4054 | async_iter_reset(async); |
| 4055 | |
| 4056 | if (rte_pktmbuf_alloc_bulk(mbuf_pool, pkts_prealloc, count)) |
| 4057 | goto out; |
| 4058 | |
| 4059 | do { |
| 4060 | struct rte_mbuf *pkt = pkts_prealloc[pkt_idx]; |
| 4061 | |
| 4062 | rte_prefetch0(&vq->desc_packed[vq->last_avail_idx]); |
| 4063 | |
| 4064 | slot_idx = (async->pkts_idx + pkt_idx) % vq->size; |
| 4065 | if (count - pkt_idx >= PACKED_BATCH_SIZE) { |
| 4066 | if (!virtio_dev_tx_async_packed_batch(dev, vq, &pkts_prealloc[pkt_idx], |
| 4067 | slot_idx, dma_id, vchan_id)) { |
| 4068 | for (i = 0; i < PACKED_BATCH_SIZE; i++) { |
| 4069 | slot_idx = (async->pkts_idx + pkt_idx) % vq->size; |
| 4070 | pkts_info[slot_idx].descs = 1; |
| 4071 | pkts_info[slot_idx].nr_buffers = 1; |
| 4072 | pkts_info[slot_idx].mbuf = pkts_prealloc[pkt_idx]; |
| 4073 | pkt_idx++; |
| 4074 | } |
| 4075 | continue; |
| 4076 | } |
| 4077 | } |
| 4078 | |
| 4079 | if (unlikely(virtio_dev_tx_async_single_packed(dev, vq, mbuf_pool, pkt, |
| 4080 | slot_idx, legacy_ol_flags))) { |
| 4081 | rte_pktmbuf_free_bulk(&pkts_prealloc[pkt_idx], count - pkt_idx); |
| 4082 | |
| 4083 | if (slot_idx == 0) |
| 4084 | slot_idx = vq->size - 1; |
| 4085 | else |
| 4086 | slot_idx--; |
| 4087 | |
| 4088 | break; |
| 4089 | } |
| 4090 | |
| 4091 | pkts_info[slot_idx].mbuf = pkt; |
| 4092 | pkt_idx++; |
no test coverage detected