Skip to contentSkip to conversation

b43: Rewrite TX power adjustment

PATCH In review Michael Buesch 2 participants 4 messages Jul 26, 2008 – Jul 29, 2008 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 b43: Rewrite TX power adjustment

This is an experimental attempt for fixing the currently-not-so-good TX power adjustment.

This patch rewrites the algorithms to scale better. If there's no TX traffic, the power will be checked against the desired values every 15 seconds (can probably be lowered to 30 or 60 seconds now). If there is TX traffic, the check is redone every 2 seconds. This improves the reaction times a lot and confuses the rate control less.

If you want to test this, please apply to latest wireless-testing.git and compile b43 with debugging support.
After loading the driver, mount debugfs and do

	echo 1 >/debug/b43/phy*/debug_xmitpower

to enable TX power calculation debugging. This will print a lot of useful messages in the kernel log.

This patch is only tested on a 4306 card.
Have fun.

drivers/net/wireless/b43/b43.h +51 -22
Index: wireless-testing/drivers/net/wireless/b43/b43.h
===================================================================
@@ -170,12 +170,17 @@ enum {
 #define B43_SHM_SH_RADAR		0x0066	/* Radar register */
 #define B43_SHM_SH_PHYTXNOI		0x006E	/* PHY noise directly after TX (lower 8bit only) */
 #define B43_SHM_SH_RFRXSP1		0x0072	/* RF RX SP Register 1 */
 #define B43_SHM_SH_CHAN			0x00A0	/* Current channel (low 8bit only) */
 #define  B43_SHM_SH_CHAN_5GHZ		0x0100	/* Bit set, if 5Ghz channel */
 #define B43_SHM_SH_BCMCFIFOID		0x0108	/* Last posted cookie to the bcast/mcast FIFO */
+/* TSSI information */
+#define B43_SHM_SH_TSSI_CCK		0x0058	/* TSSI for last 4 CCK frames (32bit) */
+#define B43_SHM_SH_TSSI_OFDM_A		0x0068	/* TSSI for last 4 OFDM frames (32bit) */
+#define B43_SHM_SH_TSSI_OFDM_G		0x0070	/* TSSI for last 4 OFDM frames (32bit) */
+#define  B43_TSSI_MAX			0x7F	/* Max value for one TSSI value */
 /* SHM_SHARED TX FIFO variables */
 #define B43_SHM_SH_SIZE01		0x0098	/* TX FIFO size for FIFO 0 (low) and 1 (high) */
 #define B43_SHM_SH_SIZE23		0x009A	/* TX FIFO size for FIFO 2 and 3 */
 #define B43_SHM_SH_SIZE45		0x009C	/* TX FIFO size for FIFO 4 and 5 */
 #define B43_SHM_SH_SIZE67		0x009E	/* TX FIFO size for FIFO 6 and 7 */
 /* SHM_SHARED background noise */
@@ -505,12 +510,51 @@ struct b43_iv {
 		__be16 d16;
 		__be32 d32;
 	} data __attribute__((__packed__));
 } __attribute__((__packed__));
 
 
