diff mbox

possibly broken tx_power change under linux 3.10.17 and potentially mainline

Message ID CAN44aq091tLNVywEqOV7A86K-XSrLD5QjcH0BbPO-oBTPnp8kw@mail.gmail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Alex Gal Dec. 25, 2013, 4:19 p.m. UTC
Hello all,

We had an issue with a custom board we developped using the TIWI-BLE chip.

We use the board to create a soft AP using hostapd but the signal
strength was weak but functional.

The beaglebone with the TIWI-BLE cape would have a very strong signal
instead, using the same hostapd version and the same TI firmware and
calibration file.

We ruled out the firmware, calibration, antenna and other hardware
bugs and started looking into the driver instead.

The driver in question is wl12xx but the problem did not appear to come from it.

In kernel 3.2, "iwconfig wlan0 txpower 10" would work but not in kernel 3.10.

I compared the driver in linux 3.2 and some of the kernel code and it
seems the handling of
SIOCSIWTXPOW has changed.

In kernel 3.10, the tx power would be set to 20 once the AP would be
created but the driver never updated it.

In kernel 3.2, IEEE80211_CONF_CHANGE_POWER was issued and handled in
the driver op_config handler.

However, the 3.10 kernel code no longer issues
IEEE80211_CONF_CHANGE_POWER  but BSS_CHANGED_TXPOWER which is not
handled by the wl12xx driver.

After looking for BSS_CHANGED_TXPOWER, most drivers, if not all of
them, do not handle BSS_CHANGED_TXPOWER so this could affect all
drivers.

I added a a bit of code to wlcore/main.c to handle BSS_CHANGED_TXPOWER
and it seems to be working now. See patch in attachment.

What do you guys think ?

Happy holidays,

Alex
diff mbox

Patch

diff --git drivers/net/wireless/ti/wlcore/main.c drivers/net/wireless/ti/wlcore/main.c
index 953111a..62d1ec1 100644
--- drivers/net/wireless/ti/wlcore/main.c
+++ drivers/net/wireless/ti/wlcore/main.c
@@ -4331,6 +4331,16 @@  static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
 	if (ret < 0)
 		goto out;
 
+	if ((changed & BSS_CHANGED_TXPOWER) && bss_conf->txpower != wlvif->power_level) {
+
+		ret = wl1271_acx_tx_power(wl, wlvif, bss_conf->txpower);
+
+		if (ret < 0)
+			goto out;
+
+		wlvif->power_level = bss_conf->txpower;
+	}
+
 	if (is_ap)
 		wl1271_bss_info_changed_ap(wl, vif, bss_conf, changed);
 	else