From: Jouni Malinen <jouni.malinen@atheros.com>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org,
Jouni Malinen <jouni.malinen@atheros.com>
Subject: [PATCH 08/15] ath9k: Make start/stop operations aware of virtual wiphys
Date: Tue, 03 Mar 2009 19:23:33 +0200 [thread overview]
Message-ID: <20090303172511.808072634@atheros.com> (raw)
In-Reply-To: 20090303172325.437810138@atheros.com
Instead of always going through initialization/deinitialization steps,
do this only for the first/last wiphy to not break the other wiphys.
Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
---
drivers/net/wireless/ath9k/ath9k.h | 2 ++
drivers/net/wireless/ath9k/main.c | 28 ++++++++++++++++++++++++++++
drivers/net/wireless/ath9k/virtual.c | 19 +++++++++++++++++++
3 files changed, 49 insertions(+)
--- wireless-testing.orig/drivers/net/wireless/ath9k/ath9k.h 2009-03-03 18:31:20.000000000 +0200
+++ wireless-testing/drivers/net/wireless/ath9k/ath9k.h 2009-03-03 18:31:30.000000000 +0200
@@ -627,6 +627,7 @@ struct ath_wiphy {
struct ath_softc *sc; /* shared for all virtual wiphys */
struct ieee80211_hw *hw;
enum ath_wiphy_state {
+ ATH_WIPHY_INACTIVE,
ATH_WIPHY_ACTIVE,
ATH_WIPHY_PAUSING,
ATH_WIPHY_PAUSED,
@@ -707,5 +708,6 @@ int ath9k_wiphy_pause(struct ath_wiphy *
int ath9k_wiphy_unpause(struct ath_wiphy *aphy);
int ath9k_wiphy_select(struct ath_wiphy *aphy);
void ath9k_wiphy_chan_work(struct work_struct *work);
+bool ath9k_wiphy_started(struct ath_softc *sc);
#endif /* ATH9K_H */
--- wireless-testing.orig/drivers/net/wireless/ath9k/main.c 2009-03-03 18:31:20.000000000 +0200
+++ wireless-testing/drivers/net/wireless/ath9k/main.c 2009-03-03 18:31:30.000000000 +0200
@@ -1963,6 +1963,27 @@ static int ath9k_start(struct ieee80211_
mutex_lock(&sc->mutex);
+ if (ath9k_wiphy_started(sc)) {
+ if (sc->chan_idx == curchan->hw_value) {
+ /*
+ * Already on the operational channel, the new wiphy
+ * can be marked active.
+ */
+ aphy->state = ATH_WIPHY_ACTIVE;
+ ieee80211_wake_queues(hw);
+ } else {
+ /*
+ * Another wiphy is on another channel, start the new
+ * wiphy in paused state.
+ */
+ aphy->state = ATH_WIPHY_PAUSED;
+ ieee80211_stop_queues(hw);
+ }
+ mutex_unlock(&sc->mutex);
+ return 0;
+ }
+ aphy->state = ATH_WIPHY_ACTIVE;
+
/* setup initial channel */
pos = curchan->hw_value;
@@ -2102,6 +2123,8 @@ static void ath9k_stop(struct ieee80211_
struct ath_wiphy *aphy = hw->priv;
struct ath_softc *sc = aphy->sc;
+ aphy->state = ATH_WIPHY_INACTIVE;
+
if (sc->sc_flags & SC_OP_INVALID) {
DPRINTF(sc, ATH_DBG_ANY, "Device not present\n");
return;
@@ -2111,6 +2134,11 @@ static void ath9k_stop(struct ieee80211_
ieee80211_stop_queues(hw);
+ if (ath9k_wiphy_started(sc)) {
+ mutex_unlock(&sc->mutex);
+ return; /* another wiphy still in use */
+ }
+
/* make sure h/w will not generate any interrupt
* before setting the invalid flag. */
ath9k_hw_set_interrupts(sc->sc_ah, 0);
--- wireless-testing.orig/drivers/net/wireless/ath9k/virtual.c 2009-03-03 18:31:20.000000000 +0200
+++ wireless-testing/drivers/net/wireless/ath9k/virtual.c 2009-03-03 18:31:30.000000000 +0200
@@ -477,3 +477,22 @@ int ath9k_wiphy_select(struct ath_wiphy
return 0;
}
+
+bool ath9k_wiphy_started(struct ath_softc *sc)
+{
+ int i;
+ spin_lock_bh(&sc->wiphy_lock);
+ if (sc->pri_wiphy->state != ATH_WIPHY_INACTIVE) {
+ spin_unlock_bh(&sc->wiphy_lock);
+ return true;
+ }
+ for (i = 0; i < sc->num_sec_wiphy; i++) {
+ if (sc->sec_wiphy[i] &&
+ sc->sec_wiphy[i]->state != ATH_WIPHY_INACTIVE) {
+ spin_unlock_bh(&sc->wiphy_lock);
+ return true;
+ }
+ }
+ spin_unlock_bh(&sc->wiphy_lock);
+ return false;
+}
--
--
Jouni Malinen PGP id EFC895FA
next prev parent reply other threads:[~2009-03-03 17:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-03 17:23 [PATCH 00/15] ath9k: Virtual interfaces and radios Jouni Malinen
2009-03-03 17:23 ` [PATCH 01/15] ath9k: Cleanup multiple VIF processing Jouni Malinen
2009-03-03 17:23 ` [PATCH 02/15] ath9k: Set BSSID mask based on configured interfaces Jouni Malinen
2009-03-03 17:23 ` [PATCH 03/15] ath9k: Add data structure for supporting virtual radio/wiphy operation Jouni Malinen
2009-03-03 17:23 ` [PATCH 04/15] ath9k: Add support for multiple secondary virtual wiphys Jouni Malinen
2009-03-03 17:23 ` [PATCH 05/15] ath9k: Configure RX filter for multi-BSSID broadcast Jouni Malinen
2009-03-03 17:23 ` [PATCH 06/15] ath9k: Virtual wiphy pause/unpause functionality Jouni Malinen
2009-03-03 17:23 ` [PATCH 07/15] ath9k: Add routines for switching between active virtual wiphys Jouni Malinen
2009-03-03 17:23 ` Jouni Malinen [this message]
2009-03-03 17:23 ` [PATCH 09/15] ath9k: Register larger listen interval Jouni Malinen
2009-03-03 17:23 ` [PATCH 10/15] ath9k: Pause other virtual wiphys on channel change Jouni Malinen
2009-03-03 17:23 ` [PATCH 11/15] ath9k: Check virtual wiphy state on tx() Jouni Malinen
2009-03-03 17:23 ` [PATCH 12/15] ath9k: Add workaround to recover from failed channel changes Jouni Malinen
2009-03-03 17:23 ` [PATCH 13/15] ath9k: Special processing for channel changes during scan Jouni Malinen
2009-03-03 17:23 ` [PATCH 14/15] ath9k: Add a simple virtual wiphy scheduler Jouni Malinen
2009-03-03 17:23 ` [PATCH 15/15] ath9k: Add a debugfs interface for controlling virtual wiphys Jouni Malinen
2009-03-07 13:56 ` [PATCH 00/15] ath9k: Virtual interfaces and radios Florian Fainelli
2009-03-12 20:19 ` Jouni Malinen
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=20090303172511.808072634@atheros.com \
--to=jouni.malinen@atheros.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.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;
as well as URLs for NNTP newsgroup(s).