Commit 93196ef9 authored by Vladimir Oltean's avatar Vladimir Oltean Committed by David S. Miller

selftests: ocelot: tc_flower_chains: use conventional interface names

This is a robotic rename as follows:

eth0 -> swp1
eth1 -> swp2
eth2 -> h2
eth3 -> h1

This brings the selftest more in line with the other forwarding
selftests, where h1 is connected to swp1, and h2 to swp2.
Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 980e74ca
......@@ -15,7 +15,7 @@ require_command tcpdump
# | DUT ports Generator ports |
# | +--------+ +--------+ +--------+ +--------+ |
# | | | | | | | | | |
# | | eth0 | | eth1 | | eth2 | | eth3 | |
# | | swp1 | | swp2 | | h2 | | h1 | |
# | | | | | | | | | |
# +-+--------+-+--------+-+--------+-+--------+-+
# | | | |
......@@ -24,15 +24,15 @@ require_command tcpdump
# | |
# +--------------------------------+
eth0=${NETIFS[p1]}
eth1=${NETIFS[p2]}
eth2=${NETIFS[p3]}
eth3=${NETIFS[p4]}
swp1=${NETIFS[p1]}
swp2=${NETIFS[p2]}
h2=${NETIFS[p3]}
h1=${NETIFS[p4]}
eth0_mac="de:ad:be:ef:00:00"
eth1_mac="de:ad:be:ef:00:01"
eth2_mac="de:ad:be:ef:00:02"
eth3_mac="de:ad:be:ef:00:03"
swp1_mac="de:ad:be:ef:00:00"
swp2_mac="de:ad:be:ef:00:01"
h2_mac="de:ad:be:ef:00:02"
h1_mac="de:ad:be:ef:00:03"
# Helpers to map a VCAP IS1 and VCAP IS2 lookup and policy to a chain number
# used by the kernel driver. The numbers are:
......@@ -156,39 +156,39 @@ create_tcam_skeleton()
setup_prepare()
{
ip link set $eth0 up
ip link set $eth1 up
ip link set $eth2 up
ip link set $eth3 up
ip link set $swp1 up
ip link set $swp2 up
ip link set $h2 up
ip link set $h1 up
create_tcam_skeleton $eth0
create_tcam_skeleton $swp1
ip link add br0 type bridge
ip link set $eth0 master br0
ip link set $eth1 master br0
ip link set $swp1 master br0
ip link set $swp2 master br0
ip link set br0 up
ip link add link $eth3 name $eth3.100 type vlan id 100
ip link set $eth3.100 up
ip link add link $h1 name $h1.100 type vlan id 100
ip link set $h1.100 up
ip link add link $eth3 name $eth3.200 type vlan id 200
ip link set $eth3.200 up
ip link add link $h1 name $h1.200 type vlan id 200
ip link set $h1.200 up
tc filter add dev $eth0 ingress chain $(IS1 1) pref 1 \
tc filter add dev $swp1 ingress chain $(IS1 1) pref 1 \
protocol 802.1Q flower skip_sw vlan_id 100 \
action vlan pop \
action goto chain $(IS1 2)
tc filter add dev $eth0 egress chain $(ES0) pref 1 \
flower skip_sw indev $eth1 \
tc filter add dev $swp1 egress chain $(ES0) pref 1 \
flower skip_sw indev $swp2 \
action vlan push protocol 802.1Q id 100
tc filter add dev $eth0 ingress chain $(IS1 0) pref 2 \
tc filter add dev $swp1 ingress chain $(IS1 0) pref 2 \
protocol ipv4 flower skip_sw src_ip 10.1.1.2 \
action skbedit priority 7 \
action goto chain $(IS1 1)
tc filter add dev $eth0 ingress chain $(IS2 0 0) pref 1 \
tc filter add dev $swp1 ingress chain $(IS2 0 0) pref 1 \
protocol ipv4 flower skip_sw ip_proto udp dst_port 5201 \
action police rate 50mbit burst 64k conform-exceed drop/pipe \
action goto chain $(IS2 1 0)
......@@ -196,9 +196,9 @@ setup_prepare()
cleanup()
{
ip link del $eth3.200
ip link del $eth3.100
tc qdisc del dev $eth0 clsact
ip link del $h1.200
ip link del $h1.100
tc qdisc del dev $swp1 clsact
ip link del br0
}
......@@ -206,21 +206,21 @@ test_vlan_pop()
{
RET=0
tcpdump_start $eth2
tcpdump_start $h2
# Work around Mausezahn VLAN builder bug
# (https://github.com/netsniff-ng/netsniff-ng/issues/225) by using
# an 8021q upper
$MZ $eth3.100 -q -c 1 -p 64 -a $eth3_mac -b $eth2_mac -t ip
$MZ $h1.100 -q -c 1 -p 64 -a $h1_mac -b $h2_mac -t ip
sleep 1
tcpdump_stop $eth2
tcpdump_stop $h2
tcpdump_show $eth2 | grep -q "$eth3_mac > $eth2_mac, ethertype IPv4"
tcpdump_show $h2 | grep -q "$h1_mac > $h2_mac, ethertype IPv4"
check_err "$?" "untagged reception"
tcpdump_cleanup $eth2
tcpdump_cleanup $h2
log_test "VLAN pop"
}
......@@ -229,18 +229,18 @@ test_vlan_push()
{
RET=0
tcpdump_start $eth3.100
tcpdump_start $h1.100
$MZ $eth2 -q -c 1 -p 64 -a $eth2_mac -b $eth3_mac -t ip
$MZ $h2 -q -c 1 -p 64 -a $h2_mac -b $h1_mac -t ip
sleep 1
tcpdump_stop $eth3.100
tcpdump_stop $h1.100
tcpdump_show $eth3.100 | grep -q "$eth2_mac > $eth3_mac"
tcpdump_show $h1.100 | grep -q "$h2_mac > $h1_mac"
check_err "$?" "tagged reception"
tcpdump_cleanup $eth3.100
tcpdump_cleanup $h1.100
log_test "VLAN push"
}
......@@ -250,33 +250,33 @@ test_vlan_ingress_modify()
RET=0
ip link set br0 type bridge vlan_filtering 1
bridge vlan add dev $eth0 vid 200
bridge vlan add dev $eth0 vid 300
bridge vlan add dev $eth1 vid 300
bridge vlan add dev $swp1 vid 200
bridge vlan add dev $swp1 vid 300
bridge vlan add dev $swp2 vid 300
tc filter add dev $eth0 ingress chain $(IS1 2) pref 3 \
tc filter add dev $swp1 ingress chain $(IS1 2) pref 3 \
protocol 802.1Q flower skip_sw vlan_id 200 \
action vlan modify id 300 \
action goto chain $(IS2 0 0)
tcpdump_start $eth2
tcpdump_start $h2
$MZ $eth3.200 -q -c 1 -p 64 -a $eth3_mac -b $eth2_mac -t ip
$MZ $h1.200 -q -c 1 -p 64 -a $h1_mac -b $h2_mac -t ip
sleep 1
tcpdump_stop $eth2
tcpdump_stop $h2
tcpdump_show $eth2 | grep -q "$eth3_mac > $eth2_mac, .* vlan 300"
tcpdump_show $h2 | grep -q "$h1_mac > $h2_mac, .* vlan 300"
check_err "$?" "tagged reception"
tcpdump_cleanup $eth2
tcpdump_cleanup $h2
tc filter del dev $eth0 ingress chain $(IS1 2) pref 3
tc filter del dev $swp1 ingress chain $(IS1 2) pref 3
bridge vlan del dev $eth0 vid 200
bridge vlan del dev $eth0 vid 300
bridge vlan del dev $eth1 vid 300
bridge vlan del dev $swp1 vid 200
bridge vlan del dev $swp1 vid 300
bridge vlan del dev $swp2 vid 300
ip link set br0 type bridge vlan_filtering 0
log_test "Ingress VLAN modification"
......@@ -286,34 +286,34 @@ test_vlan_egress_modify()
{
RET=0
tc qdisc add dev $eth1 clsact
tc qdisc add dev $swp2 clsact
ip link set br0 type bridge vlan_filtering 1
bridge vlan add dev $eth0 vid 200
bridge vlan add dev $eth1 vid 200
bridge vlan add dev $swp1 vid 200
bridge vlan add dev $swp2 vid 200
tc filter add dev $eth1 egress chain $(ES0) pref 3 \
tc filter add dev $swp2 egress chain $(ES0) pref 3 \
protocol 802.1Q flower skip_sw vlan_id 200 vlan_prio 0 \
action vlan modify id 300 priority 7
tcpdump_start $eth2
tcpdump_start $h2
$MZ $eth3.200 -q -c 1 -p 64 -a $eth3_mac -b $eth2_mac -t ip
$MZ $h1.200 -q -c 1 -p 64 -a $h1_mac -b $h2_mac -t ip
sleep 1
tcpdump_stop $eth2
tcpdump_stop $h2
tcpdump_show $eth2 | grep -q "$eth3_mac > $eth2_mac, .* vlan 300"
tcpdump_show $h2 | grep -q "$h1_mac > $h2_mac, .* vlan 300"
check_err "$?" "tagged reception"
tcpdump_cleanup $eth2
tcpdump_cleanup $h2
tc filter del dev $eth1 egress chain $(ES0) pref 3
tc qdisc del dev $eth1 clsact
tc filter del dev $swp2 egress chain $(ES0) pref 3
tc qdisc del dev $swp2 clsact
bridge vlan del dev $eth0 vid 200
bridge vlan del dev $eth1 vid 200
bridge vlan del dev $swp1 vid 200
bridge vlan del dev $swp2 vid 200
ip link set br0 type bridge vlan_filtering 0
log_test "Egress VLAN modification"
......@@ -323,11 +323,11 @@ test_skbedit_priority()
{
local num_pkts=100
before=$(ethtool_stats_get $eth0 'rx_green_prio_7')
before=$(ethtool_stats_get $swp1 'rx_green_prio_7')
$MZ $eth3 -q -c $num_pkts -p 64 -a $eth3_mac -b $eth2_mac -t ip -A 10.1.1.2
$MZ $h1 -q -c $num_pkts -p 64 -a $h1_mac -b $h2_mac -t ip -A 10.1.1.2
after=$(ethtool_stats_get $eth0 'rx_green_prio_7')
after=$(ethtool_stats_get $swp1 'rx_green_prio_7')
if [ $((after - before)) = $num_pkts ]; then
RET=0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment