2010-03-15 12:12:06

by Juuso Oikarinen

[permalink] [raw]
Subject: [RFC PATCHv2 0/1] mac80211: Support for HW connection recovery

When PSM is enabled, the wl1271 performs connection recovery independently by
sending probe-requests to the associated-to AP if it detects beacon loss.

The wl1271 only indicates connection problem after the probe-requests have
failed. At this stage, it's useless for the mac80211 to send further
probe requests in attempt to recover the connection.

As the wl1271 is also capable of transmitting periodic keep-alive frames to
the AP, I realised these functionalities should be bundled.

Instead of any new functions, this v2 of this proposed feature does not add
any functions, instead it introduces the IEEE80211_HW_CONNECTION_MONITOR flag,
which prevents mac80211 from sending periodic keep-alive probe-requests to the
AP and prevents it from sending probe-requests on beacon loss.

Any suggestions or comments are welcomed.

Juuso Oikarinen (1):
mac80211: Add support connection monitor in hardware

include/net/mac80211.h | 4 ++++
net/mac80211/mlme.c | 33 ++++++++++++++++++++++++++++++++-
2 files changed, 36 insertions(+), 1 deletions(-)



2010-03-17 05:48:28

by Juuso Oikarinen

[permalink] [raw]
Subject: Re: [RFC PATCHv2 1/1] mac80211: Add support connection monitor in hardware

On Tue, 2010-03-16 at 22:45 +0100, ext Johannes Berg wrote:
> On Mon, 2010-03-15 at 12:57 +0200, Juuso Oikarinen wrote:
> > This patch is based on a RFC patch by Kalle Valo.
> >
> > The wl1271 has a feature which handles the connection monitor logic
> > in hardware, basically sending periodically nullfunc frames and reporting
> > to the host if AP is lost, after attempting to recover by sending
> > probe-requests to the AP.
> >
> > Add support to mac80211 by adding a new flag IEEE80211_HW_CONNECTION_MONITOR
> > which prevents conn_mon_timer from triggering during idle periods, and
> > prevents sending probe-requests to the AP if beacon-loss is indicated by the
> > hardware.
> >
> > Cc: Kalle Valo <[email protected]>
> > Signed-off-by: Juuso Oikarinen <[email protected]>
> > ---
> > include/net/mac80211.h | 4 ++++
> > net/mac80211/mlme.c | 33 ++++++++++++++++++++++++++++++++-
> > 2 files changed, 36 insertions(+), 1 deletions(-)
> >
> > diff --git a/include/net/mac80211.h b/include/net/mac80211.h
> > index 936bc41..cd7b471 100644
> > --- a/include/net/mac80211.h
> > +++ b/include/net/mac80211.h
> > @@ -954,6 +954,9 @@ enum ieee80211_tkip_key_type {
> > * Hardware can provide ack status reports of Tx frames to
> > * the stack.
> > *
> > + * @IEEE80211_HW_CONNECTION_MONITOR:
> > + * The hardware performs its own connection monitoring, including
> > + * periodic keep-alives to the AP and probing the AP on beacon loss.
>
> I think this should mention that you get disconnected right away when
> you then signal beacon loss with the mac80211 api call, which is new.
> Might also be worth updating the API docs for that function.

Yes, those are still missing. I'll add those to v3.

> > @@ -936,8 +939,36 @@ void ieee80211_beacon_loss_work(struct work_struct *work)
> > struct ieee80211_sub_if_data *sdata =
> > container_of(work, struct ieee80211_sub_if_data,
> > u.mgd.beacon_loss_work);
> > + struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
> > + struct ieee80211_local *local = sdata->local;
> > + u8 bssid[ETH_ALEN];
> > +
> > + if (!(sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR))
> > + ieee80211_mgd_probe_ap(sdata, true);
> > + else {
> > + mutex_lock(&ifmgd->mtx);
> > + if (!ifmgd->associated) {
> > + mutex_unlock(&ifmgd->mtx);
> > + return;
> > + }
> >
> > - ieee80211_mgd_probe_ap(sdata, true);
> > + memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN);
> > +
> > + printk(KERN_DEBUG "No probe-response from AP %pM, "
> > + "disconnected.\n", bssid);
> > +
> > + ieee80211_set_disassoc(sdata);
> > + ieee80211_recalc_idle(local);
> > + mutex_unlock(&ifmgd->mtx);
> > + /*
> > + * must be outside lock due to cfg80211,
> > + * but that's not a problem.
> > + */
> > + ieee80211_send_deauth_disassoc(sdata, bssid,
> > + IEEE80211_STYPE_DEAUTH,
> > + WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY,
> > + NULL);
> > + }
>
> This !() is a little awkward, how about moving this to a new function?
> and the message is also really misleading.

Technically, the message is not misleading at least for the hw I'm
working with (as it will send probe-requests to the AP similarly as the
mac80211 would in this case) but I'll try to figure out something more
generic fort this.

I'll try to address these still for v3.

-Juuso

> johannes
>



2010-03-15 12:12:06

by Juuso Oikarinen

[permalink] [raw]
Subject: [RFC PATCHv2 1/1] mac80211: Add support connection monitor in hardware

This patch is based on a RFC patch by Kalle Valo.

The wl1271 has a feature which handles the connection monitor logic
in hardware, basically sending periodically nullfunc frames and reporting
to the host if AP is lost, after attempting to recover by sending
probe-requests to the AP.

Add support to mac80211 by adding a new flag IEEE80211_HW_CONNECTION_MONITOR
which prevents conn_mon_timer from triggering during idle periods, and
prevents sending probe-requests to the AP if beacon-loss is indicated by the
hardware.

