DPDK usage discussions
 help / color / mirror / Atom feed
From: "Wu, Xiaoban" <Xiaoban_Wu@student.uml.edu>
To: "users@dpdk.org" <users@dpdk.org>, "dev@dpdk.org" <dev@dpdk.org>
Subject: [dpdk-users] A question about the possible race condition in the l3fwd example?
Date: Tue, 28 Nov 2017 02:22:57 +0000	[thread overview]
Message-ID: <BN6PR02MB2689B9C9FB7D64F582186747BC3A0@BN6PR02MB2689.namprd02.prod.outlook.com> (raw)

Dear All,


I am studying the source code of the l3fwd example. I am confused about a possible race condition in the l3fwd_lpm_simple_forward().


In this function it calls send_single_packet(), which executes the following code,

    len = qconf->tx_mbufs[port].len;
    qconf->tx_mbufs[port].m_table[len] = m;
    len++;

As you can see, if two threads are trying to call send_single_packet() at the same time and send  different packets to the same port, which writes the value to the same array and updates the same counter 'len', then the race condition happens, so we might lose packets.

Can anybody please clarify if this indeed brings race condition? If yes, then why we want to design it in this way, just for high performance? If no, why?

Thanks very much for your help.

Best wishes,
Xiaoban

             reply	other threads:[~2017-11-28  2:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-28  2:22 Wu, Xiaoban [this message]
2017-11-28  4:06 ` [dpdk-users] [dpdk-dev] " Stephen Hemminger
2017-11-28  4:39   ` Wu, Xiaoban

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=BN6PR02MB2689B9C9FB7D64F582186747BC3A0@BN6PR02MB2689.namprd02.prod.outlook.com \
    --to=xiaoban_wu@student.uml.edu \
    --cc=dev@dpdk.org \
    --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).