🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #16903

Re: [PATCH net-next v21 12/13] ax88179_178a: Add support for AX88179A/772D/279 EEPROM access

#16903
From: netdev-bot+sashiko
Date: Mon, 16 Nov 2026 02:07
169 lines
14577 bytes
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
Technical Details
Message-ID: <179479482870.3136.10078101441879571465@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder3.feed.ams11.usenet.farm!feeder4.usenet.farm!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363996-linux-kernel-netdev=dewy.ru
References: <20261114-ax88179a-v21-12-c2d34410bcbe@birger-koblitz.de>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder3.feed.ams11.usenet.farm!feeder4.usenet.farm!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363996-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v21 12/13] ax88179_178a: Add support for AX88179A/772D/279 EEPROM access
Date: Mon, 16 Nov 2026 02:07:08 +0000
Organization: Usenet Network
Message-ID: <179479482870.3136.10078101441879571465@kernel.org>
References: <20261114-ax88179a-v21-12-c2d34410bcbe@birger-koblitz.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="1956541"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Bu23WQcirKIW/4sq0g1J4KODKYg= sha256:SImAqLh4cT+GGYf3JUQkn7VP8W1gvwtVZEZZnrXmgnE= sha1:gChBCqwcPkUkVZvmfZekeKmhaqM= sha256:zDQ4VqpidShi0xsaTduovuLINXVa0821eP357z6w8Oc=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 961D0114AF8; Mon, 16 Nov 2026 05:08:28 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id je4f9PvWIwGK; Mon, 16 Nov 2026 05:08:25 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-363996-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id A3B46114AF2; Mon, 16 Nov 2026 05:08:16 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 7203D37597; Mon, 16 Nov 2026 02:07:24 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794794831; b=LfKDyN2Pssm1lbdEl8gLYErjiC6VpFhgfb9abxo45o4novSPdn/DRLvHKIW8qJou2b7I ljCvqaM5UHVfa/baf2RBtAiTkq5N7ceSovWLdmR71B/Eb+5NRfU5Q1nAhF2VnTM+U6fii lTEK2PXCOgcaHfVU90pvxvZ4G9Ciklsc6WRZV8V3UmXyDm+U0gDpc8m8bPhGdnP1Kk8xD husT6ZMKzCf/mQsjf0qZc/aK93FXVQJ/KJ67dAeBNqKPXz/fFufrCe7J7hlmy2ooLRakX m1ifyTJHsbdu+loWS1jJnjR6wtJ1uM9rR7u+1XPEwvjo919dM3Nrx9N9P0kkPZd+4ew==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794794831; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=D/IbGZ9nhg9AGebaNUKLhffH3G51e8GK38u9ilPGpl0=; b=b7ZMr5vClCx2XtfVs1iP3cASl2/lalx2NKYFh7V62Ma6CeoVwkrVzVCyB8c4Krfu21vy dVVkoK5K5vXw1HDnYMsjuL6DKQcH3Hs1OWywTBPAWz3ODTjY5QKO0FjOepVtqxdk08FNk tmrHtvrAK/S3nEuyep6tXDEdWUuIAOujjdIuDstDojaXYkqYs9p4f1lOrJBfvvCHcHGzn tMTwQ+Fg5PXbcdYrVApEuSkh0FgkZKZUkzZ2ZSgscFpAw/qCNoHiiGxIcvYpLmvI89j4V 6zrAizKiWvM7jv+JsEF+T04B800OCXF/K92Kjc6tju9uVH2fZYbI15TzrDaLoEnqBYQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=TYso6ZsW; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8E27960A2606; Mon, 16 Nov 2026 02:07:11 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=TYso6ZsW
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794794830; b=eMzT6K4rwRCDbwtkgdTMsogl0aNjM6HV7BaKaF5gz82myXX2dBcW0XuttZdkmYfOnLZ5 WPUZaAXPgA/EVpbsnPsw1BkwmiZiQZOFnBX/Vl/Jfes/YS6ljnokGe2Rk7vkH++Q7M37C alH4KIW2PdQPnyvUz62F9EfPdsDp3vJsoPj3Eyf8SNl0p4DyWnxEk83oxsL2lT4m5n0Gn m/Ae1lDVT3E/7Rm8fX5oX1tN0vqNjpZY3pbc6fYJyEGA7XgV9jKo0JUszxAGCNU0SQ1zW qbBRBQaTun0UOjVwuWyGO7wdJWqoYJ2DaGFzgVi/kLKnY4jnKErSGhVy6GlXcTWhqgQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794794830; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=D/IbGZ9nhg9AGebaNUKLhffH3G51e8GK38u9ilPGpl0=; b=a1d+hxgM11/mZ7QFL9rb0ImE1Z+OVXjEZJpO7yWoRkZ66EgSLqjy6e41+HUKOAbcCM69 e4FwqZDTgPcM/tBYkiMjxn7gKLreX/m/I77MxwnJ1PiEXjDxX8knkRgTCsWLInWGR8gum mfIwKMSg0bSu8mSJFd0vV7kbiMzhPS/lFsVeOrMwbSvEahG9Fw72AqDELIPOkaKdAxIT+ fO39jUYKbY71Zz/3qMw0Bbppt3ZRt/pLWtlFG1HmDVZikTcazP0zpJd6tt+iY82dgblNa PCz9A98PgWBlHcyrZSaapZjJL7RmoF5kuYwIONLQORK7tkEYY9vUfvd3aB/oBS6SK/Q==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=TYso6ZsW; arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0C08606A88B; Mon, 16 Nov 2026 02:07:10 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30A491F00932; Mon, 16 Nov 2026 02:07:09 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794794830; bh=D/IbGZ9nhg9AGebaNUKLhffH3G51e8GK38u9ilPGpl0=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=TYso6ZsWRiDZ28HKDt9VCGywJ076oZm0H+ZAGFqMHIj/22oqJy1U5OZgaKWKdPUdE DSLZPPeAbwuUrS0xkfpd2Ilm62GZcewa+u9pnYwI+HG86zwZW4aNXUb/sLMhSKwJPW iJrNiBfVmzOZNJtGVqzdKULzInhRtnd7HFnDATdawt8931pyduWEjlHH/Z4PYH5mEX qvP0fCfy+Vfws0jdB0KEGKWBXikBnGIqqmkEdHLOEw4jhmjOCZAzbGIw5fMO5IIrvo TTTrIL9yXlBAD1HvwXBqYXNZV5p5afDbuU97OebNdfrW5qWLmAwRMW0i+xuWRy+Tod 3KHU8wR16GsbA==
X-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
X-In-Reply-To: <20261114-ax88179a-v21-12-c2d34410bcbe@birger-koblitz.de>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list