Linux wireless drivers development
 help / color / mirror / Atom feed
From: Eliad Peller <eliad@wizery.com>
To: Luciano Coelho <coelho@ti.com>
Cc: <linux-wireless@vger.kernel.org>
Subject: [PATCH 10/15] wlcore: initiate ROC/CROC on sta state updates
Date: Mon, 19 Nov 2012 18:39:25 +0200	[thread overview]
Message-ID: <1353343170-26516-11-git-send-email-eliad@wizery.com> (raw)
In-Reply-To: <1353343170-26516-1-git-send-email-eliad@wizery.com>

Use the sta_state notifications to ROC when a station
is about to connect, and CROC respectively on
authorization (success) / deletion (failure).

Change the wl12xx_update_sta_state() flow to bail out
only on error, so multiple code blocks could refer
to the same state.

Signed-off-by: Eliad Peller <eliad@wizery.com>
---
 drivers/net/wireless/ti/wlcore/main.c |   43 ++++++++++++++++++++------------
 1 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index fcdf381..e1f0606 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -83,8 +83,6 @@ static int wl12xx_set_authorized(struct wl1271 *wl,
 	if (ret < 0)
 		return ret;
 
-	wl12xx_croc(wl, wlvif->role_id);
-
 	wl1271_info("Association completed.");
 	return 0;
 }
@@ -3944,14 +3942,6 @@ sta_not_found:
 			wl1271_warning("cmd join failed %d", ret);
 			goto out;
 		}
-
-		/* ROC until connected (after EAPOL exchange) */
-		if (!is_ibss) {
-			ret = wl12xx_roc(wl, wlvif, wlvif->role_id,
-					 wlvif->channel);
-			if (ret < 0)
-				goto out;
-		}
 	}
 
 	if (set_assoc) {
@@ -4355,8 +4345,11 @@ static int wl12xx_update_sta_state(struct wl1271 *wl,
 	/* Add station (AP mode) */
 	if (is_ap &&
 	    old_state == IEEE80211_STA_NOTEXIST &&
-	    new_state == IEEE80211_STA_NONE)
-		return wl12xx_sta_add(wl, wlvif, sta);
+	    new_state == IEEE80211_STA_NONE) {
+		ret = wl12xx_sta_add(wl, wlvif, sta);
+		if (ret)
+			return ret;
+	}
 
 	/* Remove station (AP mode) */
 	if (is_ap &&
@@ -4364,7 +4357,6 @@ static int wl12xx_update_sta_state(struct wl1271 *wl,
 	    new_state == IEEE80211_STA_NOTEXIST) {
 		/* must not fail */
 		wl12xx_sta_remove(wl, wlvif, sta);
-		return 0;
 	}
 
 	/* Authorize station (AP mode) */
@@ -4376,14 +4368,17 @@ static int wl12xx_update_sta_state(struct wl1271 *wl,
 
 		ret = wl1271_acx_set_ht_capabilities(wl, &sta->ht_cap, true,
 						     hlid);
-		return ret;
+		if (ret)
+			return ret;
 	}
 
 	/* Authorize station */
 	if (is_sta &&
 	    new_state == IEEE80211_STA_AUTHORIZED) {
 		set_bit(WLVIF_FLAG_STA_AUTHORIZED, &wlvif->flags);
-		return wl12xx_set_authorized(wl, wlvif);
+		ret = wl12xx_set_authorized(wl, wlvif);
+		if (ret)
+			return ret;
 	}
 
 	if (is_sta &&
@@ -4391,9 +4386,25 @@ static int wl12xx_update_sta_state(struct wl1271 *wl,
 	    new_state == IEEE80211_STA_ASSOC) {
 		clear_bit(WLVIF_FLAG_STA_AUTHORIZED, &wlvif->flags);
 		clear_bit(WLVIF_FLAG_STA_STATE_SENT, &wlvif->flags);
-		return 0;
 	}
 
+	/* clear ROCs on failure or authorization */
+	if (is_sta &&
+	    (new_state == IEEE80211_STA_AUTHORIZED ||
+	     new_state == IEEE80211_STA_NOTEXIST)) {
+		if (test_bit(wlvif->role_id, wl->roc_map))
+			wl12xx_croc(wl, wlvif->role_id);
+	}
+
+	if (is_sta &&
+	    old_state == IEEE80211_STA_NOTEXIST &&
+	    new_state == IEEE80211_STA_NONE) {
+		if (find_first_bit(wl->roc_map,
+				   WL12XX_MAX_ROLES) >= WL12XX_MAX_ROLES) {
+			WARN_ON(wlvif->role_id == WL12XX_INVALID_ROLE_ID);
+			wl12xx_roc(wl, wlvif, wlvif->role_id, wlvif->channel);
+		}
+	}
 	return 0;
 }
 
-- 
1.7.6.401.g6a319


  parent reply	other threads:[~2012-11-19 16:39 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-19 16:39 [PATCH 00/15] wlcore: prepare to multi-channel Eliad Peller
2012-11-19 16:39 ` [PATCH 01/15] wlcore: start sta role on CHANGED_BSSID Eliad Peller
2012-11-19 18:14   ` Luciano Coelho
2012-11-20  8:22     ` Eliad Peller
2012-11-19 16:39 ` [PATCH 02/15] wlcore: set ssid before starting station role Eliad Peller
2012-11-19 16:39 ` [PATCH 03/15] wlcore: always use sta.hlid Eliad Peller
2012-11-19 22:39   ` Julian Calaby
2012-11-20  8:46     ` Eliad Peller
2012-11-19 16:39 ` [PATCH 04/15] wlcore: workaround start_sta problem in wl12xx fw Eliad Peller
2012-11-19 16:39 ` [PATCH 05/15] wlcore: implement .remain_on_channel() callback Eliad Peller
2012-11-19 21:13   ` Arik Nemtsov
2012-11-20  8:33     ` Eliad Peller
2012-11-19 16:39 ` [PATCH 06/15] wlcore: use dev_hlid if the tx is offchannel Eliad Peller
2012-11-19 16:39 ` [PATCH 07/15] wlcore: get channel from bss_conf instead of hw->conf Eliad Peller
2012-11-19 16:39 ` [PATCH 08/15] wlcore: add chanctx implementation Eliad Peller
2012-11-19 17:03   ` Johannes Berg
2012-11-19 17:16     ` Eliad Peller
2012-11-19 17:36       ` Luciano Coelho
2012-11-19 17:48         ` Eliad Peller
2012-11-19 21:23   ` Arik Nemtsov
2012-11-20  8:38     ` Eliad Peller
2012-11-20 11:03       ` Arik Nemtsov
2012-11-20 11:42   ` Johannes Berg
2012-11-20 11:47     ` Eliad Peller
2012-11-19 16:39 ` [PATCH 09/15] wlcore: remove channel handling from op_config Eliad Peller
2012-11-19 21:26   ` Arik Nemtsov
2012-11-19 16:39 ` Eliad Peller [this message]
2012-11-19 21:41   ` [PATCH 10/15] wlcore: initiate ROC/CROC on sta state updates Arik Nemtsov
2012-11-20  8:42     ` Eliad Peller
2012-11-20 10:25       ` Arik Nemtsov
2012-11-19 16:39 ` [PATCH 11/15] wlcore: set active psm on association Eliad Peller
2012-11-20  7:39   ` Luciano Coelho
2012-11-20  9:06     ` Eliad Peller
2012-11-19 16:39 ` [PATCH 12/15] wlcore: specify correct supported_rates Eliad Peller
2012-11-20  7:55   ` Luciano Coelho
2012-11-20  9:11     ` Eliad Peller
2012-11-19 16:39 ` [PATCH 13/15] wlcore: reconfigure rate policy on association Eliad Peller
2012-11-20  8:13   ` Luciano Coelho
2012-11-20  9:14     ` Eliad Peller
2012-11-19 16:39 ` [PATCH 14/15] wlcore: refactor CHANGED_HT handling Eliad Peller
2012-11-19 16:39 ` [PATCH 15/15] wlcore: configure the remote rates with our own rates Eliad Peller
2012-11-20  8:18   ` Luciano Coelho
2012-11-20  9:21     ` Eliad Peller

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=1353343170-26516-11-git-send-email-eliad@wizery.com \
    --to=eliad@wizery.com \
    --cc=coelho@ti.com \
    --cc=linux-wireless@vger.kernel.org \
    /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