aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2009-03-03 12:23:28 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-03-05 14:39:44 -0500
commitbce048d77dff3dcfd75d54dc38580c81baa95853 (patch)
tree214b954bae87b52bad66c60f625c925be10b3500
parent8ca21f0185a606c490867f7471196aa29639e638 (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>
-rw-r--r--drivers/net/wireless/ath9k/ahb.c12
-rw-r--r--drivers/net/wireless/ath9k/ath9k.h8
-rw-r--r--drivers/net/wireless/ath9k/main.c58
-rw-r--r--drivers/net/wireless/ath9k/pci.c19
-rw-r--r--drivers/net/wireless/ath9k/rc.c3
-rw-r--r--drivers/net/wireless/ath9k/recv.c15
-rw-r--r--drivers/net/wireless/ath9k/regd.c6
-rw-r--r--drivers/net/wireless/ath9k/virtual.c3
8 files changed, 88 insertions, 36 deletions
diff --git a/drivers/net/wireless/ath9k/ahb.c b/drivers/net/wireless/ath9k/ahb.c
index 391c9fd3b646..bc562bd88890 100644
--- a/drivers/net/wireless/ath9k/ahb.c
+++ b/drivers/net/wireless/ath9k/ahb.c
@@ -96,7 +96,8 @@ static int ath_ahb_probe(struct platform_device *pdev)
96 96
97 irq = res->start; 97 irq = res->start;
98 98
99 hw = ieee80211_alloc_hw(sizeof(struct ath_softc), &ath9k_ops); 99 hw = ieee80211_alloc_hw(sizeof(struct ath_wiphy) +
100 sizeof(struct ath_softc), &ath9k_ops);
100 if (hw == NULL) { 101 if (hw == NULL) {
101 dev_err(&pdev->dev, "no memory for ieee80211_hw\n"); 102 dev_err(&pdev->dev, "no memory for ieee80211_hw\n");
102 ret = -ENOMEM; 103 ret = -ENOMEM;
@@ -106,7 +107,11 @@ static int ath_ahb_probe(struct platform_device *pdev)
106 SET_IEEE80211_DEV(hw, &pdev->dev); 107 SET_IEEE80211_DEV(hw, &pdev->dev);
107 platform_set_drvdata(pdev, hw); 108 platform_set_drvdata(pdev, hw);
108 109
109 sc = hw->priv; 110 aphy = hw->priv;
111 sc = (struct ath_softc *) (aphy + 1);
112 aphy->sc = sc;
113 aphy->hw = hw;
114 sc->pri_wiphy = aphy;
110 sc->hw = hw; 115 sc->hw = hw;
111 sc->dev = &pdev->dev; 116 sc->dev = &pdev->dev;
112 sc->mem = mem; 117 sc->mem = mem;
@@ -156,7 +161,8 @@ static int ath_ahb_remove(struct platform_device *pdev)
156 struct ieee80211_hw *hw = platform_get_drvdata(pdev); 161 struct ieee80211_hw *hw = platform_get_drvdata(pdev);
157 162
158 if (hw) { 163 if (hw) {
159 struct ath_softc *sc = hw->priv; 164 struct ath_wiphy *aphy = hw->priv;
165 struct ath_softc *sc = aphy->sc;
160 166
161 ath_cleanup(sc); 167 ath_cleanup(sc);
162 platform_set_drvdata(pdev, NULL); 168 platform_set_drvdata(pdev, NULL);
diff --git a/drivers/net/wireless/ath9k/ath9k.h b/drivers/net/wireless/ath9k/ath9k.h
index 1598bac9242d..41eeac42a80c 100644
--- a/drivers/net/wireless/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath9k/ath9k.h
@@ -549,9 +549,12 @@ struct ath_bus_ops {
549 bool (*eeprom_read)(struct ath_hw *ah, u32 off, u16 *data); 549 bool (*eeprom_read)(struct ath_hw *ah, u32 off, u16 *data);
550}; 550};
551 551
552struct ath_wiphy;
553
552struct ath_softc { 554struct ath_softc {
553 struct ieee80211_hw *hw; 555 struct ieee80211_hw *hw;
554 struct device *dev; 556 struct device *dev;
557 struct ath_wiphy *pri_wiphy;
555 struct tasklet_struct intr_tq; 558 struct tasklet_struct intr_tq;
556 struct tasklet_struct bcon_tasklet; 559 struct tasklet_struct bcon_tasklet;
557 struct ath_hw *sc_ah; 560 struct ath_hw *sc_ah;
@@ -607,6 +610,11 @@ struct ath_softc {
607 struct ath_bus_ops *bus_ops; 610 struct ath_bus_ops *bus_ops;
608}; 611};
609 612
613struct ath_wiphy {
614 struct ath_softc *sc; /* shared for all virtual wiphys */
615 struct ieee80211_hw *hw;
616};
617
610int ath_reset(struct ath_softc *sc, bool retry_tx); 618int ath_reset(struct ath_softc *sc, bool retry_tx);
611int ath_get_hal_qnum(u16 queue, struct ath_softc *sc); 619int ath_get_hal_qnum(u16 queue, struct ath_softc *sc);
612int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc); 620int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc);
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
1935static int ath9k_start(struct ieee80211_hw *hw) 1935static 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
2079static void ath9k_stop(struct ieee80211_hw *hw) 2081static 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)
2118static int ath9k_add_interface(struct ieee80211_hw *hw, 2121static 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:
2217static void ath9k_remove_interface(struct ieee80211_hw *hw, 2221static 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
2253static int ath9k_config(struct ieee80211_hw *hw, u32 changed) 2258static 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,
2459static int ath9k_conf_tx(struct ieee80211_hw *hw, u16 queue, 2468static 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,
2572static u64 ath9k_get_tsf(struct ieee80211_hw *hw) 2584static 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
2584static void ath9k_set_tsf(struct ieee80211_hw *hw, u64 tsf) 2597static 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
2593static void ath9k_reset_tsf(struct ieee80211_hw *hw) 2607static 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
2643static void ath9k_sw_scan_start(struct ieee80211_hw *hw) 2659static 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
2652static void ath9k_sw_scan_complete(struct ieee80211_hw *hw) 2669static 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;
diff --git a/drivers/net/wireless/ath9k/pci.c b/drivers/net/wireless/ath9k/pci.c
index eea9d3a9d43c..9a58baabb9ca 100644
--- a/drivers/net/wireless/ath9k/pci.c
+++ b/drivers/net/wireless/ath9k/pci.c
@@ -83,6 +83,7 @@ static struct ath_bus_ops ath_pci_bus_ops = {
83static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) 83static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
84{ 84{
85 void __iomem *mem; 85 void __iomem *mem;
86 struct ath_wiphy *aphy;
86 struct ath_softc *sc; 87 struct ath_softc *sc;
87 struct ieee80211_hw *hw; 88 struct ieee80211_hw *hw;
88 u8 csz; 89 u8 csz;
@@ -155,7 +156,8 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
155 goto bad1; 156 goto bad1;
156 } 157 }
157 158
158 hw = ieee80211_alloc_hw(sizeof(struct ath_softc), &ath9k_ops); 159 hw = ieee80211_alloc_hw(sizeof(struct ath_wiphy) +
160 sizeof(struct ath_softc), &ath9k_ops);
159 if (hw == NULL) { 161 if (hw == NULL) {
160 printk(KERN_ERR "ath_pci: no memory for ieee80211_hw\n"); 162 printk(KERN_ERR "ath_pci: no memory for ieee80211_hw\n");
161 goto bad2; 163 goto bad2;
@@ -164,7 +166,11 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
164 SET_IEEE80211_DEV(hw, &pdev->dev); 166 SET_IEEE80211_DEV(hw, &pdev->dev);
165 pci_set_drvdata(pdev, hw); 167 pci_set_drvdata(pdev, hw);
166 168
167 sc = hw->priv; 169 aphy = hw->priv;
170 sc = (struct ath_softc *) (aphy + 1);
171 aphy->sc = sc;
172 aphy->hw = hw;
173 sc->pri_wiphy = aphy;
168 sc->hw = hw; 174 sc->hw = hw;
169 sc->dev = &pdev->dev; 175 sc->dev = &pdev->dev;
170 sc->mem = mem; 176 sc->mem = mem;
@@ -214,7 +220,8 @@ bad:
214static void ath_pci_remove(struct pci_dev *pdev) 220static void ath_pci_remove(struct pci_dev *pdev)
215{ 221{
216 struct ieee80211_hw *hw = pci_get_drvdata(pdev); 222 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
217 struct ath_softc *sc = hw->priv; 223 struct ath_wiphy *aphy = hw->priv;
224 struct ath_softc *sc = aphy->sc;
218 225
219 ath_cleanup(sc); 226 ath_cleanup(sc);
220} 227}
@@ -224,7 +231,8 @@ static void ath_pci_remove(struct pci_dev *pdev)
224static int ath_pci_suspend(struct pci_dev *pdev, pm_message_t state) 231static int ath_pci_suspend(struct pci_dev *pdev, pm_message_t state)
225{ 232{
226 struct ieee80211_hw *hw = pci_get_drvdata(pdev); 233 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
227 struct ath_softc *sc = hw->priv; 234 struct ath_wiphy *aphy = hw->priv;
235 struct ath_softc *sc = aphy->sc;
228 236
229 ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 1); 237 ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 1);
230 238
@@ -243,7 +251,8 @@ static int ath_pci_suspend(struct pci_dev *pdev, pm_message_t state)
243static int ath_pci_resume(struct pci_dev *pdev) 251static int ath_pci_resume(struct pci_dev *pdev)
244{ 252{
245 struct ieee80211_hw *hw = pci_get_drvdata(pdev); 253 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
246 struct ath_softc *sc = hw->priv; 254 struct ath_wiphy *aphy = hw->priv;
255 struct ath_softc *sc = aphy->sc;
247 u32 val; 256 u32 val;
248 int err; 257 int err;
249 258
diff --git a/drivers/net/wireless/ath9k/rc.c b/drivers/net/wireless/ath9k/rc.c
index 6d7e636054ed..832735677a46 100644
--- a/drivers/net/wireless/ath9k/rc.c
+++ b/drivers/net/wireless/ath9k/rc.c
@@ -1673,7 +1673,8 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband,
1673 1673
1674static void *ath_rate_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) 1674static void *ath_rate_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
1675{ 1675{
1676 return hw->priv; 1676 struct ath_wiphy *aphy = hw->priv;
1677 return aphy->sc;
1677} 1678}
1678 1679
1679static void ath_rate_free(void *priv) 1680static void ath_rate_free(void *priv)
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c
index 23b6f54cde5c..ec535834f961 100644
--- a/drivers/net/wireless/ath9k/recv.c
+++ b/drivers/net/wireless/ath9k/recv.c
@@ -16,6 +16,12 @@
16 16
17#include "ath9k.h" 17#include "ath9k.h"
18 18
19static struct ieee80211_hw * ath_get_virt_hw(struct ath_softc *sc,
20 struct ieee80211_hdr *hdr)
21{
22 return sc->pri_wiphy->hw;
23}
24
19/* 25/*
20 * Setup and link descriptors. 26 * Setup and link descriptors.
21 * 27 *
@@ -123,10 +129,12 @@ static int ath_rx_prepare(struct sk_buff *skb, struct ath_desc *ds,
123 struct ieee80211_hdr *hdr; 129 struct ieee80211_hdr *hdr;
124 u8 ratecode; 130 u8 ratecode;
125 __le16 fc; 131 __le16 fc;
132 struct ieee80211_hw *hw;
126 133
127 hdr = (struct ieee80211_hdr *)skb->data; 134 hdr = (struct ieee80211_hdr *)skb->data;
128 fc = hdr->frame_control; 135 fc = hdr->frame_control;
129 memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); 136 memset(rx_status, 0, sizeof(struct ieee80211_rx_status));
137 hw = ath_get_virt_hw(sc, hdr);
130 138
131 if (ds->ds_rxstat.rs_more) { 139 if (ds->ds_rxstat.rs_more) {
132 /* 140 /*
@@ -186,7 +194,6 @@ static int ath_rx_prepare(struct sk_buff *skb, struct ath_desc *ds,
186 rx_status->rate_idx = ratecode & 0x7f; 194 rx_status->rate_idx = ratecode & 0x7f;
187 } else { 195 } else {
188 int i = 0, cur_band, n_rates; 196 int i = 0, cur_band, n_rates;
189 struct ieee80211_hw *hw = sc->hw;
190 197
191 cur_band = hw->conf.channel->band; 198 cur_band = hw->conf.channel->band;
192 n_rates = sc->sbands[cur_band].n_bitrates; 199 n_rates = sc->sbands[cur_band].n_bitrates;
@@ -208,8 +215,8 @@ static int ath_rx_prepare(struct sk_buff *skb, struct ath_desc *ds,
208 } 215 }
209 216
210 rx_status->mactime = ath_extend_tsf(sc, ds->ds_rxstat.rs_tstamp); 217 rx_status->mactime = ath_extend_tsf(sc, ds->ds_rxstat.rs_tstamp);
211 rx_status->band = sc->hw->conf.channel->band; 218 rx_status->band = hw->conf.channel->band;
212 rx_status->freq = sc->hw->conf.channel->center_freq; 219 rx_status->freq = hw->conf.channel->center_freq;
213 rx_status->noise = sc->ani.noise_floor; 220 rx_status->noise = sc->ani.noise_floor;
214 rx_status->signal = rx_status->noise + ds->ds_rxstat.rs_rssi; 221 rx_status->signal = rx_status->noise + ds->ds_rxstat.rs_rssi;
215 rx_status->antenna = ds->ds_rxstat.rs_antenna; 222 rx_status->antenna = ds->ds_rxstat.rs_antenna;
@@ -604,7 +611,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
604 } 611 }
605 612
606 /* Send the frame to mac80211 */ 613 /* Send the frame to mac80211 */
607 __ieee80211_rx(sc->hw, skb, &rx_status); 614 __ieee80211_rx(ath_get_virt_hw(sc, hdr), skb, &rx_status);
608 615
609 /* We will now give hardware our shiny new allocated skb */ 616 /* We will now give hardware our shiny new allocated skb */
610 bf->bf_mpdu = requeue_skb; 617 bf->bf_mpdu = requeue_skb;
diff --git a/drivers/net/wireless/ath9k/regd.c b/drivers/net/wireless/ath9k/regd.c
index f7d7cc24a129..639da975bf54 100644
--- a/drivers/net/wireless/ath9k/regd.c
+++ b/drivers/net/wireless/ath9k/regd.c
@@ -311,7 +311,8 @@ void ath9k_reg_apply_radar_flags(struct wiphy *wiphy)
311void ath9k_reg_apply_world_flags(struct wiphy *wiphy, enum reg_set_by setby) 311void ath9k_reg_apply_world_flags(struct wiphy *wiphy, enum reg_set_by setby)
312{ 312{
313 struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); 313 struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
314 struct ath_softc *sc = hw->priv; 314 struct ath_wiphy *aphy = hw->priv;
315 struct ath_softc *sc = aphy->sc;
315 struct ath_hw *ah = sc->sc_ah; 316 struct ath_hw *ah = sc->sc_ah;
316 317
317 switch (ah->regulatory.regpair->regDmnEnum) { 318 switch (ah->regulatory.regpair->regDmnEnum) {
@@ -332,7 +333,8 @@ void ath9k_reg_apply_world_flags(struct wiphy *wiphy, enum reg_set_by setby)
332int ath9k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) 333int ath9k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request)
333{ 334{
334 struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); 335 struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
335 struct ath_softc *sc = hw->priv; 336 struct ath_wiphy *aphy = hw->priv;
337 struct ath_softc *sc = aphy->sc;
336 338
337 /* We always apply this */ 339 /* We always apply this */
338 ath9k_reg_apply_radar_flags(wiphy); 340 ath9k_reg_apply_radar_flags(wiphy);
diff --git a/drivers/net/wireless/ath9k/virtual.c b/drivers/net/wireless/ath9k/virtual.c
index 52d5021f39f9..a91f2f1c911b 100644
--- a/drivers/net/wireless/ath9k/virtual.c
+++ b/drivers/net/wireless/ath9k/virtual.c
@@ -38,7 +38,8 @@ static void ath9k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
38 38
39void ath9k_set_bssid_mask(struct ieee80211_hw *hw) 39void ath9k_set_bssid_mask(struct ieee80211_hw *hw)
40{ 40{
41 struct ath_softc *sc = hw->priv; 41 struct ath_wiphy *aphy = hw->priv;
42 struct ath_softc *sc = aphy->sc;
42 struct ath9k_vif_iter_data iter_data; 43 struct ath9k_vif_iter_data iter_data;
43 int i, j; 44 int i, j;
44 u8 mask[ETH_ALEN]; 45 u8 mask[ETH_ALEN];