Re: [PATCH net-next v21 12/13] ax88179_178a: Add support for AX88179A/772D/279 EEPROM access
From: netdev-bot+sashiko
Date: Sun Nov 15 2026 - 21:07:42 EST
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 2
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 new EEPROM read path builds each vendor request from two
sources that are not tied together.
- [Low] This patch quietly closes an EEPROM write path that an earlier
commit in this series already opened on AX88179A/772D/279 chips, and…
- [Low] The new comment in `ax88179_eeprom_access_params()`
(drivers/net/usb/ax88179_lib.c) says "AX88279 has an EEPROM…
--
ax88179_178a: Add support for AX88179A/772D/279 EEPROM access
This commit makes ax88179_get_eeprom() chip-aware. It uses a per-device
read command and block size, so ethtool can read the AX88179A/772D efuses
and the AX88279 flash. It also makes ax88179_set_eeprom() return
-EOPNOTSUPP on AX88179A and newer chips.
> diff --git a/drivers/net/usb/ax88179_lib.c b/drivers/net/usb/ax88179_lib.c
> index 1523a920f3c38..821ee9cd8ded1 100644
> --- a/drivers/net/usb/ax88179_lib.c
> +++ b/drivers/net/usb/ax88179_lib.c
> @@ -210,35 +210,61 @@ int ax88179_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
> return 0;
> }
>
> +static void
> +ax88179_eeprom_access_params(struct ax88179_data *ax179_data, int i, u16 *value, u16 *idx)
> +{
> + /* AX88179 has a word-addressable EEPROM
> + * AX88179A uses EFUSES with 20 bytes length
> + * AX88279 has an EEPROM addressable in 256 byte blocks
> + */
[Severity: Low]
This isn't a bug, but is this comment accurate for the AX88279?
The commit message says "The AX88279 has 16K FLASH", and ax88179a_bind()
sets up AX88179A_FLASH_READ/AX88179A_FLASH_WRITE for it. The code below
also passes a byte offset, not a block number:
*value = (i * ax179_data->eeprom_block) >> 16;
*idx = (i * ax179_data->eeprom_block) & 0xffff;
Would it be clearer to describe this as flash read in 256 byte chunks,
with a 32-bit byte offset split across wValue/wIndex?
> + if (ax179_data->chip_version < AX_VERSION_AX88179A) {
> + *value = i;
> + *idx = 1;
> + } else if (ax179_data->chip_version == AX_VERSION_AX88279) {
> + *value = (i * ax179_data->eeprom_block) >> 16;
> + *idx = (i * ax179_data->eeprom_block) & 0xffff;
> + } else {
> + *value = i << 4;
> + *idx = 0;
> + }
> +}
[Severity: Medium]
Can the wValue/wIndex chosen here disagree with the opcode and length used
in the same request?
ax88179_get_eeprom() takes eeprom_read_cmd and eeprom_block from whatever
the bind function set. This helper, and the new write gate in
ax88179_set_eeprom(), branch only on chip_version. That value comes from
the hardware as (AX_CHIP_STATUS & 0xf0) >> 4, so it can be 0..15, and
nothing validates it.
ax88179_bind() in ax88179_178a.c stores chip_version without checking it
and always uses the legacy parameters:
ax179_data->eeprom_read_cmd = AX_ACCESS_EEPROM;
ax179_data->eeprom_write_cmd = AX_ACCESS_EEPROM;
ax179_data->eeprom_block = 2;
That bind handles the generic 0b95:1790 entry, which matches any
bcdDevice other than 0x200/0x300/0x400. It also handles all of the OEM
IDs.
Suppose an AX88179A-class chip binds this way:
version 6: ethtool -e sends AX_ACCESS_EEPROM with value=i<<4, idx=0,
len=2
version 7: ethtool -e sends value=(2*i)>>16, idx=2*i
Before this patch, the same device got consistent word reads (value=i,
idx=1). On that device, ethtool -E now returns -EOPNOTSUPP, even though
bind set up the legacy word-write protocol.
The ax88179a path has the opposite mismatch. ax88179a_get_eeprom_len()
uses a >= test:
if (ax179_data->chip_version >= AX_VERSION_AX88279)
return AX88279_EEPROM_LEN;
ax88179a_bind() and this helper both test == AX_VERSION_AX88279 instead.
A chip code of 8..15 would be reported as 16K of flash. It would then be
read with 20-byte efuse requests (value=i<<4) for up to 819 rows, while
only 32 rows exist.
A chip code below 6 on the ax88179a path would get value=i, idx=1 with
the efuse opcode and a 20-byte length. ax88179_set_eeprom() would also
still allow the legacy word writes for it.
Could all of these decisions come from one per-bind setting, for example
an access mode stored next to eeprom_block? Alternatively, could bind
reject or normalize unexpected chip_version values?
[ ... ]
> @@ -246,12 +272,17 @@ int ax88179_get_eeprom(struct net_device *net, struct ethtool_eeprom *eeprom, u8
> int ax88179_set_eeprom(struct net_device *net, struct ethtool_eeprom *eeprom, u8 *data)
> {
> struct usbnet *dev = netdev_priv(net);
> + struct ax88179_data *ax179_data;
> u16 *eeprom_buff;
[ ... ]
> + ax179_data = dev->driver_priv;
> + if (ax179_data->chip_version >= AX_VERSION_AX88179A)
> + return -EOPNOTSUPP;
> +
[Severity: Low]
This guard changes existing behavior, but the commit message only
describes new read support ("no write access is provided"). Should the
commit message say that this also closes a write path that already
exists?
An earlier patch in this series, "ax88179_178a: Add HW support for
AX179A-based chips", already added these to ax88179a_ethtool_ops in
ax88179a_devices.c:
.get_eeprom_len = ax88179a_get_eeprom_len,
.get_eeprom = ax88179_get_eeprom,
.set_eeprom = ax88179_set_eeprom,
At that point ax88179a_get_eeprom_len() already reported 640 bytes or
16K. So at every commit between that one and this patch, ethtool -E on an
AX88179A/772D/279 runs the legacy word read-modify-write:
ax88179_set_eeprom()
ax88179_write_cmd(dev, AX_ACCESS_EEPROM, i, 1, 2, ...) /* per word */
ax88179_write_cmd(dev, AX_RELOAD_EEPROM_EFUSE, ...)
These parts have efuses or SPI flash, not a word EEPROM. At those commits,
ethtool -e also sends legacy AX_ACCESS_EEPROM word reads across the whole
advertised range.
Could the series be reordered? One option is to leave
.get_eeprom/.set_eeprom out of ax88179a_ethtool_ops until this patch.
Another is to move the -EOPNOTSUPP guard into the commit that adds the
ops. Either way, a bisect or partial backport would not land on a kernel
that can send EEPROM writes and a reload to these parts.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261114-ax88179a-v21-0-c2d34410bcbe%40birger-koblitz.de