🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24497

Re: [PATCH net-next v2 1/2] net: usb: ax88179: Make receiving FCS on AX88179A configurable

#24497
From: netdev-bot+sashiko
Date: Mon, 30 Nov 2026 08:35
200 lines
15181 bytes
Thank you for your contribution! Sashiko AI review found 5 potential
issue(s) to consider.

Critical: 0 · High: 1 · Medium: 0 · Low: 4 (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).

- [High] Legacy AX88179/AX88178A adapters
  (drivers/net/usb/ax88179_178a.c) stop receiving after ifup.
- [Low] In this patch alone, the new `net->features & (NETIF_F_RXFCS |
  NETIF_F_RXALL)` test in `ax88179_set_multicast()` can never be true.
- [Low] In this patch, `ax88179a_reset()` still sets AX_RX_CTL_DROPCRCERR
  unconditionally in `data->rxctl` and in the hardware.
- [Low] The comment in `ax88179a_bind()` says 'AX_RX_CTL_DROPCRCERR is
  anyway set for all chips'.
- [Low] Moving `ax88179_set_multicast()` from rebuilding rxctl to a read-
  modify-write of `data->rxctl` also silently keeps AX_RX_CTL_AP…

Pre-existing issues:
- [Low] Three writers of AX_RX_CTL do not share a lock.

--

net: usb: ax88179: Make receiving FCS on AX88179A configurable

This commit changes ax88179_set_multicast() to start from the cached
data->rxctl value. Before, it built the value from a fixed
START | AB | DROPCRCERR seed. With this patch, AX_RX_CTL_DROPCRCERR is
set on AX88179A only when NETIF_F_RXFCS or NETIF_F_RXALL is enabled, and
is always set on the other chips.

> diff --git a/drivers/net/usb/ax88179_lib.c b/drivers/net/usb/ax88179_lib.c
> index 821ee9cd8ded1..6a0023e6153dc 100644
> --- a/drivers/net/usb/ax88179_lib.c
> +++ b/drivers/net/usb/ax88179_lib.c
> @@ -352,14 +352,19 @@ void ax88179_set_multicast(struct net_device *net)
>  	struct usbnet *dev = netdev_priv(net);
>  	u8 *m_filter = ((u8 *)dev->data);
>  	struct ax88179_data *data;
> -	u16 rxctl = 0;
> +	u16 rxctl;
>  
>  	data = dev->driver_priv;
>  
> -	rxctl = (AX_RX_CTL_START | AX_RX_CTL_AB | AX_RX_CTL_DROPCRCERR);
> +	rxctl = READ_ONCE(data->rxctl);
> +	rxctl &= ~(AX_RX_CTL_IPE | AX_RX_CTL_DROPCRCERR | AX_RX_CTL_PRO |
> +		   AX_RX_CTL_AMALL | AX_RX_CTL_AM);

[Severity: High]
Does this stop RX on the legacy AX88179/AX88178A devices handled by
ax88179_178a.c?

The new code assumes data->rxctl already holds AX_RX_CTL_START and
AX_RX_CTL_AB. The legacy driver never stores anything in that field.
ax88179_bind() allocates ax179_data with kzalloc_obj(), so rxctl starts
at 0. ax88179_reset() programs the register only from a stack buffer:

drivers/net/usb/ax88179_178a.c:ax88179_reset() {
    ...
	*tmp16 = AX_RX_CTL_DROPCRCERR | AX_RX_CTL_IPE | AX_RX_CTL_START |
		 AX_RX_CTL_AP | AX_RX_CTL_AMALL | AX_RX_CTL_AB;
	ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, tmp16);
    ...
}

On ifup the sequence is:

__dev_open()
  usbnet_open()
    ax88179_reset()          /* START written to hardware only */
  dev_set_rx_mode()
    ax88179_set_multicast()  /* starts from data->rxctl == 0 */

The value written to AX_RX_CTL and cached in data->rxctl then has
neither AX_RX_CTL_START nor AX_RX_CTL_AB set.

ax88179_link_reset() writes that cached value again on every link-up:

drivers/net/usb/ax88179_178a.c:ax88179_link_reset() {
    ...
		mode = 0;
		ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, &mode);
		ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2,
				  &ax179_data->rxctl);
    ...
}

Wouldn't the receiver then stay disabled?

If so, this statement in the commit message would not hold:

  "For the older AX88179, the behaviour does not change."

The follow-up patch "net: usb: ax88179: Support NETIF_F_RXFCS and
NETIF_F_RXALL on AX88179A" does not touch ax88179_178a.c, so this
appears to remain at the end of the series.

[Severity: Low]
Is it intended that AX_RX_CTL_AP now survives every rx_mode update on
AX88179A/AX88772D/AX88279?

ax88179a_reset() puts AP into data->rxctl:

drivers/net/usb/ax88179a_devices.c:ax88179a_reset() {
    ...
	rxctl = AX_RX_CTL_DROPCRCERR | AX_RX_CTL_START | AX_RX_CTL_AP |
		AX_RX_CTL_AMALL | AX_RX_CTL_AB;
    ...
	WRITE_ONCE(ax179_data->rxctl, rxctl);
	ax88179_write_u16(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, rxctl);
}

