Skip to contentSkip to conversation

wl1251 IBSS fixes

PATCH In review Grazvydas Ignotas 2 participants 11 messages Apr 22, 2014 – May 31, 2014 TI wilink wireless drivers

lore
Share & tools
lore
#0 lore raw

cover wl1251 IBSS fixes

IBSS mode is currently advertised by wl1251 driver but is totally broken. First there is a disconnect hack for monitor mode that was recently merged, it abuses mac80211 and causes corruption in IBSS mode, so I think should be reverted. Then there are several cases of station-only mac80211 functions called carelessly, what is also fixed.

Grazvydas Ignotas (4):
Revert "wl1251: enforce changed hw encryption support on monitor state change"
wl1251: fix null data for IBSS
wl1251: fix mixed up args for join
wl1251: only call ieee80211_beacon_loss in managed mode

 drivers/net/wireless/ti/wl1251/event.c |    5 ++-
 drivers/net/wireless/ti/wl1251/main.c  |   68 ++++++++++++++++++--------------
 2 files changed, 42 insertions(+), 31 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/4 Revert "wl1251: enforce changed hw encryption support on monitor state change"

This reverts commit b90a1165a72fabdc260abaa9eeadcbfd29e267eb.

That commit (or rather, hack) triggers a scary WARN in IBSS (ad-hoc) mode. Steps to reproduce:
ifconfig wlan0 down
iwconfig wlan0 mode ad-hoc
ifconfig wlan0 up

------------[ cut here ]------------
WARNING: CPU: 0 PID: 905 at kernel/workqueue.c:1400 __queue_work+0x21c/0x2f4()
Modules linked in: wl1251_sdio wl1251 mac80211 cfg80211
CPU: 0 PID: 905 Comm: ifconfig Not tainted 3.15.0-rc2#233

[<c0015f38>] (unwind_backtrace) from [<c0012938>] [<c0012938>] (show_stack) from [<c05d4034>]
[<c05d4034>] (dump_stack) from [<c0043984>]
[<c0043984>] (warn_slowpath_common) from [<c00439c0>] [<c00439c0>] (warn_slowpath_null) from [<c005b6c8>] [<c005b6c8>] (__queue_work) from [<c005b820>]
[<c005b820>] (queue_work_on) from [<bf134ac0>]
[<bf134ac0>] (wl1251_op_config [wl1251])
[<bf099a70>] (ieee80211_hw_config [mac80211])
...
This happens because ieee80211_connection_loss() is not expected to be called in IBSS mode (mac80211 ends up queuing uninitialized work in that case).

---
 drivers/net/wireless/ti/wl1251/main.c |   13 -------------
 1 file changed, 13 deletions(-)
drivers/net/wireless/ti/wl1251/main.c +0 -13
index 757e257..c22e225 100644
@@ -687,16 +687,6 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed)
 		wl->power_level = conf->power_level;
 	}
 
-	/*
-	 * Tell stack that connection is lost because hw encryption isn't
-	 * supported in monitor mode.
-	 * This requires temporary enabling of the hw connection monitor flag
-	 */
-	if ((changed & IEEE80211_CONF_CHANGE_MONITOR) && wl->vif) {
-		wl->hw->flags |= IEEE80211_HW_CONNECTION_MONITOR;
-		ieee80211_connection_loss(wl->vif);
-	}
-
 out_sleep:
 	wl1251_ps_elp_sleep(wl);
 
