Netdev List
 help / color / mirror / Atom feed
* [PATCH v3 0/3] net: atlantic: AQC113: Fix regression on Apple silicon systems
@ 2026-11-27 14:54 Janne Grunau
  2026-11-27 14:54 ` [PATCH v3 1/3] net: atlantic: AQC113: Ensure L2 filter count is valid Janne Grunau
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Janne Grunau @ 2026-11-27 14:54 UTC (permalink / raw)
  To: Sukhdeep Singh, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, Janne Grunau, stable

Hej,

commit 6c1ca112a6e4 ("net: atlantic: fix AQC113 HW init: ART, L2 filter
slot, MAC address") broke data transmission on Apple silicon systems
with integrated AQC113. The commit uses the queried filter caps from the
firmware which may result in using L2 filter slots starting from
`l2_filters_base_index`.
hw_atl_b0_hw_packet_filter_set() is not aware of this change and enables
/disables L2 filter slots starting from index 0. When the firmware
reported `l2_filters_base_index` is high enough (9 on Apple systems) it
will likely disable the L2 filter for the NIC's own MAC address
resulting in a complete loss of data transmission.
Another issue is that the number of available L2 filter slots might
smaller than AQ_HW_MULTICAST_ADDRESS_MAX (32). This is the case on Apple
systems with `l2_filter_count` == 29. To avoid -EBADRQC when L2 filters
run out query the number of filter slots from the hardware.

The fixes in this series restores Ethernet data transmission on an Apple
M1 Max Mac Studio and supersedes my previous "fix" in [1].

Link: https://lore.kernel.org/r/20261024-net-atlantic-aq113-apple-regression-v1-1-b8305415a8b1@jannau.net [1]

Signed-off-by: Janne Grunau <j@jannau.net>
---
Changes in v3:
- fix off-by-one error in hw_atl2_hw_packet_filter_set()
- ensure hw_atl2_hw_packet_filter_set programs only valid L2 filter slots
- validate firmware provided l2_filter_count
- swap order of changes to avoid introducing temporary issues with the
  main fix
- rename added hw ops function and switched return value to unsigned int
- fix typos and rewrite commit messages
- Link to v2: https://lore.kernel.org/r/20261108-net-atlantic-aq113-apple-l2-filter-slots-v2-0-0b988d031c78@jannau.net

Changes in v2:
- Leave atl_b0 as is and copy hw_atl_b0_hw_packet_filter_set to hw_atl2
  to adapt it
- Enable L2 filters for multicast addresses correctly
- Query the number of available L2 filter slots from HW to avoid
  -EBADRQC if it exceeds `l2_filter_count - 1` and use promiscuous mode
  instead in aq_nic_set_multicast_list()
- Link to v1: https://lore.kernel.org/r/20261026-net-atlantic-aq113-apple-l2-filter-slots-v1-0-d72e99b69583@jannau.net

---
Janne Grunau (3):
      net: atlantic: AQC113: Ensure L2 filter count is valid
      net: atlantic: AQC113: Limit multicast filters to available slots
      net: atlantic: AQC113: Fix hw_atl2_hw_packet_filter_set for L2 filter base index > 0

 drivers/net/ethernet/aquantia/atlantic/aq_hw.h     |  2 +
 drivers/net/ethernet/aquantia/atlantic/aq_nic.c    |  9 ++--
 .../ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c  |  7 ++++
 .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c  | 11 ++++-
 .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.h  |  3 --
 .../ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c   | 48 +++++++++++++++++++++-
 .../aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c   |  2 +
 7 files changed, 72 insertions(+), 10 deletions(-)
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261026-net-atlantic-aq113-apple-l2-filter-slots-6342515c5318

Best regards,
-- 
Janne Grunau <j@jannau.net>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3 1/3] net: atlantic: AQC113: Ensure L2 filter count is valid
  2026-11-27 14:54 [PATCH v3 0/3] net: atlantic: AQC113: Fix regression on Apple silicon systems Janne Grunau
@ 2026-11-27 14:54 ` Janne Grunau
  2026-11-28 15:39   ` netdev-bot+sashiko
  2026-11-27 14:54 ` [PATCH v3 2/3] net: atlantic: AQC113: Limit multicast filters to available slots Janne Grunau
  2026-11-27 14:54 ` [PATCH v3 3/3] net: atlantic: AQC113: Fix hw_atl2_hw_packet_filter_set for L2 filter base index > 0 Janne Grunau
  2 siblings, 1 reply; 7+ messages in thread
From: Janne Grunau @ 2026-11-27 14:54 UTC (permalink / raw)
  To: Sukhdeep Singh, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, Janne Grunau, stable

Set l2_filter_count based on l2_filters_base_index if it is out of the
range [1, HW_ATL2_MAC_MAX]. At least one L2 filter slot is required for
the MAC address. When the firmware delivers out of range L2 filter count
values the best option is to compute it based on l2_filters_base_index
which is already validated.

Fixes: 6c1ca112a6e4 ("net: atlantic: fix AQC113 HW init: ART, L2 filter slot, MAC address")
Cc: stable@vger.kernel.org
Signed-off-by: Janne Grunau <j@jannau.net>
---
 drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c | 2 ++
 1 file changed, 2 insertions(+)

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 dc9b2ef4640b..9ad5bbb11bdf 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,8 @@ 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 < 1 || 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 =

-- 
2.56.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 2/3] net: atlantic: AQC113: Limit multicast filters to available slots
  2026-11-27 14:54 [PATCH v3 0/3] net: atlantic: AQC113: Fix regression on Apple silicon systems Janne Grunau
  2026-11-27 14:54 ` [PATCH v3 1/3] net: atlantic: AQC113: Ensure L2 filter count is valid Janne Grunau
