MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vhost_dequeue_single_packed

Function vhost_dequeue_single_packed

dpdk/lib/vhost/virtio_net.c:3408–3458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3406}
3407
3408static __rte_always_inline int
3409vhost_dequeue_single_packed(struct virtio_net *dev,
3410 struct vhost_virtqueue *vq,
3411 struct rte_mempool *mbuf_pool,
3412 struct rte_mbuf *pkts,
3413 uint16_t *buf_id,
3414 uint16_t *desc_count,
3415 bool legacy_ol_flags)
3416 __rte_shared_locks_required(&vq->access_lock)
3417 __rte_shared_locks_required(&vq->iotlb_lock)
3418{
3419 struct buf_vector buf_vec[BUF_VECTOR_MAX];
3420 uint32_t buf_len;
3421 uint16_t nr_vec = 0;
3422 int err;
3423 static bool allocerr_warned;
3424
3425 if (unlikely(fill_vec_buf_packed(dev, vq,
3426 vq->last_avail_idx, desc_count,
3427 buf_vec, &nr_vec,
3428 buf_id, &buf_len,
3429 VHOST_ACCESS_RO) < 0))
3430 return -1;
3431
3432 if (unlikely(buf_len <= dev->vhost_hlen))
3433 return -1;
3434
3435 buf_len -= dev->vhost_hlen;
3436
3437 if (unlikely(virtio_dev_pktmbuf_prep(dev, pkts, buf_len))) {
3438 if (!allocerr_warned) {
3439 VHOST_LOG_DATA(dev->ifname, ERR,
3440 "failed mbuf alloc of size %d from %s.\n",
3441 buf_len, mbuf_pool->name);
3442 allocerr_warned = true;
3443 }
3444 return -1;
3445 }
3446
3447 err = desc_to_mbuf(dev, vq, buf_vec, nr_vec, pkts,
3448 mbuf_pool, legacy_ol_flags, 0, false);
3449 if (unlikely(err)) {
3450 if (!allocerr_warned) {
3451 VHOST_LOG_DATA(dev->ifname, ERR, "failed to copy desc to mbuf.\n");
3452 allocerr_warned = true;
3453 }
3454 return -1;
3455 }
3456
3457 return 0;
3458}
3459
3460static __rte_always_inline int
3461virtio_dev_tx_single_packed(struct virtio_net *dev,

Callers 1

Calls 3

fill_vec_buf_packedFunction · 0.85
virtio_dev_pktmbuf_prepFunction · 0.85
desc_to_mbufFunction · 0.85

Tested by

no test coverage detected