Before this patch, the first ndo_set_rx_mode call rebuilt the value,
which cleared AP. The new clear mask leaves AP set, and
ax88179a_mac_link_up() writes it again on each link-up.

This changes the RX filter programming beyond the FCS change, and the
commit message does not mention it. At the end of the series,
ax88179a_reset() still sets AP and the mask is the same.

> +
>  	if (data->ip_align)
>  		rxctl |= AX_RX_CTL_IPE;
> -
> +	if (net->features & (NETIF_F_RXFCS | NETIF_F_RXALL) ||
> +	    data->chip_version != AX_VERSION_AX88179A)
> +		rxctl |= AX_RX_CTL_DROPCRCERR;

[Severity: Low]
Can the NETIF_F_RXFCS | NETIF_F_RXALL test ever be true with only this
patch applied?

ax88179a_bind() does not add either feature to hw_features. Neither
ax88179a_set_features() nor ax88179_set_features() reprograms AX_RX_CTL
when these features change. ax88179a_rx_fixup() also still drops
errored frames, so RXALL would not deliver them.

The follow-up patch "net: usb: ax88179: Support NETIF_F_RXFCS and
NETIF_F_RXALL on AX88179A" adds the hw_features bits, the set_features
handling and the rx_fixup changes. This only affects this patch when
applied on its own.

[Severity: Low]
ax88179a_reset() still sets AX_RX_CTL_DROPCRCERR unconditionally, in
both data->rxctl and the hardware (see the ax88179a_reset() snippet
above).

Nothing calls ndo_set_rx_mode after ax88179a_resume()->ax88179a_reset().
Wouldn't AX88179A/AX88772D go back to appending the FCS after a resume?
ax88179a_mac_link_up() would then write that value again on each
link-up.

The follow-up patch "net: usb: ax88179: Support NETIF_F_RXFCS and
NETIF_F_RXALL on AX88179A" makes DROPCRCERR conditional in
ax88179a_reset(). That makes the reset/resume path match
ax88179_set_multicast().

