Skip to content

net: atlantic: keep AQC113 filters above the firmware base index - #502

Open
ludagoo wants to merge 1 commit into
omacom:integration/aurorafrom
ludagoo:aqc113-rx-filter-upstream
Open

ludagoo wants to merge 1 commit into
omacom:integration/aurorafrom
ludagoo:aqc113-rx-filter-upstream

Conversation

@ludagoo

@ludagoo ludagoo commented Nov 17, 2026

Copy link
Copy Markdown

Problem

On Apple silicon desktops the AQC113 (ATL2) stops receiving unicast frames and IPv6 router advertisements once promiscuous mode is off. DHCP and SLAAC then fail. Broadcast still arrives, and turning promiscuous mode on hides the bug because that path sets a separate L2 promiscuous bit.

Cause

Apple's firmware configuration reports l2_filters_base_index 9 and l2_filter_count 29, so the L2 window is slots 9..37. The station MAC is programmed at slot 9 and tagged for the action resolver. Multicast addresses are programmed just above it. hw_atl2_hw_packet_filter_set() calls the A1 helper, which walks every slot from HW_ATL_B0_MAC_MIN (1) and leaves a slot on only when its index is at most mc_list_count. With fewer than nine addresses that clears the station filter at slot 9, and it clears multicast slots in every case.

The same helper stops at HW_ATL_B0_MAC_MAX (slot 33). Entries 24..28 land in slots 33..37 and stay enabled with stale addresses when the list shrinks or IFF_MULTICAST is cleared.

A multicast list used to be bounded by the whole hardware table (HW_ATL2_MAC_MAX - HW_ATL2_MAC_MIN). Comparing against the whole hardware table writes past the firmware window.

Fix

Start the walk at the first multicast slot (l2_filters_base_index + 1) and treat mc_list_count as a count of slots from there, not as an absolute slot number. Pass the end of the firmware window (min(HW_ATL2_MAC_MAX, base + count)) so slots through 37 are cleared with the list. On A1 the first slot is still 1 and the end is still HW_ATL_B0_MAC_MAX, so the enabled set is unchanged. A0 has its own function.

Refuse a list that does not fit in the firmware window. One slot is the station address, so at most l2_filter_count - 1 multicast addresses fit.

If the firmware reports l2_filter_count 0, or a window that runs past HW_ATL2_MAC_MAX, clamp the count to the slots that remain above the base index. A zero count would make the fit check true for an empty list, aq_nic_start() would fail, and the link would not come up.

Tested on hardware

Mac Studio M2 Max (J475c), AQC113 with firmware ATL2FW 1.3.27, linux-aurora 7.2.11.aurora14 with this commit, promiscuous mode off (NetworkManager accept-all-mac-addresses disabled, promiscuity 0): DHCP lease in 0.15 s, IPv6 SLAAC addresses from router advertisements, and unicast IPv4/IPv6 pings to the router and another host all work. Without the fix the same machine gets link and transmits, but never completes DHCP or SLAAC unless promiscuous mode is on (the report in omacom/omarchy-mac-pkgs#137 is the same bug on an M2 Ultra).

ludagoo is not listed in .github/VOUCHED.td, so CI will not build this pull request until a maintainer applies ci:build.

Not tested

  • A1 chips (the A1 walk is unchanged by construction; not booted)
  • multicast lists of more than 23 entries
  • suspend/resume

Known limitation

A list of 29..32 addresses is refused with -EBADRQC. aq_nic_set_multicast_list() still decides allmulti/promisc fallback from AQ_HW_MULTICAST_ADDRESS_MAX (32) at aq_nic.c, and returns before applying the packet filter when the hardware list set fails. aq_ndev_set_multicast_settings() discards that error. mc_list.count stays in 29..32, so the next aq_nic_start() fails until the list shrinks. That needs 29 or more L2 addresses. It is still better than the current out-of-table writes. The complete fallback is the per-chip op in linux-asahi 179bf209fccf (five files) and is not in this pull request.

Credit

Based on the linux-asahi change d96f2a368faa by Janne Grunau (AsahiLinux/linux, branch asahi). That version keeps the i <= mc_list_count test, which no longer matches once the walk starts above the base index. This patch compares the offset from the first multicast slot instead.

Link: omacom/omarchy-mac-pkgs#137

Fixes: 6c1ca11 ("net: atlantic: fix AQC113 HW init: ART, L2 filter slot, MAC address")

🤖 Generated with Claude Code

Apple AQC113 firmware on Apple silicon desktops reports
l2_filters_base_index 9 and l2_filter_count 29 (slots 9..37). The
station MAC is programmed at that slot and tagged for the action
resolver, and multicast addresses are programmed just above it.
Broadcast uses a separate enable, so ARP still arrives.

hw_atl2_hw_packet_filter_set() then calls the A1 helper, which walks
every L2 slot from HW_ATL_B0_MAC_MIN (1) and leaves a slot on only when
its index is at most mc_list_count. With fewer than nine addresses that
clears the station filter at slot 9, and it clears multicast slots in
every case, so unicast to the netdev MAC and IPv6 router advertisements
are dropped. Promiscuous mode sets the L2 promisc bit and hides it.

Start the walk at the first multicast slot and treat mc_list_count as a
count of slots from there. Pass the end of the firmware window: the
helper used to stop at HW_ATL_B0_MAC_MAX, so entries 24..28 in slots
33..37 stayed enabled with stale addresses when the list shrank or
IFF_MULTICAST was cleared. On A1 the first slot is still 1 and the end
is still HW_ATL_B0_MAC_MAX, so the enabled set is unchanged. Refuse a
multicast list that does not fit in the firmware window (one slot is
the station address). Comparing against the whole hardware table writes
past that window.

A reported l2_filter_count of zero makes the fit check true for an
empty list, so aq_nic_start() fails and the link does not come up.
Clamp a zero count, or a window that runs past HW_ATL2_MAC_MAX, to the
slots that remain above the base index.

Mac Studio M2 Max (J475c), ATL2FW 1.3.27: DHCP, IPv6 SLAAC and unicast
work with promiscuity 0.

Based on the linux-asahi change d96f2a3 by Janne Grunau
(AsahiLinux/linux, branch asahi). That version keeps the
i <= mc_list_count test, which no longer matches once the walk starts
above the base index; compare the offset from the first multicast slot
instead.

Fixes: 6c1ca11 ("net: atlantic: fix AQC113 HW init: ART, L2 filter slot, MAC address")
Link: omacom/omarchy-mac-pkgs#137
Assisted-by: Grok:grok-4.7-build-fast
Assisted-by: Claude:claude-fable-5-2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant