From: Luca Coelho <luca@coelho.fi>
To: linux-wireless@vger.kernel.org, johannes@sipsolutions.net
Cc: michal.kazior@tieto.com
Subject: [PATCH 3/4] mac80211: send channel switch failed notifications
Date: Fri, 2 May 2014 16:40:30 +0300 [thread overview]
Message-ID: <1399038031-23206-3-git-send-email-luca@coelho.fi> (raw)
In-Reply-To: <1399038031-23206-1-git-send-email-luca@coelho.fi>
From: Luciano Coelho <luciano.coelho@intel.com>
Send a channel switch failed notification to userspace when an ongoing
channel swith fails.
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
---
net/mac80211/cfg.c | 30 +++++++++++++++++++++++-------
net/mac80211/iface.c | 6 +++++-
net/mac80211/mlme.c | 9 ++++++++-
3 files changed, 36 insertions(+), 9 deletions(-)
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 53a2cfe..f8958e0 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1101,9 +1101,13 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
old_probe_resp = sdata_dereference(sdata->u.ap.probe_resp, sdata);
/* abort any running channel switch */
- sdata->vif.csa_active = false;
- kfree(sdata->u.ap.next_beacon);
- sdata->u.ap.next_beacon = NULL;
+ if (sdata->vif.csa_active) {
+ cfg80211_ch_switch_failed_notify(sdata->dev,
+ &sdata->csa_chandef);
+ sdata->vif.csa_active = false;
+ kfree(sdata->u.ap.next_beacon);
+ sdata->u.ap.next_beacon = NULL;
+ }
/* turn off carrier for this interface and dependent VLANs */
list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list)
@@ -3030,8 +3034,11 @@ static void ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
sdata->radar_required = sdata->csa_radar_required;
err = ieee80211_vif_change_channel(sdata, &changed);
mutex_unlock(&local->mtx);
- if (WARN_ON(err < 0))
+ if (WARN_ON(err < 0)) {
+ cfg80211_ch_switch_failed_notify(sdata->dev,
+ &sdata->csa_chandef);
return;
+ }
if (!local->use_chanctx) {
local->_oper_chandef = sdata->csa_chandef;
@@ -3045,21 +3052,30 @@ static void ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
kfree(sdata->u.ap.next_beacon);
sdata->u.ap.next_beacon = NULL;
- if (err < 0)
+ if (err < 0) {
+ cfg80211_ch_switch_failed_notify(sdata->dev,
+ &sdata->csa_chandef);
return;
+ }
changed |= err;
break;
case NL80211_IFTYPE_ADHOC:
err = ieee80211_ibss_finish_csa(sdata);
- if (err < 0)
+ if (err < 0) {
+ cfg80211_ch_switch_failed_notify(sdata->dev,
+ &sdata->csa_chandef);
return;
+ }
changed |= err;
break;
#ifdef CONFIG_MAC80211_MESH
case NL80211_IFTYPE_MESH_POINT:
err = ieee80211_mesh_finish_csa(sdata);
- if (err < 0)
+ if (err < 0) {
+ cfg80211_ch_switch_failed_notify(sdata->dev,
+ &sdata->csa_chandef);
return;
+ }
changed |= err;
break;
#endif
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 7fff3dc..578f6e6 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -838,7 +838,11 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
cancel_work_sync(&sdata->recalc_smps);
sdata_lock(sdata);
- sdata->vif.csa_active = false;
+ if (sdata->vif.csa_active) {
+ sdata->vif.csa_active = false;
+ cfg80211_ch_switch_failed_notify(sdata->dev,
+ &sdata->csa_chandef);
+ }
sdata_unlock(sdata);
cancel_work_sync(&sdata->csa_finalize_work);
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 139005d..beff8c8 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -958,6 +958,8 @@ static void ieee80211_chswitch_work(struct work_struct *work)
"vif channel switch failed, disconnecting\n");
ieee80211_queue_work(&sdata->local->hw,
&ifmgd->csa_connection_drop_work);
+ cfg80211_ch_switch_failed_notify(sdata->dev,
+ &sdata->csa_chandef);
goto out;
}
@@ -2060,7 +2062,12 @@ static void __ieee80211_disconnect(struct ieee80211_sub_if_data *sdata)
WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY,
true, frame_buf);
ifmgd->flags &= ~IEEE80211_STA_CSA_RECEIVED;
- sdata->vif.csa_active = false;
+
+ if (sdata->vif.csa_active) {
+ cfg80211_ch_switch_failed_notify(sdata->dev,
+ &sdata->csa_chandef);
+ sdata->vif.csa_active = false;
+ }
ieee80211_wake_queues_by_reason(&sdata->local->hw,
IEEE80211_MAX_QUEUE_MAP,
IEEE80211_QUEUE_STOP_REASON_CSA);
--
1.9.2
next prev parent reply other threads:[~2014-05-02 13:41 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-02 13:40 [PATCH 1/4] cfg80211/nl80211: add channel switch started and failed notifications Luca Coelho
2014-05-02 13:40 ` [PATCH 2/4] mac80211: send channel switch started notifications Luca Coelho
2014-05-02 13:40 ` Luca Coelho [this message]
2014-05-02 13:40 ` [PATCH 4/4] cfg80211/nl80211: allow any interface to send channel switch notifications Luca Coelho
2014-05-06 10:47 ` [PATCH 1/4] cfg80211/nl80211: add channel switch started and failed notifications Johannes Berg
2014-05-06 12:49 ` Michal Kazior
2014-05-06 13:08 ` Johannes Berg
2014-05-07 6:08 ` Peer, Ilan
2014-05-07 6:39 ` Johannes Berg
2014-05-07 10:27 ` Peer, Ilan
2014-05-07 11:19 ` Johannes Berg
2014-05-07 11:45 ` Michal Kazior
2014-05-07 11:55 ` Peer, Ilan
2014-05-13 10:31 ` Luca Coelho
2014-05-06 10:48 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1399038031-23206-3-git-send-email-luca@coelho.fi \
--to=luca@coelho.fi \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=michal.kazior@tieto.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox