[EXT] [PATCH v3] examples/packet_ordering: fix segfault in disable_reorder mode

Volodymyr Fialko vfialko at marvell.com
Mon Dec 18 11:59:53 CET 2023


> -----Original Message-----
> From: Qian Hao <qi_an_hao at 126.com>
> Sent: Wednesday, December 13, 2023 12:07 PM
> To: dev at dpdk.org
> Cc: Volodymyr Fialko <vfialko at marvell.com>
> Subject: [EXT] [PATCH v3] examples/packet_ordering: fix segfault in disable_reorder mode
> 
> External Email
> 
> ----------------------------------------------------------------------
> The packet_ordering example works in two modes (opt via --disable-reorder):
>   - When reorder is enabled: rx_thread - N*worker_thread - send_thread
>   - When reorder is disabled: rx_thread - N*worker_thread - tx_thread N parallel worker_thread(s)
> generate out-of-order packets.
> 
> When reorder is enabled, send_thread uses sequence number generated in rx_thread (L459) to
> enforce packet ordering. Otherwise rx_thread just sends any packet it receives.
> 
> rx_thread writes sequence number into a dynamic field, which is only registered by calling
> rte_reorder_create() (Line 741) when reorder is enabled. However, rx_thread marks sequence
> number onto each packet no matter whether reorder is enabled, overwriting the leading bytes in
> packet mbufs when reorder is disabled, resulting in segfaults when PMD tries to DMA packets.
> 
> `if (!disable_reorder_flag) {...}` is added in rx_thread to fix the bug.
> The test is inlined by the compiler to prevent any performance loss.
> 
> Signed-off-by: Qian Hao <qi_an_hao at 126.com>
> ---
>  examples/packet_ordering/main.c | 32 +++++++++++++++++++++++++-------
>  1 file changed, 25 insertions(+), 7 deletions(-)
> 

Acked-by: Volodymyr Fialko <vfialko at marvell.com> 

/Volodymyr


More information about the dev mailing list