DPDK usage discussions
 help / color / mirror / Atom feed
From: Huai-En Tseng <the@csie.io>
To: users@dpdk.org
Subject: [dpdk-users] Is rte_ring_dequeue_burst/rte_ring_enqueue_burst just memory address copy from enqueue side to dequeue side?
Date: Thu, 6 Jun 2019 11:31:17 +0800	[thread overview]
Message-ID: <352715A9-AE7E-42FC-BD9B-D386742AA5D7@csie.io> (raw)

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.

                 reply	other threads:[~2019-06-06  3:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=352715A9-AE7E-42FC-BD9B-D386742AA5D7@csie.io \
    --to=the@csie.io \
    --cc=users@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).