Bug 729 - Bad mbuf chain handling in the memif driver resulting in truncated packets
Summary: Bad mbuf chain handling in the memif driver resulting in truncated packets
Status: UNCONFIRMED
Alias: None
Product: DPDK
Classification: Unclassified
Component: ethdev (show other bugs)
Version: unspecified
Hardware: All All
: Normal normal
Target Milestone: ---
Assignee: dev
URL:
Depends on:
Blocks:
 
Reported: 2021-06-10 11:51 CEST by Ivan Shvedunov
Modified: 2021-07-27 14:48 CEST (History)
2 users (show)



Attachments

Description Ivan Shvedunov 2021-06-10 11:51:11 CEST
In a couple of places in the memif driver [1][2] rte_pktmbuf_is_contiguous() [3] is being used to check whether there are more mbufs in the chain when sending packets. Problem is, rte_pktmbuf_is_contiguous() checks nb_segs in the mbuf, which, as far as I understand, is only set to the number of segments in the first mbuf in the chain. This results in truncated packets as usually, nb_segs is 1 in the mbufs other than the first. Replacing rte_pktmbuf_is_contiguous(mbuf) == 0 with mbuf->next != NULL fixes the issue.

The problem has been observed while trying to use TRex traffic generator with VPP [4].

[1] http://code.dpdk.org/dpdk/v21.05/source/drivers/net/memif/rte_eth_memif.c#L660

[2] http://code.dpdk.org/dpdk/v21.05/source/drivers/net/memif/rte_eth_memif.c#L717

[3] http://code.dpdk.org/dpdk/v21.05/source/lib/mbuf/rte_mbuf.h#L1687

[4] https://github.com/cisco-system-traffic-generator/trex-core/issues/686
Comment 1 Ivan Shvedunov 2021-06-14 17:44:23 CEST
Downstream patch for TRex: https://github.com/cisco-system-traffic-generator/trex-core/pull/723
Comment 2 Olivier Matz 2021-07-27 14:48:50 CEST
Hi Ivan,

This patch makes sense to me, thanks for spotting it.

Can you please submit it on the dev mailing list?

+CC jgrajcia@cisco.com

Note You need to log in before you can comment on or make changes to this bug.