Skip to contentSkip to conversation

wifi: b43: back off the N-PHY TX power per rate

PATCH In review Rosen Penev 2 participants 3 messages Oct 15 B43 wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: b43: back off the N-PHY TX power per rate

On N-PHY rev 3+ the hardware TX power control aims at the highest per-rate target, and an adjusted power table backs each rate group off from it. b43 fills that table from nphy->tx_power_offset[], but never sets the offsets, so they stay zero and every rate is sent at the power allowed for CCK.

The SPROM power offsets exist to avoid this: on boards with external PAs, OFDM and MCS rates have to be sent a few dB lower than CCK to keep the PA linear. Sent at full power, 16-QAM and 64-QAM frames are too distorted to decode. On an ASUS RT-N16 (BCM4718, N-PHY rev 5, radio 2056, ofdm2gpo 0x66666666) the router could only send at 6-18 Mbit/s and MCS 0-2, even at -50 dBm, and 24 Mbit/s and up or MCS 3 and up delivered nothing.

Set the offsets from the per-rate targets b43 already computes from the SPROM, as brcmsmac does, before the table is built.

With this, the RT-N16 sends at 54 Mbit/s, and at MCS 7 with HT enabled, and TCP from the router to a client goes from 9 to 17-18 Mbit/s.

Fixes 8615eb2870f1 ("b43: N-PHY: support setting custom TX power")
Assisted-by LLM
---
 drivers/net/wireless/broadcom/b43/phy_n.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/net/wireless/broadcom/b43/phy_n.c +11 -0
