[dpdk-users] A question about the possible race condition in the l3fwd example?

Wu, Xiaoban Xiaoban_Wu at student.uml.edu
Tue Nov 28 03:22:57 CET 2017

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,

More information about the users mailing list