+/* Transmission Power values.
+ * (Almost) everything related to and required for TX-power adjustment
+ * is stored in this structure. */
+struct b43_txpower_context {
+	/* Pointer to the table used to convert a
+	 * TSSI value to dBm-Q5.2 */
+	const s8 *tssi2dbm;
+	/* tssi2dbm is kmalloc()ed. Only used for free()ing. */
+	bool dyn_tssi_tbl;
+	/* Target idle TSSI */
+	int tgt_idle_tssi;
+	/* Current idle TSSI */
+	int cur_idle_tssi;
+	/* The current average TSSI.
+	 * Needs irq_lock, as it's updated in the IRQ path. */
+	u8 average_tssi;
+	/* jiffies when the next TSSI read (from SHM) is required.
+	 * Needs irq_lock, as it's updated in the IRQ path. */
+	unsigned long next_tssi_average;
+	/* User-desired TX power level (in dBm). */
+	u8 desired_power;
+
+	/* A-PHY TX Power control value. */
+	u16 txpwr_offset;
+
+	/* Current TX power level attenuation control values */
+	struct b43_bbatt bbatt;
+	struct b43_rfatt rfatt;
+	u8 tx_control;		/* B43_TXCTL_XXX */
+
+	/* The calculated attenuation deltas that are used later
+	 * when adjusting the actual power output. */
+	int bbatt_delta;
+	int rfatt_delta;
+
+	/* Hardware Power Control enabled? */
+	bool hardware_power_control;
+};
+
 struct b43_phy {
 	/* Band support flags. */
 	bool supports_2ghz;
 	bool supports_5ghz;
 
 	/* GMODE bit enabled? */
@@ -525,14 +569,12 @@ struct b43_phy {
 
 	/* Radio versioning */
 	u16 radio_manuf;	/* Radio manufacturer */
 	u16 radio_ver;		/* Radio version */
 	u8 radio_rev;		/* Radio revision */
 
-	bool dyn_tssi_tbl;	/* tssi2dbm is kmalloc()ed. */
-
 	/* ACI (adjacent channel interference) flags. */
 	bool aci_enable;
 	bool aci_wlan_automatic;
 	bool aci_hw_rssi;
 
 	/* Radio switched on/off */
@@ -545,41 +587,23 @@ struct b43_phy {
 		u16 rfoverval;
 	} radio_off_context;
 
 	u16 minlowsig[2];
 	u16 minlowsigpos[2];
 
-	/* TSSI to dBm table in use */
-	const s8 *tssi2dbm;
-	/* Target idle TSSI */
-	int tgt_idle_tssi;
-	/* Current idle TSSI */
-	int cur_idle_tssi;
-
 	/* LocalOscillator control values. */
 	struct b43_txpower_lo_control *lo_control;
 	/* Values from b43_calc_loopback_gain() */
 	s16 max_lb_gain;	/* Maximum Loopback gain in hdB */
 	s16 trsw_rx_gain;	/* TRSW RX gain in hdB */
 	s16 lna_lod_gain;	/* LNA lod */
 	s16 lna_gain;		/* LNA */
 	s16 pga_gain;		/* PGA */
 
-	/* Desired TX power level (in dBm).
-	 * This is set by the user and adjusted in b43_phy_xmitpower(). */
-	u8 power_level;
-	/* A-PHY TX Power control value. */
-	u16 txpwr_offset;
-
-	/* Current TX power level attenuation control values */
-	struct b43_bbatt bbatt;
-	struct b43_rfatt rfatt;
-	u8 tx_control;		/* B43_TXCTL_XXX */
-
-	/* Hardware Power Control enabled? */
-	bool hardware_power_control;
+	/* (Almost) everything related to TX power is stored here. */
+	struct b43_txpower_context txpwr;
 
 	/* Current Interference Mitigation mode */
 	int interfmode;
 	/* Stack of saved values from the Interference Mitigation code.
 	 * Each value in the stack is layed out as follows:
 	 * bit 0-11:  offset
@@ -761,12 +785,17 @@ struct b43_wl {
 
 	/* The current QOS parameters for the 4 queues.
 	 * This is protected by the irq_lock. */
 	struct b43_qos_params qos_params[4];
 	/* Workqueue for updating QOS parameters in hardware. */
 	struct work_struct qos_update_work;
+
+	/* Work for adjustment of the transmission power.
+	 * This is scheduled when we determine that the actual TX output
+	 * power doesn't match what we want. */
+	struct work_struct txpower_adjust_work;
 };
 
 /* In-memory representation of a cached microcode file. */
 struct b43_firmware_file {
 	const char *filename;
 	const struct firmware *data;
drivers/net/wireless/b43/main.c +20 -11
Index: wireless-testing/drivers/net/wireless/b43/main.c
===================================================================
@@ -2866,13 +2866,15 @@ static void b43_periodic_every15sec(stru
 			b43_mac_enable(dev);
 		} else if (phy->interfmode == B43_INTERFMODE_NONWLAN &&
 			   phy->rev == 1) {
 			//TODO: implement rev1 workaround
 		}
 	}
-	b43_phy_xmitpower(dev);	//FIXME: unless scanning?
+	spin_lock_irq(&dev->wl->irq_lock);
+	b43_phy_txpower_check(dev, B43_TXPWR_IGNORE_TIME);
+	spin_unlock_irq(&dev->wl->irq_lock);
 	b43_lo_g_maintanance_work(dev);
 	//TODO for APHY (temperature?)
 
 	atomic_set(&phy->txerr_cnt, B43_PHY_TX_BADNESS_LIMIT);
 	wmb();
 }
