DPDK usage discussions
 help / color / mirror / Atom feed
* [dpdk-users] A question about the possible race condition in the l3fwd example?
@ 2017-11-28  2:22 Wu, Xiaoban
  2017-11-28  4:06 ` [dpdk-users] [dpdk-dev] " Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: Wu, Xiaoban @ 2017-11-28  2:22 UTC (permalink / raw)
  To: users, dev

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-28  4:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-28  2:22 [dpdk-users] A question about the possible race condition in the l3fwd example? Wu, Xiaoban
2017-11-28  4:06 ` [dpdk-users] [dpdk-dev] " Stephen Hemminger
2017-11-28  4:39   ` Wu, Xiaoban

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).