drm/bridge: adv7511: Switch to atomic operations
[drm/drm-misc.git] / tools / testing / selftests / net / fdb_notify.sh
blobc03151e7791c68f97bd44811607e631150ebaf09
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
4 source lib.sh
6 ALL_TESTS="
7 test_dup_bridge
8 test_dup_vxlan_self
9 test_dup_vxlan_master
10 test_dup_macvlan_self
11 test_dup_macvlan_master
14 do_test_dup()
16 local op=$1; shift
17 local what=$1; shift
18 local tmpf
20 RET=0
22 tmpf=$(mktemp)
23 defer rm "$tmpf"
25 defer_scope_push
26 bridge monitor fdb &> "$tmpf" &
27 defer kill_process $!
29 sleep 0.5
30 bridge fdb "$op" 00:11:22:33:44:55 vlan 1 "$@"
31 sleep 0.5
32 defer_scope_pop
34 local count=$(grep -c -e 00:11:22:33:44:55 $tmpf)
35 ((count == 1))
36 check_err $? "Got $count notifications, expected 1"
38 log_test "$what $op: Duplicate notifications"
41 test_dup_bridge()
43 ip_link_add br up type bridge vlan_filtering 1
44 do_test_dup add "bridge" dev br self
45 do_test_dup del "bridge" dev br self
48 test_dup_vxlan_self()
50 ip_link_add br up type bridge vlan_filtering 1
51 ip_link_add vx up type vxlan id 2000 dstport 4789
52 ip_link_master vx br
54 do_test_dup add "vxlan" dev vx self dst 192.0.2.1
55 do_test_dup del "vxlan" dev vx self dst 192.0.2.1
58 test_dup_vxlan_master()
60 ip_link_add br up type bridge vlan_filtering 1
61 ip_link_add vx up type vxlan id 2000 dstport 4789
62 ip_link_master vx br
64 do_test_dup add "vxlan master" dev vx master
65 do_test_dup del "vxlan master" dev vx master
68 test_dup_macvlan_self()
70 ip_link_add dd up type dummy
71 ip_link_add mv up link dd type macvlan mode passthru
73 do_test_dup add "macvlan self" dev mv self
74 do_test_dup del "macvlan self" dev mv self
77 test_dup_macvlan_master()
79 ip_link_add br up type bridge vlan_filtering 1
80 ip_link_add dd up type dummy
81 ip_link_add mv up link dd type macvlan mode passthru
82 ip_link_master mv br
84 do_test_dup add "macvlan master" dev mv self
85 do_test_dup del "macvlan master" dev mv self
88 cleanup()
90 defer_scopes_cleanup
93 trap cleanup EXIT
94 tests_run
96 exit $EXIT_STATUS