On 04/12/2026 9:19 am, netd…@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 3 potential > issue(s) to consider. > > Critical: 0 · High: 0 · Medium: 2 · 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] ax88179_set_multicast() > (drivers/net/usb/ax88179_lib.c:359-365) now picks its starting rxctl… > - [Medium] ax88179_set_multicast() now does an unlocked read-modify-write > of data->rxctl: READ_ONCE, clear IPE/DROPCRCERR/PRO/AMALL/AM, then… > - [Low] For chip_version >= AX_VERSION_AX88179A (AX88179A, AX88772D, > AX88279), ax88179_set_multicast()… > > -- > > net: usb: ax88179: Make receiving FCS on AX88179A configurable > > This patch changes ax88179_set_multicast() so that AX_RX_CTL_DROPCRCERR is > set on the AX88179A only when NETIF_F_RXFCS or NETIF_F_RXALL is enabled. > For chips with chip_version >= AX_VERSION_AX88179A, the rxctl value is now > built from the cached data->rxctl, not from a fixed baseline. The > behaviour of the older AX88179 is meant to stay the same. >
>> diff --git a/drivers/net/usb/ax88179_lib.c b/drivers/net/usb/ax88179_lib.c >> index 821ee9cd8ded1..353b3a7479308 100644 >> --- a/drivers/net/usb/ax88179_lib.c >> +++ b/drivers/net/usb/ax88179_lib.c >> @@ -352,14 +352,22 @@ 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); >> + if (data->chip_version >= AX_VERSION_AX88179A) { >> + 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: Medium] > > When chip_version >= AX_VERSION_AX88179A, this branch now starts from the > cached data->rxctl instead of AX_RX_CTL_START | AX_RX_CTL_AB. It never adds > START or AB back. The cache is only initialized by ax88179a_reset(). What > happens if this runs on the legacy ax88179_178a.c path? > > ax88179_bind() zero-allocates the private data: > > drivers/net/usb/ax88179_178a.c:ax88179_bind() { > ... > ax179_data = kzalloc_obj(*ax179_data); > ... > } > > It then reads chip_version from AX_CHIP_STATUS and does not reject values
>> = AX_VERSION_AX88179A. The legacy driver_info is picked only by USB
> VID/PID. That covers the 0b95:1790 vendor-interface catch-all entry and > the OEM entries (D-Link, Sitecom, Samsung, Lenovo, Belkin, Toshiba, MCT, > Allied Telesis). > > ax88179_reset() starts RX from a stack buffer and never stores the value > in ax179_data->rxctl: > > *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); > > If AX179A-class silicon (chip_version 6 or 7) is bound through this path, > would open go like this? > > __dev_open() > dev_set_rx_mode() > ax88179_set_multicast() > rxctl = 0 & ~(...); /* no START, no AB */ > WRITE_ONCE(data->rxctl, rxctl); > ax88179_write_cmd_async(dev, AX_ACCESS_MAC, AX_RX_CTL, ...); > > ax88179_link_reset() would then write the same START-less value back on > every link reset: > > ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, > &ax179_data->rxctl); > > Wouldn't that leave the RX engine stopped and broadcast reception off? > > Before this patch the legacy path always rebuilt the value with > START | AB, whatever chip_version said. The second patch in the series > does not seem to change this. > > I could not confirm that any shipping device puts AX179A-class silicon > behind one of the legacy table entries. Still, nothing in the code > prevents it.
This is wrong from the AI because these devices do not exist, the legacy driver only supported legacy devices.
> > [Severity: Low] > > AX_RX_CTL_AP is not in this mask, so is it intended that AP now stays set > on AX179A-family chips? ax88179a_reset() puts it into the cache: > > rxctl = AX_RX_CTL_DROPCRCERR | AX_RX_CTL_START | AX_RX_CTL_AP | > AX_RX_CTL_AMALL | AX_RX_CTL_AB; > > Before this patch, the first ndo_set_rx_mode call rebuilt rxctl from > START | AB | DROPCRCERR, which cleared AP. Now AP survives every rx-mode > update on the AX88179A, AX88772D and AX88279. > > The commit message only covers the DROPCRCERR/FCS change. Could it also > mention the switch to a read-modify-write of the cached value, and this > change to the filter mode? That switch is also what makes this function > depend on data->rxctl being initialized, as noted above. >
>> + } else { >> + rxctl = (AX_RX_CTL_START | AX_RX_CTL_AB | AX_RX_CTL_DROPCRCERR); >> + } >> 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;
>
Commit message will be modified.
> [Severity: Medium] > > This is an unlocked read-modify-write of data->rxctl, and DROPCRCERR is > derived from net->features. Can it race with ndo_set_features? > > Later in this series, the "Support NETIF_F_RXFCS and NETIF_F_RXALL" patch > makes ax88179a_set_features() do its own read-modify-write. It calls > READ_ONCE() on ax179_data->rxctl, toggles DROPCRCERR, stores the result > with WRITE_ONCE() and then does a synchronous AX_RX_CTL write. All of this > runs under RTNL only. > > ndo_set_rx_mode runs under netif_addr_lock and can be reached without > RTNL, for example by an unprivileged IPV6_ADD_MEMBERSHIP: > > ipv6_sock_mc_join() > dev_mc_add() > __dev_set_rx_mode() > ax88179_set_multicast() > > Also, __netdev_update_features() only updates dev->features after > ndo_set_features() returns: > > err = dev->netdev_ops->ndo_set_features(dev, features); > ... > dev->features = features; > > With "ethtool -K ethX rx-all on", the interleaving could be: > > CPU1 (set_features) CPU2 (ax88179_set_multicast) > sets DROPCRCERR in cache and hw > sees RXALL still clear > clears DROPCRCERR > async AX_RX_CTL write lands last > dev->features gains RXALL > > After that, ax88179a_rx_fixup() sets fcs_trailer = ETH_FCS_LEN and > subtracts it from pkt_len because RXFCS is off, but the hardware no > longer appends the FCS. Wouldn't every received frame then lose 4 bytes > of payload until the next rx-mode change? Turning rx-fcs or rx-all off > would hit the reverse case and leave a 4-byte trailer on every frame. > > The two read-modify-write paths can also lose each other's PRO/AM/AMALL > updates. ax88179a_mac_link_up() then writes the stale cache back to the > hardware. It holds medium_status_mutex, which neither writer takes: > > ax88179_write_u16(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, READ_ONCE(ax179_data->rxctl)); > > The second patch in the series fixes the resume case by deriving > DROPCRCERR from the features in ax88179a_reset(). It doesn't seem to fix > this race, and it adds the second writer. Should these writers share a > lock? >
>> if (net->flags & IFF_PROMISC) { >> rxctl |= AX_RX_CTL_PRO; >> } else if (net->flags & IFF_ALLMULTI ||
> > [ ... ] >
Locking via a mutex will be added to protect AX_RX_CTL/rxctl.