net: rnpgbe: Accept link-down events without speed magic

The interface can continue reporting carrier up after the link goes
down because the driver ignores the firmware's link-down notification.

Firmware reports link-down events with a zero port_magic and no
valid speed or duplex information. The driver requires ST_VALID_MAGIC
for every link event and returns before updating the cached link state
when this check fails. It also writes an invalid driver snapshot to
firmware instead of acknowledging the link-down state.

Validate the speed magic only for link-up events. This allows link-down
events to update the cached state, propagate carrier loss, and update
the snapshot exported to firmware. Keep the checks for invalid link-up
magic and unsupported speeds.

Fixes: 92a671d510 ("net: rnpgbe: Add link status handling support")
Signed-off-by: Dong Yibo <dong100@mucse.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/C2DFBBF04F1DCFD2+20261026075445.920572-1-dong100@mucse.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Dong Yibo 2026-10-26 15:54:45 +08:00 committed by Paolo Abeni
parent 85b4bc79dd
commit 6815a2513e

View File

@ -392,8 +392,11 @@ static void mucse_mbx_fw_req_handler(struct mucse_hw *hw,
u16 speed = le16_to_cpu(req->link_stat.st.speed);
spin_lock_irqsave(&mucse->link_lock, flags);
if (magic != ST_VALID_MAGIC) {
/* Do not change the cached state for an invalid event.
/* Link-down events do not carry valid speed/duplex information
* and may have a zero port_magic. Validate it only for link up.
*/
if (mucse_link_is_up(hw, req) && magic != ST_VALID_MAGIC) {
/* Keep the cached state for an invalid link-up event.
* Use an invalid speed encoding to make firmware report
* again.
*/