Skip to content

Fix and improve VLAN/MPLS parsing in rte_net_get_ptype

Robin Jarry dpdk-dev 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest5 patches 12 repliesIn review
  2. v41 patch 7 repliesSuperseded
  3. v31 patch 4 repliesSuperseded

Changes in v5 from the cover letter

* Split the series in multiple patches.
* Revert the commit that introduced the bug.
* Add support for stacked VLAN/QINQ as suggested by David.
* Fix MPLS bottom of stack detection. Try to guess MPLS payload.
* Add more test cases.

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5Revert "net: fix packet type for stacked VLAN"lib/net/rte_net.c+15 -142 replies
2/5net: support multiple stacked VLAN tagslib/net/rte_net.c+16 -197 replies
3/5net: add unit tests for rte_net_get_ptypeapp/test/meson.build app/test/test_net_ptype.c+232 -00 replies
4/5net: parse L3 protocol after MPLS labelsapp/test/test_net_ptype.c lib/net/rte_net.c+81 -102 replies
5/5net: add truncated packet tests for rte_net_get_ptypeapp/test/test_net_ptype.c+38 -00 replies

Reviews trailers per patch

1 of 5 patches has a Reviewed-by or Acked-by.

PatchDavid MarchandKevin Traynor
1/5A-b A-b
2/5
3/5
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH dpdk v5 0/5] Fix and improve VLAN/MPLS parsing in rte_net_get_ptype

Revert commit 1f250674085a ("net: fix packet type for stacked VLAN") which introduced a regression causing single VLAN frames to be misidentified as QinQ due to incorrect use of |= on the ptype.

Replace the separate VLAN and QinQ code paths with a single loop that handles arbitrarily stacked VLAN tags. Fix the MPLS path to use the bottom of stack bit instead of a hardcoded label limit, and parse the L3 protocol of the MPLS payload by inspecting the first nibble.

Add unit tests for rte_net_get_ptype covering Ethernet, VLAN, QinQ, MPLS, IPv4/IPv6, and truncated packet scenarios.

v5:

* Split the series in multiple patches.
* Revert the commit that introduced the bug.
* Add support for stacked VLAN/QINQ as suggested by David.
* Fix MPLS bottom of stack detection. Try to guess MPLS payload.
* Add more test cases.

v4:

* changed the approach again. Only set VLAN or QINQ ptype for the first encountered vlan/qinq ether type.
* unit tests not changed

v3:

* changed the approach: initialize pkt_type=0 and only set it to RTE_PTYPE_L2_ETHER if neither of VLAN nor QINQ matched.
* extended the unit tests to check for header lengths and added ipv6 / tcp cases.

v2: added new ptype tests

v3:

* changed the approach: initialize pkt_type=0 and only set it to RTE_PTYPE_L2_ETHER if neither of VLAN nor QINQ matched.
* extended the unit tests to check for header lengths and added ipv6 / tcp cases.

v2: added new ptype tests

Robin Jarry (5):
Revert "net: fix packet type for stacked VLAN"
net: support multiple stacked VLAN tags
net: add unit tests for rte_net_get_ptype
net: parse L3 protocol after MPLS labels
net: add truncated packet tests for rte_net_get_ptype

 app/test/meson.build      |   1 +
 app/test/test_net_ptype.c | 326 ++++++++++++++++++++++++++++++++++++++
 lib/net/rte_net.c         |  72 +++++----
 3 files changed, 369 insertions(+), 30 deletions(-)
 create mode 100644 app/test/test_net_ptype.c
Signature · 1 line
2.54.0