@ 2026-11-27 14:54 ` Janne Grunau
  2026-11-28 15:39   ` netdev-bot+sashiko
  2026-11-27 14:54 ` [PATCH v3 3/3] net: atlantic: AQC113: Fix hw_atl2_hw_packet_filter_set for L2 filter base index > 0 Janne Grunau
  2 siblings, 1 reply; 7+ messages in thread
From: Janne Grunau @ 2026-11-27 14:54 UTC (permalink / raw)
  To: Sukhdeep Singh, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, Janne Grunau, stable

Since commit 6c1ca112a6e4 ("net: atlantic: fix AQC113 HW init: ART,
L2 filter slot, MAC address") hw_atl2_hw_multicast_list_set() uses L2
filter slots based on the firmware-assigned L2 filter base index.
On Apple silicon systems with AQC113 the firmware returns
`l2_filters_base_index = 9` and `l2_filter_count = 29` which is
less than AQ_HW_MULTICAST_ADDRESS_MAX (32).
Add a new `struct aq_hw_ops` function pointer
hw_get_multicast_address_max to query the number of available L2 filter
slots. hw_atl_a0 and hw_atl_b0 will return AQ_HW_MULTICAST_ADDRESS_MAX
and hw_atl2 may return a smaller if l2_filter_count is smaller than 33.
aq_nic_set_multicast_list() uses the number of available L2 filter slots
to configure the packet filter to IFF_PROMISC and or IFF_ALLMULTI based
on the number of unicast and multicast addresses.

Fixes: 6c1ca112a6e4 ("net: atlantic: fix AQC113 HW init: ART, L2 filter slot, MAC address")
Cc: stable@vger.kernel.org
Signed-off-by: Janne Grunau <j@jannau.net>
---
 drivers/net/ethernet/aquantia/atlantic/aq_hw.h            |  2 ++
 drivers/net/ethernet/aquantia/atlantic/aq_nic.c           |  9 ++++++---
 drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c |  7 +++++++
 drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c |  7 +++++++
 drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c  | 12 +++++++++++-
 5 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
index 338c956ad1f7..98b37d025e67 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
@@ -374,6 +374,8 @@ struct aq_hw_ops {
 
 	int (*hw_read_module_eeprom)(struct aq_hw_s *self, u8 dev_addr,
 				     u8 reg_start_addr, int len, u8 *data);
+
+	unsigned int (*hw_get_multicast_address_max)(struct aq_hw_s *self);
 };
 
 struct aq_fw_ops {
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index 42e0fe9248f2..8ef54be36037 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -976,11 +976,14 @@ int aq_nic_set_multicast_list(struct aq_nic_s *self, struct net_device *ndev)
 	struct aq_nic_cfg_s *cfg = &self->aq_nic_cfg;
 	unsigned int packet_filter = ndev->flags;
 	struct netdev_hw_addr *ha = NULL;
+	unsigned int mc_address_max;
 	unsigned int i = 0U;
 	int err = 0;
 
+	mc_address_max = hw_ops->hw_get_multicast_address_max(self->aq_hw);
+
 	self->mc_list.count = 0;
-	if (netdev_uc_count(ndev) > AQ_HW_MULTICAST_ADDRESS_MAX) {
+	if (netdev_uc_count(ndev) > mc_address_max) {
 		packet_filter |= IFF_PROMISC;
 	} else {
 		netdev_for_each_uc_addr(ha, ndev) {
@@ -990,7 +993,7 @@ int aq_nic_set_multicast_list(struct aq_nic_s *self, struct net_device *ndev)
 
 	cfg->is_mc_list_enabled = !!(packet_filter & IFF_MULTICAST);
 	if (cfg->is_mc_list_enabled) {
-		if (i + netdev_mc_count(ndev) > AQ_HW_MULTICAST_ADDRESS_MAX) {
+		if (i + netdev_mc_count(ndev) > mc_address_max) {
 			packet_filter |= IFF_ALLMULTI;
 		} else {
 			netdev_for_each_mc_addr(ha, ndev) {
@@ -1000,7 +1003,7 @@ int aq_nic_set_multicast_list(struct aq_nic_s *self, struct net_device *ndev)
 		}
 	}
 
-	if (i > 0 && i <= AQ_HW_MULTICAST_ADDRESS_MAX) {
+	if (i > 0 && i <= mc_address_max) {
 		self->mc_list.count = i;
 		err = hw_ops->hw_multicast_list_set(self->aq_hw,
 						    self->mc_list.ar,
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
index 8de2cdd09213..6bc187153a9c 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
@@ -944,6 +944,11 @@ static int hw_atl_a0_hw_fl3l4_set(struct aq_hw_s *self,
 	return aq_hw_err_from_flags(self);
 }
 
+static unsigned int hw_atl_a0_get_multicast_address_max(struct aq_hw_s *self)
+{
+	return AQ_HW_MULTICAST_ADDRESS_MAX;
+}
+
 const struct aq_hw_ops hw_atl_ops_a0 = {
 	.hw_soft_reset        = hw_atl_utils_soft_reset,
 	.hw_prepare           = hw_atl_utils_initfw,
@@ -978,4 +983,6 @@ const struct aq_hw_ops hw_atl_ops_a0 = {
 	.hw_get_regs                 = hw_atl_utils_hw_get_regs,
 	.hw_get_hw_stats             = hw_atl_utils_get_hw_stats,
 	.hw_get_fw_version           = hw_atl_utils_get_fw_version,
+
+	.hw_get_multicast_address_max = hw_atl_a0_get_multicast_address_max,
 };
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 6c25ad264b19..639ec472aa0d 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
@@ -1777,6 +1777,11 @@ static int hw_atl_b0_read_module_eeprom(struct aq_hw_s *self, u8 dev_addr,
 	return err;
 }
 
+static unsigned int hw_atl_b0_get_multicast_address_max(struct aq_hw_s *self)
+{
+	return AQ_HW_MULTICAST_ADDRESS_MAX;
+}
+
 const struct aq_hw_ops hw_atl_ops_b0 = {
 	.hw_soft_reset        = hw_atl_utils_soft_reset,
 	.hw_prepare           = hw_atl_utils_initfw,
@@ -1836,4 +1841,6 @@ const struct aq_hw_ops hw_atl_ops_b0 = {
 
 	.hw_get_mac_temp         = hw_atl_b0_get_mac_temp,
 	.hw_read_module_eeprom   = hw_atl_b0_read_module_eeprom,
+
+	.hw_get_multicast_address_max = hw_atl_b0_get_multicast_address_max,
 };
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 25dd7150aaaf..0b5a5bc420e9 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c
@@ -777,7 +777,7 @@ 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)) {
+	if (count > (priv->l2_filter_count - 1)) {
 		err = -EBADRQC;
 		goto err_exit;
 	}
@@ -1602,6 +1602,14 @@ static int hw_atl2_hw_vlan_ctrl(struct aq_hw_s *self, bool enable)
 	return aq_hw_err_from_flags(self);
 }
 
+static unsigned int hw_atl2_get_multicast_address_max(struct aq_hw_s *self)
+{
+	struct hw_atl2_priv *priv = self->priv;
+
+	return min_t(unsigned int, priv->l2_filter_count - 1,
+		     AQ_HW_MULTICAST_ADDRESS_MAX);
+}
+
 const struct aq_hw_ops hw_atl2_ops = {
 	.hw_soft_reset        = hw_atl2_utils_soft_reset,
 	.hw_prepare           = hw_atl2_utils_initfw,
@@ -1661,4 +1669,6 @@ const struct aq_hw_ops hw_atl2_ops = {
 	.hw_get_clk_sel          = hw_atl2_hw_get_clk_sel,
 	.extract_hwts            = NULL,
 	.hw_extts_gpio_enable    = NULL,
+
+	.hw_get_multicast_address_max  = hw_atl2_get_multicast_address_max,
 };

-- 
2.56.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 3/3] net: atlantic: AQC113: Fix hw_atl2_hw_packet_filter_set for L2 filter base index > 0
  2026-11-27 14:54 [PATCH v3 0/3] net: atlantic: AQC113: Fix regression on Apple silicon systems Janne Grunau
  2026-11-27 14:54 ` [PATCH v3 1/3] net: atlantic: AQC113: Ensure L2 filter count is valid Janne Grunau
  2026-11-27 14:54 ` [PATCH v3 2/3] net: atlantic: AQC113: Limit multicast filters to available slots Janne Grunau
@ 2026-11-27 14:54 ` Janne Grunau
  2026-11-28 15:39   ` netdev-bot+sashiko
  2 siblings, 1 reply; 7+ messages in thread
From: Janne Grunau @ 2026-11-27 14:54 UTC (permalink / raw)
  To: Sukhdeep Singh, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, Janne Grunau, stable

hw_atl2_hw_packet_filter_set() wraps hw_atl_b0_hw_packet_filter_set()
which has no concept of `l2_filters_base_index` and enables/disables
filters from `HW_ATL_B0_MAC_MIN` (1) to `HW_ATL_B0_MAC_MAX` (33). After
commit 6c1ca112a6e4 ("net: atlantic: fix AQC113 HW init: ART, L2 filter
slot, MAC address") this may result in disabling filters set in
hw_atl2.c including the l2 filter for the MAC address. This results in
broken networking on Apple silicon systems with AQC113. The firmware in
this systems report `l2_filters_base_index = 9`.
Copy the formerly wrapped `hw_atl_b0_hw_packet_filter_set()` and modify
it to handle this additional complexity on atl2 hardware.

Fixes: 6c1ca112a6e4 ("net: atlantic: fix AQC113 HW init: ART, L2 filter slot, MAC address")
Cc: stable@vger.kernel.org
Signed-off-by: Janne Grunau <j@jannau.net>
---
 .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c  |  4 +--
 .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.h  |  3 --
 .../ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c   | 36 +++++++++++++++++++++-
 3 files changed, 37 insertions(+), 6 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 639ec472aa0d..608ebad669c5 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,8 @@ 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)
+static int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self,
+					  unsigned int packet_filter)
 {
 	struct aq_nic_cfg_s *cfg = self->aq_nic_cfg;
 	unsigned int i = 0U;
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 5298846dd9f7..35c43762c35a 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,4 @@ 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);
-
 #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 0b5a5bc420e9..89841612be16 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,43 @@ 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 aq_nic_cfg_s *cfg = self->aq_nic_cfg;
+	struct hw_atl2_priv *priv = self->priv;
+	u32 base_location = priv->l2_filters_base_index + 1;
+	unsigned int num_l2_filters = min_t(unsigned int,
+					    HW_ATL2_MAC_MAX - base_location,
+					    priv->l2_filter_count - 1);
+	unsigned int i = 0U;
+	u32 vlan_promisc;
+	u32 l2_promisc;
+
 	hw_atl2_hw_new_rx_filter_promisc(self, IS_FILTER_ENABLED(IFF_PROMISC));
 
-	return hw_atl_b0_hw_packet_filter_set(self, packet_filter);
+	l2_promisc = IS_FILTER_ENABLED(IFF_PROMISC) ||
+		     !!(cfg->priv_flags & BIT(AQ_HW_LOOPBACK_DMA_NET));
+	vlan_promisc = l2_promisc || cfg->is_vlan_force_promisc;
+
+	hw_atl_rpfl2promiscuous_mode_en_set(self, l2_promisc);
+
+	hw_atl_rpf_vlan_prom_mode_en_set(self, vlan_promisc);
+
+	hw_atl_rpfl2multicast_flr_en_set(self,
+					 IS_FILTER_ENABLED(IFF_ALLMULTI) &&
+					 IS_FILTER_ENABLED(IFF_MULTICAST), 0);
+
+	hw_atl_rpfl2_accept_all_mc_packets_set(self,
+					       IS_FILTER_ENABLED(IFF_ALLMULTI) &&
+					       IS_FILTER_ENABLED(IFF_MULTICAST));
+
+	hw_atl_rpfl2broadcast_en_set(self, IS_FILTER_ENABLED(IFF_BROADCAST));
+
+	for (i = 0; i < num_l2_filters; ++i)
+		hw_atl_rpfl2_uc_flr_en_set(self,
+					   (cfg->is_mc_list_enabled &&
+					    (i <= cfg->mc_list_count)) ?
+					   1U : 0U, base_location + i);
+
+	return aq_hw_err_from_flags(self);
 }
 
 #undef IS_FILTER_ENABLED

-- 
2.56.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 1/3] net: atlantic: AQC113: Ensure L2 filter count is valid
  2026-11-27 14:54 ` [PATCH v3 1/3] net: atlantic: AQC113: Ensure L2 filter count is valid Janne Grunau
