Skip to contentSkip to conversation

bcm43xx-mac80211: Make hwpctl optional (disabled by default)

PATCH In review Michael Buesch 2 participants 2 messages Aug 7, 2007 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bcm43xx-mac80211: Make hwpctl optional (disabled by default)

This patch makes hardware power control optional through a module parameter, which is disabled by default. Hardware power control is broken, so we will drive with software based power control.

--

John, please apply to wireless-dev.
With this patch we come into the region where we might consider going into production with bcm43xx-mac80211.
The mac80211 rc algorithm is able to auto-scale up to 54M on my 4306 and the 4318(!).
So the major TX problems seem mostly gone with this.

I am going to do more small patches that optimize software power adjustment and so on later. But the major stuff should be fixed.

drivers/net/wireless/bcm43xx-mac80211/bcm43xx.h +2 -0
Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx.h
===================================================================
@@ -537,6 +537,8 @@ struct bcm43xx_phy {
 #ifdef CONFIG_BCM43XX_MAC80211_DEBUG
 	bool manual_txpower_control; /* Manual TX-power control enabled? */
 #endif
+	/* Hardware Power Control enabled? */
+	bool hardware_power_control;
 
 	/* Current Interference Mitigation mode */
 	int interfmode;
drivers/net/wireless/bcm43xx-mac80211/bcm43xx_lo.c +4 -4
Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_lo.c
===================================================================
@@ -589,7 +589,7 @@ static void lo_measure_setup(struct bcm4
 	struct bcm43xx_txpower_lo_control *lo = phy->lo_control;
 	u16 tmp;
 
-	if (has_hardware_pctl(phy)) {
+	if (bcm43xx_has_hardware_pctl(phy)) {
 		sav->phy_lo_mask = bcm43xx_phy_read(dev, BCM43xx_PHY_LO_MASK);
 		sav->phy_extg_01 = bcm43xx_phy_read(dev, BCM43xx_PHY_EXTG(0x01));
 		sav->phy_dacctl_hwpctl = bcm43xx_phy_read(dev, BCM43xx_PHY_DACCTL);
@@ -615,7 +615,7 @@ static void lo_measure_setup(struct bcm4
 		bcm43xx_phy_write(dev, BCM43xx_PHY_BASE(0x16), 0x410);
 		bcm43xx_phy_write(dev, BCM43xx_PHY_BASE(0x17), 0x820);
 	}
-	if (!lo->rebuild && has_hardware_pctl(phy))
+	if (!lo->rebuild && bcm43xx_has_hardware_pctl(phy))
 		lo_read_power_vector(dev);
 	if (phy->rev >= 2) {
 		sav->phy_analogover = bcm43xx_phy_read(dev, BCM43xx_PHY_ANALOGOVER);
@@ -730,7 +730,7 @@ static void lo_measure_restore(struct bc
 		tmp = (phy->pga_gain | 0xEFA0);
 		bcm43xx_phy_write(dev, BCM43xx_PHY_PGACTL, tmp);
 	}
-	if (has_hardware_pctl(phy)) {
+	if (bcm43xx_has_hardware_pctl(phy)) {
 		bcm43xx_gphy_dc_lt_init(dev);
 	} else {
 		if (lo->rebuild)
@@ -777,7 +777,7 @@ static void lo_measure_restore(struct bc
 		bcm43xx_phy_write(dev, BCM43xx_PHY_BASE(0x3E), sav->phy_base_3E);
 		bcm43xx_phy_write(dev, BCM43xx_PHY_CRS0, sav->phy_crs0);
 	}
-	if (has_hardware_pctl(phy)) {
+	if (bcm43xx_has_hardware_pctl(phy)) {
 		tmp = (sav->phy_lo_mask & 0xBFFF);
 		bcm43xx_phy_write(dev, BCM43xx_PHY_LO_MASK, tmp);
 		bcm43xx_phy_write(dev, BCM43xx_PHY_EXTG(0x01), sav->phy_extg_01);
drivers/net/wireless/bcm43xx-mac80211/bcm43xx_main.c +6 -0
Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_main.c
===================================================================
@@ -102,6 +102,10 @@ static int modparam_mon_keep_badplcp;
 module_param_named(mon_keep_badplcp, modparam_mon_keep_bad, int, 0444);
 MODULE_PARM_DESC(mon_keep_badplcp, "Keep frames with bad PLCP in monitor mode");
 
+static int modparam_hwpctl;
+module_param_named(hwpctl, modparam_hwpctl, int, 0444);
+MODULE_PARM_DESC(hwpctl, "Enable hardware-side power control (default off)");
+
 
 static const struct ssb_device_id bcm43xx_ssb_tbl[] = {
 	SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, SSB_ANY_REV),
@@ -3170,6 +3174,8 @@ static void setup_struct_phy_for_init(st
 	spin_lock_init(&phy->lock);
 	phy->interfmode = BCM43xx_INTERFMODE_NONE;
 	phy->channel = 0xFF;
+
+	phy->hardware_power_control = !!modparam_hwpctl;
 }
 
 static void setup_struct_wldev_for_init(struct bcm43xx_wldev *dev)
drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.c +37 -11

74 lines not on this page · raw message

drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.h +2 -3
Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.h
===================================================================
@@ -4,6 +4,7 @@
 #include <linux/types.h>
 
 struct bcm43xx_wldev;
+struct bcm43xx_phy;
 
 
 /*** PHY Registers ***/
@@ -218,9 +219,7 @@ void bcm43xx_phy_xmitpower(struct bcm43x
 void bcm43xx_gphy_dc_lt_init(struct bcm43xx_wldev *dev);
 
 /* Returns the boolean whether the board has HardwarePowerControl */
-#define has_hardware_pctl(phy) \
-	(((phy)->type == BCM43xx_PHYTYPE_A && (phy)->rev >= 5) ||	\
-	 ((phy)->type == BCM43xx_PHYTYPE_G && (phy)->rev >= 6))
+bool bcm43xx_has_hardware_pctl(struct bcm43xx_phy *phy);
 /* Returns the boolean whether "TX Magnification" is enabled. */
 #define has_tx_magnification(phy) \
 	(((phy)->rev >= 2) &&			\
Signature · 1 line
Greetings Michael.
#1 lore raw
Quoted 6 lines · Michael Buesch

This patch makes hardware power control optional through a module parameter, which is disabled by default. Hardware power control is broken, so we will drive with software based power control.

ACK: Larry Finger <[email protected]>

Quoted 10 lines

--

John, please apply to wireless-dev.
With this patch we come into the region where we might consider going into production with bcm43xx-mac80211.
The mac80211 rc algorithm is able to auto-scale up to 54M on my 4306 and the 4318(!).
So the major TX problems seem mostly gone with this.

Quoted 3 lines

I am going to do more small patches that optimize software power adjustment and so on later. But the major stuff should be fixed.

I get auto-scaling to 54M on my 4311 as well. I agree that bcm43xx-mac80211 is now ready to start the process of getting it into mainstream in the 2.6.24 or -25 cycle. Any changes required by the reviewers will be mirrored in the bcm4301 code. It certainly looks as if we will be free of softmac very soon.

Larry