[dpdk-users] [dpdk-dev] A question about the possible race condition in the l3fwd example?
Xiaoban_Wu at student.uml.edu
Tue Nov 28 05:39:58 CET 2017
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];
From: Stephen Hemminger <stephen at networkplumber.org>
Sent: Monday, November 27, 2017 11:06:13 PM
To: Wu, Xiaoban
Cc: users at dpdk.org; dev at 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 at 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;
> 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,
qconf is in in a per core data structure, so it is impossible for sharing to happen.
More information about the users