@@ -1129,9 +1119,6 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw,
 	}
 
 	if (changed & BSS_CHANGED_ASSOC) {
-		/* Disable temporary enabled hw connection monitor flag */
-		wl->hw->flags &= ~IEEE80211_HW_CONNECTION_MONITOR;
-
 		if (bss_conf->assoc) {
 			wl->beacon_int = bss_conf->beacon_int;
 
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/4 wl1251: fix null data for IBSS

In reply to Grazvydas Ignotas

Fix the WARN below by not calling ieee80211_nullfunc_get() in IBSS mode, but setting up empty template the same way wl12xx driver does.

WARNING: CPU: 0 PID: 914 at net/mac80211/tx.c:2750 ieee80211_nullfunc_get+0xc0/0xd0 [mac80211]()
Modules linked in: wl1251_sdio wl1251 mac80211 cfg80211

...
[<c00439c0>] (warn_slowpath_null)
[<bf0bdfdc>] (ieee80211_nullfunc_get [mac80211]) [<bf134774>] (wl1251_op_bss_info_changed [wl1251]) [<bf099e14>] (ieee80211_bss_info_change_notify [mac80211])
...

Also perform join command regardless of bss_type as that seems to be required for proper operation.

---
 drivers/net/wireless/ti/wl1251/main.c |   51 ++++++++++++++++++++++++---------
 1 file changed, 37 insertions(+), 14 deletions(-)
drivers/net/wireless/ti/wl1251/main.c +37 -14
index c22e225..f557eb5 100644
@@ -550,6 +550,34 @@ static void wl1251_op_remove_interface(struct ieee80211_hw *hw,
 	mutex_unlock(&wl->mutex);
 }
 
+static int wl1251_build_null_data(struct wl1251 *wl)
+{
+	struct sk_buff *skb = NULL;
+	int size;
+	void *ptr;
+	int ret = -ENOMEM;
+
+	if (wl->bss_type == BSS_TYPE_IBSS) {
+		size = sizeof(struct wl12xx_null_data_template);
+		ptr = NULL;
+	} else {
+		skb = ieee80211_nullfunc_get(wl->hw, wl->vif);
+		if (!skb)
+			goto out;
+		size = skb->len;
+		ptr = skb->data;
+	}
+
+	ret = wl1251_cmd_template_set(wl, CMD_NULL_DATA, ptr, size);
+
+out:
+	dev_kfree_skb(skb);
+	if (ret)
+		wl1251_warning("cmd buld null data failed: %d", ret);
+
+	return ret;
+}
+
 static int wl1251_build_qos_null_data(struct wl1251 *wl)
 {
 	struct ieee80211_qos_hdr template;
@@ -1093,24 +1121,19 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw,
 		wl->rssi_thold = bss_conf->cqm_rssi_thold;
 	}
 
-	if (changed & BSS_CHANGED_BSSID) {
+	if ((changed & BSS_CHANGED_BSSID) &&
+	    memcmp(wl->bssid, bss_conf->bssid, ETH_ALEN)) {
 		memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN);
 
-		skb = ieee80211_nullfunc_get(wl->hw, wl->vif);
-		if (!skb)
-			goto out_sleep;
-
-		ret = wl1251_cmd_template_set(wl, CMD_NULL_DATA,
-					      skb->data, skb->len);
-		dev_kfree_skb(skb);
-		if (ret < 0)
-			goto out_sleep;
+		if (!is_zero_ether_addr(wl->bssid)) {
+			ret = wl1251_build_null_data(wl);
+			if (ret < 0)
+				goto out_sleep;
 
-		ret = wl1251_build_qos_null_data(wl);
-		if (ret < 0)
-			goto out;
+			ret = wl1251_build_qos_null_data(wl);
+			if (ret < 0)
+				goto out_sleep;
 
-		if (wl->bss_type != BSS_TYPE_IBSS) {
 			ret = wl1251_join(wl, wl->bss_type, wl->channel,
 					  wl->beacon_int, wl->dtim_period);
 			if (ret < 0)
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/4 wl1251: fix mixed up args for join

In reply to Grazvydas Ignotas

The join arguments are mixed up, passing beacon_interval instead of channel and channel instead of beacon_interval. Fix them.

---
 drivers/net/wireless/ti/wl1251/main.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ti/wl1251/main.c +2 -2
index f557eb5..4e782f1 100644
@@ -1226,8 +1226,8 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw,
 		if (ret < 0)
 			goto out_sleep;
 
-		ret = wl1251_join(wl, wl->bss_type, wl->beacon_int,
-				  wl->channel, wl->dtim_period);
+		ret = wl1251_join(wl, wl->bss_type, wl->channel,
+				  wl->beacon_int, wl->dtim_period);
 
 		if (ret < 0)
 			goto out_sleep;
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 4/4 wl1251: only call ieee80211_beacon_loss in managed mode

In reply to Grazvydas Ignotas

ieee80211_beacon_loss() is only to be called in managed mode, but the firmware may send the sync timeout event at any time, so do a check before calling.

---
 drivers/net/wireless/ti/wl1251/event.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/ti/wl1251/event.c +3 -2
index db01053..c986303 100644
@@ -124,11 +124,12 @@ static int wl1251_event_process(struct wl1251 *wl, struct event_mailbox *mbox)
 			return ret;
 	}
 
-	if (wl->vif && vector & SYNCHRONIZATION_TIMEOUT_EVENT_ID) {
+	if (vector & SYNCHRONIZATION_TIMEOUT_EVENT_ID) {
 		wl1251_debug(DEBUG_EVENT, "SYNCHRONIZATION_TIMEOUT_EVENT");
 
 		/* indicate to the stack, that beacons have been lost */
-		ieee80211_beacon_loss(wl->vif);
+		if (wl->vif && wl->vif->type == NL80211_IFTYPE_STATION)
+			ieee80211_beacon_loss(wl->vif);
 	}
 
 	if (vector & REGAINED_BSS_EVENT_ID) {
Signature · 1 line
1.7.9.5
#5 lore raw
In reply to Grazvydas Ignotas
Quoted 5 lines · Grazvydas Ignotas

IBSS mode is currently advertised by wl1251 driver but is totally broken. First there is a disconnect hack for monitor mode that was recently merged, it abuses mac80211 and causes corruption in IBSS mode, so I think should be reverted. Then there are several cases of station-only mac80211 functions called carelessly, what is also fixed.

Ping.
This driver is orphan and hardware carrying it is outdated, so acks / tested-bys are unlikely..

Signature · 1 line
Gražvydas
#6 lore raw
Quoted 1 line · On Friday 09 May 2014 02:21:21 Grazvydas Ignotas wrote:

On Tue, Apr 22, 2014 at 3:09 AM, Grazvydas Ignotas

Quoted 10 lines · <[email protected]> wrote:
Quoted 6 lines

IBSS mode is currently advertised by wl1251 driver but is totally broken. First there is a disconnect hack for monitor mode that was recently merged, it abuses mac80211 and causes corruption in IBSS mode, so I think should be reverted. Then there are several cases of station-only mac80211 functions called carelessly, what is also fixed.

Ping.
This driver is orphan and hardware carrying it is outdated, so acks / tested-bys are unlikely..

Now I'm testing these patches on wireless-testing git tree from year 2010 compiled against patched maemo 2.6.28 kernel.

Reason for using these historical wireless-testing version is that this version can be compiled against kernel which working with default Maemo system in Nokia N900.

It looks like your patches fixed some kernel oops when iwconfig changing mode to ad-hoc.

Signature · 2 lines
Pali Rohár
[email protected]
#7 lore raw
Quoted 18 lines · On Friday 09 May 2014 22:03:00 Pali Rohár wrote:
Quoted 1 line · On Friday 09 May 2014 02:21:21 Grazvydas Ignotas wrote:

On Tue, Apr 22, 2014 at 3:09 AM, Grazvydas Ignotas

Quoted 10 lines · <[email protected]> wrote:
Quoted 6 lines

IBSS mode is currently advertised by wl1251 driver but is totally broken. First there is a disconnect hack for monitor mode that was recently merged, it abuses mac80211 and causes corruption in IBSS mode, so I think should be reverted. Then there are several cases of station-only mac80211 functions called carelessly, what is also fixed.

Ping.
This driver is orphan and hardware carrying it is outdated, so acks / tested-bys are unlikely..

Now I'm testing these patches on wireless-testing git tree from year 2010 compiled against patched maemo 2.6.28 kernel.

Quoted 6 lines

Reason for using these historical wireless-testing version is that this version can be compiled against kernel which working with default Maemo system in Nokia N900.

It looks like your patches fixed some kernel oops when iwconfig changing mode to ad-hoc.

Looks like everything working fine except power save mode. In dmesg I see only these message:

wl1251: ERROR Power save entry failed, giving up

If you are OK with fact that I tested your patches with older kernel (not last upstream), you can add my Tested-by.

Signature · 2 lines
Pali Rohár
[email protected]
#8 lore raw
Quoted 27 lines · On Saturday 10 May 2014 14:28:45 Pali Rohár wrote:
Quoted 19 lines · On Friday 09 May 2014 22:03:00 Pali Rohár wrote:
Quoted 1 line · On Friday 09 May 2014 02:21:21 Grazvydas Ignotas wrote:

On Tue, Apr 22, 2014 at 3:09 AM, Grazvydas Ignotas

Quoted 11 lines · <[email protected]> wrote:
Quoted 7 lines

IBSS mode is currently advertised by wl1251 driver but is totally broken. First there is a disconnect hack for monitor mode that was recently merged, it abuses mac80211 and causes corruption in IBSS mode, so I think should be reverted. Then there are several cases of station-only mac80211 functions called carelessly, what is also fixed.

Ping.
This driver is orphan and hardware carrying it is
outdated, so acks / tested-bys are unlikely..

Now I'm testing these patches on wireless-testing git tree from year 2010 compiled against patched maemo 2.6.28 kernel.

Quoted 6 lines

Reason for using these historical wireless-testing version is that this version can be compiled against kernel which working with default Maemo system in Nokia N900.

It looks like your patches fixed some kernel oops when iwconfig changing mode to ad-hoc.

Quoted 7 lines

Looks like everything working fine except power save mode. In dmesg I see only these message:

wl1251: ERROR Power save entry failed, giving up

If you are OK with fact that I tested your patches with older kernel (not last upstream), you can add my Tested-by.

Grazvydas: PING

Signature · 2 lines
Pali Rohár
[email protected]
#9 lore raw
Quoted 31 lines · Pali Rohár
Quoted 30 lines · On Saturday 10 May 2014 14:28:45 Pali Rohár wrote:
Quoted 19 lines · On Friday 09 May 2014 22:03:00 Pali Rohár wrote:
Quoted 1 line · On Friday 09 May 2014 02:21:21 Grazvydas Ignotas wrote:

On Tue, Apr 22, 2014 at 3:09 AM, Grazvydas Ignotas

Quoted 11 lines · <[email protected]> wrote:
Quoted 7 lines

IBSS mode is currently advertised by wl1251 driver but is totally broken. First there is a disconnect hack for monitor mode that was recently merged, it abuses mac80211 and causes corruption in IBSS mode, so I think should be reverted. Then there are several cases of station-only mac80211 functions called carelessly, what is also fixed.

Ping.
This driver is orphan and hardware carrying it is
outdated, so acks / tested-bys are unlikely..

Now I'm testing these patches on wireless-testing git tree from year 2010 compiled against patched maemo 2.6.28 kernel.

Quoted 6 lines

Reason for using these historical wireless-testing version is that this version can be compiled against kernel which working with default Maemo system in Nokia N900.

It looks like your patches fixed some kernel oops when iwconfig changing mode to ad-hoc.

Looks like everything working fine except power save mode. In dmesg I see only these message:

Quoted 6 lines
Quoted 4 lines

wl1251: ERROR Power save entry failed, giving up

If you are OK with fact that I tested your patches with older kernel (not last upstream), you can add my Tested-by.

Grazvydas: PING

Sure I'm ok, patches seem to be already queued with your Tested-bys:
https://git.kernel.org/cgit/linux/kernel/git/linville/wireless-next.git/log/?h=e5b02f649bb

Signature · 1 line
Gražvydas
#10 lore raw
Quoted 1 line · On Saturday 31 May 2014 15:15:20 Grazvydas Ignotas wrote:

On Fri, May 30, 2014 at 7:18 PM, Pali Rohár

Quoted 39 lines · <[email protected]> wrote:
Quoted 39 lines · On Saturday 10 May 2014 14:28:45 Pali Rohár wrote:
Quoted 37 lines · On Friday 09 May 2014 22:03:00 Pali Rohár wrote:
Quoted 20 lines · On Friday 09 May 2014 02:21:21 Grazvydas Ignotas wrote:
Quoted 1 line

On Tue, Apr 22, 2014 at 3:09 AM, Grazvydas Ignotas

Quoted 11 lines · <[email protected]> wrote:
Quoted 7 lines

IBSS mode is currently advertised by wl1251 driver but is totally broken. First there is a disconnect hack for monitor mode that was recently merged, it abuses mac80211 and causes corruption in IBSS mode, so I think should be reverted. Then there are several cases of station-only mac80211 functions called carelessly, what is also fixed.

Ping.
This driver is orphan and hardware carrying it is
outdated, so acks / tested-bys are unlikely..

Now I'm testing these patches on wireless-testing git tree from year 2010 compiled against patched maemo 2.6.28 kernel.

Quoted 7 lines

Reason for using these historical wireless-testing version is that this version can be compiled against kernel which working with default Maemo system in Nokia N900.

It looks like your patches fixed some kernel oops when iwconfig changing mode to ad-hoc.

Looks like everything working fine except power save mode. In dmesg I see only these message:

wl1251: ERROR Power save entry failed, giving up

If you are OK with fact that I tested your patches with older kernel (not last upstream), you can add my Tested-by.

Quoted 6 lines
Quoted 1 line

Grazvydas: PING

Sure I'm ok, patches seem to be already queued with your Tested-bys:
https://git.kernel.org/cgit/linux/kernel/git/linville/wireles
s-next.git/log/?h=e5b02f649bb

OK.

Signature · 2 lines
Pali Rohár
[email protected]