@@ -3448,16 +3450,19 @@ static int b43_op_config(struct ieee8021
 	}
 
 	dev->wl->radiotap_enabled = !!(conf->flags & IEEE80211_CONF_RADIOTAP);
 
 	/* Adjust the desired TX power level. */
 	if (conf->power_level != 0) {
-		if (conf->power_level != phy->power_level) {
-			phy->power_level = conf->power_level;
-			b43_phy_xmitpower(dev);
+		spin_lock_irqsave(&wl->irq_lock, flags);
+		if (conf->power_level != phy->txpwr.desired_power) {
+			phy->txpwr.desired_power = conf->power_level;
+			b43_phy_txpower_check(dev, B43_TXPWR_IGNORE_TIME |
+						   B43_TXPWR_IGNORE_TSSI);
 		}
+		spin_unlock_irqrestore(&wl->irq_lock, flags);
 	}
 
 	/* Antennas for RX and management frame TX. */
 	antenna = b43_antenna_from_ieee80211(dev, conf->antenna_sel_tx);
 	b43_mgmtframe_txantenna(dev, antenna);
 	antenna = b43_antenna_from_ieee80211(dev, conf->antenna_sel_rx);
@@ -3861,21 +3866,24 @@ static void setup_struct_phy_for_init(st
 	phy->aci_enable = 0;
 	phy->aci_wlan_automatic = 0;
 	phy->aci_hw_rssi = 0;
 
 	phy->radio_off_context.valid = 0;
 
+	memset(&phy->txpwr, 0, sizeof(phy->txpwr));
+	phy->txpwr.next_tssi_average = jiffies;
+	phy->txpwr.hardware_power_control = !!modparam_hwpctl;
+
 	lo = phy->lo_control;
 	if (lo) {
 		memset(lo, 0, sizeof(*(phy->lo_control)));
 		lo->tx_bias = 0xFF;
 		INIT_LIST_HEAD(&lo->calib_list);
 	}
 	phy->max_lb_gain = 0;
 	phy->trsw_rx_gain = 0;
-	phy->txpwr_offset = 0;
 
 	/* NRSSI */
 	phy->nrssislope = 0;
 	for (i = 0; i < ARRAY_SIZE(phy->nrssi); i++)
 		phy->nrssi[i] = -1000;
 	for (i = 0; i < ARRAY_SIZE(phy->nrssi_lt); i++)
@@ -3884,14 +3892,12 @@ static void setup_struct_phy_for_init(st
 	phy->lofcal = 0xFFFF;
 	phy->initval = 0xFFFF;
 
 	phy->interfmode = B43_INTERFMODE_NONE;
 	phy->channel = 0xFF;
 
-	phy->hardware_power_control = !!modparam_hwpctl;
-
 	/* PHY TX errors counter. */
 	atomic_set(&phy->txerr_cnt, B43_PHY_TX_BADNESS_LIMIT);
 
 	/* OFDM-table address caching. */
 	phy->ofdmtab_addr_direction = B43_OFDMTAB_DIRECTION_UNKNOWN;
 }
@@ -4049,14 +4055,14 @@ static void b43_wireless_core_exit(struc
 	}
 	b43_dma_free(dev);
 	b43_pio_free(dev);
 	b43_chip_exit(dev);
 	b43_radio_turn_off(dev, 1);
 	b43_switch_analog(dev, 0);
-	if (phy->dyn_tssi_tbl)
-		kfree(phy->tssi2dbm);
+	if (phy->txpwr.dyn_tssi_tbl)
+		kfree(phy->txpwr.tssi2dbm);
 	kfree(phy->lo_control);
 	phy->lo_control = NULL;
 	if (dev->wl->current_beacon) {
 		dev_kfree_skb_any(dev->wl->current_beacon);
 		dev->wl->current_beacon = NULL;
 	}
@@ -4174,14 +4180,14 @@ static int b43_wireless_core_init(struct
 out:
 	return err;
 
       err_chip_exit:
 	b43_chip_exit(dev);
       err_kfree_tssitbl:
-	if (phy->dyn_tssi_tbl)
-		kfree(phy->tssi2dbm);
+	if (phy->txpwr.dyn_tssi_tbl)
+		kfree(phy->txpwr.tssi2dbm);
       err_kfree_lo_control:
 	kfree(phy->lo_control);
 	phy->lo_control = NULL;
       err_busdown:
 	ssb_bus_may_powerdown(bus);
 	B43_WARN_ON(b43_status(dev) != B43_STAT_UNINIT);
@@ -4322,12 +4328,14 @@ static void b43_op_stop(struct ieee80211
 
 	mutex_lock(&wl->mutex);
 	if (b43_status(dev) >= B43_STAT_STARTED)
 		b43_wireless_core_stop(dev);
 	b43_wireless_core_exit(dev);
 	mutex_unlock(&wl->mutex);
+
+	cancel_work_sync(&(wl->txpower_adjust_work));
 }
 
 static int b43_op_set_retry_limit(struct ieee80211_hw *hw,
 				  u32 short_retry_limit, u32 long_retry_limit)
 {
 	struct b43_wl *wl = hw_to_b43_wl(hw);
@@ -4699,12 +4707,13 @@ static int b43_wireless_init(struct ssb_
 	spin_lock_init(&wl->leds_lock);
 	spin_lock_init(&wl->shm_lock);
 	mutex_init(&wl->mutex);
 	INIT_LIST_HEAD(&wl->devlist);
 	INIT_WORK(&wl->qos_update_work, b43_qos_update_work);
 	INIT_WORK(&wl->beacon_update_trigger, b43_beacon_update_trigger_work);
+	INIT_WORK(&wl->txpower_adjust_work, b43_phy_txpower_adjust_work);
 
 	ssb_set_devtypedata(dev, wl);
 	b43info(wl, "Broadcom %04X WLAN found\n", dev->bus->chip_id);
 	err = 0;
       out:
 	return err;
drivers/net/wireless/b43/phy.c +394 -210

864 lines not on this page · raw message

drivers/net/wireless/b43/phy.h +16 -1
Index: wireless-testing/drivers/net/wireless/b43/phy.h
===================================================================
@@ -221,13 +221,12 @@ int b43_phy_init_tssi2dbm_table(struct b
 
 void b43_phy_early_init(struct b43_wldev *dev);
 int b43_phy_init(struct b43_wldev *dev);
 
 void b43_set_rx_antenna(struct b43_wldev *dev, int antenna);
 
-void b43_phy_xmitpower(struct b43_wldev *dev);
 
 /* Returns the boolean whether the board has HardwarePowerControl */
 bool b43_has_hardware_pctl(struct b43_phy *phy);
 /* Returns the boolean whether "TX Magnification" is enabled. */
 #define has_tx_magnification(phy) \
 	(((phy)->rev >= 2) &&			\
@@ -334,7 +333,23 @@ void b43_put_attenuation_into_ranges(str
 				     int *_bbatt, int *_rfatt);
 
 void b43_set_txpower_g(struct b43_wldev *dev,
 		       const struct b43_bbatt *bbatt,
 		       const struct b43_rfatt *rfatt, u8 tx_control);
 
+void b43_phy_txpower_check(struct b43_wldev *dev, unsigned int flags);
+/**
+ * enum b43_phy_txpower_check_flags - Flags for b43_phy_txpower_check()
+ *
+ * @B43_TXPWR_IGNORE_TIME: Ignore the schedule time and force-redo
+ *                         the check now.
+ * @B43_TXPWR_IGNORE_TSSI: Redo the recalculation, even if the average
+ *                         TSSI did not change.
+ */
+enum b43_phy_txpower_check_flags {
+	B43_TXPWR_IGNORE_TIME		= (1 << 0),
+	B43_TXPWR_IGNORE_TSSI		= (1 << 1),
+};
+
+void b43_phy_txpower_adjust_work(struct work_struct *work);
+
 #endif /* B43_PHY_H_ */
drivers/net/wireless/b43/debugfs.c +21 -17
Index: wireless-testing/drivers/net/wireless/b43/debugfs.c
===================================================================
@@ -451,20 +451,20 @@ static ssize_t txpower_g_read_file(struc
 	if (dev->phy.type != B43_PHYTYPE_G) {
 		fappend("Device is not a G-PHY\n");
 		goto out;
 	}
 	fappend("Control:               %s\n", dev->phy.manual_txpower_control ?
 		"MANUAL" : "AUTOMATIC");
-	fappend("Baseband attenuation:  %u\n", dev->phy.bbatt.att);
-	fappend("Radio attenuation:     %u\n", dev->phy.rfatt.att);
+	fappend("Baseband attenuation:  %u\n", dev->phy.txpwr.bbatt.att);
+	fappend("Radio attenuation:     %u\n", dev->phy.txpwr.rfatt.att);
 	fappend("TX Mixer Gain:         %s\n",
-		(dev->phy.tx_control & B43_TXCTL_TXMIX) ? "ON" : "OFF");
+		(dev->phy.txpwr.tx_control & B43_TXCTL_TXMIX) ? "ON" : "OFF");
 	fappend("PA Gain 2dB:           %s\n",
-		(dev->phy.tx_control & B43_TXCTL_PA2DB) ? "ON" : "OFF");
+		(dev->phy.txpwr.tx_control & B43_TXCTL_PA2DB) ? "ON" : "OFF");
 	fappend("PA Gain 3dB:           %s\n",
-		(dev->phy.tx_control & B43_TXCTL_PA3DB) ? "ON" : "OFF");
+		(dev->phy.txpwr.tx_control & B43_TXCTL_PA3DB) ? "ON" : "OFF");
 	fappend("\n\n");
 	fappend("You can write to this file:\n");
 	fappend("Writing \"auto\" enables automatic txpower control.\n");
 	fappend
 	    ("Writing the attenuation values as \"bbatt rfatt txmix pa2db pa3db\" "
 	     "enables manual txpower control.\n");
@@ -480,35 +480,39 @@ static int txpower_g_write_file(struct b
 				const char *buf, size_t count)
 {
 	if (dev->phy.type != B43_PHYTYPE_G)
 		return -ENODEV;
 	if ((count >= 4) && (memcmp(buf, "auto", 4) == 0)) {
 		/* Automatic control */
+		spin_lock_irq(&dev->wl->irq_lock);
 		dev->phy.manual_txpower_control = 0;
-		b43_phy_xmitpower(dev);
+		b43_phy_txpower_check(dev, B43_TXPWR_IGNORE_TIME |
+					   B43_TXPWR_IGNORE_TSSI);
+		spin_unlock_irq(&dev->wl->irq_lock);
 	} else {
 		int bbatt = 0, rfatt = 0, txmix = 0, pa2db = 0, pa3db = 0;
 		/* Manual control */
 		if (sscanf(buf, "%d %d %d %d %d", &bbatt, &rfatt,
 			   &txmix, &pa2db, &pa3db) != 5)
 			return -EINVAL;
 		b43_put_attenuation_into_ranges(dev, &bbatt, &rfatt);
 		dev->phy.manual_txpower_control = 1;
-		dev->phy.bbatt.att = bbatt;
-		dev->phy.rfatt.att = rfatt;
-		dev->phy.tx_control = 0;
+		dev->phy.txpwr.bbatt.att = bbatt;
+		dev->phy.txpwr.rfatt.att = rfatt;
+		dev->phy.txpwr.tx_control = 0;
 		if (txmix)
-			dev->phy.tx_control |= B43_TXCTL_TXMIX;
+			dev->phy.txpwr.tx_control |= B43_TXCTL_TXMIX;
 		if (pa2db)
-			dev->phy.tx_control |= B43_TXCTL_PA2DB;
+			dev->phy.txpwr.tx_control |= B43_TXCTL_PA2DB;
 		if (pa3db)
-			dev->phy.tx_control |= B43_TXCTL_PA3DB;
+			dev->phy.txpwr.tx_control |= B43_TXCTL_PA3DB;
 		b43_phy_lock(dev);
 		b43_radio_lock(dev);
-		b43_set_txpower_g(dev, &dev->phy.bbatt,
-				  &dev->phy.rfatt, dev->phy.tx_control);
+		b43_set_txpower_g(dev, &dev->phy.txpwr.bbatt,
+				  &dev->phy.txpwr.rfatt,
+				  dev->phy.txpwr.tx_control);
 		b43_radio_unlock(dev);
 		b43_phy_unlock(dev);
 	}
 
 	return 0;
 }
@@ -560,13 +564,13 @@ static ssize_t loctls_read_file(struct b
 		err = -ENODEV;
 		goto out;
 	}
 	lo = phy->lo_control;
 	fappend("-- Local Oscillator calibration data --\n\n");
 	fappend("HW-power-control enabled: %d\n",
-		dev->phy.hardware_power_control);
+		dev->phy.txpwr.hardware_power_control);
 	fappend("TX Bias: 0x%02X,  TX Magn: 0x%02X  (expire in %lu sec)\n",
 		lo->tx_bias, lo->tx_magn,
 		calc_expire_secs(now, lo->txctl_measured_time,
 				 B43_LO_TXCTL_EXPIRE));
 	fappend("Power Vector: 0x%08X%08X  (expires in %lu sec)\n",
 		(unsigned int)((lo->power_vector & 0xFFFFFFFF00000000ULL) >> 32),
@@ -575,14 +579,14 @@ static ssize_t loctls_read_file(struct b
 				 B43_LO_PWRVEC_EXPIRE));
 
 	fappend("\nCalibrated settings:\n");
 	list_for_each_entry(cal, &lo->calib_list, list) {
 		bool active;
 
-		active = (b43_compare_bbatt(&cal->bbatt, &phy->bbatt) &&
-			  b43_compare_rfatt(&cal->rfatt, &phy->rfatt));
+		active = (b43_compare_bbatt(&cal->bbatt, &phy->txpwr.bbatt) &&
+			  b43_compare_rfatt(&cal->rfatt, &phy->txpwr.rfatt));
 		fappend("BB(%d), RF(%d,%d)  ->  I=%d, Q=%d  "
 			"(expires in %lu sec)%s\n",
 			cal->bbatt.att,
 			cal->rfatt.att, cal->rfatt.with_padmix,
 			cal->ctl.i, cal->ctl.q,
 			calc_expire_secs(now, cal->calib_time,
drivers/net/wireless/b43/lo.c +6 -5
Index: wireless-testing/drivers/net/wireless/b43/lo.c
===================================================================
@@ -918,16 +918,16 @@ static inline void b43_lo_fixup_rfatt(st
 void b43_lo_g_adjust(struct b43_wldev *dev)
 {
 	struct b43_phy *phy = &dev->phy;
 	struct b43_lo_calib *cal;
 	struct b43_rfatt rf;
 
-	memcpy(&rf, &phy->rfatt, sizeof(rf));
+	memcpy(&rf, &phy->txpwr.rfatt, sizeof(rf));
 	b43_lo_fixup_rfatt(&rf);
 
-	cal = b43_get_calib_lo_settings(dev, &phy->bbatt, &rf);
+	cal = b43_get_calib_lo_settings(dev, &phy->txpwr.bbatt, &rf);
 	if (!cal)
 		return;
 	b43_lo_write(dev, &cal->ctl);
 }
 
 void b43_lo_g_adjust_to(struct b43_wldev *dev,
@@ -980,14 +980,14 @@ void b43_lo_g_maintanance_work(struct b4
 	 * Recalibrate the current setting, if expired. */
 	expire = now - B43_LO_CALIB_EXPIRE;
 	list_for_each_entry_safe(cal, tmp, &lo->calib_list, list) {
 		if (!time_before(cal->calib_time, expire))
 			continue;
 		/* This item expired. */
-		if (b43_compare_bbatt(&cal->bbatt, &phy->bbatt) &&
-		    b43_compare_rfatt(&cal->rfatt, &phy->rfatt)) {
+		if (b43_compare_bbatt(&cal->bbatt, &phy->txpwr.bbatt) &&
+		    b43_compare_rfatt(&cal->rfatt, &phy->txpwr.rfatt)) {
 			B43_WARN_ON(current_item_expired);
 			current_item_expired = 1;
 		}
 		if (b43_debug(dev, B43_DBG_LO)) {
 			b43dbg(dev->wl, "LO: Item BB(%u), RF(%u,%u), "
 			       "I=%d, Q=%d expired\n",
@@ -999,13 +999,14 @@ void b43_lo_g_maintanance_work(struct b4
 		kfree(cal);
 	}
 	if (current_item_expired || unlikely(list_empty(&lo->calib_list))) {
 		/* Recalibrate currently used LO setting. */
 		if (b43_debug(dev, B43_DBG_LO))
 			b43dbg(dev->wl, "LO: Recalibrating current LO setting\n");
-		cal = b43_calibrate_lo_setting(dev, &phy->bbatt, &phy->rfatt);
+		cal = b43_calibrate_lo_setting(dev, &phy->txpwr.bbatt,
+					       &phy->txpwr.rfatt);
 		if (cal) {
 			list_add(&cal->list, &lo->calib_list);
 			b43_lo_write(dev, &cal->ctl);
 		} else
 			b43warn(dev->wl, "Failed to recalibrate current LO setting\n");
 	}
drivers/net/wireless/b43/xmit.c +2 -0
Index: wireless-testing/drivers/net/wireless/b43/xmit.c
===================================================================
@@ -675,12 +675,14 @@ void b43_handle_txstatus(struct b43_wlde
 	}
 
 	if (b43_using_pio_transfers(dev))
 		b43_pio_handle_txstatus(dev, status);
 	else
 		b43_dma_handle_txstatus(dev, status);
+
+	b43_phy_txpower_check(dev, 0);
 }
 
 /* Fill out the mac80211 TXstatus report based on the b43-specific
  * txstatus report data. This returns a boolean whether the frame was
  * successfully transmitted. */
 bool b43_fill_txstatus_report(struct ieee80211_tx_info *report,
#1 lore raw
Quoted 2 lines · On Saturday 26 July 2008 17:26:52 Michael Buesch wrote:

This is an experimental attempt for fixing the currently-not-so-good TX power adjustment.

Hm, is anybody going to test this, or are there really no transmission problems left? :)

But please note that current wireless-testing tree seems to have some unrelated TX issues in mac80211 (see the discussions about the qdisc and skb->cb stuff.)

In any case, I'd like to have some initial testing of this patch? :) I think it really is a good step forward, once all bugs in it are fixed.

Signature · 1 line
Greetings Michael.
#2 lore raw
Quoted 6 lines · Michael Buesch
Quoted 2 lines · On Saturday 26 July 2008 17:26:52 Michael Buesch wrote:

This is an experimental attempt for fixing the currently-not-so-good TX power adjustment.

Hm, is anybody going to test this, or are there really no transmission problems left? :)

It seems to work here. The dmesg output for my BCM4312 is:

ssb: Core 0 found: ChipCommon (cc 0x800, rev 0x11, vendor 0x4243)
ssb: Core 1 found: IEEE 802.11 (cc 0x812, rev 0x0A, vendor 0x4243)
ssb: Core 2 found: USB 1.1 Host (cc 0x817, rev 0x03, vendor 0x4243)
ssb: Core 3 found: PCI-E (cc 0x820, rev 0x01, vendor 0x4243)
ssb: SPROM revision 2 detected.
ssb: Sonics Silicon Backplane found on PCI device 0000:04:00.0
b43-phy0: Broadcom 4311 WLAN found
b43-phy0 debug: Found PHY: Analog 4, Type 2, Revision 8 b43-phy0 debug: Found Radio: Manuf 0x17F, Version 0x2050, Revision 2
phy0: Selected rate control algorithm 'pid'
Broadcom 43xx driver loaded [ Features: PLR, Firmware-ID: FW13 ]
udev: renamed network interface wlan0 to wlan1
input: b43-phy0 as /class/input/input9
firmware: requesting b43/ucode5.fw
firmware: requesting b43/pcm5.fw
firmware: requesting b43/b0g0initvals5.fw
firmware: requesting b43/b0g0bsinitvals5.fw
b43-phy0: Loading firmware version 410.2160 (2007-05-26 15:32:10) b43-phy0 debug: Chip initialized
b43-phy0 debug: 32-bit DMA initialized
Registered led device: b43-phy0::tx
Registered led device: b43-phy0::rx
Registered led device: b43-phy0::radio
b43-phy0 debug: Wireless interface started
b43-phy0 debug: Adding Interface type 2
Adjusted power
wlan1: authenticate with AP 00:1a:70:46:ba:b1
wlan1: authenticated
wlan1: associate with AP 00:1a:70:46:ba:b1
wlan1: RX AssocResp from 00:1a:70:46:ba:b1 (capab=0x431 status=0 aid=3)
wlan1: associated
Average is 39
Adjusted power
Average is 17
Average is 18
Adjusted power
Average is 4
Adjusted power
Average is 4
Average is 4
Adjusted power
Average is 8
Adjusted power
Average is 6
Average is 12
Average is 11
Average is 12
Average is 11
Average is 12
Average is 10
Average is 12
Average is 11
Average is 12
Average is 12
Average is 11
Average is 12
Average is 11
Average is 12
Average is 12
Average is 11
Average is 13
Average is 13
Adjusted power
Average is 13
Adjusted power
Average is 11
Average is 13
Adjusted power
Average is 12
Average is 13
Adjusted power
Average is 13
Adjusted power
Average is 11
Average is 13
Adjusted power
Average is 11
Average is 13
Adjusted power
Average is 13
Adjusted power
Average is 8
Average is 9
Average is 13
Average is 12
Average is 13
Adjusted power
Average is 13
Adjusted power
Average is 12
Average is 13
Adjusted power
Average is 12
Average is 13
Adjusted power
Average is 12
Average is 13
Adjusted power
Average is 7
Average is 9
Average is 12
Average is 10
Average is 7
Average is 7
Adjusted power
Average is 9
Average is 13
Average is 13
Average is 13
Adjusted power
Average is 13
Adjusted power
Average is 8
Average is 8
Average is 13
Average is 12

Is this sufficient, or is there other output that you want to see?

Quoted 3 lines

But please note that current wireless-testing tree seems to have some unrelated TX issues in mac80211 (see the discussions about the qdisc and skb->cb stuff.)

AFAIK, this particular bug is limited to mainline. At least wireless still works in wireless-testing, but fails completely in Linus's tree.

Larry

#3 lore raw
Quoted 9 lines · On Tuesday 29 July 2008 00:51:42 Larry Finger wrote:
Quoted 6 lines · Michael Buesch
Quoted 2 lines · On Saturday 26 July 2008 17:26:52 Michael Buesch wrote:

This is an experimental attempt for fixing the currently-not-so-good TX power adjustment.

Hm, is anybody going to test this, or are there really no transmission problems left? :)

It seems to work here. The dmesg output for my BCM4312 is:

Thanks.

Quoted 1 line

Is this sufficient,

No.

Quoted 1 line

or is there other output that you want to see?

Please do

        echo 1 >/debug/b43/phy*/debug_xmitpower

to enable verbose xmitpower debugging.

Quoted 6 lines
Quoted 3 lines

But please note that current wireless-testing tree seems to have some unrelated TX issues in mac80211 (see the discussions about the qdisc and skb->cb stuff.)

AFAIK, this particular bug is limited to mainline. At least wireless still works in wireless-testing, but fails completely in Linus's tree.

Yeah, I noticed. So please ignore this.

Signature · 1 line
Greetings Michael.