[Severity: Low]
This isn't a bug, but this change makes the comment in ax88179a_bind()
stale:

	/* The AX88279 requires both the AX_RX_CTL_IPE and AX_RX_CTL_DROPCRCERR
	 * bits set in AX_RX_CTL for creating correct RX-URBs. AX_RX_CTL_DROPCRCERR
	 * is anyway set for all chips, make sure AX_RX_CTL_IPE is set via ip_align.

DROPCRCERR is no longer set on AX88179A unless RXFCS or RXALL is
enabled. The follow-up patch in the series rewrites this comment.

>  	if (net->flags & IFF_PROMISC) {
>  		rxctl |= AX_RX_CTL_PRO;
>  	} else if (net->flags & IFF_ALLMULTI ||

[Severity: Low]
This is a pre-existing issue and was not introduced by this patch.
ax88179_set_multicast() ends with:

	WRITE_ONCE(data->rxctl, rxctl);
	ax88179_write_cmd_async(dev, AX_ACCESS_MAC, AX_RX_CTL,
				2, 2, &data->rxctl);

It runs under netif_addr_lock only. There are two other writers of
AX_RX_CTL:

ax88179a_mac_link_up() writes a READ_ONCE() snapshot synchronously,
under medium_status_mutex.

ax88179a_reset() on the resume path does its own WRITE_ONCE() and a
synchronous write.

These three writers don't share a lock. Can AX_RX_CTL end up holding an
older value than the cached data->rxctl?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261129-fcs-v2-0-f60d6b105a15%40birger-koblitz.de
Technical Details
Message-ID: <179602771999.3146.10007976287622195841@kernel.org>
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374025-linux-kernel-netdev=dewy.ru
References: <20261129-fcs-v2-1-f60d6b105a15@birger-koblitz.de>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374025-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2 1/2] net: usb: ax88179: Make receiving FCS on
 AX88179A configurable
Date: Mon, 30 Nov 2026 08:35:19 +0000
Organization: Usenet Network
Message-ID: <179602771999.3146.10007976287622195841@kernel.org>
References: <20261129-fcs-v2-1-f60d6b105a15@birger-koblitz.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1378740"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:FWIRtZ6HKA3r/iSwJWpy3ZBZclU= sha256:Ae4GPYKjb3OcIyQg3FBOQ3uWa66KZJmD/7PslFwBrYI=
	sha1:WCd+9iofhDglyHvAixksBYoq0Rk= sha256:JLUDSS3GKZiU04FhTsGTz/wAzzIgB+phtplgqcv/igQ=
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 B5106125FCC; Mon, 30 Nov 2026 11:35:44 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.401
X-Spam-Status: No, score=-2.401 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.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] 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 DdAl2_KL3IRF;
	Mon, 30 Nov 2026 11:35:41 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-374025-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 79532125FD0; Mon, 30 Nov 2026 11:35:32 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id CE25225BBA; Mon, 30 Nov 2026 08:35:28 +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=1796027727;
	b=Ohn+Vg8dvwtqM82tHfOLrVQAgEsO9a7qzsBeX9DnTRbU9kSbaSnCd3agv66bdMIjciMi
	 9TWK+cWVHJP7ZvbrJIWmLU8MVYV8+5PeN7aULSD3VPG09laAzK6nRNjTX+dlGw+5MHHfI
	 KLz7NQWwWs+c3UYDb3HiDlU2C3pV4kHwl+0hjtxUC95m/waajl2gsXffOXQkgTibz1Hue
	 z8MWalPg7DflmU+Z9twR3KPlpjw6nzZCh+ynG1LQFLHtKCo0J+Dgh3mkoGJuq+GODBEm7
	 DmUmV3H+ashn8esEBfJmnvx6jfJR8GNdspg/Q5FfkKGc4yVoaEktnlnWM08UiVf7pxw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796027727;
	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=pfVqDNCEPxIQv4waHIm061LYtsluTPQjgP9a6f1tU0c=;
	b=QZyUOYcJV816eCYPorjD9LMBDRjTgZrhljQotIl834KfL2erI7YVOjI9/SwSdr4jaNk8
	 0yuXPRnwMVS9ACfQXPldmtcsmOBvFjNXpWtVqMOk/3Oxf/44fYbB5irLc3j83Pz5Up7sR
	 x4oG3KS/FT/uj55lzZAUp5t/Z8UESZLl4jx3HFtyPIMWlTvQfoC9bSRWpYkNXbVlCDrNP
	 rCQnlDvg3+vUyx1IWMsy2ivNAneGykevSZWpDnRFstAqAdpK9H6KbWqyiF/1kRvowjBCR
	 HPnitV/xa8VGROYWYmPWF13SJ3PpnhHVFzN9a9YsaHps7kFOWc8Nbn0Y1+YpFl0kcZA==
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="Q8n/9yiF";
	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 22F53606A334;
	Mon, 30 Nov 2026 08:35:27 +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=Q8n/9yiF
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=1796027721;
	b=IhUtAz/SGvD0xMycc4CX6e7C5LJogrzXKlAktMi6akSUXC4TKfV7DRxGZNyS7qzwzBVo
	 WvrqQv1zIdcDqFCgKWpZRoUUy9zXecThmX1LtEcllxeJMW4Dmz1/0ekGPzTiA6l43nGMv
	 OTH4Fy6s36WoSejtXWvcCL7QT895dsRr6BGir2nmZf0gSr1nbEWbS07qbWXBMXdayh3F5
	 Fi/oRWPqe6SzJjplvbACT8sWJEezzkpE8X/FugldvWz64LCyIaly2xM/FaRNwOlrBaSF6
	 YQmzVzaBa9OlTTz7bEboRldi9ldndF/5KPretfokLdIzI5W9jUkTCcKbN2oNqoFV8hQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796027721;
	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=pfVqDNCEPxIQv4waHIm061LYtsluTPQjgP9a6f1tU0c=;
	b=MExZbNMc8I0dtVcvM2twxRXzwoWcy01CkiA9uww4GeXyA/z3kWbpG4KRXRlam040ihiW
	 d3RuYeLX76lolUDMXkaWrXdx4kOcvDNXriA23iCurPDv1GzSNd/QRQakS9tQgOIKNA16f
	 Nd9gnINQ+M16vZ/Jkf/4eCWMW3DHMggrQNSRfukbZsskwhYz+DylCiHshfHtcOvWK43NN
	 4rcufO29ymogJvcHOKJzutkgp5KAgNvcttRhVhK253SDA4+CHz4qZmfW+bOPKSXYSzpqs
	 wR4uQVjwSVRN6FC+wpZgdUX6BVGO/I49emtzpgSFOyodJJeYiwgQ90zWPasswFLrJBg==
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="Q8n/9yiF";
	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 42E73606A31C;
	Mon, 30 Nov 2026 08:35:21 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B9B51F00896;
	Mon, 30 Nov 2026 08:35:20 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796027720;
	bh=pfVqDNCEPxIQv4waHIm061LYtsluTPQjgP9a6f1tU0c=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Q8n/9yiFPqI3j1CIj5EwJwLNcFZBYOIMTxpdD4QqI/7gpjdfdcse9HheiOMF+y72Q
	 czPR/dS3QfLOcUVpWsJSsrb1zd1janEbCW4XhjNTnxl3/rFBV5G7WxtPOVgHio/pb1
	 u7HCxlX95DcRcBW+wTQphOFkTfBA1eBbbrdKOt/UMQ1y4mH9lZXQESNNUw7KFbvFJH
	 x8FZVhfoRY0LqrXp45BjU23zDabKocCY+W5EOy2tp4y8/xLbuc+hzz5O0G62QgaceA
	 SHtjXCAfziy8AV+QAvbgYCQhgn2NJ9nhW600jzsOFyh1ZBOMgcaGpGZYJ98DbElDtn
	 ndPO4lrt2yu9w==
X-Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
 linux-usb@vger.kernel.org, benjamin.larsson@genexis.eu
X-In-Reply-To: <20261129-fcs-v2-1-f60d6b105a15@birger-koblitz.de>
X-sashiko-severity: High
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