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 <step...@networkplumber.org>
Sent: Monday, November 27, 2017 11:06:13 PM
To: Wu, Xiaoban
Cc: us...@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...@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.

Reply via email to