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

Function rte_vhost_poll_enqueue_completed

dpdk/lib/vhost/virtio_net.c:2351–2404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2349}
2350
2351uint16_t
2352rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id,
2353 struct rte_mbuf **pkts, uint16_t count, int16_t dma_id,
2354 uint16_t vchan_id)
2355{
2356 struct virtio_net *dev = get_device(vid);
2357 struct vhost_virtqueue *vq;
2358 uint16_t n_pkts_cpl = 0;
2359
2360 if (unlikely(!dev))
2361 return 0;
2362
2363 VHOST_LOG_DATA(dev->ifname, DEBUG, "%s\n", __func__);
2364 if (unlikely(!is_valid_virt_queue_idx(queue_id, 0, dev->nr_vring))) {
2365 VHOST_LOG_DATA(dev->ifname, ERR,
2366 "%s: invalid virtqueue idx %d.\n",
2367 __func__, queue_id);
2368 return 0;
2369 }
2370
2371 if (unlikely(!dma_copy_track[dma_id].vchans ||
2372 !dma_copy_track[dma_id].vchans[vchan_id].pkts_cmpl_flag_addr)) {
2373 VHOST_LOG_DATA(dev->ifname, ERR,
2374 "%s: invalid channel %d:%u.\n",
2375 __func__, dma_id, vchan_id);
2376 return 0;
2377 }
2378
2379 vq = dev->virtqueue[queue_id];
2380
2381 if (rte_rwlock_read_trylock(&vq->access_lock)) {
2382 VHOST_LOG_DATA(dev->ifname, DEBUG,
2383 "%s: virtqueue %u is busy.\n",
2384 __func__, queue_id);
2385 return 0;
2386 }
2387
2388 if (unlikely(!vq->async)) {
2389 VHOST_LOG_DATA(dev->ifname, ERR,
2390 "%s: async not registered for virtqueue %d.\n",
2391 __func__, queue_id);
2392 goto out;
2393 }
2394
2395 n_pkts_cpl = vhost_poll_enqueue_completed(dev, vq, pkts, count, dma_id, vchan_id);
2396
2397 vhost_queue_stats_update(dev, vq, pkts, n_pkts_cpl);
2398 vq->stats.inflight_completed += n_pkts_cpl;
2399
2400out:
2401 rte_rwlock_read_unlock(&vq->access_lock);
2402
2403 return n_pkts_cpl;
2404}
2405
2406uint16_t
2407rte_vhost_clear_queue_thread_unsafe(int vid, uint16_t queue_id,

Callers 1

complete_async_pktsFunction · 0.85

Calls 4

get_deviceFunction · 0.85
is_valid_virt_queue_idxFunction · 0.85
vhost_queue_stats_updateFunction · 0.85

Tested by

no test coverage detected