index 22359bd9db47..c9b2b7496983 100644
@@ -5834,6 +5834,7 @@ static enum b43_txpwr_result b43_nphy_op_recalc_txpower(struct b43_wldev *dev,
 	struct ieee80211_channel *channel = dev->wl->hw->conf.chandef.chan;
 	struct b43_ppr *ppr = &nphy->tx_pwr_max_ppr;
 	u8 max; /* qdBm */
+	int i;
 
 	if (nphy->tx_pwr_last_recalc_freq == channel->center_freq &&
 	    nphy->tx_pwr_last_recalc_limit == phy->desired_txpower)
@@ -5868,6 +5869,16 @@ static enum b43_txpwr_result b43_nphy_op_recalc_txpower(struct b43_wldev *dev,
 	/* Make sure we didn't go too low */
 	b43_ppr_apply_min(dev, ppr, INT_TO_Q52(8));
 
+	/*
+	 * The hardware power control aims at the highest per-rate target.
+	 * The adjusted power table backs other rates off from it, so that
+	 * e.g. 64-QAM isn't sent at the power allowed for CCK.
+	 */
+	max = b43_ppr_get_max(dev, ppr);
+	memset(nphy->tx_power_offset, 0, sizeof(nphy->tx_power_offset));
+	for (i = 0; i < B43_PPR_RATES_NUM; i++)
+		nphy->tx_power_offset[i] = max - ppr->__all_rates[i];
+
 	/* Apply */
 	b43_mac_suspend(dev);
 	b43_nphy_tx_power_ctl_setup(dev);
Signature · 1 line
2.56.0
#1 lore raw

Il giorno Thu, 15 Oct 2026 10:59:28 -0700
Rosen Penev <[email protected]> ha scritto:

Quoted 55 lines

On N-PHY rev 3+ the hardware TX power control aims at the highest per-rate target, and an adjusted power table backs each rate group off from it. b43 fills that table from nphy->tx_power_offset[], but never sets the offsets, so they stay zero and every rate is sent at the power allowed for CCK.

The SPROM power offsets exist to avoid this: on boards with external PAs, OFDM and MCS rates have to be sent a few dB lower than CCK to keep the PA linear. Sent at full power, 16-QAM and 64-QAM frames are too distorted to decode. On an ASUS RT-N16 (BCM4718, N-PHY rev 5, radio 2056, ofdm2gpo 0x66666666) the router could only send at 6-18 Mbit/s and MCS 0-2, even at -50 dBm, and 24 Mbit/s and up or MCS 3 and up delivered nothing.

Set the offsets from the per-rate targets b43 already computes from the SPROM, as brcmsmac does, before the table is built.

With this, the RT-N16 sends at 54 Mbit/s, and at MCS 7 with HT enabled, and TCP from the router to a client goes from 9 to 17-18 Mbit/s.

Fixes 8615eb2870f1 ("b43: N-PHY: support setting custom TX power")
Assisted-by LLM
---
 drivers/net/wireless/broadcom/b43/phy_n.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
(quoted diff) +0 -0

b/drivers/net/wireless/broadcom/b43/phy_n.c index 22359bd9db47..c9b2b7496983 100644 --- a/drivers/net/wireless/broadcom/b43/phy_n.c +++ b/drivers/net/wireless/broadcom/b43/phy_n.c @@ -5834,6 +5834,7 @@ static enum b43_txpwr_result b43_nphy_op_recalc_txpower(struct b43_wldev *dev, struct ieee80211_channel *channel = dev->wl->hw->conf.chandef.chan; struct b43_ppr *ppr = &nphy->tx_pwr_max_ppr; u8 max; /* qdBm */

drivers/net/wireless/broadcom/b43/phy_n.c +1 -0
+	int i;
 
 	if (nphy->tx_pwr_last_recalc_freq == channel->center_freq &&
 	    nphy->tx_pwr_last_recalc_limit == phy->desired_txpower)
@@ -5868,6 +5869,16 @@ static enum b43_txpwr_result

b43_nphy_op_recalc_txpower(struct b43_wldev *dev, /* Make sure we didn't go too low */ b43_ppr_apply_min(dev, ppr, INT_TO_Q52(8));

(quoted diff) +2 -0
+	/*
+	 * The hardware power control aims at the highest per-rate

target.

(quoted diff) +1 -0
+	 * The adjusted power table backs other rates off from it,

so that

drivers/net/wireless/broadcom/b43/phy_n.c +4 -0
+	 * e.g. 64-QAM isn't sent at the power allowed for CCK.
+	 */
+	max = b43_ppr_get_max(dev, ppr);
+	memset(nphy->tx_power_offset, 0,

sizeof(nphy->tx_power_offset));

drivers/net/wireless/broadcom/b43/phy_n.c static enum b43_txpwr_result b43_nphy_op_recalc_txpower(struct b43_wldev *dev, · line 5884

Quoted 6 lines
drivers/net/wireless/broadcom/b43/phy_n.c +3 -0
+	for (i = 0; i < B43_PPR_RATES_NUM; i++)
+		nphy->tx_power_offset[i] = max - ppr->__all_rates[i];
+
 	/* Apply */
 	b43_mac_suspend(dev);
 	b43_nphy_tx_power_ctl_setup(dev);

I'm not the maintainer, and i also have the same exact patch in my repo
https://github.com/aleferri/b43-6362-wip/tree/main/patches/mainline, so i'm all for it, but isn't the ppr currently populated with 2Ghz sprom params for all bands?

Alessio

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

#2 lore raw
Quoted 62 lines · Alessio Ferri

Il giorno Thu, 15 Oct 2026 10:59:28 -0700
Rosen Penev <[email protected]> ha scritto:

Quoted 58 lines

On N-PHY rev 3+ the hardware TX power control aims at the highest per-rate target, and an adjusted power table backs each rate group off from it. b43 fills that table from nphy->tx_power_offset[], but never sets the offsets, so they stay zero and every rate is sent at the power allowed for CCK.

The SPROM power offsets exist to avoid this: on boards with external PAs, OFDM and MCS rates have to be sent a few dB lower than CCK to keep the PA linear. Sent at full power, 16-QAM and 64-QAM frames are too distorted to decode. On an ASUS RT-N16 (BCM4718, N-PHY rev 5, radio 2056, ofdm2gpo 0x66666666) the router could only send at 6-18 Mbit/s and MCS 0-2, even at -50 dBm, and 24 Mbit/s and up or MCS 3 and up delivered nothing.

Set the offsets from the per-rate targets b43 already computes from the SPROM, as brcmsmac does, before the table is built.

With this, the RT-N16 sends at 54 Mbit/s, and at MCS 7 with HT enabled, and TCP from the router to a client goes from 9 to 17-18 Mbit/s.

Fixes 8615eb2870f1 ("b43: N-PHY: support setting custom TX power")
Assisted-by LLM
---
 drivers/net/wireless/broadcom/b43/phy_n.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
(quoted diff) +0 -0

b/drivers/net/wireless/broadcom/b43/phy_n.c index 22359bd9db47..c9b2b7496983 100644 --- a/drivers/net/wireless/broadcom/b43/phy_n.c +++ b/drivers/net/wireless/broadcom/b43/phy_n.c @@ -5834,6 +5834,7 @@ static enum b43_txpwr_result b43_nphy_op_recalc_txpower(struct b43_wldev *dev, struct ieee80211_channel *channel = dev->wl->hw->conf.chandef.chan; struct b43_ppr *ppr = &nphy->tx_pwr_max_ppr; u8 max; /* qdBm */

drivers/net/wireless/broadcom/b43/phy_n.c +1 -0
+     int i;
 
      if (nphy->tx_pwr_last_recalc_freq == channel->center_freq &&
          nphy->tx_pwr_last_recalc_limit == phy->desired_txpower)
@@ -5868,6 +5869,16 @@ static enum b43_txpwr_result

b43_nphy_op_recalc_txpower(struct b43_wldev *dev, /* Make sure we didn't go too low */ b43_ppr_apply_min(dev, ppr, INT_TO_Q52(8));

(quoted diff) +2 -0
+     /*
+      * The hardware power control aims at the highest per-rate

target.
+ * The adjusted power table backs other rates off from it,
so that

drivers/net/wireless/broadcom/b43/phy_n.c +4 -0
+      * e.g. 64-QAM isn't sent at the power allowed for CCK.
+      */
+     max = b43_ppr_get_max(dev, ppr);
+     memset(nphy->tx_power_offset, 0,

sizeof(nphy->tx_power_offset));

drivers/net/wireless/broadcom/b43/phy_n.c +3 -0
+     for (i = 0; i < B43_PPR_RATES_NUM; i++)
+             nphy->tx_power_offset[i] = max - ppr->__all_rates[i];
+
Quoted 8 lines
Quoted 3 lines
      /* Apply */
      b43_mac_suspend(dev);
      b43_nphy_tx_power_ctl_setup(dev);

I'm not the maintainer, and i also have the same exact patch in my repo
https://github.com/aleferri/b43-6362-wip/tree/main/patches/mainline, so i'm all for it, but isn't the ppr currently populated with 2Ghz sprom params for all bands?

This patch comes from work on an RT-N16, which is 2ghz only, hence why 5ghz is not touched. I submitted this since there's a Fixes: tag that's appropriate here. The actual fixes I'll submit in the next merge window. It's quite late in the cycle.

There's no maintainer here. It's an orphaned driver. I wanted to focus on brcmsmac but that driver is really slow.

Quoted 2 lines

Alessio