@ 2026-11-28 15:39   ` netdev-bot+sashiko
  0 siblings, 0 replies; 7+ messages in thread
From: netdev-bot+sashiko @ 2026-11-28 15:39 UTC (permalink / raw)
  To: j
  Cc: sukhdeeps, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel, stable

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

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] In hw_atl2_utils_get_filter_caps()
  (drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c,…

--

net: atlantic: AQC113: Ensure L2 filter count is valid

This commit checks the firmware-provided l2_filter_count in
hw_atl2_utils_get_filter_caps(). If the value is outside [1, HW_ATL2_MAC_MAX],
the count is recomputed from the already validated l2_filters_base_index.

> 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 dc9b2ef4640b1..9ad5bbb11bdf8 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,8 @@ 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 < 1 || priv->l2_filter_count > HW_ATL2_MAC_MAX)
> +		priv->l2_filter_count = HW_ATL2_MAC_MAX - priv->l2_filters_base_index;

[Severity: Medium]
Should the upper bound here be HW_ATL2_MAC_MAX - l2_filters_base_index
instead of HW_ATL2_MAC_MAX?

The fallback treats the count as the number of slots from the base to the
end of the 38-entry table. The accept condition does not apply that bound,
so a count that does not fit after the base still gets through.

For example, base = 30 passes the base check (it is below 38), and
count = 38 passes the new check.

Later patches in this series use l2_filter_count as the bound for
multicast programming:

hw_atl2_get_multicast_address_max():
	return min_t(unsigned int, priv->l2_filter_count - 1,
		     AQ_HW_MULTICAST_ADDRESS_MAX);

hw_atl2_hw_multicast_list_set():
	if (count > (priv->l2_filter_count - 1)) {

With base = 30 and count = 38, this advertises 32 multicast slots. The
loop then writes slots base_location + i, which is 31..62.

The register addresses are linear in the slot index:

	#define HW_ATL_RPFL2UC_DAFLSW_ADR(filter) (0x00005110 + (filter) * 0x8)

Slots 38..62 would land on MMIO 0x5240..0x5304, which is past the L2
unicast filter block. Can this misprogram unrelated RPF registers?

In the final series, hw_atl2_hw_packet_filter_set() clamps with
min(HW_ATL2_MAC_MAX - base_location, l2_filter_count - 1). The multicast
paths above use the raw l2_filter_count without that clamp.

Something like this would give every consumer the same window:

	if (count < 1 || count > HW_ATL2_MAC_MAX - base)

The Apple firmware reports base = 9 and count = 29, which is consistent. So
this only applies to firmware that reports a mismatched base/count pair.

>  	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 =

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261127-net-atlantic-aq113-apple-l2-filter-slots-v3-0-b5efbc124dcc%40jannau.net

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 2/3] net: atlantic: AQC113: Limit multicast filters to available slots
  2026-11-27 14:54 ` [PATCH v3 2/3] net: atlantic: AQC113: Limit multicast filters to available slots Janne Grunau
