Skip to contentSkip to conversation

bonding: fix mii_status when slave is down

PATCH Applied Nicolas Dichtel 4 participants 9 messages Nov 6, 2025 – Nov 11, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bonding: fix mii_status when slave is down

netif_carrier_ok() doesn't check if the slave is up. Before the below commit, netif_running() was also checked.

Fixes 23a6037ce76c ("bonding: Remove support for use_carrier")
---
 drivers/net/bonding/bond_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/bonding/bond_main.c +3 -2
index e95e593cd12d..5abef8a3b775 100644
@@ -2120,7 +2120,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
 	/* check for initial state */
 	new_slave->link = BOND_LINK_NOCHANGE;
 	if (bond->params.miimon) {
-		if (netif_carrier_ok(slave_dev)) {
+		if (netif_running(slave_dev) && netif_carrier_ok(slave_dev)) {
 			if (bond->params.updelay) {
 				bond_set_slave_link_state(new_slave,
 							  BOND_LINK_BACK,
@@ -2665,7 +2665,8 @@ static int bond_miimon_inspect(struct bonding *bond)
 	bond_for_each_slave_rcu(bond, slave, iter) {
 		bond_propose_link_state(slave, BOND_LINK_NOCHANGE);
 
-		link_state = netif_carrier_ok(slave->dev);
+		link_state = netif_running(slave->dev) &&
+			     netif_carrier_ok(slave->dev);
 
 		switch (slave->link) {
 		case BOND_LINK_UP:
Signature · 1 line
2.47.1
#1 lore raw
Quoted 2 lines · Nicolas Dichtel

netif_carrier_ok() doesn't check if the slave is up. Before the below commit, netif_running() was also checked.

I assume you have a device which is reporting carrier, despite being admin down? That is pretty unusual, and suggests its PHY handing is broken. What device is it? You might want to also fix it.

Andrew

#2 lore raw

Le 07/11/2025 à 03:36, Andrew Lunn a écrit :

Quoted 7 lines · Nicolas Dichtel
Quoted 2 lines

netif_carrier_ok() doesn't check if the slave is up. Before the below commit, netif_running() was also checked.

I assume you have a device which is reporting carrier, despite being admin down? That is pretty unusual, and suggests its PHY handing is broken. What device is it? You might want to also fix it.

Yes, one slave is put down administratively. Before the mentioned commit, the status was correctly reported; it's no longer the case.
It's a regression.

Thanks,
Nicolas

#3 lore raw
Quoted 11 lines · Nicolas Dichtel

Le 07/11/2025 à 03:36, Andrew Lunn a écrit :

Quoted 7 lines · Nicolas Dichtel
Quoted 2 lines

netif_carrier_ok() doesn't check if the slave is up. Before the below commit, netif_running() was also checked.

I assume you have a device which is reporting carrier, despite being admin down? That is pretty unusual, and suggests its PHY handing is broken. What device is it? You might want to also fix it.

Yes, one slave is put down administratively. Before the mentioned commit, the status was correctly reported; it's no longer the case.
It's a regression.

I agree with your fix, but i would also like to know more about the interfaces you are testing on. We should probably fix that device as well. What is it?

Things do get 'interesting' when there is a BMC also sharing the link. Linux cannot tell the PHY to drop the carrier because that would also disconnect the BMC, but there should be some separation between netif_carrier_ok() returns and the state of the PHY.

Andrew

#4 lore raw

Le 07/11/2025 à 14:55, Andrew Lunn a écrit :

Quoted 9 lines · Nicolas Dichtel
Quoted 8 lines

Le 07/11/2025 à 03:36, Andrew Lunn a écrit :

Quoted 7 lines · Nicolas Dichtel
Quoted 2 lines

netif_carrier_ok() doesn't check if the slave is up. Before the below commit, netif_running() was also checked.

I assume you have a device which is reporting carrier, despite being admin down? That is pretty unusual, and suggests its PHY handing is broken. What device is it? You might want to also fix it.

Quoted 7 lines
Quoted 3 lines

Yes, one slave is put down administratively. Before the mentioned commit, the status was correctly reported; it's no longer the case.
It's a regression.

I agree with your fix, but i would also like to know more about the interfaces you are testing on. We should probably fix that device as well. What is it?

There is no bug. It is manually put down by one of our internal tests.

Nicolas

#5 lore raw
Quoted 4 lines
Quoted 3 lines

I agree with your fix, but i would also like to know more about the interfaces you are testing on. We should probably fix that device as well. What is it?

There is no bug. It is manually put down by one of our internal tests.

Are you sure?

admin down should cause the link to be dropped. You want the local device to drop the carrier so the remote device knows you are gone, etc. Also, dropping the carrier saves power. For a typical 1G copper PHY, that is 1W. For a data centre connection, it can be many watts.

Andrew

#6 lore raw

Le 07/11/2025 à 18:32, Andrew Lunn a écrit :

Quoted 6 lines
Quoted 4 lines
Quoted 3 lines

I agree with your fix, but i would also like to know more about the interfaces you are testing on. We should probably fix that device as well. What is it?

There is no bug. It is manually put down by one of our internal tests.

Are you sure?

Hmm, ok ok.

Quoted 5 lines

admin down should cause the link to be dropped. You want the local device to drop the carrier so the remote device knows you are gone, etc. Also, dropping the carrier saves power. For a typical 1G copper PHY, that is 1W. For a data centre connection, it can be many watts.

It's a virtual interface, a tuntap.

Nicolas

maintainer Acked-by on v1 1/1
#7 lore raw
In reply to Nicolas Dichtel
Quoted 5 lines · Nicolas Dichtel

netif_carrier_ok() doesn't check if the slave is up. Before the below commit, netif_running() was also checked.

Fixes 23a6037ce76c ("bonding: Remove support for use_carrier")
Quoted 30 lines

---
drivers/net/bonding/bond_main.c | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/bonding/bond_main.c +3 -2
index e95e593cd12d..5abef8a3b775 100644
@@ -2120,7 +2120,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
 	/* check for initial state */
 	new_slave->link = BOND_LINK_NOCHANGE;
 	if (bond->params.miimon) {
-		if (netif_carrier_ok(slave_dev)) {
+		if (netif_running(slave_dev) && netif_carrier_ok(slave_dev)) {
 			if (bond->params.updelay) {
 				bond_set_slave_link_state(new_slave,
 							  BOND_LINK_BACK,
@@ -2665,7 +2665,8 @@ static int bond_miimon_inspect(struct bonding *bond)
 	bond_for_each_slave_rcu(bond, slave, iter) {
 		bond_propose_link_state(slave, BOND_LINK_NOCHANGE);
 
-		link_state = netif_carrier_ok(slave->dev);
+		link_state = netif_running(slave->dev) &&
+			     netif_carrier_ok(slave->dev);
 
 		switch (slave->link) {
 		case BOND_LINK_UP:
Signature · 1 line
2.47.1
#8 lore raw
In reply to Nicolas Dichtel
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Thu, 6 Nov 2025 19:02:52 +0100 you wrote:

netif_carrier_ok() doesn't check if the slave is up. Before the below commit, netif_running() was also checked.

Fixes 23a6037ce76c ("bonding: Remove support for use_carrier")
---
 drivers/net/bonding/bond_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Here is the summary with links:
- [net] bonding: fix mii_status when slave is down

    https://git.kernel.org/netdev/net/c/2554559aba88

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html