diff mbox series

[net] selftests: bonding: do not set port down before adding to bond

Message ID 20230817082459.1685972-1-liuhangbin@gmail.com (mailing list archive)
State Accepted
Commit be809424659c2844a2d7ab653aacca4898538023
Delegated to: Netdev Maintainers
Headers show
Series [net] selftests: bonding: do not set port down before adding to bond | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/fixes_present fail Series targets non-next tree, but doesn't contain any Fixes tags
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 9 this patch: 9
netdev/cc_maintainers warning 3 maintainers not CCed: andy@greyhouse.net shuah@kernel.org linux-kselftest@vger.kernel.org
netdev/build_clang success Errors and warnings before: 9 this patch: 9
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success net selftest script(s) already in Makefile
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 9 this patch: 9
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Hangbin Liu Aug. 17, 2023, 8:24 a.m. UTC
Before adding a port to bond, it need to be set down first. In the
lacpdu test the author set the port down specifically. But commit
a4abfa627c38 ("net: rtnetlink: Enslave device before bringing it up")
changed the operation order, the kernel will set the port down _after_
adding to bond. So all the ports will be down at last and the test failed.

In fact, the veth interfaces are already inactive when added. This
means there's no need to set them down again before adding to the bond.
Let's just remove the link down operation.

Reported-by: Zhengchao Shao <shaozhengchao@huawei.com>
Closes: https://lore.kernel.org/netdev/a0ef07c7-91b0-94bd-240d-944a330fcabd@huawei.com/
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
PS: I'm not sure if this should be a regression of a4abfa627c38.
---
 .../selftests/drivers/net/bonding/bond-break-lacpdu-tx.sh     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Phil Sutter Aug. 17, 2023, 10:38 a.m. UTC | #1
On Thu, Aug 17, 2023 at 04:24:59PM +0800, Hangbin Liu wrote:
> Before adding a port to bond, it need to be set down first. In the
> lacpdu test the author set the port down specifically. But commit
> a4abfa627c38 ("net: rtnetlink: Enslave device before bringing it up")
> changed the operation order, the kernel will set the port down _after_
> adding to bond. So all the ports will be down at last and the test failed.
> 
> In fact, the veth interfaces are already inactive when added. This
> means there's no need to set them down again before adding to the bond.
> Let's just remove the link down operation.
> 
> Reported-by: Zhengchao Shao <shaozhengchao@huawei.com>
> Closes: https://lore.kernel.org/netdev/a0ef07c7-91b0-94bd-240d-944a330fcabd@huawei.com/
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> ---
> PS: I'm not sure if this should be a regression of a4abfa627c38.

Well, in theory it might be as ip-link's behaviour changed in this
detail. Yet:

> -ip link set veth1-bond down master fbond

Without prior knowledge of kernel interna[1], one would expect this
command to result in veth1-bond being enslaved and down, irrespective of
in which order the link changes happen.

The command my patch enables, namely:

| ip link set veth1-bond up master fbond

is actually intuitive. OK, it won't work if veth1-bond is up already.
But I guess that's rather a missing feature (bridge driver supports it
for instance).

Cheers, Phil

[1] - link-state change happens before master assignment
    - bond driver "ups" newly attached ports
patchwork-bot+netdevbpf@kernel.org Aug. 22, 2023, 2:10 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 17 Aug 2023 16:24:59 +0800 you wrote:
> Before adding a port to bond, it need to be set down first. In the
> lacpdu test the author set the port down specifically. But commit
> a4abfa627c38 ("net: rtnetlink: Enslave device before bringing it up")
> changed the operation order, the kernel will set the port down _after_
> adding to bond. So all the ports will be down at last and the test failed.
> 
> In fact, the veth interfaces are already inactive when added. This
> means there's no need to set them down again before adding to the bond.
> Let's just remove the link down operation.
> 
> [...]

Here is the summary with links:
  - [net] selftests: bonding: do not set port down before adding to bond
    https://git.kernel.org/netdev/net/c/be809424659c

You are awesome, thank you!
diff mbox series

Patch

diff --git a/tools/testing/selftests/drivers/net/bonding/bond-break-lacpdu-tx.sh b/tools/testing/selftests/drivers/net/bonding/bond-break-lacpdu-tx.sh
index 47ab90596acb..6358df5752f9 100755
--- a/tools/testing/selftests/drivers/net/bonding/bond-break-lacpdu-tx.sh
+++ b/tools/testing/selftests/drivers/net/bonding/bond-break-lacpdu-tx.sh
@@ -57,8 +57,8 @@  ip link add name veth2-bond type veth peer name veth2-end
 
 # add ports
 ip link set fbond master fab-br0
-ip link set veth1-bond down master fbond
-ip link set veth2-bond down master fbond
+ip link set veth1-bond master fbond
+ip link set veth2-bond master fbond
 
 # bring up
 ip link set veth1-end up