@ 2026-11-28 15:39   ` netdev-bot+sashiko
  0 siblings, 0 replies; 7+ messages in thread
From: netdev-bot+sashiko @ 2026-11-28 15:39 UTC (permalink / raw)
  To: j
  Cc: sukhdeeps, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel, stable

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

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] The new helper hw_atl2_get_multicast_address_max() returns
  `min(priv->l2_filter_count - 1, AQ_HW_MULTICAST_ADDRESS_MAX)`.

--

net: atlantic: AQC113: Limit multicast filters to available slots

This adds a hw_get_multicast_address_max() hw op. With it,
aq_nic_set_multicast_list() can fall back to IFF_PROMISC or IFF_ALLMULTI
based on how many L2 filter slots the firmware really provides. hw_atl2
takes the value from the firmware-reported l2_filter_count, and the bounds
check in hw_atl2_hw_multicast_list_set() now uses l2_filter_count too.

> 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 25dd7150aaaf2..0b5a5bc420e92 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c
> @@ -777,7 +777,7 @@ 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)) {
> +	if (count > (priv->l2_filter_count - 1)) {
>  		err = -EBADRQC;
>  		goto err_exit;
>  	}

[ ... ]

> @@ -1602,6 +1602,14 @@ static int hw_atl2_hw_vlan_ctrl(struct aq_hw_s *self, bool enable)
>  	return aq_hw_err_from_flags(self);
>  }
>  
> +static unsigned int hw_atl2_get_multicast_address_max(struct aq_hw_s *self)
> +{
> +	struct hw_atl2_priv *priv = self->priv;
> +
> +	return min_t(unsigned int, priv->l2_filter_count - 1,
> +		     AQ_HW_MULTICAST_ADDRESS_MAX);
> +}

[Severity: Medium]
Should this helper also account for the firmware base index?
hw_atl2_hw_multicast_list_set() writes slots starting at
l2_filters_base_index + 1. Neither this helper nor the new check above
limits the count to the part of the HW_ATL2_MAC_MAX (38) entry bank that
sits above that base.

hw_atl2_utils_get_filter_caps() checks the two firmware values separately:

    priv->l2_filters_base_index = filter_caps.l2_filters_base_index;
    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 < 1 || priv->l2_filter_count > HW_ATL2_MAC_MAX)
        priv->l2_filter_count = HW_ATL2_MAC_MAX - priv->l2_filters_base_index;

This means firmware caps such as base=9 and count=38 are accepted. With
those values:

  - this helper returns 32
  - aq_nic_set_multicast_list() can pass 32 addresses
  - the count > 37 check in hw_atl2_hw_multicast_list_set() passes

The loop then writes the DA LSW/MSW, tag and enable registers at
base_location + i, which covers slots 10 to 41. Slots 38 to 41 are past the
L2 unicast filter bank that hw_atl2_hw_init() initialises.

HW_ATL_RPFL2UC_DAFLSW_ADR(f) is 0x5110 + f * 8. So slot 40 maps to 0x5250,
which is HW_ATL_RPFL2MC_ENF_ADR(0), and slot 41 maps to ENF_ADR(2) and
ENF_ADR(3).

Can this overwrite the L2 multicast filter registers? The Apple values
(9 + 29) add up to exactly 38, so this only happens with firmware that
reports base + count > 38.

The later patch in this series, "net: atlantic: AQC113: Fix
hw_atl2_hw_packet_filter_set for L2 filter base index > 0", sizes the same
slot range like this:

    min_t(unsigned int, HW_ATL2_MAC_MAX - base_location,
          priv->l2_filter_count - 1);

At the end of the series, three places therefore use different slot
counts:

  - this helper
  - the check in hw_atl2_hw_multicast_list_set()
  - the loop in hw_atl2_hw_packet_filter_set()

Could the helper and the check both use the same limit?

    min(HW_ATL2_MAC_MAX - (l2_filters_base_index + 1),
        l2_filter_count - 1, AQ_HW_MULTICAST_ADDRESS_MAX)

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261127-net-atlantic-aq113-apple-l2-filter-slots-v3-0-b5efbc124dcc%40jannau.net

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 3/3] net: atlantic: AQC113: Fix hw_atl2_hw_packet_filter_set for L2 filter base index > 0
  2026-11-27 14:54 ` [PATCH v3 3/3] net: atlantic: AQC113: Fix hw_atl2_hw_packet_filter_set for L2 filter base index > 0 Janne Grunau
