| 3488 | } |
| 3489 | |
| 3490 | __rte_always_inline |
| 3491 | static uint16_t |
| 3492 | virtio_dev_tx_packed(struct virtio_net *dev, |
| 3493 | struct vhost_virtqueue *__rte_restrict vq, |
| 3494 | struct rte_mempool *mbuf_pool, |
| 3495 | struct rte_mbuf **__rte_restrict pkts, |
| 3496 | uint32_t count, |
| 3497 | bool legacy_ol_flags) |
| 3498 | __rte_shared_locks_required(&vq->access_lock) |
| 3499 | __rte_shared_locks_required(&vq->iotlb_lock) |
| 3500 | { |
| 3501 | uint32_t pkt_idx = 0; |
| 3502 | |
| 3503 | if (rte_pktmbuf_alloc_bulk(mbuf_pool, pkts, count)) |
| 3504 | return 0; |
| 3505 | |
| 3506 | do { |
| 3507 | rte_prefetch0(&vq->desc_packed[vq->last_avail_idx]); |
| 3508 | |
| 3509 | if (count - pkt_idx >= PACKED_BATCH_SIZE) { |
| 3510 | if (!virtio_dev_tx_batch_packed(dev, vq, |
| 3511 | &pkts[pkt_idx], |
| 3512 | legacy_ol_flags)) { |
| 3513 | pkt_idx += PACKED_BATCH_SIZE; |
| 3514 | continue; |
| 3515 | } |
| 3516 | } |
| 3517 | |
| 3518 | if (virtio_dev_tx_single_packed(dev, vq, mbuf_pool, |
| 3519 | pkts[pkt_idx], |
| 3520 | legacy_ol_flags)) |
| 3521 | break; |
| 3522 | pkt_idx++; |
| 3523 | } while (pkt_idx < count); |
| 3524 | |
| 3525 | if (pkt_idx != count) |
| 3526 | rte_pktmbuf_free_bulk(&pkts[pkt_idx], count - pkt_idx); |
| 3527 | |
| 3528 | if (vq->shadow_used_idx) { |
| 3529 | do_data_copy_dequeue(vq); |
| 3530 | |
| 3531 | vhost_flush_dequeue_shadow_packed(dev, vq); |
| 3532 | vhost_vring_call_packed(dev, vq); |
| 3533 | } |
| 3534 | |
| 3535 | return pkt_idx; |
| 3536 | } |
| 3537 | |
| 3538 | __rte_noinline |
| 3539 | static uint16_t |
no test coverage detected