From: "Wu, Xiaoban" <Xiaoban_Wu@student.uml.edu>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: "users@dpdk.org" <users@dpdk.org>, "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-users] [dpdk-dev] A question about the possible race condition in the l3fwd example?
Date: Tue, 28 Nov 2017 04:39:58 +0000 [thread overview]
Message-ID: <BN6PR02MB268978103FAB8A47B18CE89EBC3A0@BN6PR02MB2689.namprd02.prod.outlook.com> (raw)
In-Reply-To: <20171127200613.74783eff@xeon-e3>
Dear Stephen,
Yes, you are right. Thanks very much for your help, very appreciated. It is much more clear to me now.
extern struct lcore_conf lcore_conf[RTE_MAX_LCORE];
Best wishes,
Xiaoban
________________________________
From: Stephen Hemminger <stephen@networkplumber.org>
Sent: Monday, November 27, 2017 11:06:13 PM
To: Wu, Xiaoban
Cc: users@dpdk.org; dev@dpdk.org
Subject: Re: [dpdk-dev] A question about the possible race condition in the l3fwd example?
On Tue, 28 Nov 2017 02:22:57 +0000
"Wu, Xiaoban" <Xiaoban_Wu@student.uml.edu> wrote:
> 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
>
>
>
qconf is in in a per core data structure, so it is impossible for sharing to happen.
prev parent reply other threads:[~2017-11-28 4:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-28 2:22 [dpdk-users] " Wu, Xiaoban
2017-11-28 4:06 ` [dpdk-users] [dpdk-dev] " Stephen Hemminger
2017-11-28 4:39 ` Wu, Xiaoban [this message]
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=BN6PR02MB268978103FAB8A47B18CE89EBC3A0@BN6PR02MB2689.namprd02.prod.outlook.com \
--to=xiaoban_wu@student.uml.edu \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.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).