Resubmitting this series that I did not finish in my previous life (6WIND
people are okay with this).

Here is a little series which helped me identify a multi segment issue.
Hope it can help others.

The difference since the RFC patches I sent some time ago is that, rather
than force the user to build the dpdk with CONFIG_RTE_LIBRTE_MBUF_DEBUG
enabled, it uses rx/tx callbacks to apply checks on the mbufs.

Changelog since v1:
- dropped unnecessary casts in patch 1,
- rewrote patch 3: reused the existing rx/tx callbacks and left the invalid
  mbufs in rx bulk

Example (with [1] that generates invalid mbufs):
./testpmd --no-huge -l 2,3 -m 512 --log-level *:debug --vdev=eth_ring0
 --vdev=eth_ring1 -- -i --total-num-mbufs 2048

[...]

testpmd> set verbose 1
testpmd> set burst 4
Number of packets per burst set to 4
testpmd> start tx_first
port 0/queue 0: received 4 packets
  src=00:00:00:00:00:00 - dst=02:00:00:00:00:00 - type=0x0800 - length=64
 - nb_segs=2 - sw ptype: L2_ETHER L3_IPV4 L4_UDP  - l2_len=14 - l3_len=20
 - l4_len=8 - Receive queue=0x0
  ol_flags: PKT_RX_L4_CKSUM_UNKNOWN PKT_RX_IP_CKSUM_UNKNOWN
 PKT_RX_OUTER_L4_CKSUM_UNKNOWN 
INVALID mbuf: bad nb_segs
  src=00:00:00:00:00:00 - dst=02:00:00:00:00:00 - type=0x0800 - length=64
 - nb_segs=1 - sw ptype: L2_ETHER L3_IPV4 L4_UDP  - l2_len=14 - l3_len=20
 - l4_len=8 - Receive queue=0x0
  ol_flags: PKT_RX_L4_CKSUM_UNKNOWN PKT_RX_IP_CKSUM_UNKNOWN
 PKT_RX_OUTER_L4_CKSUM_UNKNOWN 
INVALID mbuf: bad pkt_len
  src=00:00:00:00:00:00 - dst=02:00:00:00:00:00 - type=0x0800 - length=64
 - nb_segs=1 - sw ptype: L2_ETHER L3_IPV4 L4_UDP  - l2_len=14 - l3_len=20
 - l4_len=8 - Receive queue=0x0
  ol_flags: PKT_RX_L4_CKSUM_UNKNOWN PKT_RX_IP_CKSUM_UNKNOWN
 PKT_RX_OUTER_L4_CKSUM_UNKNOWN 
INVALID mbuf: bad nb_segs
  src=00:00:00:00:00:00 - dst=02:00:00:00:00:00 - type=0x0800 - length=64
 - nb_segs=2 - sw ptype: L2_ETHER L3_IPV4 L4_UDP  - l2_len=14 - l3_len=20
 - l4_len=8 - Receive queue=0x0
  ol_flags: PKT_RX_L4_CKSUM_UNKNOWN PKT_RX_IP_CKSUM_UNKNOWN
 PKT_RX_OUTER_L4_CKSUM_UNKNOWN 
INVALID mbuf: bad nb_segs
port 1/queue 0: received 4 packets
[...]
testpmd> stop


1: https://github.com/david-marchand/dpdk/commit/601630d8db0e

-- 
David Marchand

David Marchand (3):
  mbuf: add sanity checks on segment metadata
  mbuf: add a non fatal sanity check helper
  app/testpmd: check mbufs in verbose mode

 app/test-pmd/util.c                  |  3 ++
 lib/librte_mbuf/Makefile             |  2 ++
 lib/librte_mbuf/meson.build          |  2 ++
 lib/librte_mbuf/rte_mbuf.c           | 70 +++++++++++++++++++++++++++---------
 lib/librte_mbuf/rte_mbuf.h           | 23 ++++++++++++
 lib/librte_mbuf/rte_mbuf_version.map |  6 ++++
 6 files changed, 89 insertions(+), 17 deletions(-)

-- 
1.8.3.1

Reply via email to