Cc: Kalle Valo <[email protected]>
Signed-off-by: Juuso Oikarinen <[email protected]>
---
include/net/mac80211.h | 4 ++++
net/mac80211/mlme.c | 33 ++++++++++++++++++++++++++++++++-
2 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 936bc41..cd7b471 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -954,6 +954,9 @@ enum ieee80211_tkip_key_type {
* Hardware can provide ack status reports of Tx frames to
* the stack.
*
+ * @IEEE80211_HW_CONNECTION_MONITOR:
+ * The hardware performs its own connection monitoring, including
+ * periodic keep-alives to the AP and probing the AP on beacon loss.
*/
enum ieee80211_hw_flags {
IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -975,6 +978,7 @@ enum ieee80211_hw_flags {
IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16,
IEEE80211_HW_SUPPORTS_UAPSD = 1<<17,
IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18,
+ IEEE80211_HW_CONNECTION_MONITOR = 1<<19,
};

/**
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index be5f723..aa40e43 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -854,6 +854,9 @@ void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata,
if (is_multicast_ether_addr(hdr->addr1))
return;

+ if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR)
+ return;
+
mod_timer(&sdata->u.mgd.conn_mon_timer,
round_jiffies_up(jiffies + IEEE80211_CONNECTION_IDLE_TIME));
}
@@ -936,8 +939,36 @@ void ieee80211_beacon_loss_work(struct work_struct *work)
struct ieee80211_sub_if_data *sdata =
container_of(work, struct ieee80211_sub_if_data,
u.mgd.beacon_loss_work);
+ struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
+ struct ieee80211_local *local = sdata->local;
+ u8 bssid[ETH_ALEN];
+
+ if (!(sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR))
+ ieee80211_mgd_probe_ap(sdata, true);
+ else {
+ mutex_lock(&ifmgd->mtx);
+ if (!ifmgd->associated) {
+ mutex_unlock(&ifmgd->mtx);
+ return;
+ }

- ieee80211_mgd_probe_ap(sdata, true);
+ memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN);
+
+ printk(KERN_DEBUG "No probe-response from AP %pM, "
+ "disconnected.\n", bssid);
+
+ ieee80211_set_disassoc(sdata);
+ ieee80211_recalc_idle(local);
+ mutex_unlock(&ifmgd->mtx);
+ /*
+ * must be outside lock due to cfg80211,
+ * but that's not a problem.
+ */
+ ieee80211_send_deauth_disassoc(sdata, bssid,
+ IEEE80211_STYPE_DEAUTH,
+ WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY,
+ NULL);
+ }
}

void ieee80211_beacon_loss(struct ieee80211_vif *vif)
--
1.6.3.3


2010-03-17 00:53:51

by Johannes Berg

[permalink] [raw]
Subject: Re: [RFC PATCHv2 1/1] mac80211: Add support connection monitor in hardware

On Mon, 2010-03-15 at 12:57 +0200, Juuso Oikarinen wrote:
> This patch is based on a RFC patch by Kalle Valo.
>
> The wl1271 has a feature which handles the connection monitor logic
> in hardware, basically sending periodically nullfunc frames and reporting
> to the host if AP is lost, after attempting to recover by sending
> probe-requests to the AP.
>
> Add support to mac80211 by adding a new flag IEEE80211_HW_CONNECTION_MONITOR
> which prevents conn_mon_timer from triggering during idle periods, and
> prevents sending probe-requests to the AP if beacon-loss is indicated by the
> hardware.
>
> Cc: Kalle Valo <[email protected]>
> Signed-off-by: Juuso Oikarinen <[email protected]>
> ---
> include/net/mac80211.h | 4 ++++
> net/mac80211/mlme.c | 33 ++++++++++++++++++++++++++++++++-
> 2 files changed, 36 insertions(+), 1 deletions(-)
>
> diff --git a/include/net/mac80211.h b/include/net/mac80211.h
> index 936bc41..cd7b471 100644
> --- a/include/net/mac80211.h
> +++ b/include/net/mac80211.h
> @@ -954,6 +954,9 @@ enum ieee80211_tkip_key_type {
> * Hardware can provide ack status reports of Tx frames to
> * the stack.
> *
> + * @IEEE80211_HW_CONNECTION_MONITOR:
> + * The hardware performs its own connection monitoring, including
> + * periodic keep-alives to the AP and probing the AP on beacon loss.

I think this should mention that you get disconnected right away when
you then signal beacon loss with the mac80211 api call, which is new.
Might also be worth updating the API docs for that function.

> @@ -936,8 +939,36 @@ void ieee80211_beacon_loss_work(struct work_struct *work)
> struct ieee80211_sub_if_data *sdata =
> container_of(work, struct ieee80211_sub_if_data,
> u.mgd.beacon_loss_work);
> + struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
> + struct ieee80211_local *local = sdata->local;
> + u8 bssid[ETH_ALEN];
> +
> + if (!(sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR))
> + ieee80211_mgd_probe_ap(sdata, true);
> + else {
> + mutex_lock(&ifmgd->mtx);
> + if (!ifmgd->associated) {
> + mutex_unlock(&ifmgd->mtx);
> + return;
> + }
>
> - ieee80211_mgd_probe_ap(sdata, true);
> + memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN);
> +
> + printk(KERN_DEBUG "No probe-response from AP %pM, "
> + "disconnected.\n", bssid);
> +
> + ieee80211_set_disassoc(sdata);
> + ieee80211_recalc_idle(local);
> + mutex_unlock(&ifmgd->mtx);
> + /*
> + * must be outside lock due to cfg80211,
> + * but that's not a problem.
> + */
> + ieee80211_send_deauth_disassoc(sdata, bssid,
> + IEEE80211_STYPE_DEAUTH,
> + WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY,
> + NULL);
> + }

This !() is a little awkward, how about moving this to a new function?
and the message is also really misleading.

johannes