From abcb70291106f790a5274db0cc76115cea549085 Mon Sep 17 00:00:00 2001 From: Lucas Goossen Date: Tue, 17 Nov 2026 18:23:24 -0300 Subject: [PATCH] net: atlantic: keep AQC113 filters above the firmware base index 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 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; compare the offset from the first multicast slot instead. Fixes: 6c1ca112a6e4 ("net: atlantic: fix AQC113 HW init: ART, L2 filter slot, MAC address") Link: https://github.com/omacom/omarchy-mac-pkgs/issues/137 Assisted-by: Grok:grok-4.7-build-fast Assisted-by: Claude:claude-fable-5-2 --- .../aquantia/atlantic/hw_atl/hw_atl_b0.c | 32 +++++++++++++++---- .../aquantia/atlantic/hw_atl/hw_atl_b0.h | 6 ++-- .../aquantia/atlantic/hw_atl2/hw_atl2.c | 16 ++++++++-- .../atlantic/hw_atl2/hw_atl2_utils_fw.c | 5 +++ 4 files changed, 48 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c index 6c25ad264b19d5..2b6bdc50b4df24 100644 --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c @@ -1038,8 +1038,10 @@ int hw_atl_b0_hw_irq_read(struct aq_hw_s *self, u64 *mask) #define IS_FILTER_ENABLED(_F_) ((packet_filter & (_F_)) ? 1U : 0U) -int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self, - unsigned int packet_filter) +int hw_atl_b0_hw_packet_filter_set_int(struct aq_hw_s *self, + unsigned int base_location, + unsigned int end_location, + unsigned int packet_filter) { struct aq_nic_cfg_s *cfg = self->aq_nic_cfg; unsigned int i = 0U; @@ -1065,17 +1067,33 @@ int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self, hw_atl_rpfl2broadcast_en_set(self, IS_FILTER_ENABLED(IFF_BROADCAST)); - for (i = HW_ATL_B0_MAC_MIN; i < HW_ATL_B0_MAC_MAX; ++i) - hw_atl_rpfl2_uc_flr_en_set(self, - (cfg->is_mc_list_enabled && - (i <= cfg->mc_list_count)) ? - 1U : 0U, i); + /* + * base_location is the first multicast slot. On A1 that is + * HW_ATL_B0_MAC_MIN. On A2, slots below the base index are not ours + * and the station MAC occupies that index, so the walk must not + * disable them. mc_list_count is a count, not an absolute slot + * number. + */ + for (i = base_location; i < end_location; ++i) { + bool enable = cfg->is_mc_list_enabled && + (i - base_location) < cfg->mc_list_count; + + hw_atl_rpfl2_uc_flr_en_set(self, enable ? 1U : 0U, i); + } return aq_hw_err_from_flags(self); } #undef IS_FILTER_ENABLED +static int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self, + unsigned int packet_filter) +{ + return hw_atl_b0_hw_packet_filter_set_int(self, HW_ATL_B0_MAC_MIN, + HW_ATL_B0_MAC_MAX, + packet_filter); +} + static int hw_atl_b0_hw_multicast_list_set(struct aq_hw_s *self, u8 ar_mac [AQ_HW_MULTICAST_ADDRESS_MAX] diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.h b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.h index 5298846dd9f772..310a93865779c9 100644 --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.h +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.h @@ -69,7 +69,9 @@ int hw_atl_b0_hw_irq_enable(struct aq_hw_s *self, u64 mask); int hw_atl_b0_hw_irq_disable(struct aq_hw_s *self, u64 mask); int hw_atl_b0_hw_irq_read(struct aq_hw_s *self, u64 *mask); -int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self, - unsigned int packet_filter); +int hw_atl_b0_hw_packet_filter_set_int(struct aq_hw_s *self, + unsigned int base_location, + unsigned int end_location, + unsigned int packet_filter); #endif /* HW_ATL_B0_H */ diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c index 25dd7150aaaf22..0761136c29c220 100644 --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c @@ -759,9 +759,16 @@ static int hw_atl2_hw_ring_tx_init(struct aq_hw_s *self, static int hw_atl2_hw_packet_filter_set(struct aq_hw_s *self, unsigned int packet_filter) { + struct hw_atl2_priv *priv = self->priv; + u32 base_location = priv->l2_filters_base_index + 1; + u32 end_location = min_t(u32, HW_ATL2_MAC_MAX, + priv->l2_filters_base_index + + priv->l2_filter_count); + hw_atl2_hw_new_rx_filter_promisc(self, IS_FILTER_ENABLED(IFF_PROMISC)); - return hw_atl_b0_hw_packet_filter_set(self, packet_filter); + return hw_atl_b0_hw_packet_filter_set_int(self, base_location, + end_location, packet_filter); } #undef IS_FILTER_ENABLED @@ -777,7 +784,12 @@ static int hw_atl2_hw_multicast_list_set(struct aq_hw_s *self, struct aq_nic_cfg_s *cfg = self->aq_nic_cfg; int err = 0; - if (count > (HW_ATL2_MAC_MAX - HW_ATL2_MAC_MIN)) { + /* + * The firmware window is l2_filter_count slots starting at + * l2_filters_base_index. Slot base holds the station MAC, so at most + * l2_filter_count - 1 multicast addresses fit. + */ + if (count >= priv->l2_filter_count) { err = -EBADRQC; goto err_exit; } diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c index dc9b2ef4640b12..43bf21e304c37c 100644 --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c @@ -629,6 +629,11 @@ int hw_atl2_utils_get_filter_caps(struct aq_hw_s *self) if (priv->l2_filters_base_index >= HW_ATL2_MAC_MAX) priv->l2_filters_base_index = HW_ATL2_MAC_UC; priv->l2_filter_count = filter_caps.l2_filter_count; + if (!priv->l2_filter_count || + priv->l2_filters_base_index + priv->l2_filter_count > + HW_ATL2_MAC_MAX) + priv->l2_filter_count = HW_ATL2_MAC_MAX - + priv->l2_filters_base_index; priv->etype_filter_base_index = filter_caps.ethertype_filter_base_index; priv->etype_filter_count = filter_caps.ethertype_filter_count; priv->etype_filter_tag_top =