From: sashiko-bot@kernel.org
To: "Birger Koblitz" <mail@birger-koblitz.de>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH net-next v18 09/13] ax88179_178a: Add Suspend/resume support for AX88179A/772D/279
Date: Fri, 09 Oct 2026 03:51:45 +0000 [thread overview]
Message-ID: <sashiko-outbox-164800@kernel.org> (raw)
In-Reply-To: <20261008-ax88179a-v18-9-6fa1d4c40422@birger-koblitz.de>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] net: ax88179a_reset() clobbers user-configured MAC address during resume
- [Medium] net: ax88179a_resume() skips phylink_resume() on hardware read error
- [Medium] ax88179_178a: ignores usbnet_suspend() return value in suspend
--
commit d715e3f0710659f4025065a805e16bf7832459fd
Author: Birger Koblitz <mail@birger-koblitz.de>
ax88179_178a: Add Suspend/resume support for AX88179A/772D/279
The suspend and resume functions are called via the usb_driver structure,
for which the driver has only a single instance. Add wrapper functions
for the different implementations for the AX88179 and AX179A architecutres
in ax88179_lib which calls the 2 implementations in ax88179_178a and
ax88179a_devices, respectively.
> diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
> index 071b03b4f145c..ef0856627d08b 100644
> --- a/drivers/net/usb/ax88179_178a.c
> +++ b/drivers/net/usb/ax88179_178a.c
[ ... ]
> @@ -1356,9 +1359,9 @@ static struct usb_driver ax88179_178a_driver = {
> .name = "ax88179_178a",
> .id_table = products,
> .probe = usbnet_probe,
> - .suspend = ax88179_suspend,
> - .resume = ax88179_resume,
> - .reset_resume = ax88179_resume,
> + .suspend = ax88179_suspend_wrapper,
[Severity: Medium]
If usbnet_suspend() aborts an autosuspend (e.g. because of an active TX
queue, returning -EBUSY), ax88179_suspend() ignores the error and continues
to force the MAC and PHY into low-power mode (AX_MEDIUM_RECEIVE_EN disabled,
AX_RX_CTL_STOP, etc.).
This stalls the active network stack because the hardware is stopped but the
USB core reports success to the PM core. The patch refactors this into
ax88179_suspend_wrapper without fixing the underlying bug.
Does this need to be fixed to properly handle usbnet_suspend() return values
in ax88179_suspend() to avoid hardware stalling?
> + .resume = ax88179_resume_wrapper,
> + .reset_resume = ax88179_resume_wrapper,
> .disconnect = ax88179_disconnect,
> .supports_autosuspend = 1,
> .disable_hub_initiated_lpm = 1,
[ ... ]
> diff --git a/drivers/net/usb/ax88179a_devices.c b/drivers/net/usb/ax88179a_devices.c
> index e86cbe3e4400f..e9913a7c70390 100644
> --- a/drivers/net/usb/ax88179a_devices.c
> +++ b/drivers/net/usb/ax88179a_devices.c
[ ... ]
> @@ -135,6 +194,47 @@ static int ax88179a_auto_detach(struct usbnet *dev)
> return 0;
> }
>
> +static int ax88179a_resume(struct usb_interface *intf)
> +{
> + struct usbnet *dev = usb_get_intfdata(intf);
> + struct ax88179_data *ax179_data;
> + u8 reg8 = 0;
> + int ret;
> +
> + ax179_data = dev->driver_priv;
> + ax88179_set_pm_mode(dev, true);
> +
> + ret = ax88179_read_cmd(dev, AX88179A_PHY_POWER, 0, 0, 1, ®8);
> + if (ret < 0)
> + goto err_out;
[Severity: Medium]
In ax88179a_resume(), if reading the PHY power state fails (ret < 0),
execution jumps directly to the err_out label.
This bypasses the if (netif_running(dev->net)) { phylink_resume(...) } block.
Because phylink_suspend() was previously called during ax88179a_suspend(),
bypassing the resume call leaves the phylink state machine permanently
suspended. Even if the hardware error was transient, link state updates will
no longer be processed, resulting in a dead network interface that cannot
recover.
Can this be modified so phylink_resume() runs even on hardware error, or is
there another way to prevent the state from becoming stuck?
> +
> + if (!(reg8 & AX_PHY_POWER)) {
> + reg8 = AX_PHY_POWER;
> + ax88179_write_cmd(dev, AX88179A_PHY_POWER, 0, 0, 1, ®8);
> + msleep(250);
> + }
> + ax88179_write_cmd(dev, AX_FW_MODE, AX_FW_MODE_179A, 0, 0, NULL);
> +
> + /* Now, that AX_FW_MODE_179A is enabled, the PHY needs a power-cycle.
> + * PHY-power is re-enabled in ax88179a_reset()
> + */
> + ax88179_write_u8(dev, AX88179A_PHY_POWER, 0, 0, 0);
> + msleep(250);
> +
> + ax88179a_reset(dev);
[Severity: High]
Does this clobber a user-configured MAC address?
During resume, ax88179a_resume() unconditionally calls ax88179a_reset().
ax88179a_reset() calls ax88179_get_mac_addr(dev), which reads the default MAC
address from the hardware EEPROM or DTB and writes it into dev->net->dev_addr.
It then copies this value into dev->net->perm_addr.
If the user had previously configured a custom MAC address, this custom
address is permanently overwritten by the hardware default on every
suspend/resume cycle. Furthermore, modifying perm_addr outside of device
probe violates the invariant that it holds the permanent unalterable
hardware address.
Should the resume path instead restore the existing dev_addr to the device
registers without calling ax88179_get_mac_addr()?
> +
> + if (netif_running(dev->net)) {
> + rtnl_lock();
> + phylink_resume(ax179_data->phylink);
> + rtnl_unlock();
> + }
> +
> +err_out:
> + ax88179_set_pm_mode(dev, false);
> +
> + return usbnet_resume(intf);
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261008-ax88179a-v18-0-6fa1d4c40422@birger-koblitz.de?part=9
next prev parent reply other threads:[~2026-10-09 3:51 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 3:51 [PATCH net-next v18 00/13] ax88179_178a: Add support for AX88179A-based chips Birger Koblitz
2026-10-08 3:51 ` [PATCH net-next v18 01/13] phylink: Add phylink_mac_interrupt Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-08 3:51 ` [PATCH net-next v18 02/13] phylib: Add support for PHYs with broken forced mode Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-10 4:33 ` Birger Koblitz
2026-10-08 3:51 ` [PATCH net-next v18 03/13] ax88179_178a: Split driver into library and device specific code Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-10 4:36 ` Birger Koblitz
2026-10-08 3:51 ` [PATCH net-next v18 04/13] ax88179_178a: Add HW support for AX179A-based chips Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-10 4:46 ` Birger Koblitz
2026-10-08 3:51 ` [PATCH net-next v18 05/13] ax88179_178a: Add EEE configuration support for AX88179A MACs Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-08 3:51 ` [PATCH net-next v18 06/13] ax88179_178a: Add EEE configuration support for AX88179A PHYs Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-08 3:51 ` [PATCH net-next v18 07/13] ax88179_178a: Add VLAN offload support for AX88179A Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-10 4:49 ` Birger Koblitz
2026-10-08 3:51 ` [PATCH net-next v18 08/13] ax88179_178a: Add AX179A/AX279 multicast configuration Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-10 4:49 ` Birger Koblitz
2026-10-08 3:51 ` [PATCH net-next v18 09/13] ax88179_178a: Add Suspend/resume support for AX88179A/772D/279 Birger Koblitz
2026-10-09 3:51 ` sashiko-bot [this message]
2026-10-10 4:51 ` Birger Koblitz
2026-10-08 3:51 ` [PATCH net-next v18 10/13] ax88179_178a: Add ethtool get_drvinfo Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-08 3:51 ` [PATCH net-next v18 11/13] ax88179_178a: Update driver name and information Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-08 3:51 ` [PATCH net-next v18 12/13] ax88179_178a: Add support for AX88179A/772D/279 EEPROM access Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-08 3:51 ` [PATCH net-next v18 13/13] ax88796b: Add support for AX88772D, AX88179A and AX88279 Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-10 4:53 ` Birger Koblitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-164800@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mail@birger-koblitz.de \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.