···19031903 rxs->noise = sc->ah->ah_noise_floor;19041904 rxs->signal = rxs->noise + rs.rs_rssi;1905190519061906- /* An rssi of 35 indicates you should be able use19071907- * 54 Mbps reliably. A more elaborate scheme can be used19081908- * here but it requires a map of SNR/throughput for each19091909- * possible mode used */19101910- rxs->qual = rs.rs_rssi * 100 / 35;19111911-19121912- /* rssi can be more than 35 though, anything above that19131913- * should be considered at 100% */19141914- if (rxs->qual > 100)19151915- rxs->qual = 100;19161916-19171906 rxs->antenna = rs.rs_antenna;19181907 rxs->rate_idx = ath5k_hw_to_driver_rix(sc, rs.rs_rate);19191908 rxs->flag |= ath5k_rx_decrypted(sc, ds, skb, &rs);···23702381 */23712382 ath5k_stop_locked(sc);2372238323842384+ /* Set PHY calibration interval */23852385+ ah->ah_cal_intval = ath5k_calinterval;23862386+23732387 /*23742388 * The basic interface to setting the hardware in a good23752389 * state is ``reset''. On return the hardware is known to···2400240824012409 /* Set ack to be sent at low bit-rates */24022410 ath5k_hw_set_ack_bitrate_high(ah, false);24032403-24042404- /* Set PHY calibration inteval */24052405- ah->ah_cal_intval = ath5k_calinterval;24062406-24072411 ret = 0;24082412done:24092413 mmiowb();
···383383 }384384}385385386386-/* Check if a DMA region fits the device constraints.387387- * Returns true, if the region is OK for usage with this device. */388388-static inline bool b43_dma_address_ok(struct b43_dmaring *ring,389389- dma_addr_t addr, size_t size)390390-{391391- switch (ring->type) {392392- case B43_DMA_30BIT:393393- if ((u64)addr + size > (1ULL << 30))394394- return 0;395395- break;396396- case B43_DMA_32BIT:397397- if ((u64)addr + size > (1ULL << 32))398398- return 0;399399- break;400400- case B43_DMA_64BIT:401401- /* Currently we can't have addresses beyond402402- * 64bit in the kernel. */403403- break;404404- }405405- return 1;406406-}407407-408408-#define is_4k_aligned(addr) (((u64)(addr) & 0x0FFFull) == 0)409409-#define is_8k_aligned(addr) (((u64)(addr) & 0x1FFFull) == 0)410410-411411-static void b43_unmap_and_free_ringmem(struct b43_dmaring *ring, void *base,412412- dma_addr_t dmaaddr, size_t size)413413-{414414- ssb_dma_unmap_single(ring->dev->dev, dmaaddr, size, DMA_TO_DEVICE);415415- free_pages((unsigned long)base, get_order(size));416416-}417417-418418-static void * __b43_get_and_map_ringmem(struct b43_dmaring *ring,419419- dma_addr_t *dmaaddr, size_t size,420420- gfp_t gfp_flags)421421-{422422- void *base;423423-424424- base = (void *)__get_free_pages(gfp_flags, get_order(size));425425- if (!base)426426- return NULL;427427- memset(base, 0, size);428428- *dmaaddr = ssb_dma_map_single(ring->dev->dev, base, size,429429- DMA_TO_DEVICE);430430- if (ssb_dma_mapping_error(ring->dev->dev, *dmaaddr)) {431431- free_pages((unsigned long)base, get_order(size));432432- return NULL;433433- }434434-435435- return base;436436-}437437-438438-static void * b43_get_and_map_ringmem(struct b43_dmaring *ring,439439- dma_addr_t *dmaaddr, size_t size)440440-{441441- void *base;442442-443443- base = __b43_get_and_map_ringmem(ring, dmaaddr, size,444444- GFP_KERNEL);445445- if (!base) {446446- b43err(ring->dev->wl, "Failed to allocate or map pages "447447- "for DMA ringmemory\n");448448- return NULL;449449- }450450- if (!b43_dma_address_ok(ring, *dmaaddr, size)) {451451- /* The memory does not fit our device constraints.452452- * Retry with GFP_DMA set to get lower memory. */453453- b43_unmap_and_free_ringmem(ring, base, *dmaaddr, size);454454- base = __b43_get_and_map_ringmem(ring, dmaaddr, size,455455- GFP_KERNEL | GFP_DMA);456456- if (!base) {457457- b43err(ring->dev->wl, "Failed to allocate or map pages "458458- "in the GFP_DMA region for DMA ringmemory\n");459459- return NULL;460460- }461461- if (!b43_dma_address_ok(ring, *dmaaddr, size)) {462462- b43_unmap_and_free_ringmem(ring, base, *dmaaddr, size);463463- b43err(ring->dev->wl, "Failed to allocate DMA "464464- "ringmemory that fits device constraints\n");465465- return NULL;466466- }467467- }468468- /* We expect the memory to be 4k aligned, at least. */469469- if (B43_WARN_ON(!is_4k_aligned(*dmaaddr))) {470470- b43_unmap_and_free_ringmem(ring, base, *dmaaddr, size);471471- return NULL;472472- }473473-474474- return base;475475-}476476-477386static int alloc_ringmemory(struct b43_dmaring *ring)478387{479479- unsigned int required;480480- void *base;481481- dma_addr_t dmaaddr;388388+ gfp_t flags = GFP_KERNEL;482389483483- /* There are several requirements to the descriptor ring memory:484484- * - The memory region needs to fit the address constraints for the485485- * device (same as for frame buffers).486486- * - For 30/32bit DMA devices, the descriptor ring must be 4k aligned.487487- * - For 64bit DMA devices, the descriptor ring must be 8k aligned.390390+ /* The specs call for 4K buffers for 30- and 32-bit DMA with 4K391391+ * alignment and 8K buffers for 64-bit DMA with 8K alignment. Testing392392+ * has shown that 4K is sufficient for the latter as long as the buffer393393+ * does not cross an 8K boundary.394394+ *395395+ * For unknown reasons - possibly a hardware error - the BCM4311 rev396396+ * 02, which uses 64-bit DMA, needs the ring buffer in very low memory,397397+ * which accounts for the GFP_DMA flag below.398398+ *399399+ * The flags here must match the flags in free_ringmemory below!488400 */489489-490401 if (ring->type == B43_DMA_64BIT)491491- required = ring->nr_slots * sizeof(struct b43_dmadesc64);492492- else493493- required = ring->nr_slots * sizeof(struct b43_dmadesc32);494494- if (B43_WARN_ON(required > 0x1000))402402+ flags |= GFP_DMA;403403+ ring->descbase = ssb_dma_alloc_consistent(ring->dev->dev,404404+ B43_DMA_RINGMEMSIZE,405405+ &(ring->dmabase), flags);406406+ if (!ring->descbase) {407407+ b43err(ring->dev->wl, "DMA ringmemory allocation failed\n");495408 return -ENOMEM;496496-497497- ring->alloc_descsize = 0x1000;498498- base = b43_get_and_map_ringmem(ring, &dmaaddr, ring->alloc_descsize);499499- if (!base)500500- return -ENOMEM;501501- ring->alloc_descbase = base;502502- ring->alloc_dmabase = dmaaddr;503503-504504- if ((ring->type != B43_DMA_64BIT) || is_8k_aligned(dmaaddr)) {505505- /* We're on <=32bit DMA, or we already got 8k aligned memory.506506- * That's all we need, so we're fine. */507507- ring->descbase = base;508508- ring->dmabase = dmaaddr;509509- return 0;510409 }511511- b43_unmap_and_free_ringmem(ring, base, dmaaddr, ring->alloc_descsize);512512-513513- /* Ok, we failed at the 8k alignment requirement.514514- * Try to force-align the memory region now. */515515- ring->alloc_descsize = 0x2000;516516- base = b43_get_and_map_ringmem(ring, &dmaaddr, ring->alloc_descsize);517517- if (!base)518518- return -ENOMEM;519519- ring->alloc_descbase = base;520520- ring->alloc_dmabase = dmaaddr;521521-522522- if (is_8k_aligned(dmaaddr)) {523523- /* We're already 8k aligned. That Ok, too. */524524- ring->descbase = base;525525- ring->dmabase = dmaaddr;526526- return 0;527527- }528528- /* Force-align it to 8k */529529- ring->descbase = (void *)((u8 *)base + 0x1000);530530- ring->dmabase = dmaaddr + 0x1000;531531- B43_WARN_ON(!is_8k_aligned(ring->dmabase));410410+ memset(ring->descbase, 0, B43_DMA_RINGMEMSIZE);532411533412 return 0;534413}535414536415static void free_ringmemory(struct b43_dmaring *ring)537416{538538- b43_unmap_and_free_ringmem(ring, ring->alloc_descbase,539539- ring->alloc_dmabase, ring->alloc_descsize);417417+ gfp_t flags = GFP_KERNEL;418418+419419+ if (ring->type == B43_DMA_64BIT)420420+ flags |= GFP_DMA;421421+422422+ ssb_dma_free_consistent(ring->dev->dev, B43_DMA_RINGMEMSIZE,423423+ ring->descbase, ring->dmabase, flags);540424}541425542426/* Reset the RX DMA channel */···530646 if (unlikely(ssb_dma_mapping_error(ring->dev->dev, addr)))531647 return 1;532648533533- if (!b43_dma_address_ok(ring, addr, buffersize)) {534534- /* We can't support this address. Unmap it again. */535535- unmap_descbuffer(ring, addr, buffersize, dma_to_device);536536- return 1;649649+ switch (ring->type) {650650+ case B43_DMA_30BIT:651651+ if ((u64)addr + buffersize > (1ULL << 30))652652+ goto address_error;653653+ break;654654+ case B43_DMA_32BIT:655655+ if ((u64)addr + buffersize > (1ULL << 32))656656+ goto address_error;657657+ break;658658+ case B43_DMA_64BIT:659659+ /* Currently we can't have addresses beyond660660+ * 64bit in the kernel. */661661+ break;537662 }538663539664 /* The address is OK. */540665 return 0;666666+667667+address_error:668668+ /* We can't support this address. Unmap it again. */669669+ unmap_descbuffer(ring, addr, buffersize, dma_to_device);670670+671671+ return 1;541672}542673543674static bool b43_rx_buffer_is_poisoned(struct b43_dmaring *ring, struct sk_buff *skb)···614715 meta->dmaaddr = dmaaddr;615716 ring->ops->fill_descriptor(ring, desc, dmaaddr,616717 ring->rx_buffersize, 0, 0, 0);617617- ssb_dma_sync_single_for_device(ring->dev->dev,618618- ring->alloc_dmabase,619619- ring->alloc_descsize, DMA_TO_DEVICE);620718621719 return 0;622720}···12501354 }12511355 /* Now transfer the whole frame. */12521356 wmb();12531253- ssb_dma_sync_single_for_device(ring->dev->dev,12541254- ring->alloc_dmabase,12551255- ring->alloc_descsize, DMA_TO_DEVICE);12561357 ops->poke_tx(ring, next_slot(ring, slot));12571358 return 0;12581359
+1-6
drivers/net/wireless/b43/dma.h
···157157} __attribute__ ((__packed__));158158159159/* Misc DMA constants */160160+#define B43_DMA_RINGMEMSIZE PAGE_SIZE160161#define B43_DMA0_RX_FRAMEOFFSET 30161162162163/* DMA engine tuning knobs */···247246 /* The QOS priority assigned to this ring. Only used for TX rings.248247 * This is the mac80211 "queue" value. */249248 u8 queue_prio;250250- /* Pointers and size of the originally allocated and mapped memory251251- * region for the descriptor ring. */252252- void *alloc_descbase;253253- dma_addr_t alloc_dmabase;254254- unsigned int alloc_descsize;255255- /* Pointer to our wireless device. */256249 struct b43_wldev *dev;257250#ifdef CONFIG_B43_DEBUG258251 /* Maximum number of used slots. */
+2-8
drivers/net/wireless/iwlwifi/iwl-3945.c
···681681 snr = rx_stats_sig_avg / rx_stats_noise_diff;682682 rx_status.noise = rx_status.signal -683683 iwl3945_calc_db_from_ratio(snr);684684- rx_status.qual = iwl3945_calc_sig_qual(rx_status.signal,685685- rx_status.noise);686686-687687- /* If noise info not available, calculate signal quality indicator (%)688688- * using just the dBm signal level. */689684 } else {690685 rx_status.noise = priv->last_rx_noise;691691- rx_status.qual = iwl3945_calc_sig_qual(rx_status.signal, 0);692686 }693687694688695695- IWL_DEBUG_STATS(priv, "Rssi %d noise %d qual %d sig_avg %d noise_diff %d\n",696696- rx_status.signal, rx_status.noise, rx_status.qual,689689+ IWL_DEBUG_STATS(priv, "Rssi %d noise %d sig_avg %d noise_diff %d\n",690690+ rx_status.signal, rx_status.noise,697691 rx_stats_sig_avg, rx_stats_noise_diff);698692699693 header = (struct ieee80211_hdr *)IWL_RX_DATA(pkt);
-1
drivers/net/wireless/iwlwifi/iwl-3945.h
···222222 *223223 *****************************************************************************/224224extern int iwl3945_calc_db_from_ratio(int sig_ratio);225225-extern int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm);226225extern void iwl3945_rx_replenish(void *data);227226extern void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq);228227extern unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv,
···650650}651651EXPORT_SYMBOL(iwl_reply_statistics);652652653653-#define PERFECT_RSSI (-20) /* dBm */654654-#define WORST_RSSI (-95) /* dBm */655655-#define RSSI_RANGE (PERFECT_RSSI - WORST_RSSI)656656-657657-/* Calculate an indication of rx signal quality (a percentage, not dBm!).658658- * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info659659- * about formulas used below. */660660-static int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm)661661-{662662- int sig_qual;663663- int degradation = PERFECT_RSSI - rssi_dbm;664664-665665- /* If we get a noise measurement, use signal-to-noise ratio (SNR)666666- * as indicator; formula is (signal dbm - noise dbm).667667- * SNR at or above 40 is a great signal (100%).668668- * Below that, scale to fit SNR of 0 - 40 dB within 0 - 100% indicator.669669- * Weakest usable signal is usually 10 - 15 dB SNR. */670670- if (noise_dbm) {671671- if (rssi_dbm - noise_dbm >= 40)672672- return 100;673673- else if (rssi_dbm < noise_dbm)674674- return 0;675675- sig_qual = ((rssi_dbm - noise_dbm) * 5) / 2;676676-677677- /* Else use just the signal level.678678- * This formula is a least squares fit of data points collected and679679- * compared with a reference system that had a percentage (%) display680680- * for signal quality. */681681- } else682682- sig_qual = (100 * (RSSI_RANGE * RSSI_RANGE) - degradation *683683- (15 * RSSI_RANGE + 62 * degradation)) /684684- (RSSI_RANGE * RSSI_RANGE);685685-686686- if (sig_qual > 100)687687- sig_qual = 100;688688- else if (sig_qual < 1)689689- sig_qual = 0;690690-691691- return sig_qual;692692-}693693-694653/* Calc max signal level (dBm) among 3 possible receivers */695654static inline int iwl_calc_rssi(struct iwl_priv *priv,696655 struct iwl_rx_phy_res *rx_resp)···10601101 if (iwl_is_associated(priv) &&10611102 !test_bit(STATUS_SCANNING, &priv->status)) {10621103 rx_status.noise = priv->last_rx_noise;10631063- rx_status.qual = iwl_calc_sig_qual(rx_status.signal,10641064- rx_status.noise);10651104 } else {10661105 rx_status.noise = IWL_NOISE_MEAS_NOT_AVAILABLE;10671067- rx_status.qual = iwl_calc_sig_qual(rx_status.signal, 0);10681106 }1069110710701108 /* Reset beacon noise level if not associated. */···10741118 iwl_dbg_report_frame(priv, phy_res, len, header, 1);10751119#endif10761120 iwl_dbg_log_rx_data_frame(priv, len, header);10771077- IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, noise %d, qual %d, TSF %llu\n",10781078- rx_status.signal, rx_status.noise, rx_status.qual,11211121+ IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, noise %d, TSF %llu\n",11221122+ rx_status.signal, rx_status.noise,10791123 (unsigned long long)rx_status.mactime);1080112410811125 /*
-41
drivers/net/wireless/iwlwifi/iwl3945-base.c
···12991299 return (int)ratio2dB[sig_ratio];13001300}1301130113021302-#define PERFECT_RSSI (-20) /* dBm */13031303-#define WORST_RSSI (-95) /* dBm */13041304-#define RSSI_RANGE (PERFECT_RSSI - WORST_RSSI)13051305-13061306-/* Calculate an indication of rx signal quality (a percentage, not dBm!).13071307- * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info13081308- * about formulas used below. */13091309-int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm)13101310-{13111311- int sig_qual;13121312- int degradation = PERFECT_RSSI - rssi_dbm;13131313-13141314- /* If we get a noise measurement, use signal-to-noise ratio (SNR)13151315- * as indicator; formula is (signal dbm - noise dbm).13161316- * SNR at or above 40 is a great signal (100%).13171317- * Below that, scale to fit SNR of 0 - 40 dB within 0 - 100% indicator.13181318- * Weakest usable signal is usually 10 - 15 dB SNR. */13191319- if (noise_dbm) {13201320- if (rssi_dbm - noise_dbm >= 40)13211321- return 100;13221322- else if (rssi_dbm < noise_dbm)13231323- return 0;13241324- sig_qual = ((rssi_dbm - noise_dbm) * 5) / 2;13251325-13261326- /* Else use just the signal level.13271327- * This formula is a least squares fit of data points collected and13281328- * compared with a reference system that had a percentage (%) display13291329- * for signal quality. */13301330- } else13311331- sig_qual = (100 * (RSSI_RANGE * RSSI_RANGE) - degradation *13321332- (15 * RSSI_RANGE + 62 * degradation)) /13331333- (RSSI_RANGE * RSSI_RANGE);13341334-13351335- if (sig_qual > 100)13361336- sig_qual = 100;13371337- else if (sig_qual < 1)13381338- sig_qual = 0;13391339-13401340- return sig_qual;13411341-}13421342-13431302/**13441303 * iwl3945_rx_handle - Main entry function for receiving responses from uCode13451304 *
···567567 chan_count = lbs_scan_create_channel_list(priv, chan_list);568568569569 netif_stop_queue(priv->dev);570570- netif_carrier_off(priv->dev);571571- if (priv->mesh_dev) {570570+ if (priv->mesh_dev)572571 netif_stop_queue(priv->mesh_dev);573573- netif_carrier_off(priv->mesh_dev);574574- }575572576573 /* Prepare to continue an interrupted scan */577574 lbs_deb_scan("chan_count %d, scan_channel %d\n",···632635 priv->scan_channel = 0;633636634637out:635635- if (priv->connect_status == LBS_CONNECTED) {636636- netif_carrier_on(priv->dev);637637- if (!priv->tx_pending_len)638638- netif_wake_queue(priv->dev);639639- }640640- if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED)) {641641- netif_carrier_on(priv->mesh_dev);642642- if (!priv->tx_pending_len)643643- netif_wake_queue(priv->mesh_dev);644644- }638638+ if (priv->connect_status == LBS_CONNECTED && !priv->tx_pending_len)639639+ netif_wake_queue(priv->dev);640640+641641+ if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED) &&642642+ !priv->tx_pending_len)643643+ netif_wake_queue(priv->mesh_dev);644644+645645 kfree(chan_list);646646647647 lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
-1
drivers/net/wireless/libertas_tf/main.c
···495495 stats.band = IEEE80211_BAND_2GHZ;496496 stats.signal = prxpd->snr;497497 stats.noise = prxpd->nf;498498- stats.qual = prxpd->snr - prxpd->nf;499498 /* Marvell rate index has a hole at value 4 */500499 if (prxpd->rx_rate > 4)501500 --prxpd->rx_rate;
+3-3
drivers/net/wireless/orinoco/wext.c
···2323#define MAX_RID_LEN 102424242525/* Helper routine to record keys2626- * Do not call from interrupt context */2626+ * It is called under orinoco_lock so it may not sleep */2727static int orinoco_set_key(struct orinoco_private *priv, int index,2828 enum orinoco_alg alg, const u8 *key, int key_len,2929 const u8 *seq, int seq_len)···3232 kzfree(priv->keys[index].seq);33333434 if (key_len) {3535- priv->keys[index].key = kzalloc(key_len, GFP_KERNEL);3535+ priv->keys[index].key = kzalloc(key_len, GFP_ATOMIC);3636 if (!priv->keys[index].key)3737 goto nomem;3838 } else3939 priv->keys[index].key = NULL;40404141 if (seq_len) {4242- priv->keys[index].seq = kzalloc(seq_len, GFP_KERNEL);4242+ priv->keys[index].seq = kzalloc(seq_len, GFP_ATOMIC);4343 if (!priv->keys[index].seq)4444 goto free_key;4545 } else
···256256 }257257 }258258259259- if (loop >= INIT_LOOP) {259259+ if (loop > INIT_LOOP) {260260 wl1251_error("timeout waiting for the hardware to "261261 "complete initialization");262262 return -EIO;
+2-2
drivers/net/wireless/wl12xx/wl1271_cmd.c
···777777 return ret;778778}779779780780-static int wl1271_build_basic_rates(char *rates, u8 band)780780+static int wl1271_build_basic_rates(u8 *rates, u8 band)781781{782782 u8 index = 0;783783···804804 return index;805805}806806807807-static int wl1271_build_extended_rates(char *rates, u8 band)807807+static int wl1271_build_extended_rates(u8 *rates, u8 band)808808{809809 u8 index = 0;810810
-140
drivers/net/wireless/zd1211rw/zd_chip.c
···13251325 return r;13261326}1327132713281328-static int ofdm_qual_db(u8 status_quality, u8 zd_rate, unsigned int size)13291329-{13301330- static const u16 constants[] = {13311331- 715, 655, 585, 540, 470, 410, 360, 315,13321332- 270, 235, 205, 175, 150, 125, 105, 85,13331333- 65, 50, 40, 25, 1513341334- };13351335-13361336- int i;13371337- u32 x;13381338-13391339- /* It seems that their quality parameter is somehow per signal13401340- * and is now transferred per bit.13411341- */13421342- switch (zd_rate) {13431343- case ZD_OFDM_RATE_6M:13441344- case ZD_OFDM_RATE_12M:13451345- case ZD_OFDM_RATE_24M:13461346- size *= 2;13471347- break;13481348- case ZD_OFDM_RATE_9M:13491349- case ZD_OFDM_RATE_18M:13501350- case ZD_OFDM_RATE_36M:13511351- case ZD_OFDM_RATE_54M:13521352- size *= 4;13531353- size /= 3;13541354- break;13551355- case ZD_OFDM_RATE_48M:13561356- size *= 3;13571357- size /= 2;13581358- break;13591359- default:13601360- return -EINVAL;13611361- }13621362-13631363- x = (10000 * status_quality)/size;13641364- for (i = 0; i < ARRAY_SIZE(constants); i++) {13651365- if (x > constants[i])13661366- break;13671367- }13681368-13691369- switch (zd_rate) {13701370- case ZD_OFDM_RATE_6M:13711371- case ZD_OFDM_RATE_9M:13721372- i += 3;13731373- break;13741374- case ZD_OFDM_RATE_12M:13751375- case ZD_OFDM_RATE_18M:13761376- i += 5;13771377- break;13781378- case ZD_OFDM_RATE_24M:13791379- case ZD_OFDM_RATE_36M:13801380- i += 9;13811381- break;13821382- case ZD_OFDM_RATE_48M:13831383- case ZD_OFDM_RATE_54M:13841384- i += 15;13851385- break;13861386- default:13871387- return -EINVAL;13881388- }13891389-13901390- return i;13911391-}13921392-13931393-static int ofdm_qual_percent(u8 status_quality, u8 zd_rate, unsigned int size)13941394-{13951395- int r;13961396-13971397- r = ofdm_qual_db(status_quality, zd_rate, size);13981398- ZD_ASSERT(r >= 0);13991399- if (r < 0)14001400- r = 0;14011401-14021402- r = (r * 100)/29;14031403- return r <= 100 ? r : 100;14041404-}14051405-14061406-static unsigned int log10times100(unsigned int x)14071407-{14081408- static const u8 log10[] = {14091409- 0,14101410- 0, 30, 47, 60, 69, 77, 84, 90, 95, 100,14111411- 104, 107, 111, 114, 117, 120, 123, 125, 127, 130,14121412- 132, 134, 136, 138, 139, 141, 143, 144, 146, 147,14131413- 149, 150, 151, 153, 154, 155, 156, 157, 159, 160,14141414- 161, 162, 163, 164, 165, 166, 167, 168, 169, 169,14151415- 170, 171, 172, 173, 174, 174, 175, 176, 177, 177,14161416- 178, 179, 179, 180, 181, 181, 182, 183, 183, 184,14171417- 185, 185, 186, 186, 187, 188, 188, 189, 189, 190,14181418- 190, 191, 191, 192, 192, 193, 193, 194, 194, 195,14191419- 195, 196, 196, 197, 197, 198, 198, 199, 199, 200,14201420- 200, 200, 201, 201, 202, 202, 202, 203, 203, 204,14211421- 204, 204, 205, 205, 206, 206, 206, 207, 207, 207,14221422- 208, 208, 208, 209, 209, 210, 210, 210, 211, 211,14231423- 211, 212, 212, 212, 213, 213, 213, 213, 214, 214,14241424- 214, 215, 215, 215, 216, 216, 216, 217, 217, 217,14251425- 217, 218, 218, 218, 219, 219, 219, 219, 220, 220,14261426- 220, 220, 221, 221, 221, 222, 222, 222, 222, 223,14271427- 223, 223, 223, 224, 224, 224, 224,14281428- };14291429-14301430- return x < ARRAY_SIZE(log10) ? log10[x] : 225;14311431-}14321432-14331433-enum {14341434- MAX_CCK_EVM_DB = 45,14351435-};14361436-14371437-static int cck_evm_db(u8 status_quality)14381438-{14391439- return (20 * log10times100(status_quality)) / 100;14401440-}14411441-14421442-static int cck_snr_db(u8 status_quality)14431443-{14441444- int r = MAX_CCK_EVM_DB - cck_evm_db(status_quality);14451445- ZD_ASSERT(r >= 0);14461446- return r;14471447-}14481448-14491449-static int cck_qual_percent(u8 status_quality)14501450-{14511451- int r;14521452-14531453- r = cck_snr_db(status_quality);14541454- r = (100*r)/17;14551455- return r <= 100 ? r : 100;14561456-}14571457-14581328static inline u8 zd_rate_from_ofdm_plcp_header(const void *rx_frame)14591329{14601330 return ZD_OFDM | zd_ofdm_plcp_header_rate(rx_frame);14611461-}14621462-14631463-u8 zd_rx_qual_percent(const void *rx_frame, unsigned int size,14641464- const struct rx_status *status)14651465-{14661466- return (status->frame_status&ZD_RX_OFDM) ?14671467- ofdm_qual_percent(status->signal_quality_ofdm,14681468- zd_rate_from_ofdm_plcp_header(rx_frame),14691469- size) :14701470- cck_qual_percent(status->signal_quality_cck);14711331}1472133214731333/**
···547547 * unspecified depending on the hardware capabilities flags548548 * @IEEE80211_HW_SIGNAL_*549549 * @noise: noise when receiving this frame, in dBm.550550- * @qual: overall signal quality indication, in percent (0-100).551550 * @antenna: antenna used552551 * @rate_idx: index of data rate into band's supported rates or MCS index if553552 * HT rates are use (RX_FLAG_HT)···558559 int freq;559560 int signal;560561 int noise;561561- int __deprecated qual;562562 int antenna;563563 int rate_idx;564564 int flag;
···1039103910401040 /* restart hardware */10411041 if (local->open_count) {10421042+ /*10431043+ * Upon resume hardware can sometimes be goofy due to10441044+ * various platform / driver / bus issues, so restarting10451045+ * the device may at times not work immediately. Propagate10461046+ * the error.10471047+ */10421048 res = drv_start(local);10491049+ if (res) {10501050+ WARN(local->suspended, "Harware became unavailable "10511051+ "upon resume. This is could be a software issue"10521052+ "prior to suspend or a harware issue\n");10531053+ return res;10541054+ }1043105510441056 ieee80211_led_radio(local, true);10451057 }
+12-1
net/wireless/mlme.c
···9393 }9494 }95959696- WARN_ON(!bss);9696+ /*9797+ * We might be coming here because the driver reported9898+ * a successful association at the same time as the9999+ * user requested a deauth. In that case, we will have100100+ * removed the BSS from the auth_bsses list due to the101101+ * deauth request when the assoc response makes it. If102102+ * the two code paths acquire the lock the other way103103+ * around, that's just the standard situation of a104104+ * deauth being requested while connected.105105+ */106106+ if (!bss)107107+ goto out;97108 } else if (wdev->conn) {98109 cfg80211_sme_failed_assoc(wdev);99110 /*
+9-4
net/wireless/scan.c
···601601 struct cfg80211_registered_device *rdev;602602 struct wiphy *wiphy;603603 struct iw_scan_req *wreq = NULL;604604- struct cfg80211_scan_request *creq;604604+ struct cfg80211_scan_request *creq = NULL;605605 int i, err, n_channels = 0;606606 enum ieee80211_band band;607607···694694 /* translate "Scan for SSID" request */695695 if (wreq) {696696 if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {697697- if (wreq->essid_len > IEEE80211_MAX_SSID_LEN)698698- return -EINVAL;697697+ if (wreq->essid_len > IEEE80211_MAX_SSID_LEN) {698698+ err = -EINVAL;699699+ goto out;700700+ }699701 memcpy(creq->ssids[0].ssid, wreq->essid, wreq->essid_len);700702 creq->ssids[0].ssid_len = wreq->essid_len;701703 }···709707 err = rdev->ops->scan(wiphy, dev, creq);710708 if (err) {711709 rdev->scan_req = NULL;712712- kfree(creq);710710+ /* creq will be freed below */713711 } else {714712 nl80211_send_scan_start(rdev, dev);713713+ /* creq now owned by driver */714714+ creq = NULL;715715 dev_hold(dev);716716 }717717 out:718718+ kfree(creq);718719 cfg80211_unlock_rdev(rdev);719720 return err;720721}