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.
Add a new function to allow the HW to indicate this situation.
Juuso Oikarinen (1):
mac80211: Add ieee80211_probereq_failed function
include/net/mac80211.h | 12 ++++++++++++
net/mac80211/mlme.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 0 deletions(-)
On Tue, 2010-03-09 at 13:52 +0200, Juuso Oikarinen wrote:
> Some hardware (i.e. the wl1271) are able to monitor beacons, and send
> probe-requests to AP in case of beacon loss independently to try to recover
> the connection. In these cases, it is useless for the mac80211 to send
> further probe-requests.
>
> Add a new function for the hardware to indicate that the AP has been lost.
> This function immediately tears down the connection.
>
> Signed-off-by: Juuso Oikarinen <[email protected]>
> ---
> include/net/mac80211.h | 12 ++++++++++++
> net/mac80211/mlme.c | 32 ++++++++++++++++++++++++++++++++
> 2 files changed, 44 insertions(+), 0 deletions(-)
>
> diff --git a/include/net/mac80211.h b/include/net/mac80211.h
> index 45d7d44..d9792e4 100644
> --- a/include/net/mac80211.h
> +++ b/include/net/mac80211.h
> @@ -2370,6 +2370,18 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw,
> */
> void ieee80211_beacon_loss(struct ieee80211_vif *vif);
>
> +/**
> + * ieee80211_probereq_failed - inform hardware has lost connection with the AP
> + *
> + * @vif: &struct ieee80211_vif pointer from the add_interface callback.
> + *
> + * When beacon filtering is enabled with IEEE80211_HW_BEACON_FILTERING and
> + * IEEE80211_CONF_PS is set, the driver needs to inform with this function
> + * whenever the hardware is not receiving beacons and the AP is not responding
> + * to probe requests with this function.
> + */
> +void ieee80211_probereq_failed(struct ieee80211_vif *vif);
> +
> /* Rate control API */
>
> /**
> diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> index 0ab284c..8f591a4 100644
> --- a/net/mac80211/mlme.c
> +++ b/net/mac80211/mlme.c
> @@ -945,6 +945,38 @@ void ieee80211_beacon_loss(struct ieee80211_vif *vif)
> }
> EXPORT_SYMBOL(ieee80211_beacon_loss);
>
> +void ieee80211_probereq_failed(struct ieee80211_vif *vif)
> +{
> + struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
> + struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
> + struct ieee80211_local *local = sdata->local;
> + u8 bssid[ETH_ALEN];
> +
> + mutex_lock(&ifmgd->mtx);
> + if (!ifmgd->associated) {
> + mutex_unlock(&ifmgd->mtx);
> + return;
> + }
> +
> + memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN);
I think the actual work should be deferred to a workqueue struct item so
that you don't get into locking trouble with drivers here.
johannes
On Fri, 2010-03-12 at 12:10 +0100, ext Johannes Berg wrote:
> On Tue, 2010-03-09 at 13:52 +0200, Juuso Oikarinen wrote:
> > Some hardware (i.e. the wl1271) are able to monitor beacons, and send
> > probe-requests to AP in case of beacon loss independently to try to recover
> > the connection. In these cases, it is useless for the mac80211 to send
> > further probe-requests.
> >
> > Add a new function for the hardware to indicate that the AP has been lost.
> > This function immediately tears down the connection.
> >
> > Signed-off-by: Juuso Oikarinen <[email protected]>
> > ---
> > include/net/mac80211.h | 12 ++++++++++++
> > net/mac80211/mlme.c | 32 ++++++++++++++++++++++++++++++++
> > 2 files changed, 44 insertions(+), 0 deletions(-)
> >
> > diff --git a/include/net/mac80211.h b/include/net/mac80211.h
> > index 45d7d44..d9792e4 100644
> > --- a/include/net/mac80211.h
> > +++ b/include/net/mac80211.h
> > @@ -2370,6 +2370,18 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw,
> > */
> > void ieee80211_beacon_loss(struct ieee80211_vif *vif);
> >
> > +/**
> > + * ieee80211_probereq_failed - inform hardware has lost connection with the AP
> > + *
> > + * @vif: &struct ieee80211_vif pointer from the add_interface callback.
> > + *
> > + * When beacon filtering is enabled with IEEE80211_HW_BEACON_FILTERING and
> > + * IEEE80211_CONF_PS is set, the driver needs to inform with this function
> > + * whenever the hardware is not receiving beacons and the AP is not responding
> > + * to probe requests with this function.
> > + */
> > +void ieee80211_probereq_failed(struct ieee80211_vif *vif);
> > +
> > /* Rate control API */
> >
> > /**
> > diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> > index 0ab284c..8f591a4 100644
> > --- a/net/mac80211/mlme.c
> > +++ b/net/mac80211/mlme.c
> > @@ -945,6 +945,38 @@ void ieee80211_beacon_loss(struct ieee80211_vif *vif)
> > }
> > EXPORT_SYMBOL(ieee80211_beacon_loss);
> >
> > +void ieee80211_probereq_failed(struct ieee80211_vif *vif)
> > +{
> > + struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
> > + struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
> > + struct ieee80211_local *local = sdata->local;
> > + u8 bssid[ETH_ALEN];
> > +
> > + mutex_lock(&ifmgd->mtx);
> > + if (!ifmgd->associated) {
> > + mutex_unlock(&ifmgd->mtx);
> > + return;
> > + }
> > +
> > + memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN);
>
> I think the actual work should be deferred to a workqueue struct item so
> that you don't get into locking trouble with drivers here.
You're right. I will send a v2 of this patch next week with that
change.
Then, I will also bundle Kalle Valo's "mac80211: add support connection
monitor in hardware" patch to this set to propose a fully hardware based
connection maintenance (periodic probe-req's (or keep-alives) and
automatic probe-requests on beacon loss.)
-Juuso
> johannes
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Some hardware (i.e. the wl1271) are able to monitor beacons, and send
probe-requests to AP in case of beacon loss independently to try to recover
the connection. In these cases, it is useless for the mac80211 to send
further probe-requests.
Add a new function for the hardware to indicate that the AP has been lost.
This function immediately tears down the connection.
Signed-off-by: Juuso Oikarinen <[email protected]>
---
include/net/mac80211.h | 12 ++++++++++++
net/mac80211/mlme.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 45d7d44..d9792e4 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2370,6 +2370,18 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw,
*/
void ieee80211_beacon_loss(struct ieee80211_vif *vif);
+/**
+ * ieee80211_probereq_failed - inform hardware has lost connection with the AP
+ *
+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
+ *
+ * When beacon filtering is enabled with IEEE80211_HW_BEACON_FILTERING and
+ * IEEE80211_CONF_PS is set, the driver needs to inform with this function
+ * whenever the hardware is not receiving beacons and the AP is not responding
+ * to probe requests with this function.
+ */
+void ieee80211_probereq_failed(struct ieee80211_vif *vif);
+
/* Rate control API */
/**
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 0ab284c..8f591a4 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -945,6 +945,38 @@ void ieee80211_beacon_loss(struct ieee80211_vif *vif)
}
EXPORT_SYMBOL(ieee80211_beacon_loss);
+void ieee80211_probereq_failed(struct ieee80211_vif *vif)
+{
+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
+ struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
+ struct ieee80211_local *local = sdata->local;
+ u8 bssid[ETH_ALEN];
+
+ mutex_lock(&ifmgd->mtx);
+ if (!ifmgd->associated) {
+ mutex_unlock(&ifmgd->mtx);
+ return;
+ }
+
+ 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);
+}
+EXPORT_SYMBOL(ieee80211_probereq_failed);
+
static enum rx_mgmt_action __must_check
ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata,
struct ieee80211_mgmt *mgmt, size_t len)
--
1.6.3.3