From: netdev-bot+sashiko@kernel.org
To: mail@birger-koblitz.de
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, kuba@kernel.org,
pabeni@redhat.com, linux@armlinux.org.uk, andrew@lunn.ch,
hkallweit1@gmail.com, chenhuacai@kernel.org, kernel@xen0n.name,
edumazet@kernel.org, linux-usb@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
loongarch@lists.linux.dev, neuromoments@gmail.com,
beganovic.emir@gmail.com
Subject: Re: [PATCH net-next v21 03/13] ax88179_178a: Split driver into library and device specific code
Date: Mon, 16 Nov 2026 02:06:55 +0000 [thread overview]
Message-ID: <179479481543.3136.5279066204729044704@kernel.org> (raw)
In-Reply-To: <20261114-ax88179a-v21-3-c2d34410bcbe@birger-koblitz.de>
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 3 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The commit message describes a pure refactor: split
ax88179_178a into common library code plus device-specific code, then…
- [Medium] The patch renames the kernel module from ax88179_178a.ko to
ax88179.ko (Makefile: `obj-$(CONFIG_USB_NET_AX88179_178A) +=…
- [Medium] The reworked `ax88179_change_mtu()` (ax88179_lib.c:394-436)
does `WRITE_ONCE(net->mtu, new_mtu)` and `dev->hard_mtu = net->mtu +…
- [Low] The new `medium_status_mutex` is commented `/* protect
AX_MEDIUM_STATUS_MODE */` (ax88179_lib.h:161), but in this patch only…
--
ax88179_178a: Split driver into library and device specific code
This splits the ax88179_178a driver into common library code
(ax88179_lib.c/ax88179_lib.h) and device specific code for the AX88179
and AX88178a. It also renames the module to ax88179 and adds a
MODULE_ALIAS for the old ax88179_178a name.
> diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
> index 4964f7b326fbc..ddd76fa71e2ee 100644
> --- a/drivers/net/usb/Makefile
> +++ b/drivers/net/usb/Makefile
> @@ -12,7 +12,8 @@ obj-$(CONFIG_USB_HSO) += hso.o
> obj-$(CONFIG_USB_LAN78XX) += lan78xx.o
> obj-$(CONFIG_USB_NET_AX8817X) += asix.o
> asix-y := asix_devices.o asix_common.o ax88172a.o
> -obj-$(CONFIG_USB_NET_AX88179_178A) += ax88179_178a.o
> +obj-$(CONFIG_USB_NET_AX88179_178A) += ax88179.o
> +ax88179-y := ax88179_178a.o ax88179_lib.o
[Severity: Medium]
This renames the module from ax88179_178a.ko to ax88179.ko. The new
MODULE_ALIAS("ax88179_178a") keeps "modprobe ax88179_178a" working. Is
that enough for existing userspace configuration?
As I understand kmod, modprobe.d blacklist entries are matched against
the real module name. Hotplug loads the driver through the USB modalias,
which now resolves to ax88179. An existing "blacklist ax88179_178a" would
then stop applying, and the driver would bind again. People commonly
blacklist this driver so that cdc_ncm binds to AX88179A adapters.
"options ax88179_178a ...", "rmmod ax88179_178a" and scripts that check
/sys/module/ax88179_178a would also stop matching.
Could the commit message mention this user visible change?
> diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
> index 2279dbbcdb4dd..55268d0890d12 100644
> --- a/drivers/net/usb/ax88179_178a.c
> +++ b/drivers/net/usb/ax88179_178a.c
[ ... ]
> @@ -1290,6 +683,7 @@ static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf)
> return -ENOMEM;
>
> dev->driver_priv = ax179_data;
> + mutex_init(&ax179_data->medium_status_mutex);
>
> dev->net->netdev_ops = &ax88179_netdev_ops;
> dev->net->ethtool_ops = &ax88179_ethtool_ops;
[Severity: Medium]
The commit message only describes a split into library and device
specific code plus a module rename. This hunk, though, adds a new
medium_status_mutex. ax88179_change_mtu() in ax88179_lib.c is also
reworked to take that mutex and to return errors from the
AX_MEDIUM_STATUS_MODE read and write.
The old ax88179_change_mtu() ignored those errors, always called
usbnet_update_max_qlen() and always returned 0. The new version can
return a negative errno from ndo_change_mtu.
Could these functional changes be described in the commit message, or
moved into a separate patch? Later patches in the series use this mutex,
so it looks like groundwork for them. Anyone bisecting or backporting
what looks like a pure split would otherwise pick up new locking and new
ndo_change_mtu error semantics without knowing it.
[ ... ]
> diff --git a/drivers/net/usb/ax88179_lib.c b/drivers/net/usb/ax88179_lib.c
> new file mode 100644
> index 0000000000000..fbaf12b713b03
> --- /dev/null
> +++ b/drivers/net/usb/ax88179_lib.c
[ ... ]
> +int ax88179_change_mtu(struct net_device *net, int new_mtu)
> +{
> + struct usbnet *dev = netdev_priv(net);
> + struct ax88179_data *data;
> + u16 tmp16;
> + int err;
> +
> + data = dev->driver_priv;
> + mutex_lock(&data->medium_status_mutex);
> + WRITE_ONCE(net->mtu, new_mtu);
> + dev->hard_mtu = net->mtu + net->hard_header_len;
> + if (net->mtu > 1500) {
> + err = ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE,
> + 2, 2, &tmp16);
> + if (err < 0)
> + goto err_out;
> + tmp16 |= AX_MEDIUM_JUMBO_EN;
> + err = ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE,
> + 2, 2, &tmp16);
> + if (err < 0)
> + goto err_out;
> + } else {
[ ... ]
> + }
> + mutex_unlock(&data->medium_status_mutex);
> +
> + /* max qlen depend on hard_mtu and rx_urb_size */
> + usbnet_update_max_qlen(dev);
> +
> + return 0;
> +
> +err_out:
> + mutex_unlock(&data->medium_status_mutex);
> + return err;
> +}
[Severity: Medium]
Can this leave the MTU half applied when a USB control transfer fails?
net->mtu and dev->hard_mtu are updated before the AX_MEDIUM_STATUS_MODE
read and write. The err_out path only drops the mutex and returns the
error. It does not restore the old MTU, and it skips
usbnet_update_max_qlen().
netif_set_mtu_ext() only sends NETDEV_CHANGEMTU when the driver
succeeds. It only restores orig_mtu when a notifier fails:
net/core/dev.c:netif_set_mtu_ext() {
...
orig_mtu = dev->mtu;
err = __netif_set_mtu(dev, new_mtu);
if (!err) {
err = call_netdevice_notifiers_mtu(NETDEV_CHANGEMTU, dev,
orig_mtu);
...
}
Say the adapter returns -ETIMEDOUT or -EPIPE, or -ENODEV during unplug.
Userspace gets the error, but dev->mtu already holds the new value.
Upper layers never got NETDEV_CHANGEMTU, the JUMBO_EN bit in hardware
may not match the MTU, and the rx/tx qlen were not recomputed.
Retrying with the same value does not help, because netif_set_mtu_ext()
returns early:
if (new_mtu == dev->mtu)
return 0;
The previous code ignored these errors and always returned 0, so it
never ended up in this state. This code is the same at the end of the
series.
Should the MTU be set only after the register update succeeds, or be
restored on the error path?
> diff --git a/drivers/net/usb/ax88179_lib.h b/drivers/net/usb/ax88179_lib.h
> new file mode 100644
> index 0000000000000..9111a1395eb2f
> --- /dev/null
> +++ b/drivers/net/usb/ax88179_lib.h
[ ... ]
> +struct ax88179_data {
> + struct mutex medium_status_mutex; /* protect AX_MEDIUM_STATUS_MODE */
[Severity: Low]
Is this comment accurate? It says the mutex protects
AX_MEDIUM_STATUS_MODE.
In this patch only ax88179_change_mtu() takes the mutex, and that
function already runs under RTNL. None of the other accesses to this
register in ax88179_178a.c take it: ax88179_suspend(),
ax88179_link_reset(), ax88179_reset(), ax88179_net_reset() and
ax88179_stop().
For example, ax88179_link_reset() runs from the usbnet kevent work
without RTNL. It writes the whole register, with JUMBO_EN based on
dev->net->mtu:
} else if (GMII_PHY_PHYSR_GIGA == (tmp16 & GMII_PHY_PHYSR_SMASK)) {
mode |= AX_MEDIUM_GIGAMODE | AX_MEDIUM_EN_125MHZ;
if (dev->net->mtu > 1500)
mode |= AX_MEDIUM_JUMBO_EN;
...
ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE,
2, 2, &mode);
Here is one possible sequence. link_reset reads an MTU of 1500. Then
change_mtu sets the MTU to 4000 and turns JUMBO_EN on. The later
link_reset write clears JUMBO_EN again.
The other way round, the read-modify-write in change_mtu can write back
stale GIGAMODE and 125MHz bits over a 100M mode that link_reset just
wrote.
This race was there before the patch. However, the comment now claims
protection that the code does not give. This is still the case at the
end of the series. The ax88179a_devices.c link up path takes the mutex,
but none of the ax88179_178a.c accessors do.
Should the comment be narrowed, or should the other accessors take the
lock too?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261114-ax88179a-v21-0-c2d34410bcbe%40birger-koblitz.de
next prev parent reply other threads:[~2026-11-16 2:06 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 10:50 [PATCH net-next v21 00/13] ax88179_178a: Add support for AX88179A-based chips Birger Koblitz
2026-11-14 10:50 ` [PATCH net-next v21 01/13] phylink: Add phylink_mac_interrupt Birger Koblitz
2026-11-15 10:51 ` sashiko-bot
2026-11-16 2:06 ` netdev-bot+sashiko
2026-11-14 10:50 ` [PATCH net-next v21 02/13] phylib: Add support for PHYs with broken forced mode Birger Koblitz
2026-11-15 10:51 ` sashiko-bot
2026-11-16 2:06 ` netdev-bot+sashiko
2026-11-14 10:50 ` [PATCH net-next v21 03/13] ax88179_178a: Split driver into library and device specific code Birger Koblitz
2026-11-15 10:51 ` sashiko-bot
2026-11-16 2:06 ` netdev-bot+sashiko [this message]
2026-11-14 10:51 ` [PATCH net-next v21 04/13] ax88179_178a: Add HW support for AX179A-based chips Birger Koblitz
2026-11-15 10:51 ` sashiko-bot
2026-11-16 2:06 ` netdev-bot+sashiko
2026-11-14 10:51 ` [PATCH net-next v21 05/13] ax88179_178a: Add EEE configuration support for AX88179A MACs Birger Koblitz
2026-11-15 10:51 ` sashiko-bot
2026-11-14 10:51 ` [PATCH net-next v21 06/13] ax88179_178a: Add EEE configuration support for AX88179A PHYs Birger Koblitz
2026-11-15 10:51 ` sashiko-bot
2026-11-16 2:06 ` netdev-bot+sashiko
2026-11-14 10:51 ` [PATCH net-next v21 07/13] ax88179_178a: Add VLAN offload support for AX88179A Birger Koblitz
2026-11-15 10:51 ` sashiko-bot
2026-11-16 2:07 ` netdev-bot+sashiko
2026-11-14 10:51 ` [PATCH net-next v21 08/13] ax88179_178a: Add AX179A/AX279 multicast configuration Birger Koblitz
2026-11-15 10:51 ` sashiko-bot
2026-11-16 2:07 ` netdev-bot+sashiko
2026-11-14 10:51 ` [PATCH net-next v21 09/13] ax88179_178a: Add Suspend/resume support for AX88179A/772D/279 Birger Koblitz
2026-11-15 10:51 ` sashiko-bot
2026-11-16 2:07 ` netdev-bot+sashiko
2026-11-14 10:51 ` [PATCH net-next v21 10/13] ax88179_178a: Add ethtool get_drvinfo Birger Koblitz
2026-11-15 10:51 ` sashiko-bot
2026-11-16 2:07 ` netdev-bot+sashiko
2026-11-14 10:51 ` [PATCH net-next v21 11/13] ax88179_178a: Update driver name and information Birger Koblitz
2026-11-15 10:51 ` sashiko-bot
2026-11-16 2:07 ` netdev-bot+sashiko
2026-11-14 10:51 ` [PATCH net-next v21 12/13] ax88179_178a: Add support for AX88179A/772D/279 EEPROM access Birger Koblitz
2026-11-15 10:51 ` sashiko-bot
2026-11-16 2:07 ` netdev-bot+sashiko
2026-11-14 10:51 ` [PATCH net-next v21 13/13] ax88796b: Add support for AX88772D, AX88179A and AX88279 Birger Koblitz
2026-11-15 10:51 ` sashiko-bot
2026-11-16 2:07 ` netdev-bot+sashiko
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=179479481543.3136.5279066204729044704@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=beganovic.emir@gmail.com \
--cc=chenhuacai@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hkallweit1@gmail.com \
--cc=kernel@xen0n.name \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=loongarch@lists.linux.dev \
--cc=mail@birger-koblitz.de \
--cc=netdev@vger.kernel.org \
--cc=neuromoments@gmail.com \
--cc=pabeni@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox