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

Function virtio_rxq_sw_ring_alloc

dpdk/drivers/net/virtio/virtqueue.c:380–410  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

378}
379
380static int
381virtio_rxq_sw_ring_alloc(struct virtqueue *vq, int numa_node)
382{
383 void *sw_ring;
384 struct rte_mbuf *mbuf;
385 size_t size;
386
387 /* SW ring is only used with vectorized datapath */
388 if (!vq->hw->use_vec_rx)
389 return 0;
390
391 size = (RTE_PMD_VIRTIO_RX_MAX_BURST + vq->vq_nentries) * sizeof(vq->rxq.sw_ring[0]);
392
393 sw_ring = rte_zmalloc_socket("sw_ring", size, RTE_CACHE_LINE_SIZE, numa_node);
394 if (!sw_ring) {
395 PMD_INIT_LOG(ERR, "can not allocate RX soft ring");
396 return -ENOMEM;
397 }
398
399 mbuf = rte_zmalloc_socket("sw_ring", sizeof(*mbuf), RTE_CACHE_LINE_SIZE, numa_node);
400 if (!mbuf) {
401 PMD_INIT_LOG(ERR, "can not allocate fake mbuf");
402 rte_free(sw_ring);
403 return -ENOMEM;
404 }
405
406 vq->rxq.sw_ring = sw_ring;
407 vq->rxq.fake_mbuf = mbuf;
408
409 return 0;
410}
411
412static void
413virtio_rxq_sw_ring_free(struct virtqueue *vq)

Callers 1

virtqueue_allocFunction · 0.85

Calls 2

rte_zmalloc_socketFunction · 0.85
rte_freeFunction · 0.85

Tested by

no test coverage detected