| 149 | } |
| 150 | |
| 151 | static __rte_always_inline uint16_t |
| 152 | vhost_async_dma_transfer(struct virtio_net *dev, struct vhost_virtqueue *vq, |
| 153 | int16_t dma_id, uint16_t vchan_id, uint16_t head_idx, |
| 154 | struct vhost_iov_iter *pkts, uint16_t nr_pkts) |
| 155 | __rte_shared_locks_required(&vq->access_lock) |
| 156 | { |
| 157 | struct async_dma_vchan_info *dma_info = &dma_copy_track[dma_id].vchans[vchan_id]; |
| 158 | int64_t ret, nr_copies = 0; |
| 159 | uint16_t pkt_idx; |
| 160 | |
| 161 | rte_spinlock_lock(&dma_info->dma_lock); |
| 162 | |
| 163 | for (pkt_idx = 0; pkt_idx < nr_pkts; pkt_idx++) { |
| 164 | ret = vhost_async_dma_transfer_one(dev, vq, dma_id, vchan_id, head_idx, |
| 165 | &pkts[pkt_idx]); |
| 166 | if (unlikely(ret < 0)) |
| 167 | break; |
| 168 | |
| 169 | nr_copies += ret; |
| 170 | head_idx++; |
| 171 | if (head_idx >= vq->size) |
| 172 | head_idx -= vq->size; |
| 173 | } |
| 174 | |
| 175 | if (likely(nr_copies > 0)) |
| 176 | rte_dma_submit(dma_id, vchan_id); |
| 177 | |
| 178 | rte_spinlock_unlock(&dma_info->dma_lock); |
| 179 | |
| 180 | return pkt_idx; |
| 181 | } |
| 182 | |
| 183 | static __rte_always_inline uint16_t |
| 184 | vhost_async_dma_check_completed(struct virtio_net *dev, int16_t dma_id, uint16_t vchan_id, |
no test coverage detected