Skip to content

selftests: openvswitch: add pop_vlan test

Minxi Hou linux-kselftest lkml netdev 11 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v10 Latest posting 2/22 patches 0 repliesApplied 2/2
  2. v10 posting 1/22 patches 0 repliesSuperseded
  3. v92 patches 1 replySuperseded
Earlier versions · 8
VersionPostedPatchesRepliesStatus
v82 patches2 repliesSuperseded
v72 patches4 repliesSuperseded
v62 patches1 replySuperseded
v52 patches2 repliesSuperseded
v42 patches0 repliesSuperseded
v32 patches0 repliesSuperseded
v22 patches4 repliesSuperseded
v12 patches0 repliesSuperseded

Changes in v10 from the cover letter · 20 lines

- rebase on net-next
- fix masked VLAN dpstr round-trip: use tci=0xNNNN/0xMMMM format for masked vlan() output instead of vid=X,pcp=Y,cfi=Z/vid=... which the parser cannot re-consume
- fix int() base handling in _parse_vlan_from_flowstr: use int(val, 0) for auto base detection instead of manual
0x prefix check
- fix commit message: remove reference to nonexistent MAX_ENCAP_DEPTH constant, clarify "encap parse()" scope
v9: https://lore.kernel.org/netdev/[email protected]/
- rebase on net-next (resolve conflict with 05416ada37aa4 "selftests: openvswitch: add tests for tunnel vport refcounting")
v8: https://lore.kernel.org/netdev/[email protected]/
- consistent error message prefix: push_vlan() instead of push_vlan (matches vlan() and encap() style)
- unify encap() error messages for clarity
- add empty-string guards for MAC address variables
- remove slot number comments from encap_ovskey nla_map
- remove explicit modprobe 8021q pre-flight check
v7: https://lore.kernel.org/netdev/[email protected]/
- remove slot number comments from encap_ovskey nla_map, keep only comments explaining differences from base ovskey class
- remove explicit modprobe 8021q pre-flight check (ip link add type vlan auto-loads the module)
v6: https://lore.kernel.org/netdev/[email protected]/
- fix non-ASCII characters (em dashes) in comments and commit messages
v5: https://lore.kernel.org/netdev/[email protected]/
- add push_vlan action class, dpstr format and parse with range

Patches in v10 posting 2/2 All 2 applied

#Subject and filesSizeRepliesApplied
1/2selftests: openvswitch: add vlan() and encap() flow string parsingtools/testing/selftests/net/openvswitch/ovs-dpctl.py+314 -100 repliesApplied
2/2selftests: openvswitch: add pop_vlan testtools/testing/selftests/net/openvswitch/openvswitch.sh+78 -00 repliesApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchAaron Conole
1/2R-b
2/2R-b

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

Read the v10 thread

Cover letter [PATCH net-next v10 0/2] selftests: openvswitch: add pop_vlan test

Add test_pop_vlan() to verify OVS kernel datapath pop_vlan action correctly strips 802.1Q VLAN tags from frames.

Patch 1 extends ovs-dpctl.py with vlan(vid=X,pcp=Y,cfi=Z) formatting and parsing, plus an encap_ovskey subclass for safe ENCAP NLA decoding. It changes OVS_KEY_ATTR_VLAN type from uint16 to be16 to match the kernel __be16 wire format.
It also adds push_vlan action support (parse/format with range validation).
Patch 2 adds the selftest using purely ping-based verification with a push_vlan return flow for symmetric bidirectional testing.

Tested with vng on x86_64, all OVS selftests pass (including new test_pop_vlan).

v10:
- rebase on net-next
- fix masked VLAN dpstr round-trip: use tci=0xNNNN/0xMMMM format for masked vlan() output instead of vid=X,pcp=Y,cfi=Z/vid=... which the parser cannot re-consume
- fix int() base handling in _parse_vlan_from_flowstr: use int(val, 0) for auto base detection instead of manual
0x prefix check
- fix commit message: remove reference to nonexistent MAX_ENCAP_DEPTH constant, clarify "encap parse()" scope
v9: https://lore.kernel.org/netdev/[email protected]/
- rebase on net-next (resolve conflict with 05416ada37aa4 "selftests: openvswitch: add tests for tunnel vport refcounting")
v8: https://lore.kernel.org/netdev/[email protected]/
- consistent error message prefix: push_vlan() instead of push_vlan (matches vlan() and encap() style)
- unify encap() error messages for clarity
- add empty-string guards for MAC address variables
- remove slot number comments from encap_ovskey nla_map
- remove explicit modprobe 8021q pre-flight check
v7: https://lore.kernel.org/netdev/[email protected]/
- remove slot number comments from encap_ovskey nla_map, keep only comments explaining differences from base ovskey class
- remove explicit modprobe 8021q pre-flight check (ip link add type vlan auto-loads the module)
v6: https://lore.kernel.org/netdev/[email protected]/
- fix non-ASCII characters (em dashes) in comments and commit messages
v5: https://lore.kernel.org/netdev/[email protected]/
- add push_vlan action class, dpstr format and parse with range

    validation (vid 0-4095, pcp 0-7, tpid 0-0xFFFF, CFI forced to 1)

- remove MAX_ENCAP_DEPTH constant and depth tracking (bracket-depth counter in encap parser already handles nesting)
- remove start_capture/stop_capture helpers and tcpdump/pcap verification -- use ping success/failure instead
- remove modprobe/netns pre-flight checks (other tests don't do this)
- remove ethtool VLAN offload disable (unnecessary for veth)
- add push_vlan return flow for symmetric bidirectional ping
- use ovs_sbx wrapper for ping commands (consistent with siblings)
v4: https://lore.kernel.org/netdev/[email protected]/
- fix all checkpatch line-length warnings in new code
- fix pylint W0707: use explicit exception chaining (from exc)
v3: https://lore.kernel.org/netdev/[email protected]/
- encap_ovskey: MPLS type "ovs_key_mpls" -> "array(ovs_key_mpls)"
- encap_ovskey: PRIORITY/IN_PORT set to "none" (metadata, not in ENCAP)
- _vlan_dpstr: cfi=0 falls back to tci=0x%04x for round-trip safety
- encap parse(): check return value for unrecognized trailing content
- vlan parser: boundary check + raise-from for exception chaining
v2: https://lore.kernel.org/netdev/[email protected]/

Minxi Hou (2):
selftests: openvswitch: add vlan() and encap() flow string parsing
selftests: openvswitch: add pop_vlan test

 .../selftests/net/openvswitch/openvswitch.sh  |  78 +++++
 .../selftests/net/openvswitch/ovs-dpctl.py    | 324 +++++++++++++++++-
 2 files changed, 392 insertions(+), 10 deletions(-)

--
2.53.0