Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: net: mscc: ocelot: add a test for egress VLAN modification

For this test we are exercising the VCAP ES0 block's ability to match on
a packet with a given VLAN ID, and push an ES0 TAG A with a VID derived
from VID_A_VAL plus the classified VLAN.

$eth3.200 is the generator port
$eth0 is the bridged DUT port that receives
$eth1 is the bridged DUT port that forwards and rewrites VID 200 to 300
on egress via VCAP ES0
$eth2 is the port that receives from the DUT port $eth1

Since the egress rewriting happens outside the bridging service, VID 300
does not need to be in the bridge VLAN table of $eth1.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Vladimir Oltean and committed by
David S. Miller
434ef350 4a907f65

+39
+39
tools/testing/selftests/drivers/net/ocelot/tc_flower_chains.sh
··· 285 285 ip link set br0 type bridge vlan_filtering 0 286 286 } 287 287 288 + test_vlan_egress_modify() 289 + { 290 + printf "Testing egress VLAN modification.. " 291 + 292 + tc qdisc add dev $eth1 clsact 293 + 294 + ip link set br0 type bridge vlan_filtering 1 295 + bridge vlan add dev $eth0 vid 200 296 + bridge vlan add dev $eth1 vid 200 297 + 298 + tc filter add dev $eth1 egress chain $(ES0) pref 3 \ 299 + protocol 802.1Q flower skip_sw vlan_id 200 vlan_prio 0 \ 300 + action vlan modify id 300 priority 7 301 + 302 + tcpdump_start $eth2 303 + 304 + $MZ $eth3.200 -q -c 1 -p 64 -a $eth3_mac -b $eth2_mac -t ip 305 + 306 + sleep 1 307 + 308 + tcpdump_stop 309 + 310 + if tcpdump_show | grep -q "$eth3_mac > $eth2_mac, .* vlan 300"; then 311 + echo "OK" 312 + else 313 + echo "FAIL" 314 + fi 315 + 316 + tcpdump_cleanup 317 + 318 + tc filter del dev $eth1 egress chain $(ES0) pref 3 319 + tc qdisc del dev $eth1 clsact 320 + 321 + bridge vlan del dev $eth0 vid 200 322 + bridge vlan del dev $eth1 vid 200 323 + ip link set br0 type bridge vlan_filtering 0 324 + } 325 + 288 326 test_skbedit_priority() 289 327 { 290 328 local num_pkts=100 ··· 348 310 test_vlan_pop 349 311 test_vlan_push 350 312 test_vlan_ingress_modify 313 + test_vlan_egress_modify 351 314 test_skbedit_priority 352 315 " 353 316