···16781678 /* Get the current SSID */16791679 if (priv->new_SSID_size != 0) {16801680 memcpy(extra, priv->new_SSID, priv->new_SSID_size);16811681- extra[priv->new_SSID_size] = '\0';16821681 dwrq->length = priv->new_SSID_size;16831682 } else {16841683 memcpy(extra, priv->SSID, priv->SSID_size);16851685- extra[priv->SSID_size] = '\0';16861684 dwrq->length = priv->SSID_size;16871685 }16881686
+23-5
drivers/net/wireless/bcm43xx/bcm43xx_dma.c
···705705 struct bcm43xx_dmaring *ring;706706 int err = -ENOMEM;707707 int dma64 = 0;708708- u32 sbtmstatehi;708708+ u64 mask = bcm43xx_get_supported_dma_mask(bcm);709709+ int nobits;709710710710- sbtmstatehi = bcm43xx_read32(bcm, BCM43xx_CIR_SBTMSTATEHIGH);711711- if (sbtmstatehi & BCM43xx_SBTMSTATEHIGH_DMA64BIT)711711+ if (mask == DMA_64BIT_MASK) {712712 dma64 = 1;713713+ nobits = 64;714714+ } else if (mask == DMA_32BIT_MASK)715715+ nobits = 32;716716+ else717717+ nobits = 30;718718+ err = pci_set_dma_mask(bcm->pci_dev, mask);719719+ err |= pci_set_consistent_dma_mask(bcm->pci_dev, mask);720720+ if (err) {721721+#ifdef CONFIG_BCM43XX_PIO722722+ printk(KERN_WARNING PFX "DMA not supported on this device."723723+ " Falling back to PIO.\n");724724+ bcm->__using_pio = 1;725725+ return -ENOSYS;726726+#else727727+ printk(KERN_ERR PFX "FATAL: DMA not supported and PIO not configured. "728728+ "Please recompile the driver with PIO support.\n");729729+ return -ENODEV;730730+#endif /* CONFIG_BCM43XX_PIO */731731+ }713732714733 /* setup TX DMA channels. */715734 ring = bcm43xx_setup_dmaring(bcm, 0, 1, dma64);···774755 dma->rx_ring3 = ring;775756 }776757777777- dprintk(KERN_INFO PFX "%s DMA initialized\n",778778- dma64 ? "64-bit" : "32-bit");758758+ dprintk(KERN_INFO PFX "%d-bit DMA initialized\n", nobits);779759 err = 0;780760out:781761 return err;
+17
drivers/net/wireless/bcm43xx/bcm43xx_dma.h
···314314 struct ieee80211_txb *txb);315315void bcm43xx_dma_rx(struct bcm43xx_dmaring *ring);316316317317+/* Helper function that returns the dma mask for this device. */318318+static inline319319+u64 bcm43xx_get_supported_dma_mask(struct bcm43xx_private *bcm)320320+{321321+ int dma64 = bcm43xx_read32(bcm, BCM43xx_CIR_SBTMSTATEHIGH) &322322+ BCM43xx_SBTMSTATEHIGH_DMA64BIT;323323+ u16 mmio_base = bcm43xx_dmacontroller_base(dma64, 0);324324+ u32 mask = BCM43xx_DMA32_TXADDREXT_MASK;325325+326326+ if (dma64)327327+ return DMA_64BIT_MASK;328328+ bcm43xx_write32(bcm, mmio_base + BCM43xx_DMA32_TXCTL, mask);329329+ if (bcm43xx_read32(bcm, mmio_base + BCM43xx_DMA32_TXCTL) & mask)330330+ return DMA_32BIT_MASK;331331+ return DMA_30BIT_MASK;332332+}333333+317334#else /* CONFIG_BCM43XX_DMA */318335319336
+1-1
drivers/net/wireless/bcm43xx/bcm43xx_leds.c
···242242 //TODO243243 break;244244 case BCM43xx_LED_ASSOC:245245- if (bcm->softmac->associated)245245+ if (bcm->softmac->associnfo.associated)246246 turn_on = 1;247247 break;248248#ifdef CONFIG_BCM43XX_DEBUG
+12-22
drivers/net/wireless/bcm43xx/bcm43xx_main.c
···29252925 bcm43xx_write16(bcm, 0x043C, 0x000C);2926292629272927 if (active_wlcore) {29282928- if (bcm43xx_using_pio(bcm))29282928+ if (bcm43xx_using_pio(bcm)) {29292929 err = bcm43xx_pio_init(bcm);29302930- else29302930+ } else {29312931 err = bcm43xx_dma_init(bcm);29322932+ if (err == -ENOSYS)29332933+ err = bcm43xx_pio_init(bcm);29342934+ }29322935 if (err)29332936 goto err_chip_cleanup;29342937 }···31673164 u32 savedirqs = 0;31683165 int badness;3169316631673167+ mutex_lock(&bcm->mutex);31703168 badness = estimate_periodic_work_badness(bcm->periodic_state);31713169 if (badness > BADNESS_LIMIT) {31723170 /* Periodic work will take a long time, so we want it to31733171 * be preemtible.31743172 */31753175- mutex_lock(&bcm->mutex);31763173 netif_tx_disable(bcm->net_dev);31773174 spin_lock_irqsave(&bcm->irq_lock, flags);31783175 bcm43xx_mac_suspend(bcm);···31853182 /* Periodic work should take short time, so we want low31863183 * locking overhead.31873184 */31883188- mutex_lock(&bcm->mutex);31893185 spin_lock_irqsave(&bcm->irq_lock, flags);31903186 }31913187···39953993 struct net_device *net_dev,39963994 struct pci_dev *pci_dev)39973995{39983998- int err;39993999-40003996 bcm43xx_set_status(bcm, BCM43xx_STAT_UNINIT);40013997 bcm->ieee = netdev_priv(net_dev);40023998 bcm->softmac = ieee80211_priv(net_dev);···40124012 (void (*)(unsigned long))bcm43xx_interrupt_tasklet,40134013 (unsigned long)bcm);40144014 tasklet_disable_nosync(&bcm->isr_tasklet);40154015- if (modparam_pio) {40154015+ if (modparam_pio)40164016 bcm->__using_pio = 1;40174017- } else {40184018- err = pci_set_dma_mask(pci_dev, DMA_30BIT_MASK);40194019- err |= pci_set_consistent_dma_mask(pci_dev, DMA_30BIT_MASK);40204020- if (err) {40214021-#ifdef CONFIG_BCM43XX_PIO40224022- printk(KERN_WARNING PFX "DMA not supported. Falling back to PIO.\n");40234023- bcm->__using_pio = 1;40244024-#else40254025- printk(KERN_ERR PFX "FATAL: DMA not supported and PIO not configured. "40264026- "Recompile the driver with PIO support, please.\n");40274027- return -ENODEV;40284028-#endif /* CONFIG_BCM43XX_PIO */40294029- }40304030- }40314017 bcm->rts_threshold = BCM43xx_DEFAULT_RTS_THRESHOLD;4032401840334019 /* default to sw encryption for now */···41944208 dprintk(KERN_INFO PFX "Resuming...\n");4195420941964210 pci_set_power_state(pdev, 0);41974197- pci_enable_device(pdev);42114211+ err = pci_enable_device(pdev);42124212+ if (err) {42134213+ printk(KERN_ERR PFX "Failure with pci_enable_device!\n");42144214+ return err;42154215+ }41984216 pci_restore_state(pdev);4199421742004218 bcm43xx_chipset_attach(bcm);
+1-1
drivers/net/wireless/bcm43xx/bcm43xx_wx.c
···847847 unsigned long flags;848848849849 wstats = &bcm->stats.wstats;850850- if (!mac->associated) {850850+ if (!mac->associnfo.associated) {851851 wstats->miss.beacon = 0;852852// bcm->ieee->ieee_stats.tx_retry_limit_exceeded = 0; // FIXME: should this be cleared here?853853 wstats->discard.retries = 0;
···1198119811991199 /* Get the essid that was set */12001200 memcpy(extra, local->sparm.b5.a_current_ess_id, IW_ESSID_MAX_SIZE);12011201- extra[IW_ESSID_MAX_SIZE] = '\0';1202120112031202 /* Push it out ! */12041203 dwrq->length = strlen(extra);
···10991099 int r;1100110011011101 spin_lock_irq(&mac->lock);11021102- is_associated = sm->associated != 0;11021102+ is_associated = sm->associnfo.associated != 0;11031103 spin_unlock_irq(&mac->lock);1104110411051105 r = zd_chip_control_leds(chip,
+16-19
include/net/ieee80211softmac.h
···63636464/*6565 * Information about association6666- *6767- * Do we need a lock for this?6868- * We only ever use this structure inlined6969- * into our global struct. I've used its lock,7070- * but maybe we need a local one here?7166 */7267struct ieee80211softmac_assoc_info {6868+6969+ struct mutex mutex;7070+7371 /*7472 * This is the requested ESSID. It is written7573 * only by the WX handlers.···9799 *98100 * bssfixed is used for SIOCSIWAP.99101 */100100- u8 static_essid:1,101101- short_preamble_available:1,102102- associating:1,103103- assoc_wait:1,104104- bssvalid:1,105105- bssfixed:1;102102+ u8 static_essid;103103+ u8 short_preamble_available;104104+ u8 associating;105105+ u8 associated;106106+ u8 assoc_wait;107107+ u8 bssvalid;108108+ u8 bssfixed;106109107110 /* Scan retries remaining */108111 int scan_retry;···228229 /* private stuff follows */229230 /* this lock protects this structure */230231 spinlock_t lock;231231-232232- /* couple of flags */233233- u8 scanning:1, /* protects scanning from being done multiple times at once */234234- associated:1,235235- running:1;236236-232232+233233+ u8 running; /* SoftMAC started? */234234+ u8 scanning;235235+237236 struct ieee80211softmac_scaninfo *scaninfo;238237 struct ieee80211softmac_assoc_info associnfo;239238 struct ieee80211softmac_bss_info bssinfo;···247250248251 /* we need to keep a list of network structs we copied */249252 struct list_head network_list;250250-253253+251254 /* This must be the last item so that it points to the data252255 * allocated beyond this structure by alloc_ieee80211 */253256 u8 priv[0];···292295{293296 struct ieee80211softmac_txrates *txrates = &mac->txrates;294297295295- if (!mac->associated)298298+ if (!mac->associnfo.associated)296299 return txrates->mgt_mcast_rate;297300298301 /* We are associated, sending unicast frame */
+27-29
net/ieee80211/softmac/ieee80211softmac_assoc.c
···4848 dprintk(KERN_INFO PFX "sent association request!\n");49495050 spin_lock_irqsave(&mac->lock, flags);5151- mac->associated = 0; /* just to make sure */5151+ mac->associnfo.associated = 0; /* just to make sure */52525353 /* Set a timer for timeout */5454 /* FIXME: make timeout configurable */···6262{6363 struct ieee80211softmac_device *mac = (struct ieee80211softmac_device *)d;6464 struct ieee80211softmac_network *n;6565- unsigned long flags;66656767- spin_lock_irqsave(&mac->lock, flags);6666+ mutex_lock(&mac->associnfo.mutex);6867 /* we might race against ieee80211softmac_handle_assoc_response,6968 * so make sure only one of us does something */7070- if (!mac->associnfo.associating) {7171- spin_unlock_irqrestore(&mac->lock, flags);7272- return;7373- }6969+ if (!mac->associnfo.associating)7070+ goto out;7471 mac->associnfo.associating = 0;7572 mac->associnfo.bssvalid = 0;7676- mac->associated = 0;7373+ mac->associnfo.associated = 0;77747875 n = ieee80211softmac_get_network_by_bssid_locked(mac, mac->associnfo.bssid);7979- spin_unlock_irqrestore(&mac->lock, flags);80768177 dprintk(KERN_INFO PFX "assoc request timed out!\n");8278 ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_TIMEOUT, n);7979+out:8080+ mutex_unlock(&mac->associnfo.mutex);8381}84828583void···91939294 netif_carrier_off(mac->dev);93959494- mac->associated = 0;9696+ mac->associnfo.associated = 0;9597 mac->associnfo.bssvalid = 0;9698 mac->associnfo.associating = 0;9799 ieee80211softmac_init_bss(mac);···105107{106108 struct ieee80211softmac_network *found;107109108108- if (mac->associnfo.bssvalid && mac->associated) {110110+ if (mac->associnfo.bssvalid && mac->associnfo.associated) {109111 found = ieee80211softmac_get_network_by_bssid(mac, mac->associnfo.bssid);110112 if (found)111113 ieee80211softmac_send_mgt_frame(mac, found, IEEE80211_STYPE_DISASSOC, reason);···194196 int bssvalid;195197 unsigned long flags;196198199199+ mutex_lock(&mac->associnfo.mutex);200200+201201+ if (!mac->associnfo.associating)202202+ goto out;203203+197204 /* ieee80211_disassoc might clear this */198205 bssvalid = mac->associnfo.bssvalid;199206200207 /* meh */201201- if (mac->associated)208208+ if (mac->associnfo.associated)202209 ieee80211softmac_send_disassoc_req(mac, WLAN_REASON_DISASSOC_STA_HAS_LEFT);203203-204204- spin_lock_irqsave(&mac->lock, flags);205205- mac->associnfo.associating = 1;206206- spin_unlock_irqrestore(&mac->lock, flags);207210208211 /* try to find the requested network in our list, if we found one already */209212 if (bssvalid || mac->associnfo.bssfixed)···259260260261 if (!found) {261262 if (mac->associnfo.scan_retry > 0) {262262- spin_lock_irqsave(&mac->lock, flags);263263 mac->associnfo.scan_retry--;264264- spin_unlock_irqrestore(&mac->lock, flags);265265-264264+266265 /* We know of no such network. Let's scan. 267266 * NB: this also happens if we had no memory to copy the network info...268267 * Maybe we can hope to have more memory after scanning finishes ;)···269272 ieee80211softmac_notify(mac->dev, IEEE80211SOFTMAC_EVENT_SCAN_FINISHED, ieee80211softmac_assoc_notify_scan, NULL);270273 if (ieee80211softmac_start_scan(mac))271274 dprintk(KERN_INFO PFX "Associate: failed to initiate scan. Is device up?\n");272272- return;275275+ goto out;273276 } else {274274- spin_lock_irqsave(&mac->lock, flags);275277 mac->associnfo.associating = 0;276276- mac->associated = 0;277277- spin_unlock_irqrestore(&mac->lock, flags);278278+ mac->associnfo.associated = 0;278279279280 dprintk(KERN_INFO PFX "Unable to find matching network after scan!\n");280281 /* reset the retry counter for the next user request since we281282 * break out and don't reschedule ourselves after this point. */282283 mac->associnfo.scan_retry = IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT;283284 ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND, NULL);284284- return;285285+ goto out;285286 }286287 }287288···292297 /* copy the ESSID for displaying it */293298 mac->associnfo.associate_essid.len = found->essid.len;294299 memcpy(mac->associnfo.associate_essid.data, found->essid.data, IW_ESSID_MAX_SIZE + 1);295295-300300+296301 /* we found a network! authenticate (if necessary) and associate to it. */297302 if (found->authenticating) {298303 dprintk(KERN_INFO PFX "Already requested authentication, waiting...\n");···300305 mac->associnfo.assoc_wait = 1;301306 ieee80211softmac_notify_internal(mac, IEEE80211SOFTMAC_EVENT_ANY, found, ieee80211softmac_assoc_notify_auth, NULL, GFP_KERNEL);302307 }303303- return;308308+ goto out;304309 }305310 if (!found->authenticated && !found->authenticating) {306311 /* This relies on the fact that _auth_req only queues the work,···316321 mac->associnfo.assoc_wait = 0;317322 ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_FAILED, found);318323 }319319- return;324324+ goto out;320325 }321326 /* finally! now we can start associating */322327 mac->associnfo.assoc_wait = 0;323328 ieee80211softmac_assoc(mac, found);329329+330330+out:331331+ mutex_unlock(&mac->associnfo.mutex);324332}325333326334/* call this to do whatever is necessary when we're associated */···339341 mac->bssinfo.supported_rates = net->supported_rates;340342 ieee80211softmac_recalc_txrates(mac);341343342342- mac->associated = 1;344344+ mac->associnfo.associated = 1;343345344346 mac->associnfo.short_preamble_available =345347 (cap & WLAN_CAPABILITY_SHORT_PREAMBLE) != 0;···419421 dprintk(KERN_INFO PFX "associating failed (reason: 0x%x)!\n", status);420422 mac->associnfo.associating = 0;421423 mac->associnfo.bssvalid = 0;422422- mac->associated = 0;424424+ mac->associnfo.associated = 0;423425 ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_FAILED, network);424426 }425427
+8-3
net/ieee80211/softmac/ieee80211softmac_io.c
···304304 2 + /* Auth Transaction Seq */305305 2 + /* Status Code */306306 /* Challenge Text IE */307307- is_shared_response ? 0 : 1 + 1 + net->challenge_len307307+ (is_shared_response ? 1 + 1 + net->challenge_len : 0)308308 );309309 if (unlikely((*pkt) == NULL))310310 return 0;···475475{476476 struct ieee80211softmac_device *mac = ieee80211_priv(dev);477477478478- if (mac->associated && memcmp(network->bssid, mac->associnfo.bssid, ETH_ALEN) == 0)479479- ieee80211softmac_process_erp(mac, network->erp_value);478478+ /* This might race, but we don't really care and it's not worth479479+ * adding heavyweight locking in this fastpath.480480+ */481481+ if (mac->associnfo.associated) {482482+ if (memcmp(network->bssid, mac->associnfo.bssid, ETH_ALEN) == 0)483483+ ieee80211softmac_process_erp(mac, network->erp_value);484484+ }480485481486 return 0;482487}