selftests/net: set link down before enslave
Subsystems (4)
PATCH 1/1 selftests/net: set link down before enslave
Set the link down before enslave it to a bond device, to avoid
Error: Device can not be enslaved while up.
--- tools/testing/selftests/net/rtnetlink.sh | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/net/rtnetlink.sh +2 -0
@@ -1205,6 +1205,8 @@ kci_test_bridge_parent_id() dev20=`ls ${sysfsnet}20/net/` ip link add name test-bond0 type bond mode 802.3ad + ip link set dev $dev10 down + ip link set dev $dev20 down ip link set dev $dev10 master test-bond0 ip link set dev $dev20 master test-bond0 ip link add name test-br0 type bridge
Signature · 1 line
2.26.2
Quoted 14 lines · Hangbin Liu
Set the link down before enslave it to a bond device, to avoid
Error: Device can not be enslaved while up.Fixes 6374a5606990 ("selftests: rtnetlink: Test bridge enslavement with different parent IDs")Signed-off-by Hangbin Liu <[email protected]>--- tools/testing/selftests/net/rtnetlink.sh | 2 ++ 1 file changed, 2 insertions(+)tools/testing/selftests/net/rtnetlink.sh +0
-0
tools/testing/selftests/net/rtnetlink.sh kci_test_bridge_parent_id() · line 1209
Quoted 5 lines
tools/testing/selftests/net/rtnetlink.sh +2
-0@@ -1205,6 +1205,8 @@ kci_test_bridge_parent_id() dev20=`ls ${sysfsnet}20/net/` ip link add name test-bond0 type bond mode 802.3ad + ip link set dev $dev10 down + ip link set dev $dev20 down
But these netdevs are created with their administrative state set to 'DOWN'. Who is setting them to up?
Quoted 6 lines
tools/testing/selftests/net/rtnetlink.sh +0
-0ip link set dev $dev10 master test-bond0 ip link set dev $dev20 master test-bond0 ip link add name test-br0 type bridgeSignature · 1 line
2.26.2
Hi Ido,
Quoted 7 lines · Ido Schimmel
Quoted 7 lines
tools/testing/selftests/net/rtnetlink.sh +0
-0@@ -1205,6 +1205,8 @@ kci_test_bridge_parent_id() dev20=`ls ${sysfsnet}20/net/`
Quoted 6 lines
tools/testing/selftests/net/rtnetlink.sh kci_test_bridge_parent_id() · line 1209
Quoted 3 lines
tools/testing/selftests/net/rtnetlink.sh +2
-0ip link add name test-bond0 type bond mode 802.3ad + ip link set dev $dev10 down + ip link set dev $dev20 downBut these netdevs are created with their administrative state set to 'DOWN'. Who is setting them to up?
Would you please point me where we set the state to 'DOWN'? Cause on my host it is init as UP:
++ ls /sys/bus/netdevsim/devices/netdevsim10/net/
+ dev10=eth3
++ ls /sys/bus/netdevsim/devices/netdevsim20/net/
+ dev20=eth4
+ ip link add name test-bond0 type bond mode 802.3ad
+ ip link show eth3
66: eth3: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/ether 1e:52:27:5f:a5:3c brd ff:ff:ff:ff:ff:ff
# uname -r 5.11.0-rc3+
Thanks
Hangbin
Quoted 20 lines · Hangbin Liu
Hi Ido,
Quoted 7 lines · Ido Schimmel
Quoted 7 lines
tools/testing/selftests/net/rtnetlink.sh +0
-0@@ -1205,6 +1205,8 @@ kci_test_bridge_parent_id() dev20=`ls ${sysfsnet}20/net/`Quoted 6 lines
tools/testing/selftests/net/rtnetlink.sh kci_test_bridge_parent_id() · line 1209
Quoted 3 lines
tools/testing/selftests/net/rtnetlink.sh +2
-0ip link add name test-bond0 type bond mode 802.3ad + ip link set dev $dev10 down + ip link set dev $dev20 downBut these netdevs are created with their administrative state set to 'DOWN'. Who is setting them to up?
Would you please point me where we set the state to 'DOWN'? Cause on my host it is init as UP:
Quoted 8 lines
++ ls
/sys/bus/netdevsim/devices/netdevsim10/net/
+ dev10=eth3
++ ls/sys/bus/netdevsim/devices/netdevsim20/net/
+ dev20=eth4
+ ip link add name test-bond0 type bond mode 802.3ad
+ ip link show eth3
66: eth3: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000link/ether 1e:52:27:5f:a5:3c brd ff:ff:ff:ff:ff:ff
I didn't have time to look into this today, but I suspect the problem is either:
1. Some interface manager on your end that is setting these interfaces up after they are created
2. A bug in netdevsim that does not initialize the carrier to off. Maybe try with this patch (didn't test):
drivers/net/netdevsim/netdev.c +2 -0
@@ -312,6 +312,8 @@ nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port)nsim_ipsec_init (ns); +netif_carrier_off (dev); + err =register_netdevice (dev);if (err) goto err_ipsec_teardown;
Quoted 6 lines
# uname -r 5.11.0-rc3+Thanks
Hangbin
Jakub Kicinski
maintainerQuoted 30 lines · On Wed, 20 Jan 2021 21:43:28 +0200 Ido Schimmel wrote:
Quoted 20 lines · Hangbin Liu
Hi Ido,
Quoted 7 lines · Ido Schimmel
Quoted 7 lines
tools/testing/selftests/net/rtnetlink.sh +0
-0@@ -1205,6 +1205,8 @@ kci_test_bridge_parent_id() dev20=`ls ${sysfsnet}20/net/`Quoted 6 lines
tools/testing/selftests/net/rtnetlink.sh kci_test_bridge_parent_id() · line 1209
Quoted 3 lines
tools/testing/selftests/net/rtnetlink.sh +2
-0ip link add name test-bond0 type bond mode 802.3ad + ip link set dev $dev10 down + ip link set dev $dev20 downBut these netdevs are created with their administrative state set to 'DOWN'. Who is setting them to up?
Would you please point me where we set the state to 'DOWN'? Cause on my host it is init as UP:
Quoted 8 lines
++ ls
/sys/bus/netdevsim/devices/netdevsim10/net/
+ dev10=eth3
++ ls/sys/bus/netdevsim/devices/netdevsim20/net/
+ dev20=eth4
+ ip link add name test-bond0 type bond mode 802.3ad
+ ip link show eth3
66: eth3: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000link/ether 1e:52:27:5f:a5:3c brd ff:ff:ff:ff:ff:ff
Quoted 5 lines
I didn't have time to look into this today, but I suspect the problem is either:
1. Some interface manager on your end that is setting these interfaces up after they are created
This must be the case, the kernel doesn't open/up devices by itself.
Quoted 2 lines
2. A bug in netdevsim that does not initialize the carrier to off. Maybe try with this patch (didn't test):
Yeah, but that's fine, SW devices don't have to manage carrier state.
Quoted 31 lines · Jakub Kicinski
Quoted 30 lines · On Wed, 20 Jan 2021 21:43:28 +0200 Ido Schimmel wrote:
Quoted 28 lines · Hangbin Liu
Hi Ido,
Quoted 7 lines · Ido Schimmel
Quoted 7 lines
tools/testing/selftests/net/rtnetlink.sh +0
-0@@ -1205,6 +1205,8 @@ kci_test_bridge_parent_id() dev20=`ls ${sysfsnet}20/net/`Quoted 6 lines
tools/testing/selftests/net/rtnetlink.sh kci_test_bridge_parent_id() · line 1209
Quoted 3 lines
tools/testing/selftests/net/rtnetlink.sh +2
-0ip link add name test-bond0 type bond mode 802.3ad + ip link set dev $dev10 down + ip link set dev $dev20 downBut these netdevs are created with their administrative state set to 'DOWN'. Who is setting them to up?
Would you please point me where we set the state to 'DOWN'? Cause on my host it is init as UP:
++ ls
/sys/bus/netdevsim/devices/netdevsim10/net/
+ dev10=eth3
++ ls/sys/bus/netdevsim/devices/netdevsim20/net/
+ dev20=eth4
+ ip link add name test-bond0 type bond mode 802.3ad
+ ip link show eth3
66: eth3: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000link/ether 1e:52:27:5f:a5:3c brd ff:ff:ff:ff:ff:ff
Quoted 7 lines
Quoted 5 lines
I didn't have time to look into this today, but I suspect the problem is either:
1. Some interface manager on your end that is setting these interfaces up after they are created
This must be the case, the kernel doesn't open/up devices by itself.
Ah, yes, My bad. I found NetworkManager enabled it by default.
Thanks
Hangbin