From: netdev-bot+sashiko@kernel.org
To: mail@birger-koblitz.de
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, linux@armlinux.org.uk,
andrew@lunn.ch, hkallweit1@gmail.com, linux-usb@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
neuromoments@gmail.com
Subject: Re: [PATCH net-next v11 10/15] ax88179_178a: Add AX179A/AX279 multicast configuration
Date: Wed, 16 Sep 2026 06:47:33 +0000 [thread overview]
Message-ID: <178954125370.22033.18019147682392087483@kernel.org> (raw)
In-Reply-To: <20260914-ax88179a-v11-10-5ea7a925ba6d@birger-koblitz.de>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider:
Critical: 0 · High: 1 · Medium: 1 · Low: 0
- [High] At this commit, ax88179_set_multicast()
(drivers/net/usb/ax88179_lib.c:313-315) only sets AX_RX_CTL_IPE when…
- [Medium] Adding '.ndo_set_rx_mode = ax88179_set_multicast' to
ax88179a_netdev_ops (drivers/net/usb/ax88179a_devices.c:611) creates a…
--
ax88179_178a: Add AX179A/AX279 multicast configuration
This makes AX_RX_CTL_IPE conditional on data->ip_align in the shared
ax88179_set_multicast() helper, adds AX_RX_CTL_DROPCRCERR to the base
value, and registers the helper as .ndo_set_rx_mode for the AX88179A
netdev ops.
> diff --git a/drivers/net/usb/ax88179_lib.c b/drivers/net/usb/ax88179_lib.c
> index 3324069e90fc3..708b0b23f1363 100644
> --- a/drivers/net/usb/ax88179_lib.c
> +++ b/drivers/net/usb/ax88179_lib.c
> @@ -305,10 +305,14 @@ int ax88179_set_eeprom(struct net_device *net, struct ethtool_eeprom *eeprom, u8
> void ax88179_set_multicast(struct net_device *net)
> {
> struct usbnet *dev = netdev_priv(net);
> - struct ax88179_data *data = dev->driver_priv;
> u8 *m_filter = ((u8 *)dev->data);
> + struct ax88179_data *data;
> +
> + data = dev->driver_priv;
>
> - data->rxctl = (AX_RX_CTL_START | AX_RX_CTL_AB | AX_RX_CTL_IPE);
> + data->rxctl = (AX_RX_CTL_START | AX_RX_CTL_AB | AX_RX_CTL_DROPCRCERR);
> + if (data->ip_align)
> + data->rxctl |= AX_RX_CTL_IPE;
[Severity: High]
Can this shift every received frame by two bytes on the legacy
AX88179/178A devices?
ax88179_set_multicast() is shared, and the legacy driver in
ax88179_178a.c registers it as .ndo_set_rx_mode in ax88179_netdev_ops.
At this commit, ->ip_align is never assigned anywhere in
ax88179_178a.c; ax88179_bind() zero-allocates the private data:
ax179_data = kzalloc_obj(*ax179_data);
if (!ax179_data)
return -ENOMEM;
dev->driver_priv = ax179_data;
The only assignments to ->ip_align in the tree at this commit are in
ax88179a_bind() in ax88179a_devices.c:
if (ax179_data->chip_version == AX_VERSION_AX88279) {
ax179_data->ip_align = 1;
...
} else {
ax179_data->ip_align = 0;
So on legacy chips the first rx-mode update after ifup
(dev_open() -> dev_set_rx_mode() -> __dev_set_rx_mode(), a multicast
join, or a promisc toggle) rewrites AX_RX_CTL as
START|AB|DROPCRCERR without AX_RX_CTL_IPE, undoing what
ax88179_reset() programmed:
*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;
Meanwhile ax88179_rx_fixup() still unconditionally accounts for the
2-byte alignment pseudo header:
/* Skip IP alignment pseudo header */
skb_pull(skb, 2);
...
memcpy(ax_skb->data, skb->data + 2, pkt_len);
Once the device stops inserting the pad, does each delivered frame lose
its first two bytes and pick up two bytes of trailing data? The state
also looks sticky, since ax88179_link_reset() re-programs the cached
rxctl.
This also seems to be the opposite of the commit message claim that the
change makes things "consistent with the initial configuration in
ax88179_reset()", at least for the legacy chips, since ax88179_reset()
sets AX_RX_CTL_IPE unconditionally there.
A later patch in the same series ("ax88179_178a: Add support for
AX88179A/772D/279 EEPROM access") adds "ax179_data->ip_align = 1;" to
ax88179_bind(), which restores AX_RX_CTL_IPE for the legacy path, so
the end state of the series is fine. Could that assignment be moved
into this patch instead, so legacy RX is not broken at intermediate
commits?
>
> if (net->flags & IFF_PROMISC) {
> data->rxctl |= AX_RX_CTL_PRO;
> diff --git a/drivers/net/usb/ax88179a_devices.c b/drivers/net/usb/ax88179a_devices.c
> index 4bca801236b08..24accbc22092a 100644
> --- a/drivers/net/usb/ax88179a_devices.c
> +++ b/drivers/net/usb/ax88179a_devices.c
> @@ -608,6 +608,7 @@ static const struct net_device_ops ax88179a_netdev_ops = {
> .ndo_set_mac_address = ax88179_set_mac_addr,
> .ndo_validate_addr = eth_validate_addr,
> .ndo_eth_ioctl = usbnet_mii_ioctl,
> + .ndo_set_rx_mode = ax88179_set_multicast,
[Severity: Medium]
What serializes ax179_data->rxctl between this new callback and
ax88179a_mac_link_up()?
ax88179_set_multicast() builds rxctl in several separate stores (base
value, then |= AX_RX_CTL_IPE, then |= PRO/AMALL/AM) and then submits an
asynchronous register write:
ax88179_write_cmd_async(dev, AX_ACCESS_MAC, AX_RX_CTL,
2, 2, &data->rxctl);
It runs from __dev_set_rx_mode() with netif_addr_lock_bh() held only.
ax88179a_mac_link_up() reads the same field and programs the same
register with a blocking control transfer:
ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, &ax179_data->rxctl);
That path comes from the phylink resolve work, and phylink_resolve()
holds only:
mutex_lock(&pl->phydev_mutex);
phy = pl->phydev;
if (phy)
mutex_lock(&phy->lock);
mutex_lock(&pl->state_mutex);
so neither RTNL nor netif_addr_lock is held there. ax88179a_reset() is
a third writer of the same field:
ax179_data->rxctl = AX_RX_CTL_DROPCRCERR | AX_RX_CTL_START |
AX_RX_CTL_AP | AX_RX_CTL_AMALL | AX_RX_CTL_AB;
if (ax179_data->ip_align)
ax179_data->rxctl |= AX_RX_CTL_IPE;
ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, &ax179_data->rxctl);
Two things look possible. Can ax88179a_mac_link_up() observe rxctl
between the base store and the "|= AX_RX_CTL_IPE" store and program
AX_RX_CTL without IPE on an AX88279 where ip_align == 1, while
ax88179a_rx_fixup() keeps deriving its offsets from ip_align:
pkt_len_plus_padd = ((pkt_len + 7 + (ax179_data->ip_align ? 2 : 0)) & 0x7FFF8);
...
memcpy(ax_skb->data, skb->data + (ax179_data->ip_align ? AX179A_RX_HW_PAD : 0),
And can the blocking write in ax88179a_mac_link_up() land after the
async URB from ax88179_set_multicast() completes, leaving the hardware
filter (promisc/AM bits) out of sync with data->rxctl until the next
link event or rx-mode change?
This still appears to be the case at the end of the series, where both
ax88179_set_multicast() and ax88179a_mac_link_up() remain unlocked.
> .ndo_set_features = ax88179a_set_features,
> .ndo_vlan_rx_add_vid = ax88179a_vlan_rx_add_vid,
> .ndo_vlan_rx_kill_vid = ax88179a_vlan_rx_kill_vid,
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260914-ax88179a-v11-0-5ea7a925ba6d%40birger-koblitz.de
next prev parent reply other threads:[~2026-09-16 6:47 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 12:46 [PATCH net-next v11 00/15] ax88179_178a: Add support for AX88179A-based chips Birger Koblitz
2026-09-14 12:46 ` [PATCH net-next v11 01/15] phylink: Add phylink_mac_interrupt Birger Koblitz
2026-09-14 14:13 ` Nicolai Buchwitz
2026-09-16 6:47 ` netdev-bot+sashiko
2026-09-14 12:46 ` [PATCH net-next v11 02/15] phylib: Add support for PHYs with broken forced mode Birger Koblitz
2026-09-14 14:14 ` Nicolai Buchwitz
2026-09-16 6:47 ` netdev-bot+sashiko
2026-09-14 12:46 ` [PATCH net-next v11 03/15] ax88179_178a: Fix endianness of pause watermark register Birger Koblitz
2026-09-14 12:46 ` [PATCH net-next v11 04/15] ax88179_178a: Split driver into library and device specific code Birger Koblitz
2026-09-14 14:15 ` Nicolai Buchwitz
2026-09-16 6:47 ` netdev-bot+sashiko
2026-09-14 12:46 ` [PATCH net-next v11 05/15] ax88179_178a: Add netdev2data() convenience function Birger Koblitz
2026-09-16 6:47 ` netdev-bot+sashiko
2026-09-14 12:46 ` [PATCH net-next v11 06/15] ax88179_178a: Add HW support for AX179A-based chips Birger Koblitz
2026-09-14 14:12 ` Nicolai Buchwitz
2026-09-14 16:53 ` Andrew Lunn
2026-09-15 0:01 ` Birger Koblitz
2026-09-15 12:07 ` Andrew Lunn
2026-09-16 0:12 ` Birger Koblitz
2026-09-15 5:28 ` Birger Koblitz
2026-09-16 6:47 ` netdev-bot+sashiko
2026-09-14 12:46 ` [PATCH net-next v11 07/15] ax88179_178a: Add EEE configuration support for AX88179A MACs Birger Koblitz
2026-09-16 6:47 ` netdev-bot+sashiko
2026-09-14 12:46 ` [PATCH net-next v11 08/15] ax88179_178a: Add EEE configuration support for AX88179A PHYs Birger Koblitz
2026-09-14 14:17 ` Nicolai Buchwitz
2026-09-16 6:47 ` netdev-bot+sashiko
2026-09-14 12:46 ` [PATCH net-next v11 09/15] ax88179_178a: Add VLAN offload support for AX88179A Birger Koblitz
2026-09-16 6:47 ` netdev-bot+sashiko
2026-09-14 12:46 ` [PATCH net-next v11 10/15] ax88179_178a: Add AX179A/AX279 multicast configuration Birger Koblitz
2026-09-16 6:47 ` netdev-bot+sashiko [this message]
2026-09-14 12:46 ` [PATCH net-next v11 11/15] ax88179_178a: Add Suspend/resume support for AX88179A/772D/279 Birger Koblitz
2026-09-16 6:47 ` netdev-bot+sashiko
2026-09-14 12:46 ` [PATCH net-next v11 12/15] ax88179_178a: Add ethtool get_drvinfo Birger Koblitz
2026-09-14 14:16 ` Nicolai Buchwitz
2026-09-16 6:47 ` netdev-bot+sashiko
2026-09-14 12:46 ` [PATCH net-next v11 13/15] ax88179_178a: Update driver name and information Birger Koblitz
2026-09-14 14:17 ` Nicolai Buchwitz
2026-09-16 6:47 ` netdev-bot+sashiko
2026-09-14 12:46 ` [PATCH net-next v11 14/15] ax88179_178a: Add support for AX88179A/772D/279 EEPROM access Birger Koblitz
2026-09-16 6:47 ` netdev-bot+sashiko
2026-09-14 12:46 ` [PATCH net-next v11 15/15] ax88796b: Add support for AX88772D, AX88179A and AX88279 Birger Koblitz
2026-09-16 6:47 ` netdev-bot+sashiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178954125370.22033.18019147682392087483@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mail@birger-koblitz.de \
--cc=netdev@vger.kernel.org \
--cc=neuromoments@gmail.com \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®