@ 2026-11-28 15:39   ` netdev-bot+sashiko
  0 siblings, 0 replies; 7+ messages in thread
From: netdev-bot+sashiko @ 2026-11-28 15:39 UTC (permalink / raw)
  To: j
  Cc: sukhdeeps, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel, stable

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

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] This patch adds an off-by-one in
  hw_atl2_hw_packet_filter_set()…

--

net: atlantic: AQC113: Fix hw_atl2_hw_packet_filter_set for L2 filter base index > 0

hw_atl2_hw_packet_filter_set() used to wrap hw_atl_b0_hw_packet_filter_set().
That function enables or disables L2 filters 1..32 without taking
l2_filters_base_index into account. With l2_filters_base_index = 9 on Apple
silicon systems, this could disable the MAC address filter.

This patch copies the b0 function into hw_atl2.c and changes the unicast
filter enable loop to start at base_location.

> 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 0b5a5bc420e92..89841612be168 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,43 @@ 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 aq_nic_cfg_s *cfg = self->aq_nic_cfg;
> +	struct hw_atl2_priv *priv = self->priv;
> +	u32 base_location = priv->l2_filters_base_index + 1;

[ ... ]

> +	hw_atl_rpfl2broadcast_en_set(self, IS_FILTER_ENABLED(IFF_BROADCAST));
> +
> +	for (i = 0; i < num_l2_filters; ++i)
> +		hw_atl_rpfl2_uc_flr_en_set(self,
> +					   (cfg->is_mc_list_enabled &&
> +					    (i <= cfg->mc_list_count)) ?
> +					   1U : 0U, base_location + i);

[Severity: Medium]
Does this enable one more L2 unicast filter slot than the driver
programmed?

The old b0 loop started at HW_ATL_B0_MAC_MIN (1) and used the absolute
slot number:

hw_atl_b0_hw_packet_filter_set() {
    ...
	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);
    ...
}

The inclusive "i <= cfg->mc_list_count" test was correct there. Here the
loop is 0-based and offset by base_location, so the same test enables
mc_list_count + 1 slots: base_location + 0 through
base_location + mc_list_count.

hw_atl2_hw_multicast_list_set() only programs count slots:

hw_atl2_hw_multicast_list_set() {
    ...
	for (cfg->mc_list_count = 0U;
			cfg->mc_list_count < count;
			++cfg->mc_list_count) {
		u32 i = cfg->mc_list_count;
		...
		hw_atl2_rpfl2_uc_flr_tag_set(self, 1, base_location + i);

		hw_atl_rpfl2_uc_flr_en_set(self, (cfg->is_mc_list_enabled),
					   base_location + i);
	}
    ...
}

So slot base_location + mc_list_count is enabled but never written in this
pass. Take this sequence:

- add a secondary MAC so the list has N + 1 entries
- remove it so the list has N entries
- hw_atl2_hw_multicast_list_set() rewrites slots 0..N-1 only
- hw_atl2_hw_packet_filter_set() turns base_location + N back on

The hardware would then keep accepting frames for the removed address.
With mc_list_count == 0 and IFF_MULTICAST set, slot base_location is enabled
even though it was never programmed.

This affects every AQC113, including l2_filters_base_index == 0. Should the
test be "i < cfg->mc_list_count" in the new 0-based loop?

> +
> +	return aq_hw_err_from_flags(self);
>  }
>  
>  #undef IS_FILTER_ENABLED

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261127-net-atlantic-aq113-apple-l2-filter-slots-v3-0-b5efbc124dcc%40jannau.net

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-11-28 15:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 14:54 [PATCH v3 0/3] net: atlantic: AQC113: Fix regression on Apple silicon systems Janne Grunau
2026-11-27 14:54 ` [PATCH v3 1/3] net: atlantic: AQC113: Ensure L2 filter count is valid Janne Grunau
2026-11-28 15:39   ` netdev-bot+sashiko
2026-11-27 14:54 ` [PATCH v3 2/3] net: atlantic: AQC113: Limit multicast filters to available slots Janne Grunau
2026-11-28 15:39   ` netdev-bot+sashiko
2026-11-27 14:54 ` [PATCH v3 3/3] net: atlantic: AQC113: Fix hw_atl2_hw_packet_filter_set for L2 filter base index > 0 Janne Grunau
2026-11-28 15:39   ` netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox