Skip to contentSkip to conversation

wifi: b43: MAC filter and 64-bit DMA fixes for the BCM4360

PATCH In review Andreas Wendleder 2 participants 7 messages Oct 14 – Oct 27 B43 wireless driver

lore
Share & tools
lore
#0 lore raw

cover wifi: b43: MAC filter and 64-bit DMA fixes for the BCM4360

Two fixes found while bringing up a BCM4360 (MacBookAir6,1). Neither depends on the AC PHY.

1. After an interface restart nothing was received until some other change touched the filter: b43_op_start() zeroes wl->filter_flags, but mac80211 computes the change against its own cached flags.
2. The 64-bit DMA engines of the BCM4352/BCM4360 cores use bus addresses in the index and status registers. They are detected by probe, as brcmsmac does; engines that keep offsets are untouched.

The rest of the BCM4360 support will follow once these land.

Tested on a MacBookAir6,1 (BCM4360, core revision 42) with the whole BCM4360 support applied.

Andreas Wendleder (2):
wifi: b43: reprogram the MAC filter after an interface restart
wifi: b43: handle 64-bit DMA engines whose index registers hold bus
addresses

 drivers/net/wireless/broadcom/b43/b43.h  |  1 +
 drivers/net/wireless/broadcom/b43/dma.c  | 52 +++++++++++++++++++-----
 drivers/net/wireless/broadcom/b43/dma.h  |  3 ++
 drivers/net/wireless/broadcom/b43/main.c |  8 ++++++++
 4 files changed, 53 insertions(+), 11 deletions(-)
#1 lore raw

PATCH 1/2 wifi: b43: reprogram the MAC filter after an interface restart

b43_op_start() clears wl->filter_flags, but mac80211 computes @changed for b43_op_configure_filter() against the flags it cached from the previous run. After a down/up it can report no change, so b43_adjust_opmode() is not called and MACCTL keeps the cleared filter.

Compare the requested flags with what the hardware was programmed with and add the difference to @changed.

---
 drivers/net/wireless/broadcom/b43/main.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/wireless/broadcom/b43/main.c +8 -0
