使用rte_ring_dequeue_burst函数时,需要先创建一个空的环形队列,然后通过调用rte_ring_enqueue函数将我们想要入队的元素放入队列。然后,调用rte_ring_dequeue_burst函数可以批量出队元素。 以下是一个使用rte_ring_dequeue_burst的示例: ```c #include <rte_ring.h> //创建一个环形队列 struct rte_ring *ring ...
29 struct rte_ring_debug_stats stats[RTE_MAX_LCORE]; 30 #endif 31 32 void * ring[0] __rte_cache_aligned; /**< Memory space of ring starts here. 33 * not volatile so need to be careful 34 * about compiler re-ordering */ 35 }; 3.2 入队函数 __rte_ring_mp_do_enqueue: 1 sta...
struct rte_ring *r = rte_ring_create(“MY_RING”, 1024,rte_socket_id(), 0); 2.出入队 有不同的出入队方式(单、bulk、burst)都在rte_ring.h中。 例如:rte_ring_enqueue和rte_ring_dequeue 这种数据结构与链表队列相比: 优点如下: 更快:比较void *大小的数据,只需要执行单次Compare-And-Swap指令,...
}if(rte_ring_enqueue_bulk(ring, (void**)mbufs, BURST_SIZE,NULL) ==0) {for(inti =0; i < BURST_SIZE; i++) {rte_pktmbuf_free(mbufs[i]); } } }returnNULL; }void*consumer(void*arg){while(1) {structrte_mbuf*mbufs[BURST_SIZE];unsignedintnb_rx =rte_ring_dequeue_bulk(ring, (...
rte_vhost_enqueue_burst通知虚拟机eventfd_write staticinline uint32_t __attribute__((always_inline)) virtio_dev_rx(structvirtio_net *dev, uint16_t queue_id,structrte_mbuf **pkts, uint32_t count) {structvhost_virtqueue *vq;structvring_desc *desc;structrte_mbuf *buff;/*The virtio_hdr is...
static__rte_always_inline unsignedint__rte_ring_do_enqueue(structrte_ring *r,void*const*obj_table, unsignedintn,enumrte_ring_queue_behavior behavior, unsignedintis_sp, unsignedint*free_space) { uint32_t prod_head, prod_next; uint32_t free_entries; ...
intthread_lb(struct lcore_cfg *lconf){structrte_mbuf*rx_mbuf[MAX_RING_BURST] __rte_cache_aligned;structtask_base*task[MAX_TASKS_PER_CORE];uint64_tcur_tsc =rte_rdtsc();uint64_tnext_term_tsc = cur_tsc + TERM_TIMEOUT;uint64_tdrain_tsc = cur_tsc + DRAIN_TIMEOUT;constuint8_tnb_ta...
*/ event_enqueue_burst_t enqueue_new_burst; /**< PMD enqueue burst new function. */ event_enqueue_burst_t enqueue_forward_burst; /**< PMD enqueue burst fwd function. */ event_dequeue_t dequeue; /**< PMD dequeue function. */ event_dequeue_burst_t dequeue_burst; /**< P...
*/ typedef uint16_t (*dequeue_pkt_burst_t)(void *qp, struct rte_crypto_op **ops, uint16_t nb_ops); /**< Dequeue processed packets from queue pair of a device. */ typedef uint16_t (*enqueue_pkt_burst_t)(void *qp, struct rte_crypto_op **ops, uint16_t nb_ops);...
/* Reset n to the initial burst count */ @@ -113,9 +114,9 @@ * - OOO reads of cons tail value * - OOO copy of elems to the ring */ - } while (__atomic_compare_exchange_n(&r->rts_prod.head.raw, - &oh.raw, nh.raw, ...