diff options
author | Jouni Malinen <jouni.malinen@atheros.com> | 2009-03-03 12:23:28 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-03-05 14:39:44 -0500 |
commit | bce048d77dff3dcfd75d54dc38580c81baa95853 (patch) | |
tree | 214b954bae87b52bad66c60f625c925be10b3500 /drivers/net/wireless/ath9k/main.c | |
parent | 8ca21f0185a606c490867f7471196aa29639e638 (diff) |
ath9k: Add data structure for supporting virtual radio/wiphy operation
This is the initial step in allowing ath9k to register multiple
virtual radios (wiphys). The goal of virtual radios is to allow the
same radio to be shared for multiple virtual interfaces that may
operate on different channels. The mac80211 virtual interface support
is designed only for single channel operation and as such, it is not
suitable for this type of use. Anyway, it can be used on top of the
virtual radio concept, if desired (e.g., use two virtual radios to
handle two channels and then add multiple mac80211 virtual interfaces
on top of each virtual radio).
The new struct ath_wiphy is now registered as the driver data
structure for wiphy. This structure has a pointer to the shared (among
virtual wiphys of the same physical radio) struct ath_softc data. The
primary wiphy maintains the allocated memory for ath_softc. Secondary
(virtual) wiphys will only allocate the new ath_wiphy structure.
Registration of secondary wiphys is added in a separate patch.
Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/main.c')
-rw-r--r-- | drivers/net/wireless/ath9k/main.c | 58 |
1 files changed, 38 insertions, 20 deletions
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index 599218def799..0c0e587d7942 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c | |||
@@ -1934,7 +1934,8 @@ static void ath9k_update_ichannel(struct ath_softc *sc, | |||
1934 | 1934 | ||
1935 | static int ath9k_start(struct ieee80211_hw *hw) | 1935 | static int ath9k_start(struct ieee80211_hw *hw) |
1936 | { | 1936 | { |
1937 | struct ath_softc *sc = hw->priv; | 1937 | struct ath_wiphy *aphy = hw->priv; |
1938 | struct ath_softc *sc = aphy->sc; | ||
1938 | struct ieee80211_channel *curchan = hw->conf.channel; | 1939 | struct ieee80211_channel *curchan = hw->conf.channel; |
1939 | struct ath9k_channel *init_channel; | 1940 | struct ath9k_channel *init_channel; |
1940 | int r, pos; | 1941 | int r, pos; |
@@ -2012,7 +2013,7 @@ static int ath9k_start(struct ieee80211_hw *hw) | |||
2012 | sc->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS); | 2013 | sc->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS); |
2013 | ath9k_hw_set_interrupts(sc->sc_ah, sc->imask); | 2014 | ath9k_hw_set_interrupts(sc->sc_ah, sc->imask); |
2014 | 2015 | ||
2015 | ieee80211_wake_queues(sc->hw); | 2016 | ieee80211_wake_queues(hw); |
2016 | 2017 | ||
2017 | #if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE) | 2018 | #if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE) |
2018 | r = ath_start_rfkill_poll(sc); | 2019 | r = ath_start_rfkill_poll(sc); |
@@ -2028,7 +2029,8 @@ static int ath9k_tx(struct ieee80211_hw *hw, | |||
2028 | struct sk_buff *skb) | 2029 | struct sk_buff *skb) |
2029 | { | 2030 | { |
2030 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 2031 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
2031 | struct ath_softc *sc = hw->priv; | 2032 | struct ath_wiphy *aphy = hw->priv; |
2033 | struct ath_softc *sc = aphy->sc; | ||
2032 | struct ath_tx_control txctl; | 2034 | struct ath_tx_control txctl; |
2033 | int hdrlen, padsize; | 2035 | int hdrlen, padsize; |
2034 | 2036 | ||
@@ -2078,7 +2080,8 @@ exit: | |||
2078 | 2080 | ||
2079 | static void ath9k_stop(struct ieee80211_hw *hw) | 2081 | static void ath9k_stop(struct ieee80211_hw *hw) |
2080 | { | 2082 | { |
2081 | struct ath_softc *sc = hw->priv; | 2083 | struct ath_wiphy *aphy = hw->priv; |
2084 | struct ath_softc *sc = aphy->sc; | ||
2082 | 2085 | ||
2083 | if (sc->sc_flags & SC_OP_INVALID) { | 2086 | if (sc->sc_flags & SC_OP_INVALID) { |
2084 | DPRINTF(sc, ATH_DBG_ANY, "Device not present\n"); | 2087 | DPRINTF(sc, ATH_DBG_ANY, "Device not present\n"); |
@@ -2087,7 +2090,7 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
2087 | 2090 | ||
2088 | mutex_lock(&sc->mutex); | 2091 | mutex_lock(&sc->mutex); |
2089 | 2092 | ||
2090 | ieee80211_stop_queues(sc->hw); | 2093 | ieee80211_stop_queues(hw); |
2091 | 2094 | ||
2092 | /* make sure h/w will not generate any interrupt | 2095 | /* make sure h/w will not generate any interrupt |
2093 | * before setting the invalid flag. */ | 2096 | * before setting the invalid flag. */ |
@@ -2118,7 +2121,8 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
2118 | static int ath9k_add_interface(struct ieee80211_hw *hw, | 2121 | static int ath9k_add_interface(struct ieee80211_hw *hw, |
2119 | struct ieee80211_if_init_conf *conf) | 2122 | struct ieee80211_if_init_conf *conf) |
2120 | { | 2123 | { |
2121 | struct ath_softc *sc = hw->priv; | 2124 | struct ath_wiphy *aphy = hw->priv; |
2125 | struct ath_softc *sc = aphy->sc; | ||
2122 | struct ath_vif *avp = (void *)conf->vif->drv_priv; | 2126 | struct ath_vif *avp = (void *)conf->vif->drv_priv; |
2123 | enum nl80211_iftype ic_opmode = NL80211_IFTYPE_UNSPECIFIED; | 2127 | enum nl80211_iftype ic_opmode = NL80211_IFTYPE_UNSPECIFIED; |
2124 | int ret = 0; | 2128 | int ret = 0; |
@@ -2217,7 +2221,8 @@ out: | |||
2217 | static void ath9k_remove_interface(struct ieee80211_hw *hw, | 2221 | static void ath9k_remove_interface(struct ieee80211_hw *hw, |
2218 | struct ieee80211_if_init_conf *conf) | 2222 | struct ieee80211_if_init_conf *conf) |
2219 | { | 2223 | { |
2220 | struct ath_softc *sc = hw->priv; | 2224 | struct ath_wiphy *aphy = hw->priv; |
2225 | struct ath_softc *sc = aphy->sc; | ||
2221 | struct ath_vif *avp = (void *)conf->vif->drv_priv; | 2226 | struct ath_vif *avp = (void *)conf->vif->drv_priv; |
2222 | int i; | 2227 | int i; |
2223 | 2228 | ||
@@ -2252,7 +2257,8 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, | |||
2252 | 2257 | ||
2253 | static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | 2258 | static int ath9k_config(struct ieee80211_hw *hw, u32 changed) |
2254 | { | 2259 | { |
2255 | struct ath_softc *sc = hw->priv; | 2260 | struct ath_wiphy *aphy = hw->priv; |
2261 | struct ath_softc *sc = aphy->sc; | ||
2256 | struct ieee80211_conf *conf = &hw->conf; | 2262 | struct ieee80211_conf *conf = &hw->conf; |
2257 | 2263 | ||
2258 | mutex_lock(&sc->mutex); | 2264 | mutex_lock(&sc->mutex); |
@@ -2319,7 +2325,8 @@ static int ath9k_config_interface(struct ieee80211_hw *hw, | |||
2319 | struct ieee80211_vif *vif, | 2325 | struct ieee80211_vif *vif, |
2320 | struct ieee80211_if_conf *conf) | 2326 | struct ieee80211_if_conf *conf) |
2321 | { | 2327 | { |
2322 | struct ath_softc *sc = hw->priv; | 2328 | struct ath_wiphy *aphy = hw->priv; |
2329 | struct ath_softc *sc = aphy->sc; | ||
2323 | struct ath_hw *ah = sc->sc_ah; | 2330 | struct ath_hw *ah = sc->sc_ah; |
2324 | struct ath_vif *avp = (void *)vif->drv_priv; | 2331 | struct ath_vif *avp = (void *)vif->drv_priv; |
2325 | u32 rfilt = 0; | 2332 | u32 rfilt = 0; |
@@ -2424,7 +2431,8 @@ static void ath9k_configure_filter(struct ieee80211_hw *hw, | |||
2424 | int mc_count, | 2431 | int mc_count, |
2425 | struct dev_mc_list *mclist) | 2432 | struct dev_mc_list *mclist) |
2426 | { | 2433 | { |
2427 | struct ath_softc *sc = hw->priv; | 2434 | struct ath_wiphy *aphy = hw->priv; |
2435 | struct ath_softc *sc = aphy->sc; | ||
2428 | u32 rfilt; | 2436 | u32 rfilt; |
2429 | 2437 | ||
2430 | changed_flags &= SUPPORTED_FILTERS; | 2438 | changed_flags &= SUPPORTED_FILTERS; |
@@ -2442,7 +2450,8 @@ static void ath9k_sta_notify(struct ieee80211_hw *hw, | |||
2442 | enum sta_notify_cmd cmd, | 2450 | enum sta_notify_cmd cmd, |
2443 | struct ieee80211_sta *sta) | 2451 | struct ieee80211_sta *sta) |
2444 | { | 2452 | { |
2445 | struct ath_softc *sc = hw->priv; | 2453 | struct ath_wiphy *aphy = hw->priv; |
2454 | struct ath_softc *sc = aphy->sc; | ||
2446 | 2455 | ||
2447 | switch (cmd) { | 2456 | switch (cmd) { |
2448 | case STA_NOTIFY_ADD: | 2457 | case STA_NOTIFY_ADD: |
@@ -2459,7 +2468,8 @@ static void ath9k_sta_notify(struct ieee80211_hw *hw, | |||
2459 | static int ath9k_conf_tx(struct ieee80211_hw *hw, u16 queue, | 2468 | static int ath9k_conf_tx(struct ieee80211_hw *hw, u16 queue, |
2460 | const struct ieee80211_tx_queue_params *params) | 2469 | const struct ieee80211_tx_queue_params *params) |
2461 | { | 2470 | { |
2462 | struct ath_softc *sc = hw->priv; | 2471 | struct ath_wiphy *aphy = hw->priv; |
2472 | struct ath_softc *sc = aphy->sc; | ||
2463 | struct ath9k_tx_queue_info qi; | 2473 | struct ath9k_tx_queue_info qi; |
2464 | int ret = 0, qnum; | 2474 | int ret = 0, qnum; |
2465 | 2475 | ||
@@ -2495,7 +2505,8 @@ static int ath9k_set_key(struct ieee80211_hw *hw, | |||
2495 | struct ieee80211_sta *sta, | 2505 | struct ieee80211_sta *sta, |
2496 | struct ieee80211_key_conf *key) | 2506 | struct ieee80211_key_conf *key) |
2497 | { | 2507 | { |
2498 | struct ath_softc *sc = hw->priv; | 2508 | struct ath_wiphy *aphy = hw->priv; |
2509 | struct ath_softc *sc = aphy->sc; | ||
2499 | int ret = 0; | 2510 | int ret = 0; |
2500 | 2511 | ||
2501 | if (modparam_nohwcrypt) | 2512 | if (modparam_nohwcrypt) |
@@ -2537,7 +2548,8 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw, | |||
2537 | struct ieee80211_bss_conf *bss_conf, | 2548 | struct ieee80211_bss_conf *bss_conf, |
2538 | u32 changed) | 2549 | u32 changed) |
2539 | { | 2550 | { |
2540 | struct ath_softc *sc = hw->priv; | 2551 | struct ath_wiphy *aphy = hw->priv; |
2552 | struct ath_softc *sc = aphy->sc; | ||
2541 | 2553 | ||
2542 | mutex_lock(&sc->mutex); | 2554 | mutex_lock(&sc->mutex); |
2543 | 2555 | ||
@@ -2572,7 +2584,8 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw, | |||
2572 | static u64 ath9k_get_tsf(struct ieee80211_hw *hw) | 2584 | static u64 ath9k_get_tsf(struct ieee80211_hw *hw) |
2573 | { | 2585 | { |
2574 | u64 tsf; | 2586 | u64 tsf; |
2575 | struct ath_softc *sc = hw->priv; | 2587 | struct ath_wiphy *aphy = hw->priv; |
2588 | struct ath_softc *sc = aphy->sc; | ||
2576 | 2589 | ||
2577 | mutex_lock(&sc->mutex); | 2590 | mutex_lock(&sc->mutex); |
2578 | tsf = ath9k_hw_gettsf64(sc->sc_ah); | 2591 | tsf = ath9k_hw_gettsf64(sc->sc_ah); |
@@ -2583,7 +2596,8 @@ static u64 ath9k_get_tsf(struct ieee80211_hw *hw) | |||
2583 | 2596 | ||
2584 | static void ath9k_set_tsf(struct ieee80211_hw *hw, u64 tsf) | 2597 | static void ath9k_set_tsf(struct ieee80211_hw *hw, u64 tsf) |
2585 | { | 2598 | { |
2586 | struct ath_softc *sc = hw->priv; | 2599 | struct ath_wiphy *aphy = hw->priv; |
2600 | struct ath_softc *sc = aphy->sc; | ||
2587 | 2601 | ||
2588 | mutex_lock(&sc->mutex); | 2602 | mutex_lock(&sc->mutex); |
2589 | ath9k_hw_settsf64(sc->sc_ah, tsf); | 2603 | ath9k_hw_settsf64(sc->sc_ah, tsf); |
@@ -2592,7 +2606,8 @@ static void ath9k_set_tsf(struct ieee80211_hw *hw, u64 tsf) | |||
2592 | 2606 | ||
2593 | static void ath9k_reset_tsf(struct ieee80211_hw *hw) | 2607 | static void ath9k_reset_tsf(struct ieee80211_hw *hw) |
2594 | { | 2608 | { |
2595 | struct ath_softc *sc = hw->priv; | 2609 | struct ath_wiphy *aphy = hw->priv; |
2610 | struct ath_softc *sc = aphy->sc; | ||
2596 | 2611 | ||
2597 | mutex_lock(&sc->mutex); | 2612 | mutex_lock(&sc->mutex); |
2598 | ath9k_hw_reset_tsf(sc->sc_ah); | 2613 | ath9k_hw_reset_tsf(sc->sc_ah); |
@@ -2604,7 +2619,8 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw, | |||
2604 | struct ieee80211_sta *sta, | 2619 | struct ieee80211_sta *sta, |
2605 | u16 tid, u16 *ssn) | 2620 | u16 tid, u16 *ssn) |
2606 | { | 2621 | { |
2607 | struct ath_softc *sc = hw->priv; | 2622 | struct ath_wiphy *aphy = hw->priv; |
2623 | struct ath_softc *sc = aphy->sc; | ||
2608 | int ret = 0; | 2624 | int ret = 0; |
2609 | 2625 | ||
2610 | switch (action) { | 2626 | switch (action) { |
@@ -2642,7 +2658,8 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw, | |||
2642 | 2658 | ||
2643 | static void ath9k_sw_scan_start(struct ieee80211_hw *hw) | 2659 | static void ath9k_sw_scan_start(struct ieee80211_hw *hw) |
2644 | { | 2660 | { |
2645 | struct ath_softc *sc = hw->priv; | 2661 | struct ath_wiphy *aphy = hw->priv; |
2662 | struct ath_softc *sc = aphy->sc; | ||
2646 | 2663 | ||
2647 | mutex_lock(&sc->mutex); | 2664 | mutex_lock(&sc->mutex); |
2648 | sc->sc_flags |= SC_OP_SCANNING; | 2665 | sc->sc_flags |= SC_OP_SCANNING; |
@@ -2651,7 +2668,8 @@ static void ath9k_sw_scan_start(struct ieee80211_hw *hw) | |||
2651 | 2668 | ||
2652 | static void ath9k_sw_scan_complete(struct ieee80211_hw *hw) | 2669 | static void ath9k_sw_scan_complete(struct ieee80211_hw *hw) |
2653 | { | 2670 | { |
2654 | struct ath_softc *sc = hw->priv; | 2671 | struct ath_wiphy *aphy = hw->priv; |
2672 | struct ath_softc *sc = aphy->sc; | ||
2655 | 2673 | ||
2656 | mutex_lock(&sc->mutex); | 2674 | mutex_lock(&sc->mutex); |
2657 | sc->sc_flags &= ~SC_OP_SCANNING; | 2675 | sc->sc_flags &= ~SC_OP_SCANNING; |