Skip to content

Commit

Permalink
selftests: router_bridge: Add remastering tests
Browse files Browse the repository at this point in the history
Add two tests to deslave a port from and reenslave to a bridge. This should
retain the ability of the system to forward traffic, but on an offloading
driver that is sensitive to ordering of operations, it might not.

The first test does this configuration in a way that relies on
vlan_default_pvid to assign the PVID. The second test disables that
autoconfiguration and configures PVID by hand in a separate step.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Danielle Ratson <danieller@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Petr Machata authored and David S. Miller committed Aug 2, 2023
1 parent 10857e6 commit eb13885
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tools/testing/selftests/net/forwarding/router_bridge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
# +---------------------------------------------------------------------------+

ALL_TESTS="
ping_ipv4
ping_ipv6
config_remaster
ping_ipv4
ping_ipv6
config_remove_pvid
Expand All @@ -28,6 +31,9 @@ ALL_TESTS="
config_add_pvid
ping_ipv4
ping_ipv6
config_late_pvid
ping_ipv4
ping_ipv6
"
NUM_NETIFS=4
source lib.sh
Expand Down Expand Up @@ -86,6 +92,15 @@ router_destroy()
ip link del dev br1
}

config_remaster()
{
log_info "Remaster bridge slave"

ip link set dev $swp1 nomaster
sleep 2
ip link set dev $swp1 master br1
}

config_remove_pvid()
{
log_info "Remove PVID from the bridge"
Expand All @@ -102,6 +117,17 @@ config_add_pvid()
sleep 2
}

config_late_pvid()
{
log_info "Add bridge PVID after enslaving port"

ip link set dev $swp1 nomaster
ip link set dev br1 type bridge vlan_default_pvid 0
sleep 2
ip link set dev $swp1 master br1
ip link set dev br1 type bridge vlan_default_pvid 1
}

setup_prepare()
{
h1=${NETIFS[p1]}
Expand Down

0 comments on commit eb13885

Please sign in to comment.