[dpdk-users] Is rte_ring_dequeue_burst/rte_ring_enqueue_burst just memory address copy from enqueue side to dequeue side?
Huai-En Tseng
the at csie.io
Thu Jun 6 05:31:17 CEST 2019
Hi,
I am curious about rte_ring_dequeue and rte_ring_enqueue.
I notice in rte_ring.h, the dequeue and enqueue mechanism, DEQUEUE_PTRS and ENQUEUE_PTRS marcos, both are just memory address assignment.
At the same time, I get a strange bug in my project.
Thread 1 continually enqueue 1 packet every time.
Thread 2 also continually dequeue dequeue packets whatever it can and does some logic operation.
However, when thread 2 does some operation taking too long time such as printf and file io or thread 1 enqueue enqueue packet twice in very short time interval.
The packet thread 2 dequeue will be the next packet content which thread 1 enqueue.
I assume that despite thread 2 dequeue 1 packet, but it actually dequeue the memory address.
Then the cons and prod pointer do dequeue operation and thread 1 is ready to enqueue next packet to the memory address which thread 2 just dequeue.
However, at the same time, thread 2 is using this memory address and it is the root cause.
Is my assumption correct or something I miss?
If my assumption is correct, is there any method can avoid this except using memcpy?
Thanks all.
More information about the users
mailing list