From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B9B51F00896; Mon, 30 Nov 2026 08:35:20 +0000 (UTC) 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== Subject: Re: [PATCH net-next v2 1/2] net: usb: ax88179: Make receiving FCS on AX88179A configurable From: netdev-bot+sashiko@kernel.org To: mail@birger-koblitz.de 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 Date: Mon, 30 Nov 2026 08:35:19 +0000 Message-ID: <179602771999.3146.10007976287622195841@kernel.org> In-Reply-To: <20261129-fcs-v2-1-f60d6b105a15@birger-koblitz.de> References: <20261129-fcs-v2-1-f60d6b105a15@birger-koblitz.de> X-sashiko-severity: High Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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