2014-04-22 00:10:24

by Grazvydas Ignotas

[permalink] [raw]
Subject: [PATCH 0/4] 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(-)

--
1.7.9.5



2014-04-22 00:10:28

by Grazvydas Ignotas

[permalink] [raw]
Subject: [PATCH 3/4] wl1251: fix mixed up args for join

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

Signed-off-by: Grazvydas Ignotas <[email protected]>
---
drivers/net/wireless/ti/wl1251/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ti/wl1251/main.c b/drivers/net/wireless/ti/wl1251/main.c
index f557eb5..4e782f1 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -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;
--
1.7.9.5


2014-04-22 00:10:27

by Grazvydas Ignotas

[permalink] [raw]
Subject: [PATCH 2/4] wl1251: fix null data for IBSS

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.

Signed-off-by: Grazvydas Ignotas <[email protected]>
---
drivers/net/wireless/ti/wl1251/main.c | 51 ++++++++++++++++++++++++---------
1 file changed, 37 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/ti/wl1251/main.c b/drivers/net/wireless/ti/wl1251/main.c
index c22e225..f557eb5 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -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)
--
1.7.9.5


2014-04-22 00:10:30

by Grazvydas Ignotas

[permalink] [raw]
Subject: [PATCH 4/4] wl1251: only call ieee80211_beacon_loss in managed mode

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.

Signed-off-by: Grazvydas Ignotas <[email protected]>
---
drivers/net/wireless/ti/wl1251/event.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ti/wl1251/event.c b/drivers/net/wireless/ti/wl1251/event.c
index db01053..c986303 100644
--- a/drivers/net/wireless/ti/wl1251/event.c
+++ b/drivers/net/wireless/ti/wl1251/event.c
@@ -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) {
--
1.7.9.5


2014-04-22 00:10:26

by Grazvydas Ignotas

[permalink] [raw]
Subject: [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).

Signed-off-by: Grazvydas Ignotas <[email protected]>
---
drivers/net/wireless/ti/wl1251/main.c | 13 -------------
1 file changed, 13 deletions(-)

diff --git a/drivers/net/wireless/ti/wl1251/main.c b/drivers/net/wireless/ti/wl1251/main.c
index 757e257..c22e225 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -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;

--
1.7.9.5


2014-05-09 20:03:06

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH 0/4] wl1251 IBSS fixes

On Friday 09 May 2014 02:21:21 Grazvydas Ignotas wrote:
> On Tue, Apr 22, 2014 at 3:09 AM, Grazvydas Ignotas
<[email protected]> wrote:
> > 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.

--
Pali Rohár
[email protected]


Attachments:
signature.asc (198.00 B)
This is a digitally signed message part.

2014-05-30 16:18:19

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH 0/4] wl1251 IBSS fixes

On Saturday 10 May 2014 14:28:45 Pali Rohár wrote:
> On Friday 09 May 2014 22:03:00 Pali Rohár wrote:
> > On Friday 09 May 2014 02:21:21 Grazvydas Ignotas wrote:
> > > On Tue, Apr 22, 2014 at 3:09 AM, Grazvydas Ignotas
> >
> > <[email protected]> wrote:
> > > > 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.
>
> 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

--
Pali Rohár
[email protected]


Attachments:
signature.asc (198.00 B)
This is a digitally signed message part.

2014-05-31 13:15:21

by Grazvydas Ignotas

[permalink] [raw]
Subject: Re: [PATCH 0/4] wl1251 IBSS fixes

On Fri, May 30, 2014 at 7:18 PM, Pali Rohár <[email protected]> wrote:
> On Saturday 10 May 2014 14:28:45 Pali Rohár wrote:
>> On Friday 09 May 2014 22:03:00 Pali Rohár wrote:
>> > On Friday 09 May 2014 02:21:21 Grazvydas Ignotas wrote:
>> > > On Tue, Apr 22, 2014 at 3:09 AM, Grazvydas Ignotas
>> >
>> > <[email protected]> wrote:
>> > > > 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.
>>
>> 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

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

--
Gražvydas

2014-05-10 12:28:48

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH 0/4] wl1251 IBSS fixes

On Friday 09 May 2014 22:03:00 Pali Rohár wrote:
> On Friday 09 May 2014 02:21:21 Grazvydas Ignotas wrote:
> > On Tue, Apr 22, 2014 at 3:09 AM, Grazvydas Ignotas
>
> <[email protected]> wrote:
> > > 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.

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.

--
Pali Rohár
[email protected]


Attachments:
signature.asc (198.00 B)
This is a digitally signed message part.

2014-05-09 00:21:22

by Grazvydas Ignotas

[permalink] [raw]
Subject: Re: [PATCH 0/4] wl1251 IBSS fixes

On Tue, Apr 22, 2014 at 3:09 AM, Grazvydas Ignotas <[email protected]> wrote:
> 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..


--
Gražvydas

2014-05-31 13:20:04

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH 0/4] wl1251 IBSS fixes

On Saturday 31 May 2014 15:15:20 Grazvydas Ignotas wrote:
> On Fri, May 30, 2014 at 7:18 PM, Pali Rohár
<[email protected]> wrote:
> > On Saturday 10 May 2014 14:28:45 Pali Rohár wrote:
> >> On Friday 09 May 2014 22:03:00 Pali Rohár wrote:
> >> > On Friday 09 May 2014 02:21:21 Grazvydas Ignotas wrote:
> >> > > On Tue, Apr 22, 2014 at 3:09 AM, Grazvydas Ignotas
> >> >
> >> > <[email protected]> wrote:
> >> > > > 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.
> >>
> >> 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
>
> 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.

--
Pali Rohár
[email protected]


Attachments:
signature.asc (198.00 B)
This is a digitally signed message part.