aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/pci.c
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 /drivers/net/wireless/ath9k/pci.c
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>
Diffstat (limited to 'drivers/net/wireless/ath9k/pci.c')
-rw-r--r--drivers/net/wireless/ath9k/pci.c19
1 files changed, 14 insertions, 5 deletions
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