diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
| -rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945.c | 15 | ||||
| -rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945.h | 1 | ||||
| -rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 2 | ||||
| -rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-5000-hw.h | 14 | ||||
| -rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-5000.c | 7 | ||||
| -rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 2 | ||||
| -rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 6 | ||||
| -rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-csr.h | 8 | ||||
| -rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 13 | ||||
| -rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-eeprom.c | 37 | ||||
| -rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-eeprom.h | 4 | ||||
| -rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-hcmd.c | 2 | ||||
| -rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-rx.c | 56 | ||||
| -rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-scan.c | 3 | ||||
| -rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-sta.c | 8 | ||||
| -rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-tx.c | 3 | ||||
| -rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 68 |
17 files changed, 80 insertions, 169 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 7da1dab933d9..234891d8cc10 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
| @@ -681,19 +681,13 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv, | |||
| 681 | snr = rx_stats_sig_avg / rx_stats_noise_diff; | 681 | snr = rx_stats_sig_avg / rx_stats_noise_diff; |
| 682 | rx_status.noise = rx_status.signal - | 682 | rx_status.noise = rx_status.signal - |
| 683 | iwl3945_calc_db_from_ratio(snr); | 683 | iwl3945_calc_db_from_ratio(snr); |
| 684 | rx_status.qual = iwl3945_calc_sig_qual(rx_status.signal, | ||
| 685 | rx_status.noise); | ||
| 686 | |||
| 687 | /* If noise info not available, calculate signal quality indicator (%) | ||
| 688 | * using just the dBm signal level. */ | ||
| 689 | } else { | 684 | } else { |
| 690 | rx_status.noise = priv->last_rx_noise; | 685 | rx_status.noise = priv->last_rx_noise; |
| 691 | rx_status.qual = iwl3945_calc_sig_qual(rx_status.signal, 0); | ||
| 692 | } | 686 | } |
| 693 | 687 | ||
| 694 | 688 | ||
| 695 | IWL_DEBUG_STATS(priv, "Rssi %d noise %d qual %d sig_avg %d noise_diff %d\n", | 689 | IWL_DEBUG_STATS(priv, "Rssi %d noise %d sig_avg %d noise_diff %d\n", |
| 696 | rx_status.signal, rx_status.noise, rx_status.qual, | 690 | rx_status.signal, rx_status.noise, |
| 697 | rx_stats_sig_avg, rx_stats_noise_diff); | 691 | rx_stats_sig_avg, rx_stats_noise_diff); |
| 698 | 692 | ||
| 699 | header = (struct ieee80211_hdr *)IWL_RX_DATA(pkt); | 693 | header = (struct ieee80211_hdr *)IWL_RX_DATA(pkt); |
| @@ -1835,8 +1829,7 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv) | |||
| 1835 | rc = -EIO; | 1829 | rc = -EIO; |
| 1836 | } | 1830 | } |
| 1837 | 1831 | ||
| 1838 | priv->alloc_rxb_page--; | 1832 | iwl_free_pages(priv, cmd.reply_page); |
| 1839 | free_pages(cmd.reply_page, priv->hw_params.rx_page_order); | ||
| 1840 | 1833 | ||
| 1841 | return rc; | 1834 | return rc; |
| 1842 | } | 1835 | } |
| @@ -2836,6 +2829,7 @@ static struct iwl_cfg iwl3945_bg_cfg = { | |||
| 2836 | .use_isr_legacy = true, | 2829 | .use_isr_legacy = true, |
| 2837 | .ht_greenfield_support = false, | 2830 | .ht_greenfield_support = false, |
| 2838 | .led_compensation = 64, | 2831 | .led_compensation = 64, |
| 2832 | .broken_powersave = true, | ||
| 2839 | }; | 2833 | }; |
| 2840 | 2834 | ||
| 2841 | static struct iwl_cfg iwl3945_abg_cfg = { | 2835 | static struct iwl_cfg iwl3945_abg_cfg = { |
| @@ -2852,6 +2846,7 @@ static struct iwl_cfg iwl3945_abg_cfg = { | |||
| 2852 | .use_isr_legacy = true, | 2846 | .use_isr_legacy = true, |
| 2853 | .ht_greenfield_support = false, | 2847 | .ht_greenfield_support = false, |
| 2854 | .led_compensation = 64, | 2848 | .led_compensation = 64, |
| 2849 | .broken_powersave = true, | ||
| 2855 | }; | 2850 | }; |
| 2856 | 2851 | ||
| 2857 | struct pci_device_id iwl3945_hw_card_ids[] = { | 2852 | struct pci_device_id iwl3945_hw_card_ids[] = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index ecc23ec1f6a4..531fa125f5a6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h | |||
| @@ -222,7 +222,6 @@ struct iwl3945_ibss_seq { | |||
| 222 | * | 222 | * |
| 223 | *****************************************************************************/ | 223 | *****************************************************************************/ |
| 224 | extern int iwl3945_calc_db_from_ratio(int sig_ratio); | 224 | extern int iwl3945_calc_db_from_ratio(int sig_ratio); |
| 225 | extern int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm); | ||
| 226 | extern void iwl3945_rx_replenish(void *data); | 225 | extern void iwl3945_rx_replenish(void *data); |
| 227 | extern void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq); | 226 | extern void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq); |
| 228 | extern unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv, | 227 | extern unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 386513b601f5..484c5fdf7c2a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
| @@ -1204,7 +1204,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, | |||
| 1204 | iwl4965_interpolate_chan(priv, channel, &ch_eeprom_info); | 1204 | iwl4965_interpolate_chan(priv, channel, &ch_eeprom_info); |
| 1205 | 1205 | ||
| 1206 | /* calculate tx gain adjustment based on power supply voltage */ | 1206 | /* calculate tx gain adjustment based on power supply voltage */ |
| 1207 | voltage = priv->calib_info->voltage; | 1207 | voltage = le16_to_cpu(priv->calib_info->voltage); |
| 1208 | init_voltage = (s32)le32_to_cpu(priv->card_alive_init.voltage); | 1208 | init_voltage = (s32)le32_to_cpu(priv->card_alive_init.voltage); |
| 1209 | voltage_compensation = | 1209 | voltage_compensation = |
| 1210 | iwl4965_get_voltage_compensation(voltage, init_voltage); | 1210 | iwl4965_get_voltage_compensation(voltage, init_voltage); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h index 4ef6804a455a..bc056e9ab85f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h | |||
| @@ -92,11 +92,15 @@ | |||
| 92 | 92 | ||
| 93 | static inline s32 iwl_temp_calib_to_offset(struct iwl_priv *priv) | 93 | static inline s32 iwl_temp_calib_to_offset(struct iwl_priv *priv) |
| 94 | { | 94 | { |
| 95 | u16 *temp_calib = (u16 *)iwl_eeprom_query_addr(priv, | 95 | u16 temperature, voltage; |
| 96 | EEPROM_5000_TEMPERATURE); | 96 | __le16 *temp_calib = |
| 97 | /* offset = temperature - voltage / coef */ | 97 | (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_TEMPERATURE); |
| 98 | s32 offset = (s32)(temp_calib[0] - temp_calib[1] / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF); | 98 | |
| 99 | return offset; | 99 | temperature = le16_to_cpu(temp_calib[0]); |
| 100 | voltage = le16_to_cpu(temp_calib[1]); | ||
| 101 | |||
| 102 | /* offset = temp - volt / coeff */ | ||
| 103 | return (s32)(temperature - voltage / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF); | ||
| 100 | } | 104 | } |
| 101 | 105 | ||
| 102 | /* Fixed (non-configurable) rx data from phy */ | 106 | /* Fixed (non-configurable) rx data from phy */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index e2f8615c8c9b..33a5866538e7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
| @@ -333,14 +333,15 @@ static void iwl5000_set_ct_threshold(struct iwl_priv *priv) | |||
| 333 | static int iwl5000_set_Xtal_calib(struct iwl_priv *priv) | 333 | static int iwl5000_set_Xtal_calib(struct iwl_priv *priv) |
| 334 | { | 334 | { |
| 335 | struct iwl_calib_xtal_freq_cmd cmd; | 335 | struct iwl_calib_xtal_freq_cmd cmd; |
| 336 | u16 *xtal_calib = (u16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_XTAL); | 336 | __le16 *xtal_calib = |
| 337 | (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_XTAL); | ||
| 337 | 338 | ||
| 338 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD; | 339 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD; |
| 339 | cmd.hdr.first_group = 0; | 340 | cmd.hdr.first_group = 0; |
| 340 | cmd.hdr.groups_num = 1; | 341 | cmd.hdr.groups_num = 1; |
| 341 | cmd.hdr.data_valid = 1; | 342 | cmd.hdr.data_valid = 1; |
| 342 | cmd.cap_pin1 = (u8)xtal_calib[0]; | 343 | cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]); |
| 343 | cmd.cap_pin2 = (u8)xtal_calib[1]; | 344 | cmd.cap_pin2 = le16_to_cpu(xtal_calib[1]); |
| 344 | return iwl_calib_set(&priv->calib_results[IWL_CALIB_XTAL], | 345 | return iwl_calib_set(&priv->calib_results[IWL_CALIB_XTAL], |
| 345 | (u8 *)&cmd, sizeof(cmd)); | 346 | (u8 *)&cmd, sizeof(cmd)); |
| 346 | } | 347 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c index fe511cbf012e..b93e49158196 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c | |||
| @@ -150,7 +150,7 @@ static s32 expected_tpt_mimo3_40MHz[4][IWL_RATE_COUNT] = { | |||
| 150 | }; | 150 | }; |
| 151 | 151 | ||
| 152 | /* mbps, mcs */ | 152 | /* mbps, mcs */ |
| 153 | const static struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = { | 153 | static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = { |
| 154 | { "1", "BPSK DSSS"}, | 154 | { "1", "BPSK DSSS"}, |
| 155 | { "2", "QPSK DSSS"}, | 155 | { "2", "QPSK DSSS"}, |
| 156 | {"5.5", "BPSK CCK"}, | 156 | {"5.5", "BPSK CCK"}, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index b8377efb3ba7..1c9866daf815 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
| @@ -1842,7 +1842,7 @@ void iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log) | |||
| 1842 | } | 1842 | } |
| 1843 | 1843 | ||
| 1844 | #ifdef CONFIG_IWLWIFI_DEBUG | 1844 | #ifdef CONFIG_IWLWIFI_DEBUG |
| 1845 | if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS)) | 1845 | if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) && !full_log) |
| 1846 | size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES) | 1846 | size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES) |
| 1847 | ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size; | 1847 | ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size; |
| 1848 | #else | 1848 | #else |
| @@ -3173,7 +3173,6 @@ static int iwl_init_drv(struct iwl_priv *priv) | |||
| 3173 | 3173 | ||
| 3174 | priv->ibss_beacon = NULL; | 3174 | priv->ibss_beacon = NULL; |
| 3175 | 3175 | ||
| 3176 | spin_lock_init(&priv->lock); | ||
| 3177 | spin_lock_init(&priv->sta_lock); | 3176 | spin_lock_init(&priv->sta_lock); |
| 3178 | spin_lock_init(&priv->hcmd_lock); | 3177 | spin_lock_init(&priv->hcmd_lock); |
| 3179 | 3178 | ||
| @@ -3361,10 +3360,11 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 3361 | (unsigned long long) pci_resource_len(pdev, 0)); | 3360 | (unsigned long long) pci_resource_len(pdev, 0)); |
| 3362 | IWL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base); | 3361 | IWL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base); |
| 3363 | 3362 | ||
| 3364 | /* this spin lock will be used in apm_ops.init and EEPROM access | 3363 | /* these spin locks will be used in apm_ops.init and EEPROM access |
| 3365 | * we should init now | 3364 | * we should init now |
| 3366 | */ | 3365 | */ |
| 3367 | spin_lock_init(&priv->reg_lock); | 3366 | spin_lock_init(&priv->reg_lock); |
| 3367 | spin_lock_init(&priv->lock); | ||
| 3368 | iwl_hw_detect(priv); | 3368 | iwl_hw_detect(priv); |
| 3369 | IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s REV=0x%X\n", | 3369 | IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s REV=0x%X\n", |
| 3370 | priv->cfg->name, priv->hw_rev); | 3370 | priv->cfg->name, priv->hw_rev); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-csr.h b/drivers/net/wireless/iwlwifi/iwl-csr.h index a7bfae01f19b..1ec8cb4d5eae 100644 --- a/drivers/net/wireless/iwlwifi/iwl-csr.h +++ b/drivers/net/wireless/iwlwifi/iwl-csr.h | |||
| @@ -77,8 +77,7 @@ | |||
| 77 | * The MAC (uCode processor, etc.) does not need to be powered up for accessing | 77 | * The MAC (uCode processor, etc.) does not need to be powered up for accessing |
| 78 | * the CSR registers. | 78 | * the CSR registers. |
| 79 | * | 79 | * |
| 80 | * NOTE: Newer devices using one-time-programmable (OTP) memory | 80 | * NOTE: Device does need to be awake in order to read this memory |
| 81 | * require device to be awake in order to read this memory | ||
| 82 | * via CSR_EEPROM and CSR_OTP registers | 81 | * via CSR_EEPROM and CSR_OTP registers |
| 83 | */ | 82 | */ |
| 84 | #define CSR_BASE (0x000) | 83 | #define CSR_BASE (0x000) |
| @@ -111,9 +110,8 @@ | |||
| 111 | /* | 110 | /* |
| 112 | * EEPROM and OTP (one-time-programmable) memory reads | 111 | * EEPROM and OTP (one-time-programmable) memory reads |
| 113 | * | 112 | * |
| 114 | * NOTE: For (newer) devices using OTP, device must be awake, initialized via | 113 | * NOTE: Device must be awake, initialized via apm_ops.init(), |
| 115 | * apm_ops.init() in order to read. Older devices (3945/4965/5000) | 114 | * in order to read. |
| 116 | * use EEPROM and do not require this. | ||
| 117 | */ | 115 | */ |
| 118 | #define CSR_EEPROM_REG (CSR_BASE+0x02c) | 116 | #define CSR_EEPROM_REG (CSR_BASE+0x02c) |
| 119 | #define CSR_EEPROM_GP (CSR_BASE+0x030) | 117 | #define CSR_EEPROM_GP (CSR_BASE+0x030) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 2673e9a4db92..165d1f6e2dd9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
| @@ -1168,7 +1168,7 @@ struct iwl_priv { | |||
| 1168 | u32 last_beacon_time; | 1168 | u32 last_beacon_time; |
| 1169 | u64 last_tsf; | 1169 | u64 last_tsf; |
| 1170 | 1170 | ||
| 1171 | /* eeprom */ | 1171 | /* eeprom -- this is in the card's little endian byte order */ |
| 1172 | u8 *eeprom; | 1172 | u8 *eeprom; |
| 1173 | int nvm_device_type; | 1173 | int nvm_device_type; |
| 1174 | struct iwl_eeprom_calib_info *calib_info; | 1174 | struct iwl_eeprom_calib_info *calib_info; |
| @@ -1353,4 +1353,15 @@ static inline int is_channel_ibss(const struct iwl_channel_info *ch) | |||
| 1353 | return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0; | 1353 | return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0; |
| 1354 | } | 1354 | } |
| 1355 | 1355 | ||
| 1356 | static inline void __iwl_free_pages(struct iwl_priv *priv, struct page *page) | ||
| 1357 | { | ||
| 1358 | __free_pages(page, priv->hw_params.rx_page_order); | ||
| 1359 | priv->alloc_rxb_page--; | ||
| 1360 | } | ||
| 1361 | |||
| 1362 | static inline void iwl_free_pages(struct iwl_priv *priv, unsigned long page) | ||
| 1363 | { | ||
| 1364 | free_pages(page, priv->hw_params.rx_page_order); | ||
| 1365 | priv->alloc_rxb_page--; | ||
| 1366 | } | ||
| 1356 | #endif /* __iwl_dev_h__ */ | 1367 | #endif /* __iwl_dev_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c index 3946e5c03f81..4a30969689ff 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c | |||
| @@ -370,7 +370,7 @@ static int iwl_init_otp_access(struct iwl_priv *priv) | |||
| 370 | return ret; | 370 | return ret; |
| 371 | } | 371 | } |
| 372 | 372 | ||
| 373 | static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, u16 *eeprom_data) | 373 | static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, __le16 *eeprom_data) |
| 374 | { | 374 | { |
| 375 | int ret = 0; | 375 | int ret = 0; |
| 376 | u32 r; | 376 | u32 r; |
| @@ -404,7 +404,7 @@ static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, u16 *eeprom_data) | |||
| 404 | CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK); | 404 | CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK); |
| 405 | IWL_ERR(priv, "Correctable OTP ECC error, continue read\n"); | 405 | IWL_ERR(priv, "Correctable OTP ECC error, continue read\n"); |
| 406 | } | 406 | } |
| 407 | *eeprom_data = le16_to_cpu((__force __le16)(r >> 16)); | 407 | *eeprom_data = cpu_to_le16(r >> 16); |
| 408 | return 0; | 408 | return 0; |
| 409 | } | 409 | } |
| 410 | 410 | ||
| @@ -413,7 +413,8 @@ static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, u16 *eeprom_data) | |||
| 413 | */ | 413 | */ |
| 414 | static bool iwl_is_otp_empty(struct iwl_priv *priv) | 414 | static bool iwl_is_otp_empty(struct iwl_priv *priv) |
| 415 | { | 415 | { |
| 416 | u16 next_link_addr = 0, link_value; | 416 | u16 next_link_addr = 0; |
| 417 | __le16 link_value; | ||
| 417 | bool is_empty = false; | 418 | bool is_empty = false; |
| 418 | 419 | ||
| 419 | /* locate the beginning of OTP link list */ | 420 | /* locate the beginning of OTP link list */ |
| @@ -443,7 +444,8 @@ static bool iwl_is_otp_empty(struct iwl_priv *priv) | |||
| 443 | static int iwl_find_otp_image(struct iwl_priv *priv, | 444 | static int iwl_find_otp_image(struct iwl_priv *priv, |
| 444 | u16 *validblockaddr) | 445 | u16 *validblockaddr) |
| 445 | { | 446 | { |
| 446 | u16 next_link_addr = 0, link_value = 0, valid_addr; | 447 | u16 next_link_addr = 0, valid_addr; |
| 448 | __le16 link_value = 0; | ||
| 447 | int usedblocks = 0; | 449 | int usedblocks = 0; |
| 448 | 450 | ||
| 449 | /* set addressing mode to absolute to traverse the link list */ | 451 | /* set addressing mode to absolute to traverse the link list */ |
| @@ -463,7 +465,7 @@ static int iwl_find_otp_image(struct iwl_priv *priv, | |||
| 463 | * check for more block on the link list | 465 | * check for more block on the link list |
| 464 | */ | 466 | */ |
| 465 | valid_addr = next_link_addr; | 467 | valid_addr = next_link_addr; |
| 466 | next_link_addr = link_value * sizeof(u16); | 468 | next_link_addr = le16_to_cpu(link_value) * sizeof(u16); |
| 467 | IWL_DEBUG_INFO(priv, "OTP blocks %d addr 0x%x\n", | 469 | IWL_DEBUG_INFO(priv, "OTP blocks %d addr 0x%x\n", |
| 468 | usedblocks, next_link_addr); | 470 | usedblocks, next_link_addr); |
| 469 | if (iwl_read_otp_word(priv, next_link_addr, &link_value)) | 471 | if (iwl_read_otp_word(priv, next_link_addr, &link_value)) |
| @@ -497,7 +499,7 @@ static int iwl_find_otp_image(struct iwl_priv *priv, | |||
| 497 | */ | 499 | */ |
| 498 | int iwl_eeprom_init(struct iwl_priv *priv) | 500 | int iwl_eeprom_init(struct iwl_priv *priv) |
| 499 | { | 501 | { |
| 500 | u16 *e; | 502 | __le16 *e; |
| 501 | u32 gp = iwl_read32(priv, CSR_EEPROM_GP); | 503 | u32 gp = iwl_read32(priv, CSR_EEPROM_GP); |
| 502 | int sz; | 504 | int sz; |
| 503 | int ret; | 505 | int ret; |
| @@ -516,12 +518,9 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
| 516 | ret = -ENOMEM; | 518 | ret = -ENOMEM; |
| 517 | goto alloc_err; | 519 | goto alloc_err; |
| 518 | } | 520 | } |
| 519 | e = (u16 *)priv->eeprom; | 521 | e = (__le16 *)priv->eeprom; |
| 520 | 522 | ||
| 521 | if (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) { | 523 | priv->cfg->ops->lib->apm_ops.init(priv); |
| 522 | /* OTP reads require powered-up chip */ | ||
| 523 | priv->cfg->ops->lib->apm_ops.init(priv); | ||
| 524 | } | ||
| 525 | 524 | ||
| 526 | ret = priv->cfg->ops->lib->eeprom_ops.verify_signature(priv); | 525 | ret = priv->cfg->ops->lib->eeprom_ops.verify_signature(priv); |
| 527 | if (ret < 0) { | 526 | if (ret < 0) { |
| @@ -562,7 +561,7 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
| 562 | } | 561 | } |
| 563 | for (addr = validblockaddr; addr < validblockaddr + sz; | 562 | for (addr = validblockaddr; addr < validblockaddr + sz; |
| 564 | addr += sizeof(u16)) { | 563 | addr += sizeof(u16)) { |
| 565 | u16 eeprom_data; | 564 | __le16 eeprom_data; |
| 566 | 565 | ||
| 567 | ret = iwl_read_otp_word(priv, addr, &eeprom_data); | 566 | ret = iwl_read_otp_word(priv, addr, &eeprom_data); |
| 568 | if (ret) | 567 | if (ret) |
| @@ -570,13 +569,6 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
| 570 | e[cache_addr / 2] = eeprom_data; | 569 | e[cache_addr / 2] = eeprom_data; |
| 571 | cache_addr += sizeof(u16); | 570 | cache_addr += sizeof(u16); |
| 572 | } | 571 | } |
| 573 | |||
| 574 | /* | ||
| 575 | * Now that OTP reads are complete, reset chip to save | ||
| 576 | * power until we load uCode during "up". | ||
| 577 | */ | ||
| 578 | priv->cfg->ops->lib->apm_ops.stop(priv); | ||
| 579 | |||
| 580 | } else { | 572 | } else { |
| 581 | /* eeprom is an array of 16bit values */ | 573 | /* eeprom is an array of 16bit values */ |
| 582 | for (addr = 0; addr < sz; addr += sizeof(u16)) { | 574 | for (addr = 0; addr < sz; addr += sizeof(u16)) { |
| @@ -594,7 +586,7 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
| 594 | goto done; | 586 | goto done; |
| 595 | } | 587 | } |
| 596 | r = _iwl_read_direct32(priv, CSR_EEPROM_REG); | 588 | r = _iwl_read_direct32(priv, CSR_EEPROM_REG); |
| 597 | e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16)); | 589 | e[addr / 2] = cpu_to_le16(r >> 16); |
| 598 | } | 590 | } |
| 599 | } | 591 | } |
| 600 | ret = 0; | 592 | ret = 0; |
| @@ -603,6 +595,8 @@ done: | |||
| 603 | err: | 595 | err: |
| 604 | if (ret) | 596 | if (ret) |
| 605 | iwl_eeprom_free(priv); | 597 | iwl_eeprom_free(priv); |
| 598 | /* Reset chip to save power until we load uCode during "up". */ | ||
| 599 | priv->cfg->ops->lib->apm_ops.stop(priv); | ||
| 606 | alloc_err: | 600 | alloc_err: |
| 607 | return ret; | 601 | return ret; |
| 608 | } | 602 | } |
| @@ -755,7 +749,8 @@ static int iwl_mod_ht40_chan_info(struct iwl_priv *priv, | |||
| 755 | ch_info->ht40_eeprom = *eeprom_ch; | 749 | ch_info->ht40_eeprom = *eeprom_ch; |
| 756 | ch_info->ht40_max_power_avg = eeprom_ch->max_power_avg; | 750 | ch_info->ht40_max_power_avg = eeprom_ch->max_power_avg; |
| 757 | ch_info->ht40_flags = eeprom_ch->flags; | 751 | ch_info->ht40_flags = eeprom_ch->flags; |
| 758 | ch_info->ht40_extension_channel &= ~clear_ht40_extension_channel; | 752 | if (eeprom_ch->flags & EEPROM_CHANNEL_VALID) |
| 753 | ch_info->ht40_extension_channel &= ~clear_ht40_extension_channel; | ||
| 759 | 754 | ||
| 760 | return 0; | 755 | return 0; |
| 761 | } | 756 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h index 5cd2b66bbe45..0cd9c02ee044 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h | |||
| @@ -137,7 +137,7 @@ struct iwl_eeprom_channel { | |||
| 137 | * | 137 | * |
| 138 | */ | 138 | */ |
| 139 | struct iwl_eeprom_enhanced_txpwr { | 139 | struct iwl_eeprom_enhanced_txpwr { |
| 140 | u16 common; | 140 | __le16 common; |
| 141 | s8 chain_a_max; | 141 | s8 chain_a_max; |
| 142 | s8 chain_b_max; | 142 | s8 chain_b_max; |
| 143 | s8 chain_c_max; | 143 | s8 chain_c_max; |
| @@ -360,7 +360,7 @@ struct iwl_eeprom_calib_subband_info { | |||
| 360 | struct iwl_eeprom_calib_info { | 360 | struct iwl_eeprom_calib_info { |
| 361 | u8 saturation_power24; /* half-dBm (e.g. "34" = 17 dBm) */ | 361 | u8 saturation_power24; /* half-dBm (e.g. "34" = 17 dBm) */ |
| 362 | u8 saturation_power52; /* half-dBm */ | 362 | u8 saturation_power52; /* half-dBm */ |
| 363 | s16 voltage; /* signed */ | 363 | __le16 voltage; /* signed */ |
| 364 | struct iwl_eeprom_calib_subband_info | 364 | struct iwl_eeprom_calib_subband_info |
| 365 | band_info[EEPROM_TX_POWER_BANDS]; | 365 | band_info[EEPROM_TX_POWER_BANDS]; |
| 366 | } __attribute__ ((packed)); | 366 | } __attribute__ ((packed)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c index a23165948202..30e9ea6d54ec 100644 --- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c +++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c | |||
| @@ -234,7 +234,7 @@ cancel: | |||
| 234 | } | 234 | } |
| 235 | fail: | 235 | fail: |
| 236 | if (cmd->reply_page) { | 236 | if (cmd->reply_page) { |
| 237 | free_pages(cmd->reply_page, priv->hw_params.rx_page_order); | 237 | iwl_free_pages(priv, cmd->reply_page); |
| 238 | cmd->reply_page = 0; | 238 | cmd->reply_page = 0; |
| 239 | } | 239 | } |
| 240 | out: | 240 | out: |
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index 6090bc15a6d5..6f36b6e79f5e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
| @@ -345,10 +345,8 @@ void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | |||
| 345 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 345 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, |
| 346 | PAGE_SIZE << priv->hw_params.rx_page_order, | 346 | PAGE_SIZE << priv->hw_params.rx_page_order, |
| 347 | PCI_DMA_FROMDEVICE); | 347 | PCI_DMA_FROMDEVICE); |
| 348 | __free_pages(rxq->pool[i].page, | 348 | __iwl_free_pages(priv, rxq->pool[i].page); |
| 349 | priv->hw_params.rx_page_order); | ||
| 350 | rxq->pool[i].page = NULL; | 349 | rxq->pool[i].page = NULL; |
| 351 | priv->alloc_rxb_page--; | ||
| 352 | } | 350 | } |
| 353 | } | 351 | } |
| 354 | 352 | ||
| @@ -416,9 +414,7 @@ void iwl_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | |||
| 416 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 414 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, |
| 417 | PAGE_SIZE << priv->hw_params.rx_page_order, | 415 | PAGE_SIZE << priv->hw_params.rx_page_order, |
| 418 | PCI_DMA_FROMDEVICE); | 416 | PCI_DMA_FROMDEVICE); |
| 419 | priv->alloc_rxb_page--; | 417 | __iwl_free_pages(priv, rxq->pool[i].page); |
| 420 | __free_pages(rxq->pool[i].page, | ||
| 421 | priv->hw_params.rx_page_order); | ||
| 422 | rxq->pool[i].page = NULL; | 418 | rxq->pool[i].page = NULL; |
| 423 | } | 419 | } |
| 424 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); | 420 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); |
| @@ -654,47 +650,6 @@ void iwl_reply_statistics(struct iwl_priv *priv, | |||
| 654 | } | 650 | } |
| 655 | EXPORT_SYMBOL(iwl_reply_statistics); | 651 | EXPORT_SYMBOL(iwl_reply_statistics); |
| 656 | 652 | ||
| 657 | #define PERFECT_RSSI (-20) /* dBm */ | ||
| 658 | #define WORST_RSSI (-95) /* dBm */ | ||
| 659 | #define RSSI_RANGE (PERFECT_RSSI - WORST_RSSI) | ||
| 660 | |||
| 661 | /* Calculate an indication of rx signal quality (a percentage, not dBm!). | ||
| 662 | * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info | ||
| 663 | * about formulas used below. */ | ||
| 664 | static int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm) | ||
| 665 | { | ||
| 666 | int sig_qual; | ||
| 667 | int degradation = PERFECT_RSSI - rssi_dbm; | ||
| 668 | |||
| 669 | /* If we get a noise measurement, use signal-to-noise ratio (SNR) | ||
| 670 | * as indicator; formula is (signal dbm - noise dbm). | ||
| 671 | * SNR at or above 40 is a great signal (100%). | ||
| 672 | * Below that, scale to fit SNR of 0 - 40 dB within 0 - 100% indicator. | ||
| 673 | * Weakest usable signal is usually 10 - 15 dB SNR. */ | ||
| 674 | if (noise_dbm) { | ||
| 675 | if (rssi_dbm - noise_dbm >= 40) | ||
| 676 | return 100; | ||
| 677 | else if (rssi_dbm < noise_dbm) | ||
| 678 | return 0; | ||
| 679 | sig_qual = ((rssi_dbm - noise_dbm) * 5) / 2; | ||
| 680 | |||
| 681 | /* Else use just the signal level. | ||
| 682 | * This formula is a least squares fit of data points collected and | ||
| 683 | * compared with a reference system that had a percentage (%) display | ||
| 684 | * for signal quality. */ | ||
| 685 | } else | ||
| 686 | sig_qual = (100 * (RSSI_RANGE * RSSI_RANGE) - degradation * | ||
| 687 | (15 * RSSI_RANGE + 62 * degradation)) / | ||
| 688 | (RSSI_RANGE * RSSI_RANGE); | ||
| 689 | |||
| 690 | if (sig_qual > 100) | ||
| 691 | sig_qual = 100; | ||
| 692 | else if (sig_qual < 1) | ||
| 693 | sig_qual = 0; | ||
| 694 | |||
| 695 | return sig_qual; | ||
| 696 | } | ||
| 697 | |||
| 698 | /* Calc max signal level (dBm) among 3 possible receivers */ | 653 | /* Calc max signal level (dBm) among 3 possible receivers */ |
| 699 | static inline int iwl_calc_rssi(struct iwl_priv *priv, | 654 | static inline int iwl_calc_rssi(struct iwl_priv *priv, |
| 700 | struct iwl_rx_phy_res *rx_resp) | 655 | struct iwl_rx_phy_res *rx_resp) |
| @@ -1105,11 +1060,8 @@ void iwl_rx_reply_rx(struct iwl_priv *priv, | |||
| 1105 | if (iwl_is_associated(priv) && | 1060 | if (iwl_is_associated(priv) && |
| 1106 | !test_bit(STATUS_SCANNING, &priv->status)) { | 1061 | !test_bit(STATUS_SCANNING, &priv->status)) { |
| 1107 | rx_status.noise = priv->last_rx_noise; | 1062 | rx_status.noise = priv->last_rx_noise; |
| 1108 | rx_status.qual = iwl_calc_sig_qual(rx_status.signal, | ||
| 1109 | rx_status.noise); | ||
| 1110 | } else { | 1063 | } else { |
| 1111 | rx_status.noise = IWL_NOISE_MEAS_NOT_AVAILABLE; | 1064 | rx_status.noise = IWL_NOISE_MEAS_NOT_AVAILABLE; |
| 1112 | rx_status.qual = iwl_calc_sig_qual(rx_status.signal, 0); | ||
| 1113 | } | 1065 | } |
| 1114 | 1066 | ||
| 1115 | /* Reset beacon noise level if not associated. */ | 1067 | /* Reset beacon noise level if not associated. */ |
| @@ -1122,8 +1074,8 @@ void iwl_rx_reply_rx(struct iwl_priv *priv, | |||
| 1122 | iwl_dbg_report_frame(priv, phy_res, len, header, 1); | 1074 | iwl_dbg_report_frame(priv, phy_res, len, header, 1); |
| 1123 | #endif | 1075 | #endif |
| 1124 | iwl_dbg_log_rx_data_frame(priv, len, header); | 1076 | iwl_dbg_log_rx_data_frame(priv, len, header); |
| 1125 | IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, noise %d, qual %d, TSF %llu\n", | 1077 | IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, noise %d, TSF %llu\n", |
| 1126 | rx_status.signal, rx_status.noise, rx_status.qual, | 1078 | rx_status.signal, rx_status.noise, |
| 1127 | (unsigned long long)rx_status.mactime); | 1079 | (unsigned long long)rx_status.mactime); |
| 1128 | 1080 | ||
| 1129 | /* | 1081 | /* |
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index a2b2b8315ff9..fa1c89ba6459 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
| @@ -144,8 +144,7 @@ static int iwl_send_scan_abort(struct iwl_priv *priv) | |||
| 144 | clear_bit(STATUS_SCAN_HW, &priv->status); | 144 | clear_bit(STATUS_SCAN_HW, &priv->status); |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | priv->alloc_rxb_page--; | 147 | iwl_free_pages(priv, cmd.reply_page); |
| 148 | free_pages(cmd.reply_page, priv->hw_params.rx_page_order); | ||
| 149 | 148 | ||
| 150 | return ret; | 149 | return ret; |
| 151 | } | 150 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c index cd6a6901216e..cde09a890b73 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c | |||
| @@ -164,9 +164,7 @@ int iwl_send_add_sta(struct iwl_priv *priv, | |||
| 164 | break; | 164 | break; |
| 165 | } | 165 | } |
| 166 | } | 166 | } |
| 167 | 167 | iwl_free_pages(priv, cmd.reply_page); | |
| 168 | priv->alloc_rxb_page--; | ||
| 169 | free_pages(cmd.reply_page, priv->hw_params.rx_page_order); | ||
| 170 | 168 | ||
| 171 | return ret; | 169 | return ret; |
| 172 | } | 170 | } |
| @@ -391,9 +389,7 @@ static int iwl_send_remove_station(struct iwl_priv *priv, const u8 *addr, | |||
| 391 | break; | 389 | break; |
| 392 | } | 390 | } |
| 393 | } | 391 | } |
| 394 | 392 | iwl_free_pages(priv, cmd.reply_page); | |
| 395 | priv->alloc_rxb_page--; | ||
| 396 | free_pages(cmd.reply_page, priv->hw_params.rx_page_order); | ||
| 397 | 393 | ||
| 398 | return ret; | 394 | return ret; |
| 399 | } | 395 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index 00da5e152d46..87ce2bd292c7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c | |||
| @@ -407,13 +407,14 @@ void iwl_hw_txq_ctx_free(struct iwl_priv *priv) | |||
| 407 | int txq_id; | 407 | int txq_id; |
| 408 | 408 | ||
| 409 | /* Tx queues */ | 409 | /* Tx queues */ |
| 410 | if (priv->txq) | 410 | if (priv->txq) { |
| 411 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; | 411 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; |
| 412 | txq_id++) | 412 | txq_id++) |
| 413 | if (txq_id == IWL_CMD_QUEUE_NUM) | 413 | if (txq_id == IWL_CMD_QUEUE_NUM) |
| 414 | iwl_cmd_queue_free(priv); | 414 | iwl_cmd_queue_free(priv); |
| 415 | else | 415 | else |
| 416 | iwl_tx_queue_free(priv, txq_id); | 416 | iwl_tx_queue_free(priv, txq_id); |
| 417 | } | ||
| 417 | iwl_free_dma_ptr(priv, &priv->kw); | 418 | iwl_free_dma_ptr(priv, &priv->kw); |
| 418 | 419 | ||
| 419 | iwl_free_dma_ptr(priv, &priv->scd_bc_tbls); | 420 | iwl_free_dma_ptr(priv, &priv->scd_bc_tbls); |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 2a28a1f8b1fe..f8e4e4b18d02 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
| @@ -548,6 +548,9 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
| 548 | txq = &priv->txq[txq_id]; | 548 | txq = &priv->txq[txq_id]; |
| 549 | q = &txq->q; | 549 | q = &txq->q; |
| 550 | 550 | ||
| 551 | if ((iwl_queue_space(q) < q->high_mark)) | ||
| 552 | goto drop; | ||
| 553 | |||
| 551 | spin_lock_irqsave(&priv->lock, flags); | 554 | spin_lock_irqsave(&priv->lock, flags); |
| 552 | 555 | ||
| 553 | idx = get_cmd_index(q, q->write_ptr, 0); | 556 | idx = get_cmd_index(q, q->write_ptr, 0); |
| @@ -812,7 +815,7 @@ static int iwl3945_get_measurement(struct iwl_priv *priv, | |||
| 812 | break; | 815 | break; |
| 813 | } | 816 | } |
| 814 | 817 | ||
| 815 | free_pages(cmd.reply_page, priv->hw_params.rx_page_order); | 818 | iwl_free_pages(priv, cmd.reply_page); |
| 816 | 819 | ||
| 817 | return rc; | 820 | return rc; |
| 818 | } | 821 | } |
| @@ -1198,9 +1201,7 @@ void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | |||
| 1198 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 1201 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, |
| 1199 | PAGE_SIZE << priv->hw_params.rx_page_order, | 1202 | PAGE_SIZE << priv->hw_params.rx_page_order, |
| 1200 | PCI_DMA_FROMDEVICE); | 1203 | PCI_DMA_FROMDEVICE); |
| 1201 | priv->alloc_rxb_page--; | 1204 | __iwl_free_pages(priv, rxq->pool[i].page); |
| 1202 | __free_pages(rxq->pool[i].page, | ||
| 1203 | priv->hw_params.rx_page_order); | ||
| 1204 | rxq->pool[i].page = NULL; | 1205 | rxq->pool[i].page = NULL; |
| 1205 | } | 1206 | } |
| 1206 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); | 1207 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); |
| @@ -1247,10 +1248,8 @@ static void iwl3945_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rx | |||
| 1247 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 1248 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, |
| 1248 | PAGE_SIZE << priv->hw_params.rx_page_order, | 1249 | PAGE_SIZE << priv->hw_params.rx_page_order, |
| 1249 | PCI_DMA_FROMDEVICE); | 1250 | PCI_DMA_FROMDEVICE); |
| 1250 | __free_pages(rxq->pool[i].page, | 1251 | __iwl_free_pages(priv, rxq->pool[i].page); |
| 1251 | priv->hw_params.rx_page_order); | ||
| 1252 | rxq->pool[i].page = NULL; | 1252 | rxq->pool[i].page = NULL; |
| 1253 | priv->alloc_rxb_page--; | ||
| 1254 | } | 1253 | } |
| 1255 | } | 1254 | } |
| 1256 | 1255 | ||
| @@ -1300,47 +1299,6 @@ int iwl3945_calc_db_from_ratio(int sig_ratio) | |||
| 1300 | return (int)ratio2dB[sig_ratio]; | 1299 | return (int)ratio2dB[sig_ratio]; |
| 1301 | } | 1300 | } |
| 1302 | 1301 | ||
| 1303 | #define PERFECT_RSSI (-20) /* dBm */ | ||
| 1304 | #define WORST_RSSI (-95) /* dBm */ | ||
| 1305 | #define RSSI_RANGE (PERFECT_RSSI - WORST_RSSI) | ||
| 1306 | |||
| 1307 | /* Calculate an indication of rx signal quality (a percentage, not dBm!). | ||
| 1308 | * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info | ||
| 1309 | * about formulas used below. */ | ||
| 1310 | int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm) | ||
| 1311 | { | ||
| 1312 | int sig_qual; | ||
| 1313 | int degradation = PERFECT_RSSI - rssi_dbm; | ||
| 1314 | |||
| 1315 | /* If we get a noise measurement, use signal-to-noise ratio (SNR) | ||
| 1316 | * as indicator; formula is (signal dbm - noise dbm). | ||
| 1317 | * SNR at or above 40 is a great signal (100%). | ||
| 1318 | * Below that, scale to fit SNR of 0 - 40 dB within 0 - 100% indicator. | ||
| 1319 | * Weakest usable signal is usually 10 - 15 dB SNR. */ | ||
| 1320 | if (noise_dbm) { | ||
| 1321 | if (rssi_dbm - noise_dbm >= 40) | ||
| 1322 | return 100; | ||
| 1323 | else if (rssi_dbm < noise_dbm) | ||
| 1324 | return 0; | ||
| 1325 | sig_qual = ((rssi_dbm - noise_dbm) * 5) / 2; | ||
| 1326 | |||
| 1327 | /* Else use just the signal level. | ||
| 1328 | * This formula is a least squares fit of data points collected and | ||
| 1329 | * compared with a reference system that had a percentage (%) display | ||
| 1330 | * for signal quality. */ | ||
| 1331 | } else | ||
| 1332 | sig_qual = (100 * (RSSI_RANGE * RSSI_RANGE) - degradation * | ||
| 1333 | (15 * RSSI_RANGE + 62 * degradation)) / | ||
| 1334 | (RSSI_RANGE * RSSI_RANGE); | ||
| 1335 | |||
| 1336 | if (sig_qual > 100) | ||
| 1337 | sig_qual = 100; | ||
| 1338 | else if (sig_qual < 1) | ||
| 1339 | sig_qual = 0; | ||
| 1340 | |||
| 1341 | return sig_qual; | ||
| 1342 | } | ||
| 1343 | |||
| 1344 | /** | 1302 | /** |
| 1345 | * iwl3945_rx_handle - Main entry function for receiving responses from uCode | 1303 | * iwl3945_rx_handle - Main entry function for receiving responses from uCode |
| 1346 | * | 1304 | * |
| @@ -1688,7 +1646,7 @@ void iwl3945_dump_nic_event_log(struct iwl_priv *priv, bool full_log) | |||
| 1688 | } | 1646 | } |
| 1689 | 1647 | ||
| 1690 | #ifdef CONFIG_IWLWIFI_DEBUG | 1648 | #ifdef CONFIG_IWLWIFI_DEBUG |
| 1691 | if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS)) | 1649 | if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) && !full_log) |
| 1692 | size = (size > DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES) | 1650 | size = (size > DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES) |
| 1693 | ? DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES : size; | 1651 | ? DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES : size; |
| 1694 | #else | 1652 | #else |
| @@ -3867,7 +3825,6 @@ static int iwl3945_init_drv(struct iwl_priv *priv) | |||
| 3867 | priv->retry_rate = 1; | 3825 | priv->retry_rate = 1; |
| 3868 | priv->ibss_beacon = NULL; | 3826 | priv->ibss_beacon = NULL; |
| 3869 | 3827 | ||
| 3870 | spin_lock_init(&priv->lock); | ||
| 3871 | spin_lock_init(&priv->sta_lock); | 3828 | spin_lock_init(&priv->sta_lock); |
| 3872 | spin_lock_init(&priv->hcmd_lock); | 3829 | spin_lock_init(&priv->hcmd_lock); |
| 3873 | 3830 | ||
| @@ -3936,9 +3893,11 @@ static int iwl3945_setup_mac(struct iwl_priv *priv) | |||
| 3936 | /* Tell mac80211 our characteristics */ | 3893 | /* Tell mac80211 our characteristics */ |
| 3937 | hw->flags = IEEE80211_HW_SIGNAL_DBM | | 3894 | hw->flags = IEEE80211_HW_SIGNAL_DBM | |
| 3938 | IEEE80211_HW_NOISE_DBM | | 3895 | IEEE80211_HW_NOISE_DBM | |
| 3939 | IEEE80211_HW_SPECTRUM_MGMT | | 3896 | IEEE80211_HW_SPECTRUM_MGMT; |
| 3940 | IEEE80211_HW_SUPPORTS_PS | | 3897 | |
| 3941 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS; | 3898 | if (!priv->cfg->broken_powersave) |
| 3899 | hw->flags |= IEEE80211_HW_SUPPORTS_PS | | ||
| 3900 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS; | ||
| 3942 | 3901 | ||
| 3943 | hw->wiphy->interface_modes = | 3902 | hw->wiphy->interface_modes = |
| 3944 | BIT(NL80211_IFTYPE_STATION) | | 3903 | BIT(NL80211_IFTYPE_STATION) | |
| @@ -4057,10 +4016,11 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
| 4057 | * PCI Tx retries from interfering with C3 CPU state */ | 4016 | * PCI Tx retries from interfering with C3 CPU state */ |
| 4058 | pci_write_config_byte(pdev, 0x41, 0x00); | 4017 | pci_write_config_byte(pdev, 0x41, 0x00); |
| 4059 | 4018 | ||
| 4060 | /* this spin lock will be used in apm_ops.init and EEPROM access | 4019 | /* these spin locks will be used in apm_ops.init and EEPROM access |
| 4061 | * we should init now | 4020 | * we should init now |
| 4062 | */ | 4021 | */ |
| 4063 | spin_lock_init(&priv->reg_lock); | 4022 | spin_lock_init(&priv->reg_lock); |
| 4023 | spin_lock_init(&priv->lock); | ||
| 4064 | 4024 | ||
| 4065 | /*********************** | 4025 | /*********************** |
| 4066 | * 4. Read EEPROM | 4026 | * 4. Read EEPROM |