index 8f4aff3..57a5935 100644
@@ -4318,6 +4318,14 @@ static void b43_op_configure_filter(struct ieee80211_hw *hw,
 		   FIF_OTHER_BSS |
 		   FIF_BCN_PRBRESP_PROMISC;
 
+	/*
+	 * b43_op_start() zeroes wl->filter_flags, but mac80211 computes
+	 * @changed against its own cached flags, so after an interface
+	 * restart it reports no change and MACCTL kept the zeroed filter.
+	 * Compare against what the hardware was actually programmed with.
+	 */
+	if (wl->filter_flags != *fflags)
+		changed |= wl->filter_flags ^ *fflags;
 	wl->filter_flags = *fflags;
 
 	if (changed && b43_status(dev) >= B43_STAT_INITIALIZED)
Tested-by on v1 1/2
#2 lore raw

Re: [PATCH wireless-next 1/2] wifi: b43: reprogram the MAC filter after an interface restart

Il giorno Wed, 14 Oct 2026 16:32:24 +0200
Andreas Wendleder <[email protected]> ha scritto:

Quoted 30 lines

b43_op_start() clears wl->filter_flags, but mac80211 computes @changed for b43_op_configure_filter() against the flags it cached from the previous run. After a down/up it can report no change, so b43_adjust_opmode() is not called and MACCTL keeps the cleared filter.

Compare the requested flags with what the hardware was programmed with and add the difference to @changed.

---
 drivers/net/wireless/broadcom/b43/main.c | 8 ++++++++
 1 file changed, 8 insertions(+)
(quoted diff) +0 -0

b/drivers/net/wireless/broadcom/b43/main.c index 8f4aff3..57a5935 100644 --- a/drivers/net/wireless/broadcom/b43/main.c +++ b/drivers/net/wireless/broadcom/b43/main.c

(quoted diff) +0 -0
@@ -4318,6 +4318,14 @@ static void b43_op_configure_filter(struct

ieee80211_hw *hw, FIF_OTHER_BSS |

drivers/net/wireless/broadcom/b43/main.c +2 -0
 		   FIF_BCN_PRBRESP_PROMISC;
 
+	/*
+	 * b43_op_start() zeroes wl->filter_flags, but mac80211

computes

(quoted diff) +1 -0
+	 * @changed against its own cached flags, so after an

interface

(quoted diff) +1 -0
+	 * restart it reports no change and MACCTL kept the zeroed

filter.

(quoted diff) +1 -0
+	 * Compare against what the hardware was actually programmed

with.

drivers/net/wireless/broadcom/b43/main.c static void b43_op_configure_filter(struct ieee80211_hw *hw, · line 4331

Quoted 6 lines
drivers/net/wireless/broadcom/b43/main.c +3 -0
+	 */
+	if (wl->filter_flags != *fflags)
+		changed |= wl->filter_flags ^ *fflags;
 	wl->filter_flags = *fflags;
 
 	if (changed && b43_status(dev) >= B43_STAT_INITIALIZED)

Tested on DSL 3580L, with 4352 chip on 5Ghz, the chip transmit and no dma error arise. Without the patch the dma engine report an error on the descriptor. Earlier in June i wrongly asserted that the DMA on AC chips was needing 64 Kb segments, it was a wrong conclusion: going 64kb did stop the error, but for the wrong reason.

#3 lore raw

Re: [PATCH wireless-next 1/2] wifi: b43: reprogram the MAC filter after an interface restart

Il giorno Tue, 27 Oct 2026 20:21:51 +0100 Alessio Ferri <[email protected]> ha scritto:

Quoted 47 lines

Il giorno Wed, 14 Oct 2026 16:32:24 +0200
Andreas Wendleder <[email protected]> ha scritto:

Quoted 31 lines

b43_op_start() clears wl->filter_flags, but mac80211 computes @changed for b43_op_configure_filter() against the flags it cached from the previous run. After a down/up it can report no change, so b43_adjust_opmode() is not called and MACCTL keeps the cleared filter.

Compare the requested flags with what the hardware was programmed with and add the difference to @changed.

---
 drivers/net/wireless/broadcom/b43/main.c | 8 ++++++++
 1 file changed, 8 insertions(+)
(quoted diff) +0 -0

b/drivers/net/wireless/broadcom/b43/main.c index 8f4aff3..57a5935 100644 --- a/drivers/net/wireless/broadcom/b43/main.c +++ b/drivers/net/wireless/broadcom/b43/main.c

(quoted diff) +0 -0
@@ -4318,6 +4318,14 @@ static void b43_op_configure_filter(struct

ieee80211_hw *hw, FIF_OTHER_BSS |

drivers/net/wireless/broadcom/b43/main.c +2 -0
 		   FIF_BCN_PRBRESP_PROMISC;
 
+	/*
+	 * b43_op_start() zeroes wl->filter_flags, but mac80211

computes

(quoted diff) +1 -0
+	 * @changed against its own cached flags, so after an

interface

(quoted diff) +1 -0
+	 * restart it reports no change and MACCTL kept the zeroed

filter.

(quoted diff) +1 -0
+	 * Compare against what the hardware was actually

programmed with.

drivers/net/wireless/broadcom/b43/main.c static void b43_op_configure_filter(struct ieee80211_hw *hw, · line 4331

Quoted 6 lines
drivers/net/wireless/broadcom/b43/main.c +3 -0
+	 */
+	if (wl->filter_flags != *fflags)
+		changed |= wl->filter_flags ^ *fflags;
 	wl->filter_flags = *fflags;
 
 	if (changed && b43_status(dev) >= B43_STAT_INITIALIZED)  

Tested on DSL 3580L, with 4352 chip on 5Ghz, the chip transmit and no dma error arise. Without the patch the dma engine report an error on the descriptor. Earlier in June i wrongly asserted that the DMA on AC chips was needing 64 Kb segments, it was a wrong conclusion: going 64kb did stop the error, but for the wrong reason.

Quoted 6 lines

_______________________________________________
b43-dev mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/b43-dev

Ops, i meant to send it for PATCH 2/2, sorry to all

Sorry again
Alessio

_______________________________________________
b43-dev mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/b43-dev

Tested-by on v1 1/2
#4 lore raw

Re: [PATCH wireless-next 1/2] wifi: b43: reprogram the MAC filter after an interface restart

In reply to Andreas Wendleder

Il giorno Wed, 14 Oct 2026 16:32:24 +0200
Andreas Wendleder <[email protected]> ha scritto:

Quoted 30 lines

b43_op_start() clears wl->filter_flags, but mac80211 computes @changed for b43_op_configure_filter() against the flags it cached from the previous run. After a down/up it can report no change, so b43_adjust_opmode() is not called and MACCTL keeps the cleared filter.

Compare the requested flags with what the hardware was programmed with and add the difference to @changed.

---
 drivers/net/wireless/broadcom/b43/main.c | 8 ++++++++
 1 file changed, 8 insertions(+)
(quoted diff) +0 -0

b/drivers/net/wireless/broadcom/b43/main.c index 8f4aff3..57a5935 100644 --- a/drivers/net/wireless/broadcom/b43/main.c +++ b/drivers/net/wireless/broadcom/b43/main.c

(quoted diff) +0 -0
@@ -4318,6 +4318,14 @@ static void b43_op_configure_filter(struct

ieee80211_hw *hw, FIF_OTHER_BSS |

drivers/net/wireless/broadcom/b43/main.c +2 -0
 		   FIF_BCN_PRBRESP_PROMISC;
 
+	/*
+	 * b43_op_start() zeroes wl->filter_flags, but mac80211

computes

(quoted diff) +1 -0
+	 * @changed against its own cached flags, so after an

interface

(quoted diff) +1 -0
+	 * restart it reports no change and MACCTL kept the zeroed

filter.

(quoted diff) +1 -0
+	 * Compare against what the hardware was actually programmed

with.

drivers/net/wireless/broadcom/b43/main.c static void b43_op_configure_filter(struct ieee80211_hw *hw, · line 4331

Quoted 6 lines
drivers/net/wireless/broadcom/b43/main.c +3 -0
+	 */
+	if (wl->filter_flags != *fflags)
+		changed |= wl->filter_flags ^ *fflags;
 	wl->filter_flags = *fflags;
 
 	if (changed && b43_status(dev) >= B43_STAT_INITIALIZED)

Tested on my DSL 3580L with a 4352 5Ghz, the chip transmit ok.

#5 lore raw

PATCH 2/2 wifi: b43: handle 64-bit DMA engines whose index registers hold bus addresses

In reply to Andreas Wendleder

Newer 64-bit DMA engines (found on the core revisions of the BCM4352 and BCM4360) accept ring addresses with low bits set and then use bus addresses, not offsets into the ring, in the index and status registers. They are detected as brcmsmac does it in _dma_descriptor_align(): write 0xff0 to TXRINGLO and see whether it sticks.

On such an engine keep the ring address in the new ring->ptr_base, add it when writing TXINDEX and RXINDEX and subtract it when reading RXSTATUS. The ring address registers have to be written before the control word enables the engine, and the hardware defaults of burst length, outstanding reads and prefetch control (the *CTL_KEEP masks) have to be preserved.

Engines that keep offsets behave as before.

---
 drivers/net/wireless/broadcom/b43/b43.h |  1 +
 drivers/net/wireless/broadcom/b43/dma.c | 52 +++++++++++++++++++------
 drivers/net/wireless/broadcom/b43/dma.h |  3 ++
 3 files changed, 45 insertions(+), 11 deletions(-)
drivers/net/wireless/broadcom/b43/b43.h +1 -0
index c0d8fc0..e1e8083 100644
@@ -668,6 +668,7 @@ struct b43_dma {
 	u32 translation; /* Routing bits */
 	bool translation_in_low; /* Should translation bit go into low addr? */
 	bool parity; /* Check for parity */
+	bool ptr_is_addr;
 };
 
 struct b43_pio_txqueue;
drivers/net/wireless/broadcom/b43/dma.c +41 -11

88 lines not on this page · raw message

drivers/net/wireless/broadcom/b43/dma.h +3 -0
index f9f65bb..eddc882 100644
@@ -90,6 +90,7 @@ struct b43_dmadesc32 {
 #define		B43_DMA64_TXPARITYDISABLE		0x00000800
 #define		B43_DMA64_TXADDREXT_MASK		0x00030000
 #define		B43_DMA64_TXADDREXT_SHIFT		16
+#define B43_DMA64_TXCTL_KEEP				0x03FC00C0
 #define B43_DMA64_TXINDEX				0x04
 #define B43_DMA64_TXRINGLO				0x08
 #define B43_DMA64_TXRINGHI				0x0C
@@ -118,6 +119,7 @@ struct b43_dmadesc32 {
 #define		B43_DMA64_RXPARITYDISABLE		0x00000800
 #define		B43_DMA64_RXADDREXT_MASK		0x00030000
 #define		B43_DMA64_RXADDREXT_SHIFT		16
+#define B43_DMA64_RXCTL_KEEP				0x03FC0000
 #define B43_DMA64_RXINDEX				0x24
 #define B43_DMA64_RXRINGLO				0x28
 #define B43_DMA64_RXRINGHI				0x2C
@@ -235,6 +237,7 @@ struct b43_dmaring {
 	u8 *txhdr_cache;
 	/* (Unadjusted) DMA base bus-address of the ring memory. */
 	dma_addr_t dmabase;
+	u32 ptr_base;
 	/* Number of descriptor slots in the ring. */
 	int nr_slots;
 	/* Number of used descriptor slots. */
Tested-by on v1 2/2
#6 lore raw

Re: [PATCH wireless-next 2/2] wifi: b43: handle 64-bit DMA engines whose index registers hold bus addresses

Il giorno Wed, 14 Oct 2026 16:32:25 +0200
Andreas Wendleder <[email protected]> ha scritto:

Quoted 176 lines

Newer 64-bit DMA engines (found on the core revisions of the BCM4352 and BCM4360) accept ring addresses with low bits set and then use bus addresses, not offsets into the ring, in the index and status registers. They are detected as brcmsmac does it in _dma_descriptor_align(): write 0xff0 to TXRINGLO and see whether it sticks.

On such an engine keep the ring address in the new ring->ptr_base, add it when writing TXINDEX and RXINDEX and subtract it when reading RXSTATUS. The ring address registers have to be written before the control word enables the engine, and the hardware defaults of burst length, outstanding reads and prefetch control (the *CTL_KEEP masks) have to be preserved.

Engines that keep offsets behave as before.

---
 drivers/net/wireless/broadcom/b43/b43.h |  1 +
 drivers/net/wireless/broadcom/b43/dma.c | 52

+++++++++++++++++++------ drivers/net/wireless/broadcom/b43/dma.h | 3 ++ 3 files changed, 45 insertions(+), 11 deletions(-)

(quoted diff) +0 -0

b/drivers/net/wireless/broadcom/b43/b43.h index c0d8fc0..e1e8083 100644 --- a/drivers/net/wireless/broadcom/b43/b43.h +++ b/drivers/net/wireless/broadcom/b43/b43.h

(quoted diff) +0 -0
@@ -668,6 +668,7 @@ struct b43_dma {
 	u32 translation; /* Routing bits */
 	bool translation_in_low; /* Should translation bit go into

low addr? */ bool parity; /* Check for parity */

drivers/net/wireless/broadcom/b43/b43.h +1 -0
+	bool ptr_is_addr;
 };
 
 struct b43_pio_txqueue;
(quoted diff) +0 -0

b/drivers/net/wireless/broadcom/b43/dma.c index 05da698..20d910a 100644 --- a/drivers/net/wireless/broadcom/b43/dma.c +++ b/drivers/net/wireless/broadcom/b43/dma.c

drivers/net/wireless/broadcom/b43/dma.c +7 -6
@@ -212,7 +212,7 @@ static void op64_fill_descriptor(struct
 b43_dmaring *ring, 
 static void op64_poke_tx(struct b43_dmaring *ring, int slot)
 {
-	b43_dma_write(ring, B43_DMA64_TXINDEX,
+	b43_dma_write(ring, B43_DMA64_TXINDEX, ring->ptr_base +
 		      (u32) (slot * sizeof(struct b43_dmadesc64)));
 }
 
@@ -233,14 +233,15 @@ static int op64_get_current_rxslot(struct
 b43_dmaring *ring) u32 val;
 
 	val = b43_dma_read(ring, B43_DMA64_RXSTATUS);
-	val &= B43_DMA64_RXSTATDPTR;
+	val = ((val & B43_DMA64_RXSTATDPTR) - ring->ptr_base) &
+	      B43_DMA64_RXSTATDPTR;
 
 	return (val / sizeof(struct b43_dmadesc64));
 }
 
 static void op64_set_current_rxslot(struct b43_dmaring *ring, int
 slot) {
-	b43_dma_write(ring, B43_DMA64_RXINDEX,
+	b43_dma_write(ring, B43_DMA64_RXINDEX, ring->ptr_base +
 		      (u32) (slot * sizeof(struct b43_dmadesc64)));
 }
 
@@ -690,9 +691,19 @@ static int dmacontroller_setup(struct
 b43_dmaring *ring) & B43_DMA64_TXADDREXT_MASK;
 			if (!parity)
 				value |= B43_DMA64_TXPARITYDISABLE;
-			b43_dma_write(ring, B43_DMA64_TXCTL, value);
-			b43_dma_write(ring, B43_DMA64_TXRINGLO,
 addrlo);
-			b43_dma_write(ring, B43_DMA64_TXRINGHI,
 addrhi);
+			if (ring->dev->dma.ptr_is_addr) {
+				ring->ptr_base =
 lower_32_bits(ring->dmabase);
+				value |= b43_dma_read(ring,

B43_DMA64_TXCTL) &

(quoted diff) +2 -0
+					 B43_DMA64_TXCTL_KEEP;
+				b43_dma_write(ring,

B43_DMA64_TXRINGLO, addrlo);

(quoted diff) +1 -0
+				b43_dma_write(ring,

B43_DMA64_TXRINGHI, addrhi);

(quoted diff) +1 -0
+				b43_dma_write(ring, B43_DMA64_TXCTL,

value);

drivers/net/wireless/broadcom/b43/dma.c +3 -0
+			} else {
+				ring->ptr_base = 0;
+				b43_dma_write(ring, B43_DMA64_TXCTL,

value);

(quoted diff) +1 -0
+				b43_dma_write(ring,

B43_DMA64_TXRINGLO, addrlo);

(quoted diff) +1 -0
+				b43_dma_write(ring,

B43_DMA64_TXRINGHI, addrhi);

drivers/net/wireless/broadcom/b43/dma.c +1 -0
+			}
 		} else {
 			u32 ringbase = (u32) (ring->dmabase);
 			addrext = b43_dma_address(&ring->dev->dma,

ringbase, B43_DMA_ADDR_EXT); @@ -722,11 +733,21 @@ static int dmacontroller_setup(struct b43_dmaring *ring) & B43_DMA64_RXADDREXT_MASK; if (!parity)

drivers/net/wireless/broadcom/b43/dma.c +0 -2
 				value |= B43_DMA64_RXPARITYDISABLE;
-			b43_dma_write(ring, B43_DMA64_RXCTL, value);
-			b43_dma_write(ring, B43_DMA64_RXRINGLO,

addrlo);

(quoted diff) +0 -1
-			b43_dma_write(ring, B43_DMA64_RXRINGHI,

addrhi);

drivers/net/wireless/broadcom/b43/dma.c +0 -1
-			b43_dma_write(ring, B43_DMA64_RXINDEX,

ring->nr_slots *

drivers/net/wireless/broadcom/b43/dma.c +2 -1
-				      sizeof(struct b43_dmadesc64));
+			if (ring->dev->dma.ptr_is_addr) {
+				ring->ptr_base =

lower_32_bits(ring->dmabase);

(quoted diff) +1 -0
+				value |= b43_dma_read(ring,

B43_DMA64_RXCTL) &

(quoted diff) +2 -0
+					 B43_DMA64_RXCTL_KEEP;
+				b43_dma_write(ring,

B43_DMA64_RXRINGLO, addrlo);

(quoted diff) +1 -0
+				b43_dma_write(ring,

B43_DMA64_RXRINGHI, addrhi);

(quoted diff) +1 -0
+				b43_dma_write(ring, B43_DMA64_RXCTL,

value);

drivers/net/wireless/broadcom/b43/dma.c +3 -0
+			} else {
+				ring->ptr_base = 0;
+				b43_dma_write(ring, B43_DMA64_RXCTL,

value);

(quoted diff) +1 -0
+				b43_dma_write(ring,

B43_DMA64_RXRINGLO, addrlo);

(quoted diff) +1 -0
+				b43_dma_write(ring,

B43_DMA64_RXRINGHI, addrhi);

(quoted diff) +2 -0
+			}
+			b43_dma_write(ring, B43_DMA64_RXINDEX,

ring->ptr_base +

(quoted diff) +1 -0
+				      ring->nr_slots * sizeof(struct

b43_dmadesc64)); } else {

(quoted diff) +0 -0
 			u32 ringbase = (u32) (ring->dmabase);
 			addrext = b43_dma_address(&ring->dev->dma,

ringbase, B43_DMA_ADDR_EXT); @@ -1080,6 +1101,15 @@ int b43_dma_init(struct b43_wldev *dev) dma->parity = false;
#endif

drivers/net/wireless/broadcom/b43/dma.c +3 -0
+	dma->ptr_is_addr = false;
+	if (type == B43_DMA_64BIT) {
+		u16 ringlo = b43_dmacontroller_base(type, 0) +

B43_DMA64_TXRINGLO; +

drivers/net/wireless/broadcom/b43/dma.c +5 -0
+		b43_write32(dev, ringlo, 0xff0);
+		dma->ptr_is_addr = b43_read32(dev, ringlo) != 0;
+		b43_write32(dev, ringlo, 0);
+	}
+
 	err = -ENOMEM;
 	/* setup TX DMA channels. */
 	dma->tx_ring_AC_BK = b43_setup_dmaring(dev, 0, 1, type);
(quoted diff) +0 -0

b/drivers/net/wireless/broadcom/b43/dma.h index f9f65bb..eddc882 100644 --- a/drivers/net/wireless/broadcom/b43/dma.h +++ b/drivers/net/wireless/broadcom/b43/dma.h

(quoted diff) +0 -0
@@ -90,6 +90,7 @@ struct b43_dmadesc32 {
 #define		B43_DMA64_TXPARITYDISABLE

0x00000800 #define B43_DMA64_TXADDREXT_MASK

	0x00030000 #define

B43_DMA64_TXADDREXT_SHIFT 16 +#define
B43_DMA64_TXCTL_KEEP 0x03FC00C0
#define B43_DMA64_TXINDEX 0x04 #define
B43_DMA64_TXRINGLO 0x08 #define
B43_DMA64_TXRINGHI 0x0C @@ -118,6
+119,7 @@ struct b43_dmadesc32 { #define
B43_DMA64_RXPARITYDISABLE 0x00000800 #define

	B43_DMA64_RXADDREXT_MASK		0x00030000

#define B43_DMA64_RXADDREXT_SHIFT 16
+#define B43_DMA64_RXCTL_KEEP
0x03FC0000 #define B43_DMA64_RXINDEX
0x24 #define B43_DMA64_RXRINGLO 0x28
#define B43_DMA64_RXRINGHI 0x2C @@
-235,6 +237,7 @@ struct b43_dmaring { u8 *txhdr_cache;

drivers/net/wireless/broadcom/b43/dma.h struct b43_dmaring { · line 243

Quoted 6 lines
drivers/net/wireless/broadcom/b43/dma.h +1 -0
 	/* (Unadjusted) DMA base bus-address of the ring memory. */
 	dma_addr_t dmabase;
+	u32 ptr_base;
 	/* Number of descriptor slots in the ring. */
 	int nr_slots;
 	/* Number of used descriptor slots. */

Tested on DSL 3580L, with 4352 chip on 5Ghz, the chip transmit and no dma error arise. Without the patch the dma engine report an error on the descriptor. Earlier in June i wrongly asserted that the DMA on AC chips was needing 64 Kb segments, it was a wrong conclusion: going 64kb did stop the error, but for the wrong reason.