* [PATCH net-next] net/mlx5e: Report link down on administrative close
@ 2026-06-08 23:42 Manjunath Patil
2026-06-10 12:06 ` Tariq Toukan
0 siblings, 1 reply; 4+ messages in thread
From: Manjunath Patil @ 2026-06-08 23:42 UTC (permalink / raw)
To: netdev
Cc: saeedm, tariqt, mbloch, leon, andrew+netdev, davem, edumazet,
kuba, pabeni, linux-rdma, linux-kernel, manjunath.b.patil
mlx5e_update_carrier() reports both link-up and link-down carrier
changes, but an administrative down does not reach it in practice. The
close path first changes the port admin state and then clears
MLX5E_STATE_OPENED and drops carrier silently in mlx5e_close_locked().
Any queued carrier worker will skip update_carrier() once the device is
no longer opened.
This leaves "ip link set dev <dev> down" without a matching netdev
"Link down" message, while reopening the device still reports "Link up".
Report the link-down transition in mlx5e_close() before the common close
helper clears the opened state and drops carrier. Guard the message with
the current opened and carrier state to avoid duplicates when the netdev
is already closed or carrier is already down.
Assisted-by: Codex:gpt-5
Signed-off-by: Manjunath Patil <manjunath.b.patil@oracle.com>
---
Validation:
- Built an OL8 mainline test kernel from this change.
- Booted 7.1.0-rc6.bug123456.el8.v1.x86_64 on an mlx5-backed VM.
- Confirmed `ip link set dev re0 down/up` and `re1 down/up` now emit
netdev `Link down` and `Link up` messages, alongside the existing RDMA
port state notifications.
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 8f2b3abe0092..a04a89f0eddf 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -3628,6 +3628,9 @@ int mlx5e_close(struct net_device *netdev)
mutex_lock(&priv->state_lock);
mlx5e_modify_admin_state(priv->mdev, MLX5_PORT_DOWN);
+ if (test_bit(MLX5E_STATE_OPENED, &priv->state) &&
+ netif_carrier_ok(netdev))
+ netdev_info(netdev, "Link down\n");
err = mlx5e_close_locked(netdev);
mutex_unlock(&priv->state_lock);
base-commit: e43ffb69e0438cddd72aaa30898b4dc446f664f8
--
2.47.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net/mlx5e: Report link down on administrative close
2026-06-08 23:42 [PATCH net-next] net/mlx5e: Report link down on administrative close Manjunath Patil
@ 2026-06-10 12:06 ` Tariq Toukan
2026-06-11 20:13 ` manjunath.b.patil
0 siblings, 1 reply; 4+ messages in thread
From: Tariq Toukan @ 2026-06-10 12:06 UTC (permalink / raw)
To: Manjunath Patil, netdev
Cc: saeedm, tariqt, mbloch, leon, andrew+netdev, davem, edumazet,
kuba, pabeni, linux-rdma, linux-kernel
On 09/06/2026 2:42, Manjunath Patil wrote:
> mlx5e_update_carrier() reports both link-up and link-down carrier
> changes, but an administrative down does not reach it in practice. The
> close path first changes the port admin state and then clears
> MLX5E_STATE_OPENED and drops carrier silently in mlx5e_close_locked().
> Any queued carrier worker will skip update_carrier() once the device is
> no longer opened.
>
> This leaves "ip link set dev <dev> down" without a matching netdev
> "Link down" message, while reopening the device still reports "Link up".
>
> Report the link-down transition in mlx5e_close() before the common close
> helper clears the opened state and drops carrier. Guard the message with
> the current opened and carrier state to avoid duplicates when the netdev
> is already closed or carrier is already down.
>
> Assisted-by: Codex:gpt-5
> Signed-off-by: Manjunath Patil <manjunath.b.patil@oracle.com>
> ---
> Validation:
> - Built an OL8 mainline test kernel from this change.
> - Booted 7.1.0-rc6.bug123456.el8.v1.x86_64 on an mlx5-backed VM.
> - Confirmed `ip link set dev re0 down/up` and `re1 down/up` now emit
> netdev `Link down` and `Link up` messages, alongside the existing RDMA
> port state notifications.
>
> drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> index 8f2b3abe0092..a04a89f0eddf 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> @@ -3628,6 +3628,9 @@ int mlx5e_close(struct net_device *netdev)
>
> mutex_lock(&priv->state_lock);
> mlx5e_modify_admin_state(priv->mdev, MLX5_PORT_DOWN);
> + if (test_bit(MLX5E_STATE_OPENED, &priv->state) &&
> + netif_carrier_ok(netdev))
> + netdev_info(netdev, "Link down\n");
> err = mlx5e_close_locked(netdev);
> mutex_unlock(&priv->state_lock);
>
>
> base-commit: e43ffb69e0438cddd72aaa30898b4dc446f664f8
Thanks for your patch.
I wouldn't print "Link down" as part of the "close" callback. I'd rather
get it printed in the event handler. Currently there is a print there,
but the callback is masked by the OPENED bit.
This made me revisit this area, and it surely needs some more
interesting enhancements.
I'll probably come up with some changes soon.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net/mlx5e: Report link down on administrative close
2026-06-10 12:06 ` Tariq Toukan
@ 2026-06-11 20:13 ` manjunath.b.patil
2026-08-19 17:35 ` manjunath.b.patil
0 siblings, 1 reply; 4+ messages in thread
From: manjunath.b.patil @ 2026-06-11 20:13 UTC (permalink / raw)
To: Tariq Toukan, netdev
Cc: saeedm, mbloch, leon, andrew+netdev, davem, edumazet, kuba,
pabeni, linux-rdma, linux-kernel
On 6/10/26 5:06 AM, Tariq Toukan wrote:
>
>
> On 09/06/2026 2:42, Manjunath Patil wrote:
>> mlx5e_update_carrier() reports both link-up and link-down carrier
>> changes, but an administrative down does not reach it in practice. The
>> close path first changes the port admin state and then clears
>> MLX5E_STATE_OPENED and drops carrier silently in mlx5e_close_locked().
>> Any queued carrier worker will skip update_carrier() once the device is
>> no longer opened.
>>
>> This leaves "ip link set dev <dev> down" without a matching netdev
>> "Link down" message, while reopening the device still reports "Link up".
>>
>> Report the link-down transition in mlx5e_close() before the common close
>> helper clears the opened state and drops carrier. Guard the message with
>> the current opened and carrier state to avoid duplicates when the netdev
>> is already closed or carrier is already down.
>>
>> Assisted-by: Codex:gpt-5
>> Signed-off-by: Manjunath Patil <manjunath.b.patil@oracle.com>
>> ---
>> Validation:
>> - Built an OL8 mainline test kernel from this change.
>> - Booted 7.1.0-rc6.bug123456.el8.v1.x86_64 on an mlx5-backed VM.
>> - Confirmed `ip link set dev re0 down/up` and `re1 down/up` now emit
>> netdev `Link down` and `Link up` messages, alongside the existing RDMA
>> port state notifications.
>>
>> drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/
>> drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>> index 8f2b3abe0092..a04a89f0eddf 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>> @@ -3628,6 +3628,9 @@ int mlx5e_close(struct net_device *netdev)
>> mutex_lock(&priv->state_lock);
>> mlx5e_modify_admin_state(priv->mdev, MLX5_PORT_DOWN);
>> + if (test_bit(MLX5E_STATE_OPENED, &priv->state) &&
>> + netif_carrier_ok(netdev))
>> + netdev_info(netdev, "Link down\n");
>> err = mlx5e_close_locked(netdev);
>> mutex_unlock(&priv->state_lock);
>>
>> base-commit: e43ffb69e0438cddd72aaa30898b4dc446f664f8
>
> Thanks for your patch.
>
> I wouldn't print "Link down" as part of the "close" callback. I'd rather
> get it printed in the event handler. Currently there is a print there,
> but the callback is masked by the OPENED bit.
>
> This made me revisit this area, and it surely needs some more
> interesting enhancements.
> I'll probably come up with some changes soon.
thank for you taking a look at this patch.
I will hold on and wait for your changes.
-Manjunath
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net/mlx5e: Report link down on administrative close
2026-06-11 20:13 ` manjunath.b.patil
@ 2026-08-19 17:35 ` manjunath.b.patil
0 siblings, 0 replies; 4+ messages in thread
From: manjunath.b.patil @ 2026-08-19 17:35 UTC (permalink / raw)
To: Tariq Toukan, netdev
Cc: saeedm, mbloch, leon, andrew+netdev, davem, edumazet, kuba,
pabeni, linux-rdma, linux-kernel
On 6/11/26 1:13 PM, manjunath.b.patil@oracle.com wrote:
> On 6/10/26 5:06 AM, Tariq Toukan wrote:
>>
>>
>> On 09/06/2026 2:42, Manjunath Patil wrote:
>>> mlx5e_update_carrier() reports both link-up and link-down carrier
>>> changes, but an administrative down does not reach it in practice. The
>>> close path first changes the port admin state and then clears
>>> MLX5E_STATE_OPENED and drops carrier silently in mlx5e_close_locked().
>>> Any queued carrier worker will skip update_carrier() once the device is
>>> no longer opened.
>>>
>>> This leaves "ip link set dev <dev> down" without a matching netdev
>>> "Link down" message, while reopening the device still reports "Link up".
>>>
>>> Report the link-down transition in mlx5e_close() before the common close
>>> helper clears the opened state and drops carrier. Guard the message with
>>> the current opened and carrier state to avoid duplicates when the netdev
>>> is already closed or carrier is already down.
>>>
>>> Assisted-by: Codex:gpt-5
>>> Signed-off-by: Manjunath Patil <manjunath.b.patil@oracle.com>
>>> ---
>>> Validation:
>>> - Built an OL8 mainline test kernel from this change.
>>> - Booted 7.1.0-rc6.bug123456.el8.v1.x86_64 on an mlx5-backed VM.
>>> - Confirmed `ip link set dev re0 down/up` and `re1 down/up` now emit
>>> netdev `Link down` and `Link up` messages, alongside the existing
>>> RDMA
>>> port state notifications.
>>>
>>> drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 3 +++
>>> 1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/
>>> drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>>> index 8f2b3abe0092..a04a89f0eddf 100644
>>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>>> @@ -3628,6 +3628,9 @@ int mlx5e_close(struct net_device *netdev)
>>> mutex_lock(&priv->state_lock);
>>> mlx5e_modify_admin_state(priv->mdev, MLX5_PORT_DOWN);
>>> + if (test_bit(MLX5E_STATE_OPENED, &priv->state) &&
>>> + netif_carrier_ok(netdev))
>>> + netdev_info(netdev, "Link down\n");
>>> err = mlx5e_close_locked(netdev);
>>> mutex_unlock(&priv->state_lock);
>>>
>>> base-commit: e43ffb69e0438cddd72aaa30898b4dc446f664f8
>>
>> Thanks for your patch.
>>
>> I wouldn't print "Link down" as part of the "close" callback. I'd
>> rather get it printed in the event handler. Currently there is a print
>> there, but the callback is masked by the OPENED bit.
>>
>> This made me revisit this area, and it surely needs some more
>> interesting enhancements.
>> I'll probably come up with some changes soon.
>
> thank for you taking a look at this patch.
> I will hold on and wait for your changes.
Any update on this?
I checked a v7.2-rc6 based kernel. That still showed the old behavior -
'fup re0' reports 're0: Link up', while a successful 'ifdown re0'
remains silent.
-Manjunath
>
> -Manjunath
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-08-19 17:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-08 23:42 [PATCH net-next] net/mlx5e: Report link down on administrative close Manjunath Patil
2026-06-10 12:06 ` Tariq Toukan
2026-06-11 20:13 ` manjunath.b.patil
2026-08-19 17:35 ` manjunath.b.patil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®