Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6

Conflicts:
drivers/net/wireless/iwlwifi/iwl-core.h
drivers/net/wireless/rt2x00/rt2800pci.c

+3108 -1632
+1 -1
MAINTAINERS
··· 5978 5978 F: drivers/input/misc/wistron_btns.c 5979 5979 5980 5980 WL1251 WIRELESS DRIVER 5981 - M: Kalle Valo <kalle.valo@nokia.com> 5981 + M: Kalle Valo <kalle.valo@iki.fi> 5982 5982 L: linux-wireless@vger.kernel.org 5983 5983 W: http://wireless.kernel.org 5984 5984 T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
+1
drivers/net/wireless/Kconfig
··· 112 112 depends on PCMCIA && (BROKEN || !M32R) 113 113 select WIRELESS_EXT 114 114 select WEXT_SPY 115 + select WEXT_PRIV 115 116 select CRYPTO 116 117 select CRYPTO_AES 117 118 ---help---
+1
drivers/net/wireless/airo.c
··· 51 51 #include <linux/freezer.h> 52 52 53 53 #include <linux/ieee80211.h> 54 + #include <net/iw_handler.h> 54 55 55 56 #include "airo.h" 56 57
+41 -39
drivers/net/wireless/ath/ar9170/main.c
··· 2329 2329 return err; 2330 2330 } 2331 2331 2332 - static void ar9170_sta_notify(struct ieee80211_hw *hw, 2333 - struct ieee80211_vif *vif, 2334 - enum sta_notify_cmd cmd, 2335 - struct ieee80211_sta *sta) 2332 + static int ar9170_sta_add(struct ieee80211_hw *hw, 2333 + struct ieee80211_vif *vif, 2334 + struct ieee80211_sta *sta) 2336 2335 { 2337 2336 struct ar9170 *ar = hw->priv; 2338 2337 struct ar9170_sta_info *sta_info = (void *) sta->drv_priv; 2339 2338 unsigned int i; 2340 2339 2341 - switch (cmd) { 2342 - case STA_NOTIFY_ADD: 2343 - memset(sta_info, 0, sizeof(*sta_info)); 2340 + memset(sta_info, 0, sizeof(*sta_info)); 2344 2341 2345 - if (!sta->ht_cap.ht_supported) 2346 - break; 2342 + if (!sta->ht_cap.ht_supported) 2343 + return 0; 2347 2344 2348 - if (sta->ht_cap.ampdu_density > ar->global_ampdu_density) 2349 - ar->global_ampdu_density = sta->ht_cap.ampdu_density; 2345 + if (sta->ht_cap.ampdu_density > ar->global_ampdu_density) 2346 + ar->global_ampdu_density = sta->ht_cap.ampdu_density; 2350 2347 2351 - if (sta->ht_cap.ampdu_factor < ar->global_ampdu_factor) 2352 - ar->global_ampdu_factor = sta->ht_cap.ampdu_factor; 2348 + if (sta->ht_cap.ampdu_factor < ar->global_ampdu_factor) 2349 + ar->global_ampdu_factor = sta->ht_cap.ampdu_factor; 2353 2350 2354 - for (i = 0; i < AR9170_NUM_TID; i++) { 2355 - sta_info->agg[i].state = AR9170_TID_STATE_SHUTDOWN; 2356 - sta_info->agg[i].active = false; 2357 - sta_info->agg[i].ssn = 0; 2358 - sta_info->agg[i].tid = i; 2359 - INIT_LIST_HEAD(&sta_info->agg[i].list); 2360 - skb_queue_head_init(&sta_info->agg[i].queue); 2361 - } 2362 - 2363 - sta_info->ampdu_max_len = 1 << (3 + sta->ht_cap.ampdu_factor); 2364 - break; 2365 - 2366 - case STA_NOTIFY_REMOVE: 2367 - if (!sta->ht_cap.ht_supported) 2368 - break; 2369 - 2370 - for (i = 0; i < AR9170_NUM_TID; i++) { 2371 - sta_info->agg[i].state = AR9170_TID_STATE_INVALID; 2372 - skb_queue_purge(&sta_info->agg[i].queue); 2373 - } 2374 - 2375 - break; 2376 - 2377 - default: 2378 - break; 2351 + for (i = 0; i < AR9170_NUM_TID; i++) { 2352 + sta_info->agg[i].state = AR9170_TID_STATE_SHUTDOWN; 2353 + sta_info->agg[i].active = false; 2354 + sta_info->agg[i].ssn = 0; 2355 + sta_info->agg[i].tid = i; 2356 + INIT_LIST_HEAD(&sta_info->agg[i].list); 2357 + skb_queue_head_init(&sta_info->agg[i].queue); 2379 2358 } 2359 + 2360 + sta_info->ampdu_max_len = 1 << (3 + sta->ht_cap.ampdu_factor); 2361 + 2362 + return 0; 2363 + } 2364 + 2365 + static int ar9170_sta_remove(struct ieee80211_hw *hw, 2366 + struct ieee80211_vif *vif, 2367 + struct ieee80211_sta *sta) 2368 + { 2369 + struct ar9170_sta_info *sta_info = (void *) sta->drv_priv; 2370 + unsigned int i; 2371 + 2372 + if (!sta->ht_cap.ht_supported) 2373 + return 0; 2374 + 2375 + for (i = 0; i < AR9170_NUM_TID; i++) { 2376 + sta_info->agg[i].state = AR9170_TID_STATE_INVALID; 2377 + skb_queue_purge(&sta_info->agg[i].queue); 2378 + } 2379 + 2380 + return 0; 2380 2381 } 2381 2382 2382 2383 static int ar9170_get_stats(struct ieee80211_hw *hw, ··· 2496 2495 .bss_info_changed = ar9170_op_bss_info_changed, 2497 2496 .get_tsf = ar9170_op_get_tsf, 2498 2497 .set_key = ar9170_set_key, 2499 - .sta_notify = ar9170_sta_notify, 2498 + .sta_add = ar9170_sta_add, 2499 + .sta_remove = ar9170_sta_remove, 2500 2500 .get_stats = ar9170_get_stats, 2501 2501 .ampdu_action = ar9170_ampdu_action, 2502 2502 };
+8 -11
drivers/net/wireless/ath/ath9k/beacon.c
··· 62 62 * Beacons are always sent out at the lowest rate, and are not retried. 63 63 */ 64 64 static void ath_beacon_setup(struct ath_softc *sc, struct ath_vif *avp, 65 - struct ath_buf *bf) 65 + struct ath_buf *bf, int rateidx) 66 66 { 67 67 struct sk_buff *skb = bf->bf_mpdu; 68 68 struct ath_hw *ah = sc->sc_ah; ··· 96 96 ds->ds_data = bf->bf_buf_addr; 97 97 98 98 sband = &sc->sbands[common->hw->conf.channel->band]; 99 - rate = sband->bitrates[0].hw_value; 99 + rate = sband->bitrates[rateidx].hw_value; 100 100 if (sc->sc_flags & SC_OP_PREAMBLE_SHORT) 101 - rate |= sband->bitrates[0].hw_value_short; 101 + rate |= sband->bitrates[rateidx].hw_value_short; 102 102 103 103 ath9k_hw_set11n_txdesc(ah, ds, skb->len + FCS_LEN, 104 104 ATH9K_PKT_TYPE_BEACON, ··· 206 206 } 207 207 } 208 208 209 - ath_beacon_setup(sc, avp, bf); 209 + ath_beacon_setup(sc, avp, bf, info->control.rates[0].idx); 210 210 211 211 while (skb) { 212 212 ath_tx_cabq(hw, skb); ··· 237 237 bf = avp->av_bcbuf; 238 238 skb = bf->bf_mpdu; 239 239 240 - ath_beacon_setup(sc, avp, bf); 240 + ath_beacon_setup(sc, avp, bf, 0); 241 241 242 242 /* NB: caller is known to have already stopped tx dma */ 243 243 ath9k_hw_puttxbuf(ah, sc->beacon.beaconq, bf->bf_daddr); ··· 526 526 { 527 527 u32 nexttbtt, intval; 528 528 529 - /* Configure the timers only when the TSF has to be reset */ 530 - 531 - if (!(sc->sc_flags & SC_OP_TSF_RESET)) 532 - return; 533 - 534 529 /* NB: the beacon interval is kept internally in TU's */ 535 530 intval = conf->beacon_interval & ATH9K_BEACON_PERIOD; 536 531 intval /= ATH_BCBUF; /* for staggered beacons */ 537 532 nexttbtt = intval; 538 - intval |= ATH9K_BEACON_RESET_TSF; 533 + 534 + if (sc->sc_flags & SC_OP_TSF_RESET) 535 + intval |= ATH9K_BEACON_RESET_TSF; 539 536 540 537 /* 541 538 * In AP mode we enable the beacon timers and SWBA interrupts to
+20 -15
drivers/net/wireless/ath/ath9k/main.c
··· 1684 1684 "Set HW RX filter: 0x%x\n", rfilt); 1685 1685 } 1686 1686 1687 - static void ath9k_sta_notify(struct ieee80211_hw *hw, 1688 - struct ieee80211_vif *vif, 1689 - enum sta_notify_cmd cmd, 1690 - struct ieee80211_sta *sta) 1687 + static int ath9k_sta_add(struct ieee80211_hw *hw, 1688 + struct ieee80211_vif *vif, 1689 + struct ieee80211_sta *sta) 1691 1690 { 1692 1691 struct ath_wiphy *aphy = hw->priv; 1693 1692 struct ath_softc *sc = aphy->sc; 1694 1693 1695 - switch (cmd) { 1696 - case STA_NOTIFY_ADD: 1697 - ath_node_attach(sc, sta); 1698 - break; 1699 - case STA_NOTIFY_REMOVE: 1700 - ath_node_detach(sc, sta); 1701 - break; 1702 - default: 1703 - break; 1704 - } 1694 + ath_node_attach(sc, sta); 1695 + 1696 + return 0; 1697 + } 1698 + 1699 + static int ath9k_sta_remove(struct ieee80211_hw *hw, 1700 + struct ieee80211_vif *vif, 1701 + struct ieee80211_sta *sta) 1702 + { 1703 + struct ath_wiphy *aphy = hw->priv; 1704 + struct ath_softc *sc = aphy->sc; 1705 + 1706 + ath_node_detach(sc, sta); 1707 + 1708 + return 0; 1705 1709 } 1706 1710 1707 1711 static int ath9k_conf_tx(struct ieee80211_hw *hw, u16 queue, ··· 2049 2045 .remove_interface = ath9k_remove_interface, 2050 2046 .config = ath9k_config, 2051 2047 .configure_filter = ath9k_configure_filter, 2052 - .sta_notify = ath9k_sta_notify, 2048 + .sta_add = ath9k_sta_add, 2049 + .sta_remove = ath9k_sta_remove, 2053 2050 .conf_tx = ath9k_conf_tx, 2054 2051 .bss_info_changed = ath9k_bss_info_changed, 2055 2052 .set_key = ath9k_set_key,
+7 -8
drivers/net/wireless/ath/ath9k/rc.c
··· 668 668 struct ieee80211_tx_rate *rates = tx_info->control.rates; 669 669 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 670 670 __le16 fc = hdr->frame_control; 671 - u8 try_per_rate, i = 0, rix, nrix; 671 + u8 try_per_rate, i = 0, rix; 672 672 int is_probe = 0; 673 673 674 674 if (rate_control_send_low(sta, priv_sta, txrc)) ··· 688 688 689 689 rate_table = sc->cur_rate_table; 690 690 rix = ath_rc_get_highest_rix(sc, ath_rc_priv, rate_table, &is_probe); 691 - nrix = rix; 692 691 693 692 if (is_probe) { 694 693 /* set one try for probe rates. For the 695 694 * probes don't enable rts */ 696 695 ath_rc_rate_set_series(rate_table, &rates[i++], txrc, 697 - 1, nrix, 0); 696 + 1, rix, 0); 698 697 699 698 /* Get the next tried/allowed rate. No RTS for the next series 700 699 * after the probe rate 701 700 */ 702 - ath_rc_get_lower_rix(rate_table, ath_rc_priv, rix, &nrix); 701 + ath_rc_get_lower_rix(rate_table, ath_rc_priv, rix, &rix); 703 702 ath_rc_rate_set_series(rate_table, &rates[i++], txrc, 704 - try_per_rate, nrix, 0); 703 + try_per_rate, rix, 0); 705 704 706 705 tx_info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; 707 706 } else { 708 707 /* Set the choosen rate. No RTS for first series entry. */ 709 708 ath_rc_rate_set_series(rate_table, &rates[i++], txrc, 710 - try_per_rate, nrix, 0); 709 + try_per_rate, rix, 0); 711 710 } 712 711 713 712 /* Fill in the other rates for multirate retry */ ··· 715 716 if (i + 1 == 4) 716 717 try_per_rate = 8; 717 718 718 - ath_rc_get_lower_rix(rate_table, ath_rc_priv, rix, &nrix); 719 + ath_rc_get_lower_rix(rate_table, ath_rc_priv, rix, &rix); 719 720 /* All other rates in the series have RTS enabled */ 720 721 ath_rc_rate_set_series(rate_table, &rates[i], txrc, 721 - try_per_rate, nrix, 1); 722 + try_per_rate, rix, 1); 722 723 } 723 724 724 725 /*
+1 -1
drivers/net/wireless/b43legacy/leds.h
··· 45 45 void b43legacy_leds_init(struct b43legacy_wldev *dev); 46 46 void b43legacy_leds_exit(struct b43legacy_wldev *dev); 47 47 48 - #else /* CONFIG_B43EGACY_LEDS */ 48 + #else /* CONFIG_B43LEGACY_LEDS */ 49 49 /* LED support disabled */ 50 50 51 51 struct b43legacy_led {
+4 -13
drivers/net/wireless/hostap/hostap_cs.c
··· 794 794 PCMCIA_MFC_DEVICE_PROD_ID12(0, "SanDisk", "ConnectPlus", 795 795 0x7a954bd9, 0x74be00c6), 796 796 PCMCIA_DEVICE_PROD_ID123( 797 - "Intersil", "PRISM 2_5 PCMCIA ADAPTER", "ISL37300P", 798 - 0x4b801a17, 0x6345a0bf, 0xc9049a39), 799 - /* D-Link DWL-650 Rev. P1; manfid 0x000b, 0x7110 */ 800 - PCMCIA_DEVICE_PROD_ID123( 801 - "D-Link", "DWL-650 Wireless PC Card RevP", "ISL37101P-10", 802 - 0x1a424a1c, 0x6ea57632, 0xdd97a26b), 803 - PCMCIA_DEVICE_PROD_ID123( 804 797 "Addtron", "AWP-100 Wireless PCMCIA", "Version 01.02", 805 798 0xe6ec52ce, 0x08649af2, 0x4b74baa0), 806 799 PCMCIA_DEVICE_PROD_ID123( ··· 827 834 "Ver. 1.00", 828 835 0x5cd01705, 0x4271660f, 0x9d08ee12), 829 836 PCMCIA_DEVICE_PROD_ID123( 830 - "corega", "WL PCCL-11", "ISL37300P", 831 - 0xa21501a, 0x59868926, 0xc9049a39), 832 - PCMCIA_DEVICE_PROD_ID123( 833 - "The Linksys Group, Inc.", "Wireless Network CF Card", "ISL37300P", 834 - 0xa5f472c2, 0x9c05598d, 0xc9049a39), 835 - PCMCIA_DEVICE_PROD_ID123( 836 837 "Wireless LAN" , "11Mbps PC Card", "Version 01.02", 837 838 0x4b8870ff, 0x70e946d1, 0x4b74baa0), 839 + PCMCIA_DEVICE_PROD_ID3("HFA3863", 0x355cb092), 840 + PCMCIA_DEVICE_PROD_ID3("ISL37100P", 0x630d52b2), 841 + PCMCIA_DEVICE_PROD_ID3("ISL37101P-10", 0xdd97a26b), 842 + PCMCIA_DEVICE_PROD_ID3("ISL37300P", 0xc9049a39), 838 843 PCMCIA_DEVICE_NULL 839 844 }; 840 845 MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids);
+2 -2
drivers/net/wireless/iwlwifi/iwl-1000.c
··· 246 246 .use_rts_for_ht = true, /* use rts/cts protection */ 247 247 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 248 248 .support_ct_kill_exit = true, 249 - .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 249 + .plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF, 250 250 .chain_noise_scale = 1000, 251 251 }; 252 252 ··· 274 274 .led_compensation = 51, 275 275 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 276 276 .support_ct_kill_exit = true, 277 - .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 277 + .plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF, 278 278 .chain_noise_scale = 1000, 279 279 }; 280 280
+4 -6
drivers/net/wireless/iwlwifi/iwl-3945.c
··· 45 45 #include "iwl-sta.h" 46 46 #include "iwl-3945.h" 47 47 #include "iwl-eeprom.h" 48 - #include "iwl-helpers.h" 49 48 #include "iwl-core.h" 49 + #include "iwl-helpers.h" 50 50 #include "iwl-led.h" 51 51 #include "iwl-3945-led.h" 52 52 ··· 2470 2470 memset((void *)&priv->hw_params, 0, 2471 2471 sizeof(struct iwl_hw_params)); 2472 2472 2473 - priv->shared_virt = 2474 - pci_alloc_consistent(priv->pci_dev, 2475 - sizeof(struct iwl3945_shared), 2476 - &priv->shared_phys); 2477 - 2473 + priv->shared_virt = dma_alloc_coherent(&priv->pci_dev->dev, 2474 + sizeof(struct iwl3945_shared), 2475 + &priv->shared_phys, GFP_KERNEL); 2478 2476 if (!priv->shared_virt) { 2479 2477 IWL_ERR(priv, "failed to allocate pci memory\n"); 2480 2478 mutex_unlock(&priv->mutex);
-18
drivers/net/wireless/iwlwifi/iwl-3945.h
··· 171 171 172 172 #define SCAN_INTERVAL 100 173 173 174 - #define STATUS_HCMD_ACTIVE 0 /* host command in progress */ 175 - #define STATUS_HCMD_SYNC_ACTIVE 1 /* sync host command in progress */ 176 - #define STATUS_INT_ENABLED 2 177 - #define STATUS_RF_KILL_HW 3 178 - #define STATUS_INIT 5 179 - #define STATUS_ALIVE 6 180 - #define STATUS_READY 7 181 - #define STATUS_TEMPERATURE 8 182 - #define STATUS_GEO_CONFIGURED 9 183 - #define STATUS_EXIT_PENDING 10 184 - #define STATUS_STATISTICS 12 185 - #define STATUS_SCANNING 13 186 - #define STATUS_SCAN_ABORTING 14 187 - #define STATUS_SCAN_HW 15 188 - #define STATUS_POWER_PMI 16 189 - #define STATUS_FW_ERROR 17 190 - #define STATUS_CONF_PENDING 18 191 - 192 174 #define MAX_TID_COUNT 9 193 175 194 176 #define IWL_INVALID_RATE 0xFF
+7
drivers/net/wireless/iwlwifi/iwl-4965.c
··· 581 581 582 582 iwl4965_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0); 583 583 584 + /* make sure all queue are not stopped */ 585 + memset(&priv->queue_stopped[0], 0, sizeof(priv->queue_stopped)); 586 + for (i = 0; i < 4; i++) 587 + atomic_set(&priv->queue_stop_count[i], 0); 588 + 589 + /* reset to 0 to enable all the queue first */ 590 + priv->txq_ctx_active_msk = 0; 584 591 /* Map each Tx/cmd queue to its corresponding fifo */ 585 592 for (i = 0; i < ARRAY_SIZE(default_queue_to_tx_fifo); i++) { 586 593 int ac = default_queue_to_tx_fifo[i];
+7
drivers/net/wireless/iwlwifi/iwl-5000.c
··· 648 648 649 649 iwl5000_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0); 650 650 651 + /* make sure all queue are not stopped */ 652 + memset(&priv->queue_stopped[0], 0, sizeof(priv->queue_stopped)); 653 + for (i = 0; i < 4; i++) 654 + atomic_set(&priv->queue_stop_count[i], 0); 655 + 656 + /* reset to 0 to enable all the queue first */ 657 + priv->txq_ctx_active_msk = 0; 651 658 /* map qos queues to fifos one-to-one */ 652 659 for (i = 0; i < ARRAY_SIZE(iwl5000_default_queue_to_tx_fifo); i++) { 653 660 int ac = iwl5000_default_queue_to_tx_fifo[i];
+77 -2
drivers/net/wireless/iwlwifi/iwl-6000.c
··· 70 70 priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD; 71 71 } 72 72 73 + /* Indicate calibration version to uCode. */ 74 + static void iwl6050_set_calib_version(struct iwl_priv *priv) 75 + { 76 + if (priv->cfg->ops->lib->eeprom_ops.calib_version(priv) >= 6) 77 + iwl_set_bit(priv, CSR_GP_DRIVER_REG, 78 + CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); 79 + } 80 + 73 81 /* NIC configuration for 6000 series */ 74 82 static void iwl6000_nic_config(struct iwl_priv *priv) 75 83 { ··· 104 96 CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_IPA); 105 97 } 106 98 /* else do nothing, uCode configured */ 99 + if (priv->cfg->ops->lib->temp_ops.set_calib_version) 100 + priv->cfg->ops->lib->temp_ops.set_calib_version(priv); 107 101 } 108 102 109 103 static struct iwl_sensitivity_ranges iwl6000_sensitivity = { ··· 287 277 .led = &iwlagn_led_ops, 288 278 }; 289 279 280 + static struct iwl_lib_ops iwl6050_lib = { 281 + .set_hw_params = iwl6000_hw_set_hw_params, 282 + .txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl, 283 + .txq_inval_byte_cnt_tbl = iwl5000_txq_inval_byte_cnt_tbl, 284 + .txq_set_sched = iwl5000_txq_set_sched, 285 + .txq_agg_enable = iwl5000_txq_agg_enable, 286 + .txq_agg_disable = iwl5000_txq_agg_disable, 287 + .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd, 288 + .txq_free_tfd = iwl_hw_txq_free_tfd, 289 + .txq_init = iwl_hw_tx_queue_init, 290 + .rx_handler_setup = iwl5000_rx_handler_setup, 291 + .setup_deferred_work = iwl5000_setup_deferred_work, 292 + .is_valid_rtc_data_addr = iwl5000_hw_valid_rtc_data_addr, 293 + .load_ucode = iwl5000_load_ucode, 294 + .dump_nic_event_log = iwl_dump_nic_event_log, 295 + .dump_nic_error_log = iwl_dump_nic_error_log, 296 + .dump_csr = iwl_dump_csr, 297 + .dump_fh = iwl_dump_fh, 298 + .init_alive_start = iwl5000_init_alive_start, 299 + .alive_notify = iwl5000_alive_notify, 300 + .send_tx_power = iwl5000_send_tx_power, 301 + .update_chain_flags = iwl_update_chain_flags, 302 + .set_channel_switch = iwl6000_hw_channel_switch, 303 + .apm_ops = { 304 + .init = iwl_apm_init, 305 + .stop = iwl_apm_stop, 306 + .config = iwl6000_nic_config, 307 + .set_pwr_src = iwl_set_pwr_src, 308 + }, 309 + .eeprom_ops = { 310 + .regulatory_bands = { 311 + EEPROM_5000_REG_BAND_1_CHANNELS, 312 + EEPROM_5000_REG_BAND_2_CHANNELS, 313 + EEPROM_5000_REG_BAND_3_CHANNELS, 314 + EEPROM_5000_REG_BAND_4_CHANNELS, 315 + EEPROM_5000_REG_BAND_5_CHANNELS, 316 + EEPROM_5000_REG_BAND_24_HT40_CHANNELS, 317 + EEPROM_5000_REG_BAND_52_HT40_CHANNELS 318 + }, 319 + .verify_signature = iwlcore_eeprom_verify_signature, 320 + .acquire_semaphore = iwlcore_eeprom_acquire_semaphore, 321 + .release_semaphore = iwlcore_eeprom_release_semaphore, 322 + .calib_version = iwl5000_eeprom_calib_version, 323 + .query_addr = iwl5000_eeprom_query_addr, 324 + .update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower, 325 + }, 326 + .post_associate = iwl_post_associate, 327 + .isr = iwl_isr_ict, 328 + .config_ap = iwl_config_ap, 329 + .temp_ops = { 330 + .temperature = iwl5000_temperature, 331 + .set_ct_kill = iwl6000_set_ct_threshold, 332 + .set_calib_version = iwl6050_set_calib_version, 333 + }, 334 + .add_bcast_station = iwl_add_bcast_station, 335 + }; 336 + 337 + static const struct iwl_ops iwl6050_ops = { 338 + .ucode = &iwl5000_ucode, 339 + .lib = &iwl6050_lib, 340 + .hcmd = &iwl5000_hcmd, 341 + .utils = &iwl5000_hcmd_utils, 342 + .led = &iwlagn_led_ops, 343 + }; 344 + 290 345 /* 291 346 * "i": Internal configuration, use internal Power Amplifier 292 347 */ ··· 455 380 .ucode_api_max = IWL6050_UCODE_API_MAX, 456 381 .ucode_api_min = IWL6050_UCODE_API_MIN, 457 382 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, 458 - .ops = &iwl6000_ops, 383 + .ops = &iwl6050_ops, 459 384 .eeprom_size = OTP_LOW_IMAGE_SIZE, 460 385 .eeprom_ver = EEPROM_6050_EEPROM_VERSION, 461 386 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, ··· 487 412 .ucode_api_max = IWL6050_UCODE_API_MAX, 488 413 .ucode_api_min = IWL6050_UCODE_API_MIN, 489 414 .sku = IWL_SKU_A|IWL_SKU_G, 490 - .ops = &iwl6000_ops, 415 + .ops = &iwl6050_ops, 491 416 .eeprom_size = OTP_LOW_IMAGE_SIZE, 492 417 .eeprom_ver = EEPROM_6050_EEPROM_VERSION, 493 418 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
+14 -1
drivers/net/wireless/iwlwifi/iwl-agn-rs.c
··· 298 298 struct iwl_lq_sta *lq_data, u8 tid, 299 299 struct ieee80211_sta *sta) 300 300 { 301 + int ret; 302 + 301 303 if (rs_tl_get_load(lq_data, tid) > IWL_AGG_LOAD_THRESHOLD) { 302 304 IWL_DEBUG_HT(priv, "Starting Tx agg: STA: %pM tid: %d\n", 303 305 sta->addr, tid); 304 - ieee80211_start_tx_ba_session(sta, tid); 306 + ret = ieee80211_start_tx_ba_session(sta, tid); 307 + if (ret == -EAGAIN) { 308 + /* 309 + * driver and mac80211 is out of sync 310 + * this might be cause by reloading firmware 311 + * stop the tx ba session here 312 + */ 313 + IWL_DEBUG_HT(priv, "Fail start Tx agg on tid: %d\n", 314 + tid); 315 + ret = ieee80211_stop_tx_ba_session(sta, tid, 316 + WLAN_BACK_INITIATOR); 317 + } 305 318 } 306 319 } 307 320
+28 -1
drivers/net/wireless/iwlwifi/iwl-agn.c
··· 2941 2941 return ret; 2942 2942 case IEEE80211_AMPDU_TX_START: 2943 2943 IWL_DEBUG_HT(priv, "start Tx\n"); 2944 - return iwl_tx_agg_start(priv, sta->addr, tid, ssn); 2944 + ret = iwl_tx_agg_start(priv, sta->addr, tid, ssn); 2945 + if (ret == 0) { 2946 + priv->agg_tids_count++; 2947 + IWL_DEBUG_HT(priv, "priv->agg_tids_count = %u\n", 2948 + priv->agg_tids_count); 2949 + } 2950 + return ret; 2945 2951 case IEEE80211_AMPDU_TX_STOP: 2946 2952 IWL_DEBUG_HT(priv, "stop Tx\n"); 2947 2953 ret = iwl_tx_agg_stop(priv, sta->addr, tid); 2954 + if ((ret == 0) && (priv->agg_tids_count > 0)) { 2955 + priv->agg_tids_count--; 2956 + IWL_DEBUG_HT(priv, "priv->agg_tids_count = %u\n", 2957 + priv->agg_tids_count); 2958 + } 2948 2959 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 2949 2960 return 0; 2950 2961 else ··· 3364 3353 INIT_LIST_HEAD(&priv->free_frames); 3365 3354 3366 3355 mutex_init(&priv->mutex); 3356 + mutex_init(&priv->sync_cmd_mutex); 3367 3357 3368 3358 /* Clear the driver's (not device's) station table */ 3369 3359 iwl_clear_stations_table(priv); ··· 3376 3364 priv->iw_mode = NL80211_IFTYPE_STATION; 3377 3365 priv->current_ht_config.smps = IEEE80211_SMPS_STATIC; 3378 3366 priv->missed_beacon_threshold = IWL_MISSED_BEACON_THRESHOLD_DEF; 3367 + priv->agg_tids_count = 0; 3368 + 3369 + /* initialize force reset */ 3370 + priv->force_reset[IWL_RF_RESET].reset_duration = 3371 + IWL_DELAY_NEXT_FORCE_RF_RESET; 3372 + priv->force_reset[IWL_FW_RESET].reset_duration = 3373 + IWL_DELAY_NEXT_FORCE_FW_RELOAD; 3379 3374 3380 3375 /* Choose which receivers/antennas to use */ 3381 3376 if (priv->cfg->ops->hcmd->set_rxon_chain) ··· 3559 3540 */ 3560 3541 spin_lock_init(&priv->reg_lock); 3561 3542 spin_lock_init(&priv->lock); 3543 + 3544 + /* 3545 + * stop and reset the on-board processor just in case it is in a 3546 + * strange state ... like being left stranded by a primary kernel 3547 + * and this is now the kdump kernel trying to start up 3548 + */ 3549 + iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); 3550 + 3562 3551 iwl_hw_detect(priv); 3563 3552 IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s REV=0x%X\n", 3564 3553 priv->cfg->name, priv->hw_rev);
-4
drivers/net/wireless/iwlwifi/iwl-commands.h
··· 3470 3470 IWL_PHY_CALIBRATE_DIFF_GAIN_CMD = 7, 3471 3471 IWL_PHY_CALIBRATE_DC_CMD = 8, 3472 3472 IWL_PHY_CALIBRATE_LO_CMD = 9, 3473 - IWL_PHY_CALIBRATE_RX_BB_CMD = 10, 3474 3473 IWL_PHY_CALIBRATE_TX_IQ_CMD = 11, 3475 - IWL_PHY_CALIBRATE_RX_IQ_CMD = 12, 3476 - IWL_PHY_CALIBRATION_NOISE_CMD = 13, 3477 - IWL_PHY_CALIBRATE_AGC_TABLE_CMD = 14, 3478 3474 IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD = 15, 3479 3475 IWL_PHY_CALIBRATE_BASE_BAND_CMD = 16, 3480 3476 IWL_PHY_CALIBRATE_TX_IQ_PERD_CMD = 17,
+51 -8
drivers/net/wireless/iwlwifi/iwl-core.c
··· 1670 1670 void iwl_free_isr_ict(struct iwl_priv *priv) 1671 1671 { 1672 1672 if (priv->ict_tbl_vir) { 1673 - pci_free_consistent(priv->pci_dev, (sizeof(u32) * ICT_COUNT) + 1674 - PAGE_SIZE, priv->ict_tbl_vir, 1675 - priv->ict_tbl_dma); 1673 + dma_free_coherent(&priv->pci_dev->dev, 1674 + (sizeof(u32) * ICT_COUNT) + PAGE_SIZE, 1675 + priv->ict_tbl_vir, priv->ict_tbl_dma); 1676 1676 priv->ict_tbl_vir = NULL; 1677 1677 } 1678 1678 } ··· 1688 1688 if (priv->cfg->use_isr_legacy) 1689 1689 return 0; 1690 1690 /* allocate shrared data table */ 1691 - priv->ict_tbl_vir = pci_alloc_consistent(priv->pci_dev, (sizeof(u32) * 1692 - ICT_COUNT) + PAGE_SIZE, 1693 - &priv->ict_tbl_dma); 1691 + priv->ict_tbl_vir = dma_alloc_coherent(&priv->pci_dev->dev, 1692 + (sizeof(u32) * ICT_COUNT) + PAGE_SIZE, 1693 + &priv->ict_tbl_dma, GFP_KERNEL); 1694 1694 if (!priv->ict_tbl_vir) 1695 1695 return -ENOMEM; 1696 1696 ··· 3334 3334 } 3335 3335 EXPORT_SYMBOL(iwl_dump_fh); 3336 3336 3337 - void iwl_force_rf_reset(struct iwl_priv *priv) 3337 + static void iwl_force_rf_reset(struct iwl_priv *priv) 3338 3338 { 3339 3339 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 3340 3340 return; ··· 3356 3356 iwl_internal_short_hw_scan(priv); 3357 3357 return; 3358 3358 } 3359 - EXPORT_SYMBOL(iwl_force_rf_reset); 3359 + 3360 + 3361 + int iwl_force_reset(struct iwl_priv *priv, int mode) 3362 + { 3363 + struct iwl_force_reset *force_reset; 3364 + 3365 + if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 3366 + return -EINVAL; 3367 + 3368 + if (mode >= IWL_MAX_FORCE_RESET) { 3369 + IWL_DEBUG_INFO(priv, "invalid reset request.\n"); 3370 + return -EINVAL; 3371 + } 3372 + force_reset = &priv->force_reset[mode]; 3373 + force_reset->reset_request_count++; 3374 + if (force_reset->last_force_reset_jiffies && 3375 + time_after(force_reset->last_force_reset_jiffies + 3376 + force_reset->reset_duration, jiffies)) { 3377 + IWL_DEBUG_INFO(priv, "force reset rejected\n"); 3378 + force_reset->reset_reject_count++; 3379 + return -EAGAIN; 3380 + } 3381 + force_reset->reset_success_count++; 3382 + force_reset->last_force_reset_jiffies = jiffies; 3383 + IWL_DEBUG_INFO(priv, "perform force reset (%d)\n", mode); 3384 + switch (mode) { 3385 + case IWL_RF_RESET: 3386 + iwl_force_rf_reset(priv); 3387 + break; 3388 + case IWL_FW_RESET: 3389 + IWL_ERR(priv, "On demand firmware reload\n"); 3390 + /* Set the FW error flag -- cleared on iwl_down */ 3391 + set_bit(STATUS_FW_ERROR, &priv->status); 3392 + wake_up_interruptible(&priv->wait_command_queue); 3393 + /* 3394 + * Keep the restart process from trying to send host 3395 + * commands by clearing the INIT status bit 3396 + */ 3397 + clear_bit(STATUS_READY, &priv->status); 3398 + queue_work(priv->workqueue, &priv->restart); 3399 + break; 3400 + } 3401 + return 0; 3402 + } 3360 3403 3361 3404 #ifdef CONFIG_PM 3362 3405
+6 -5
drivers/net/wireless/iwlwifi/iwl-core.h
··· 117 117 struct iwl_temp_ops { 118 118 void (*temperature)(struct iwl_priv *priv); 119 119 void (*set_ct_kill)(struct iwl_priv *priv); 120 + void (*set_calib_version)(struct iwl_priv *priv); 120 121 }; 121 122 122 123 struct iwl_ucode_ops { ··· 415 414 void iwl_cmd_queue_free(struct iwl_priv *priv); 416 415 int iwl_rx_queue_alloc(struct iwl_priv *priv); 417 416 void iwl_rx_handle(struct iwl_priv *priv); 418 - int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, 417 + void iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, 419 418 struct iwl_rx_queue *q); 420 419 void iwl_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq); 421 420 void iwl_rx_replenish(struct iwl_priv *priv); 422 421 void iwl_rx_replenish_now(struct iwl_priv *priv); 423 422 int iwl_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq); 424 - int iwl_rx_queue_restock(struct iwl_priv *priv); 423 + void iwl_rx_queue_restock(struct iwl_priv *priv); 425 424 int iwl_rx_queue_space(const struct iwl_rx_queue *q); 426 425 void iwl_rx_allocate(struct iwl_priv *priv, gfp_t priority); 427 426 void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb); ··· 451 450 void iwl_hw_txq_ctx_free(struct iwl_priv *priv); 452 451 int iwl_hw_tx_queue_init(struct iwl_priv *priv, 453 452 struct iwl_tx_queue *txq); 454 - int iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq); 455 453 void iwl_free_tfds_in_queue(struct iwl_priv *priv, 456 454 int sta_id, int tid, int freed); 455 + void iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq); 457 456 int iwl_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq, 458 457 int slots_num, u32 txq_id); 459 458 void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id); ··· 504 503 int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms); 505 504 int iwl_mac_hw_scan(struct ieee80211_hw *hw, struct cfg80211_scan_request *req); 506 505 int iwl_internal_short_hw_scan(struct iwl_priv *priv); 507 - void iwl_force_rf_reset(struct iwl_priv *priv); 506 + int iwl_force_reset(struct iwl_priv *priv, int mode); 508 507 u16 iwl_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame, 509 508 const u8 *ie, int ie_len, int left); 510 509 void iwl_setup_rx_scan_handlers(struct iwl_priv *priv); ··· 606 605 /*************** DRIVER STATUS FUNCTIONS *****/ 607 606 608 607 #define STATUS_HCMD_ACTIVE 0 /* host command in progress */ 609 - #define STATUS_HCMD_SYNC_ACTIVE 1 /* sync host command in progress */ 608 + /* 1 is unused (used to be STATUS_HCMD_SYNC_ACTIVE) */ 610 609 #define STATUS_INT_ENABLED 2 611 610 #define STATUS_RF_KILL_HW 3 612 611 #define STATUS_CT_KILL 4
+1 -1
drivers/net/wireless/iwlwifi/iwl-csr.h
··· 369 369 #define CSR_GP_DRIVER_REG_BIT_RADIO_SKU_3x3_HYB (0x00000000) 370 370 #define CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_HYB (0x00000001) 371 371 #define CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_IPA (0x00000002) 372 - 372 + #define CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6 (0x00000004) 373 373 374 374 /* GIO Chicken Bits (PCI Express bus link power management) */ 375 375 #define CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX (0x00800000)
+58 -2
drivers/net/wireless/iwlwifi/iwl-debugfs.c
··· 530 530 531 531 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_HCMD_ACTIVE:\t %d\n", 532 532 test_bit(STATUS_HCMD_ACTIVE, &priv->status)); 533 - pos += scnprintf(buf + pos, bufsz - pos, "STATUS_HCMD_SYNC_ACTIVE: %d\n", 534 - test_bit(STATUS_HCMD_SYNC_ACTIVE, &priv->status)); 535 533 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INT_ENABLED:\t %d\n", 536 534 test_bit(STATUS_INT_ENABLED, &priv->status)); 537 535 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n", ··· 2221 2223 return count; 2222 2224 } 2223 2225 2226 + static ssize_t iwl_dbgfs_force_reset_read(struct file *file, 2227 + char __user *user_buf, 2228 + size_t count, loff_t *ppos) { 2229 + 2230 + struct iwl_priv *priv = file->private_data; 2231 + int i, pos = 0; 2232 + char buf[300]; 2233 + const size_t bufsz = sizeof(buf); 2234 + struct iwl_force_reset *force_reset; 2235 + 2236 + for (i = 0; i < IWL_MAX_FORCE_RESET; i++) { 2237 + force_reset = &priv->force_reset[i]; 2238 + pos += scnprintf(buf + pos, bufsz - pos, 2239 + "Force reset method %d\n", i); 2240 + pos += scnprintf(buf + pos, bufsz - pos, 2241 + "\tnumber of reset request: %d\n", 2242 + force_reset->reset_request_count); 2243 + pos += scnprintf(buf + pos, bufsz - pos, 2244 + "\tnumber of reset request success: %d\n", 2245 + force_reset->reset_success_count); 2246 + pos += scnprintf(buf + pos, bufsz - pos, 2247 + "\tnumber of reset request reject: %d\n", 2248 + force_reset->reset_reject_count); 2249 + pos += scnprintf(buf + pos, bufsz - pos, 2250 + "\treset duration: %lu\n", 2251 + force_reset->reset_duration); 2252 + } 2253 + return simple_read_from_buffer(user_buf, count, ppos, buf, pos); 2254 + } 2255 + 2256 + static ssize_t iwl_dbgfs_force_reset_write(struct file *file, 2257 + const char __user *user_buf, 2258 + size_t count, loff_t *ppos) { 2259 + 2260 + struct iwl_priv *priv = file->private_data; 2261 + char buf[8]; 2262 + int buf_size; 2263 + int reset, ret; 2264 + 2265 + memset(buf, 0, sizeof(buf)); 2266 + buf_size = min(count, sizeof(buf) - 1); 2267 + if (copy_from_user(buf, user_buf, buf_size)) 2268 + return -EFAULT; 2269 + if (sscanf(buf, "%d", &reset) != 1) 2270 + return -EINVAL; 2271 + switch (reset) { 2272 + case IWL_RF_RESET: 2273 + case IWL_FW_RESET: 2274 + ret = iwl_force_reset(priv, reset); 2275 + break; 2276 + default: 2277 + return -EINVAL; 2278 + } 2279 + return ret ? ret : count; 2280 + } 2281 + 2224 2282 DEBUGFS_READ_FILE_OPS(rx_statistics); 2225 2283 DEBUGFS_READ_FILE_OPS(tx_statistics); 2226 2284 DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); ··· 2297 2243 DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon); 2298 2244 DEBUGFS_WRITE_FILE_OPS(internal_scan); 2299 2245 DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta); 2246 + DEBUGFS_READ_WRITE_FILE_OPS(force_reset); 2300 2247 2301 2248 /* 2302 2249 * Create the debugfs files and directories ··· 2351 2296 DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR); 2352 2297 DEBUGFS_ADD_FILE(internal_scan, dir_debug, S_IWUSR); 2353 2298 DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR); 2299 + DEBUGFS_ADD_FILE(force_reset, dir_debug, S_IWUSR | S_IRUSR); 2354 2300 if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { 2355 2301 DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR); 2356 2302 DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR);
+25 -1
drivers/net/wireless/iwlwifi/iwl-dev.h
··· 1033 1033 #define IWL_MAX_PLCP_ERR_THRESHOLD_MIN (0) 1034 1034 #define IWL_MAX_PLCP_ERR_THRESHOLD_DEF (50) 1035 1035 #define IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF (100) 1036 + #define IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF (200) 1036 1037 #define IWL_MAX_PLCP_ERR_THRESHOLD_MAX (255) 1038 + 1039 + #define IWL_DELAY_NEXT_FORCE_RF_RESET (HZ*3) 1040 + #define IWL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5) 1041 + 1042 + enum iwl_reset { 1043 + IWL_RF_RESET = 0, 1044 + IWL_FW_RESET, 1045 + IWL_MAX_FORCE_RESET, 1046 + }; 1047 + 1048 + struct iwl_force_reset { 1049 + int reset_request_count; 1050 + int reset_success_count; 1051 + int reset_reject_count; 1052 + unsigned long reset_duration; 1053 + unsigned long last_force_reset_jiffies; 1054 + }; 1037 1055 1038 1056 struct iwl_priv { 1039 1057 ··· 1084 1066 /* storing the jiffies when the plcp error rate is received */ 1085 1067 unsigned long plcp_jiffies; 1086 1068 1069 + /* reporting the number of tids has AGG on. 0 means no AGGREGATION */ 1070 + u8 agg_tids_count; 1071 + 1072 + /* force reset */ 1073 + struct iwl_force_reset force_reset[IWL_MAX_FORCE_RESET]; 1074 + 1087 1075 /* we allocate array of iwl4965_channel_info for NIC's valid channels. 1088 1076 * Access via channel # using indirect index array */ 1089 1077 struct iwl_channel_info *channel_info; /* channel info array */ ··· 1111 1087 unsigned long scan_start; 1112 1088 unsigned long scan_pass_start; 1113 1089 unsigned long scan_start_tsf; 1114 - unsigned long last_internal_scan_jiffies; 1115 1090 void *scan; 1116 1091 int scan_bands; 1117 1092 struct cfg80211_scan_request *scan_request; ··· 1123 1100 spinlock_t hcmd_lock; /* protect hcmd */ 1124 1101 spinlock_t reg_lock; /* protect hw register access */ 1125 1102 struct mutex mutex; 1103 + struct mutex sync_cmd_mutex; /* enable serialization of sync commands */ 1126 1104 1127 1105 /* basic pci-network driver stuff */ 1128 1106 struct pci_dev *pci_dev;
+7 -7
drivers/net/wireless/iwlwifi/iwl-hcmd.c
··· 164 164 /* A synchronous command can not have a callback set. */ 165 165 BUG_ON(cmd->callback); 166 166 167 - if (test_and_set_bit(STATUS_HCMD_SYNC_ACTIVE, &priv->status)) { 168 - IWL_ERR(priv, 169 - "Error sending %s: Already sending a host command\n", 167 + IWL_DEBUG_INFO(priv, "Attempting to send sync command %s\n", 170 168 get_cmd_string(cmd->id)); 171 - ret = -EBUSY; 172 - goto out; 173 - } 169 + mutex_lock(&priv->sync_cmd_mutex); 174 170 175 171 set_bit(STATUS_HCMD_ACTIVE, &priv->status); 172 + IWL_DEBUG_INFO(priv, "Setting HCMD_ACTIVE for command %s \n", 173 + get_cmd_string(cmd->id)); 176 174 177 175 cmd_idx = iwl_enqueue_hcmd(priv, cmd); 178 176 if (cmd_idx < 0) { ··· 191 193 jiffies_to_msecs(HOST_COMPLETE_TIMEOUT)); 192 194 193 195 clear_bit(STATUS_HCMD_ACTIVE, &priv->status); 196 + IWL_DEBUG_INFO(priv, "Clearing HCMD_ACTIVE for command %s \n", 197 + get_cmd_string(cmd->id)); 194 198 ret = -ETIMEDOUT; 195 199 goto cancel; 196 200 } ··· 237 237 cmd->reply_page = 0; 238 238 } 239 239 out: 240 - clear_bit(STATUS_HCMD_SYNC_ACTIVE, &priv->status); 240 + mutex_unlock(&priv->sync_cmd_mutex); 241 241 return ret; 242 242 } 243 243 EXPORT_SYMBOL(iwl_send_cmd_sync);
+4 -3
drivers/net/wireless/iwlwifi/iwl-helpers.h
··· 80 80 struct fw_desc *desc) 81 81 { 82 82 if (desc->v_addr) 83 - pci_free_consistent(pci_dev, desc->len, 84 - desc->v_addr, desc->p_addr); 83 + dma_free_coherent(&pci_dev->dev, desc->len, 84 + desc->v_addr, desc->p_addr); 85 85 desc->v_addr = NULL; 86 86 desc->len = 0; 87 87 } ··· 89 89 static inline int iwl_alloc_fw_desc(struct pci_dev *pci_dev, 90 90 struct fw_desc *desc) 91 91 { 92 - desc->v_addr = pci_alloc_consistent(pci_dev, desc->len, &desc->p_addr); 92 + desc->v_addr = dma_alloc_coherent(&pci_dev->dev, desc->len, 93 + &desc->p_addr, GFP_KERNEL); 93 94 return (desc->v_addr != NULL) ? 0 : -ENOMEM; 94 95 } 95 96
+61 -19
drivers/net/wireless/iwlwifi/iwl-rx.c
··· 123 123 /** 124 124 * iwl_rx_queue_update_write_ptr - Update the write pointer for the RX queue 125 125 */ 126 - int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q) 126 + void iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q) 127 127 { 128 128 unsigned long flags; 129 129 u32 rx_wrt_ptr_reg = priv->hw_params.rx_wrt_ptr_reg; 130 130 u32 reg; 131 - int ret = 0; 132 131 133 132 spin_lock_irqsave(&q->lock, flags); 134 133 ··· 160 161 161 162 exit_unlock: 162 163 spin_unlock_irqrestore(&q->lock, flags); 163 - return ret; 164 164 } 165 165 EXPORT_SYMBOL(iwl_rx_queue_update_write_ptr); 166 166 /** ··· 182 184 * also updates the memory address in the firmware to reference the new 183 185 * target buffer. 184 186 */ 185 - int iwl_rx_queue_restock(struct iwl_priv *priv) 187 + void iwl_rx_queue_restock(struct iwl_priv *priv) 186 188 { 187 189 struct iwl_rx_queue *rxq = &priv->rxq; 188 190 struct list_head *element; 189 191 struct iwl_rx_mem_buffer *rxb; 190 192 unsigned long flags; 191 193 int write; 192 - int ret = 0; 193 194 194 195 spin_lock_irqsave(&rxq->lock, flags); 195 196 write = rxq->write & ~0x7; ··· 217 220 spin_lock_irqsave(&rxq->lock, flags); 218 221 rxq->need_update = 1; 219 222 spin_unlock_irqrestore(&rxq->lock, flags); 220 - ret = iwl_rx_queue_update_write_ptr(priv, rxq); 223 + iwl_rx_queue_update_write_ptr(priv, rxq); 221 224 } 222 - 223 - return ret; 224 225 } 225 226 EXPORT_SYMBOL(iwl_rx_queue_restock); 226 227 ··· 345 350 } 346 351 } 347 352 348 - pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd, 349 - rxq->dma_addr); 350 - pci_free_consistent(priv->pci_dev, sizeof(struct iwl_rb_status), 351 - rxq->rb_stts, rxq->rb_stts_dma); 353 + dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, 354 + rxq->dma_addr); 355 + dma_free_coherent(&priv->pci_dev->dev, sizeof(struct iwl_rb_status), 356 + rxq->rb_stts, rxq->rb_stts_dma); 352 357 rxq->bd = NULL; 353 358 rxq->rb_stts = NULL; 354 359 } ··· 357 362 int iwl_rx_queue_alloc(struct iwl_priv *priv) 358 363 { 359 364 struct iwl_rx_queue *rxq = &priv->rxq; 360 - struct pci_dev *dev = priv->pci_dev; 365 + struct device *dev = &priv->pci_dev->dev; 361 366 int i; 362 367 363 368 spin_lock_init(&rxq->lock); ··· 365 370 INIT_LIST_HEAD(&rxq->rx_used); 366 371 367 372 /* Alloc the circular buffer of Read Buffer Descriptors (RBDs) */ 368 - rxq->bd = pci_alloc_consistent(dev, 4 * RX_QUEUE_SIZE, &rxq->dma_addr); 373 + rxq->bd = dma_alloc_coherent(dev, 4 * RX_QUEUE_SIZE, &rxq->dma_addr, 374 + GFP_KERNEL); 369 375 if (!rxq->bd) 370 376 goto err_bd; 371 377 372 - rxq->rb_stts = pci_alloc_consistent(dev, sizeof(struct iwl_rb_status), 373 - &rxq->rb_stts_dma); 378 + rxq->rb_stts = dma_alloc_coherent(dev, sizeof(struct iwl_rb_status), 379 + &rxq->rb_stts_dma, GFP_KERNEL); 374 380 if (!rxq->rb_stts) 375 381 goto err_rb; 376 382 ··· 388 392 return 0; 389 393 390 394 err_rb: 391 - pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd, 392 - rxq->dma_addr); 395 + dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, 396 + rxq->dma_addr); 393 397 err_bd: 394 398 return -ENOMEM; 395 399 } ··· 616 620 617 621 #define REG_RECALIB_PERIOD (60) 618 622 623 + /* the threshold ratio of actual_ack_cnt to expected_ack_cnt in percent */ 624 + #define ACK_CNT_RATIO (50) 625 + #define BA_TIMEOUT_CNT (5) 626 + #define BA_TIMEOUT_MAX (16) 627 + 619 628 #define PLCP_MSG "plcp_err exceeded %u, %u, %u, %u, %u, %d, %u mSecs\n" 620 629 void iwl_rx_statistics(struct iwl_priv *priv, 621 630 struct iwl_rx_mem_buffer *rxb) ··· 630 629 int combined_plcp_delta; 631 630 unsigned int plcp_msec; 632 631 unsigned long plcp_received_jiffies; 632 + int actual_ack_cnt_delta; 633 + int expected_ack_cnt_delta; 634 + int ba_timeout_delta; 633 635 634 636 IWL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n", 635 637 (int)sizeof(priv->statistics), ··· 647 643 #ifdef CONFIG_IWLWIFI_DEBUG 648 644 iwl_accumulative_statistics(priv, (__le32 *)&pkt->u.stats); 649 645 #endif 646 + actual_ack_cnt_delta = le32_to_cpu(pkt->u.stats.tx.actual_ack_cnt) - 647 + le32_to_cpu(priv->statistics.tx.actual_ack_cnt); 648 + expected_ack_cnt_delta = le32_to_cpu( 649 + pkt->u.stats.tx.expected_ack_cnt) - 650 + le32_to_cpu(priv->statistics.tx.expected_ack_cnt); 651 + ba_timeout_delta = le32_to_cpu( 652 + pkt->u.stats.tx.agg.ba_timeout) - 653 + le32_to_cpu(priv->statistics.tx.agg.ba_timeout); 654 + if ((priv->agg_tids_count > 0) && 655 + (expected_ack_cnt_delta > 0) && 656 + (((actual_ack_cnt_delta * 100) / expected_ack_cnt_delta) < 657 + ACK_CNT_RATIO) && 658 + (ba_timeout_delta > BA_TIMEOUT_CNT)) { 659 + IWL_DEBUG_RADIO(priv, 660 + "actual_ack_cnt delta = %d, expected_ack_cnt = %d\n", 661 + actual_ack_cnt_delta, expected_ack_cnt_delta); 662 + 663 + #ifdef CONFIG_IWLWIFI_DEBUG 664 + IWL_DEBUG_RADIO(priv, "rx_detected_cnt delta = %d\n", 665 + priv->delta_statistics.tx.rx_detected_cnt); 666 + IWL_DEBUG_RADIO(priv, 667 + "ack_or_ba_timeout_collision delta = %d\n", 668 + priv->delta_statistics.tx.ack_or_ba_timeout_collision); 669 + #endif 670 + IWL_DEBUG_RADIO(priv, "agg ba_timeout delta = %d\n", 671 + ba_timeout_delta); 672 + if ((actual_ack_cnt_delta == 0) && 673 + (ba_timeout_delta >= 674 + BA_TIMEOUT_MAX)) { 675 + IWL_DEBUG_RADIO(priv, 676 + "call iwl_force_reset(IWL_FW_RESET)\n"); 677 + iwl_force_reset(priv, IWL_FW_RESET); 678 + } else { 679 + IWL_DEBUG_RADIO(priv, 680 + "call iwl_force_reset(IWL_RF_RESET)\n"); 681 + iwl_force_reset(priv, IWL_RF_RESET); 682 + } 683 + } 650 684 /* 651 685 * check for plcp_err and trigger radio reset if it exceeds 652 686 * the plcp error threshold plcp_delta. ··· 731 689 * Reset the RF radio due to the high plcp 732 690 * error rate 733 691 */ 734 - iwl_force_rf_reset(priv); 692 + iwl_force_reset(priv, IWL_RF_RESET); 735 693 } 736 694 } 737 695
+12 -25
drivers/net/wireless/iwlwifi/iwl-scan.c
··· 250 250 251 251 if (!priv->is_internal_short_scan) 252 252 priv->next_scan_jiffies = 0; 253 - else 254 - priv->last_internal_scan_jiffies = jiffies; 255 253 256 254 IWL_DEBUG_INFO(priv, "Setting scan to off\n"); 257 255 ··· 469 471 470 472 static int iwl_scan_initiate(struct iwl_priv *priv) 471 473 { 472 - if (!iwl_is_ready_rf(priv)) { 473 - IWL_DEBUG_SCAN(priv, "Aborting scan due to not ready.\n"); 474 - return -EIO; 475 - } 476 - 477 - if (test_bit(STATUS_SCANNING, &priv->status)) { 478 - IWL_DEBUG_SCAN(priv, "Scan already in progress.\n"); 479 - return -EAGAIN; 480 - } 481 - 482 - if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) { 483 - IWL_DEBUG_SCAN(priv, "Scan request while abort pending\n"); 484 - return -EAGAIN; 485 - } 486 - 487 474 IWL_DEBUG_INFO(priv, "Starting scan...\n"); 488 475 set_bit(STATUS_SCANNING, &priv->status); 489 476 priv->is_internal_short_scan = false; ··· 497 514 if (!iwl_is_ready_rf(priv)) { 498 515 ret = -EIO; 499 516 IWL_DEBUG_MAC80211(priv, "leave - not ready or exit pending\n"); 517 + goto out_unlock; 518 + } 519 + 520 + if (test_bit(STATUS_SCANNING, &priv->status)) { 521 + IWL_DEBUG_SCAN(priv, "Scan already in progress.\n"); 522 + ret = -EAGAIN; 523 + goto out_unlock; 524 + } 525 + 526 + if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) { 527 + IWL_DEBUG_SCAN(priv, "Scan request while abort pending\n"); 528 + ret = -EAGAIN; 500 529 goto out_unlock; 501 530 } 502 531 ··· 546 551 * internal short scan, this function should only been called while associated. 547 552 * It will reset and tune the radio to prevent possible RF related problem 548 553 */ 549 - #define IWL_DELAY_NEXT_INTERNAL_SCAN (HZ*1) 550 - 551 554 int iwl_internal_short_hw_scan(struct iwl_priv *priv) 552 555 { 553 556 int ret = 0; ··· 563 570 if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) { 564 571 IWL_DEBUG_SCAN(priv, "Scan request while abort pending\n"); 565 572 ret = -EAGAIN; 566 - goto out; 567 - } 568 - if (priv->last_internal_scan_jiffies && 569 - time_after(priv->last_internal_scan_jiffies + 570 - IWL_DELAY_NEXT_INTERNAL_SCAN, jiffies)) { 571 - IWL_DEBUG_SCAN(priv, "internal scan rejected\n"); 572 573 goto out; 573 574 } 574 575
+33 -31
drivers/net/wireless/iwlwifi/iwl-tx.c
··· 60 60 static inline int iwl_alloc_dma_ptr(struct iwl_priv *priv, 61 61 struct iwl_dma_ptr *ptr, size_t size) 62 62 { 63 - ptr->addr = pci_alloc_consistent(priv->pci_dev, size, &ptr->dma); 63 + ptr->addr = dma_alloc_coherent(&priv->pci_dev->dev, size, &ptr->dma, 64 + GFP_KERNEL); 64 65 if (!ptr->addr) 65 66 return -ENOMEM; 66 67 ptr->size = size; ··· 74 73 if (unlikely(!ptr->addr)) 75 74 return; 76 75 77 - pci_free_consistent(priv->pci_dev, ptr->size, ptr->addr, ptr->dma); 76 + dma_free_coherent(&priv->pci_dev->dev, ptr->size, ptr->addr, ptr->dma); 78 77 memset(ptr, 0, sizeof(*ptr)); 79 78 } 80 79 81 80 /** 82 81 * iwl_txq_update_write_ptr - Send new write index to hardware 83 82 */ 84 - int iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq) 83 + void iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq) 85 84 { 86 85 u32 reg = 0; 87 - int ret = 0; 88 86 int txq_id = txq->q.id; 89 87 90 88 if (txq->need_update == 0) 91 - return ret; 89 + return; 92 90 93 91 /* if we're trying to save power */ 94 92 if (test_bit(STATUS_POWER_PMI, &priv->status)) { ··· 101 101 txq_id, reg); 102 102 iwl_set_bit(priv, CSR_GP_CNTRL, 103 103 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 104 - return ret; 104 + return; 105 105 } 106 106 107 107 iwl_write_direct32(priv, HBUS_TARG_WRPTR, ··· 114 114 txq->q.write_ptr | (txq_id << 8)); 115 115 116 116 txq->need_update = 0; 117 - 118 - return ret; 119 117 } 120 118 EXPORT_SYMBOL(iwl_txq_update_write_ptr); 121 119 ··· 144 146 { 145 147 struct iwl_tx_queue *txq = &priv->txq[txq_id]; 146 148 struct iwl_queue *q = &txq->q; 147 - struct pci_dev *dev = priv->pci_dev; 149 + struct device *dev = &priv->pci_dev->dev; 148 150 int i; 149 151 150 152 if (q->n_bd == 0) ··· 161 163 162 164 /* De-alloc circular buffer of TFDs */ 163 165 if (txq->q.n_bd) 164 - pci_free_consistent(dev, priv->hw_params.tfd_size * 165 - txq->q.n_bd, txq->tfds, txq->q.dma_addr); 166 + dma_free_coherent(dev, priv->hw_params.tfd_size * 167 + txq->q.n_bd, txq->tfds, txq->q.dma_addr); 166 168 167 169 /* De-alloc array of per-TFD driver data */ 168 170 kfree(txq->txb); ··· 191 193 { 192 194 struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; 193 195 struct iwl_queue *q = &txq->q; 194 - struct pci_dev *dev = priv->pci_dev; 196 + struct device *dev = &priv->pci_dev->dev; 195 197 int i; 196 198 197 199 if (q->n_bd == 0) ··· 203 205 204 206 /* De-alloc circular buffer of TFDs */ 205 207 if (txq->q.n_bd) 206 - pci_free_consistent(dev, priv->hw_params.tfd_size * 207 - txq->q.n_bd, txq->tfds, txq->q.dma_addr); 208 + dma_free_coherent(dev, priv->hw_params.tfd_size * txq->q.n_bd, 209 + txq->tfds, txq->q.dma_addr); 208 210 209 211 /* deallocate arrays */ 210 212 kfree(txq->cmd); ··· 295 297 static int iwl_tx_queue_alloc(struct iwl_priv *priv, 296 298 struct iwl_tx_queue *txq, u32 id) 297 299 { 298 - struct pci_dev *dev = priv->pci_dev; 300 + struct device *dev = &priv->pci_dev->dev; 299 301 size_t tfd_sz = priv->hw_params.tfd_size * TFD_QUEUE_SIZE_MAX; 300 302 301 303 /* Driver private data, only for Tx (not command) queues, ··· 314 316 315 317 /* Circular buffer of transmit frame descriptors (TFDs), 316 318 * shared with device */ 317 - txq->tfds = pci_alloc_consistent(dev, tfd_sz, &txq->q.dma_addr); 318 - 319 + txq->tfds = dma_alloc_coherent(dev, tfd_sz, &txq->q.dma_addr, 320 + GFP_KERNEL); 319 321 if (!txq->tfds) { 320 322 IWL_ERR(priv, "pci_alloc_consistent(%zd) failed\n", tfd_sz); 321 323 goto error; ··· 743 745 u8 tid = 0; 744 746 u8 *qc = NULL; 745 747 unsigned long flags; 746 - int ret; 747 748 748 749 spin_lock_irqsave(&priv->lock, flags); 749 750 if (iwl_is_rfkill(priv)) { ··· 817 820 hdr->seq_ctrl |= cpu_to_le16(seq_number); 818 821 seq_number += 0x10; 819 822 /* aggregation is on for this <sta,tid> */ 820 - if (info->flags & IEEE80211_TX_CTL_AMPDU) 823 + if (info->flags & IEEE80211_TX_CTL_AMPDU && 824 + priv->stations[sta_id].tid[tid].agg.state == IWL_AGG_ON) { 821 825 txq_id = priv->stations[sta_id].tid[tid].agg.txq_id; 826 + } 822 827 } 823 828 824 829 txq = &priv->txq[txq_id]; ··· 962 963 963 964 /* Tell device the write index *just past* this latest filled TFD */ 964 965 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); 965 - ret = iwl_txq_update_write_ptr(priv, txq); 966 + iwl_txq_update_write_ptr(priv, txq); 966 967 spin_unlock_irqrestore(&priv->lock, flags); 967 968 968 969 /* ··· 975 976 /* avoid atomic ops if it isn't an associated client */ 976 977 if (sta_priv && sta_priv->client) 977 978 atomic_inc(&sta_priv->pending_frames); 978 - 979 - if (ret) 980 - return ret; 981 979 982 980 if ((iwl_queue_space(q) < q->high_mark) && priv->mac80211_registered) { 983 981 if (wait_write_ptr) { ··· 1014 1018 struct iwl_cmd_meta *out_meta; 1015 1019 dma_addr_t phys_addr; 1016 1020 unsigned long flags; 1017 - int len, ret; 1021 + int len; 1018 1022 u32 idx; 1019 1023 u16 fix_size; 1020 1024 ··· 1111 1115 1112 1116 /* Increment and update queue's write index */ 1113 1117 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); 1114 - ret = iwl_txq_update_write_ptr(priv, txq); 1118 + iwl_txq_update_write_ptr(priv, txq); 1115 1119 1116 1120 spin_unlock_irqrestore(&priv->hcmd_lock, flags); 1117 - return ret ? ret : idx; 1121 + return idx; 1118 1122 } 1119 1123 1120 1124 static void iwl_tx_status(struct iwl_priv *priv, struct sk_buff *skb) ··· 1256 1260 1257 1261 if (!(meta->flags & CMD_ASYNC)) { 1258 1262 clear_bit(STATUS_HCMD_ACTIVE, &priv->status); 1263 + IWL_DEBUG_INFO(priv, "Clearing HCMD_ACTIVE for command %s \n", 1264 + get_cmd_string(cmd->hdr.cmd)); 1259 1265 wake_up_interruptible(&priv->wait_command_queue); 1260 1266 } 1261 1267 } ··· 1344 1346 { 1345 1347 int tx_fifo_id, txq_id, sta_id, ssn = -1; 1346 1348 struct iwl_tid_data *tid_data; 1347 - int ret, write_ptr, read_ptr; 1349 + int write_ptr, read_ptr; 1348 1350 unsigned long flags; 1349 1351 1350 1352 if (!ra) { ··· 1396 1398 priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF; 1397 1399 1398 1400 spin_lock_irqsave(&priv->lock, flags); 1399 - ret = priv->cfg->ops->lib->txq_agg_disable(priv, txq_id, ssn, 1401 + /* 1402 + * the only reason this call can fail is queue number out of range, 1403 + * which can happen if uCode is reloaded and all the station 1404 + * information are lost. if it is outside the range, there is no need 1405 + * to deactivate the uCode queue, just return "success" to allow 1406 + * mac80211 to clean up it own data. 1407 + */ 1408 + priv->cfg->ops->lib->txq_agg_disable(priv, txq_id, ssn, 1400 1409 tx_fifo_id); 1401 1410 spin_unlock_irqrestore(&priv->lock, flags); 1402 - 1403 - if (ret) 1404 - return ret; 1405 1411 1406 1412 ieee80211_stop_tx_ba_cb_irqsafe(priv->vif, ra, tid); 1407 1413
+21 -21
drivers/net/wireless/iwlwifi/iwl3945-base.c
··· 53 53 #include "iwl-commands.h" 54 54 #include "iwl-sta.h" 55 55 #include "iwl-3945.h" 56 - #include "iwl-helpers.h" 57 56 #include "iwl-core.h" 57 + #include "iwl-helpers.h" 58 58 #include "iwl-dev.h" 59 59 #include "iwl-spectrum.h" 60 60 ··· 352 352 static void iwl3945_unset_hw_params(struct iwl_priv *priv) 353 353 { 354 354 if (priv->shared_virt) 355 - pci_free_consistent(priv->pci_dev, 356 - sizeof(struct iwl3945_shared), 357 - priv->shared_virt, 358 - priv->shared_phys); 355 + dma_free_coherent(&priv->pci_dev->dev, 356 + sizeof(struct iwl3945_shared), 357 + priv->shared_virt, 358 + priv->shared_phys); 359 359 } 360 360 361 361 static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, ··· 478 478 u8 wait_write_ptr = 0; 479 479 u8 *qc = NULL; 480 480 unsigned long flags; 481 - int rc; 482 481 483 482 spin_lock_irqsave(&priv->lock, flags); 484 483 if (iwl_is_rfkill(priv)) { ··· 662 663 663 664 /* Tell device the write index *just past* this latest filled TFD */ 664 665 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); 665 - rc = iwl_txq_update_write_ptr(priv, txq); 666 + iwl_txq_update_write_ptr(priv, txq); 666 667 spin_unlock_irqrestore(&priv->lock, flags); 667 - 668 - if (rc) 669 - return rc; 670 668 671 669 if ((iwl_queue_space(q) < q->high_mark) 672 670 && priv->mac80211_registered) { ··· 1059 1063 * also updates the memory address in the firmware to reference the new 1060 1064 * target buffer. 1061 1065 */ 1062 - static int iwl3945_rx_queue_restock(struct iwl_priv *priv) 1066 + static void iwl3945_rx_queue_restock(struct iwl_priv *priv) 1063 1067 { 1064 1068 struct iwl_rx_queue *rxq = &priv->rxq; 1065 1069 struct list_head *element; 1066 1070 struct iwl_rx_mem_buffer *rxb; 1067 1071 unsigned long flags; 1068 - int write, rc; 1072 + int write; 1069 1073 1070 1074 spin_lock_irqsave(&rxq->lock, flags); 1071 1075 write = rxq->write & ~0x7; ··· 1095 1099 spin_lock_irqsave(&rxq->lock, flags); 1096 1100 rxq->need_update = 1; 1097 1101 spin_unlock_irqrestore(&rxq->lock, flags); 1098 - rc = iwl_rx_queue_update_write_ptr(priv, rxq); 1099 - if (rc) 1100 - return rc; 1102 + iwl_rx_queue_update_write_ptr(priv, rxq); 1101 1103 } 1102 - 1103 - return 0; 1104 1104 } 1105 1105 1106 1106 /** ··· 1241 1249 } 1242 1250 } 1243 1251 1244 - pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd, 1245 - rxq->dma_addr); 1246 - pci_free_consistent(priv->pci_dev, sizeof(struct iwl_rb_status), 1247 - rxq->rb_stts, rxq->rb_stts_dma); 1252 + dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, 1253 + rxq->dma_addr); 1254 + dma_free_coherent(&priv->pci_dev->dev, sizeof(struct iwl_rb_status), 1255 + rxq->rb_stts, rxq->rb_stts_dma); 1248 1256 rxq->bd = NULL; 1249 1257 rxq->rb_stts = NULL; 1250 1258 } ··· 3847 3855 INIT_LIST_HEAD(&priv->free_frames); 3848 3856 3849 3857 mutex_init(&priv->mutex); 3858 + mutex_init(&priv->sync_cmd_mutex); 3850 3859 3851 3860 /* Clear the driver's (not device's) station table */ 3852 3861 iwl_clear_stations_table(priv); ··· 4039 4046 */ 4040 4047 spin_lock_init(&priv->reg_lock); 4041 4048 spin_lock_init(&priv->lock); 4049 + 4050 + /* 4051 + * stop and reset the on-board processor just in case it is in a 4052 + * strange state ... like being left stranded by a primary kernel 4053 + * and this is now the kdump kernel trying to start up 4054 + */ 4055 + iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); 4042 4056 4043 4057 /*********************** 4044 4058 * 4. Read EEPROM
+26 -6
drivers/net/wireless/mac80211_hwsim.c
··· 771 771 } 772 772 } 773 773 774 + static int mac80211_hwsim_sta_add(struct ieee80211_hw *hw, 775 + struct ieee80211_vif *vif, 776 + struct ieee80211_sta *sta) 777 + { 778 + hwsim_check_magic(vif); 779 + hwsim_set_sta_magic(sta); 780 + 781 + return 0; 782 + } 783 + 784 + static int mac80211_hwsim_sta_remove(struct ieee80211_hw *hw, 785 + struct ieee80211_vif *vif, 786 + struct ieee80211_sta *sta) 787 + { 788 + hwsim_check_magic(vif); 789 + hwsim_clear_sta_magic(sta); 790 + 791 + return 0; 792 + } 793 + 774 794 static void mac80211_hwsim_sta_notify(struct ieee80211_hw *hw, 775 795 struct ieee80211_vif *vif, 776 796 enum sta_notify_cmd cmd, 777 797 struct ieee80211_sta *sta) 778 798 { 779 799 hwsim_check_magic(vif); 800 + 780 801 switch (cmd) { 781 - case STA_NOTIFY_ADD: 782 - hwsim_set_sta_magic(sta); 783 - break; 784 - case STA_NOTIFY_REMOVE: 785 - hwsim_clear_sta_magic(sta); 786 - break; 787 802 case STA_NOTIFY_SLEEP: 788 803 case STA_NOTIFY_AWAKE: 789 804 /* TODO: make good use of these flags */ 805 + break; 806 + default: 807 + WARN(1, "Invalid sta notify: %d\n", cmd); 790 808 break; 791 809 } 792 810 } ··· 976 958 .config = mac80211_hwsim_config, 977 959 .configure_filter = mac80211_hwsim_configure_filter, 978 960 .bss_info_changed = mac80211_hwsim_bss_info_changed, 961 + .sta_add = mac80211_hwsim_sta_add, 962 + .sta_remove = mac80211_hwsim_sta_remove, 979 963 .sta_notify = mac80211_hwsim_sta_notify, 980 964 .set_tim = mac80211_hwsim_set_tim, 981 965 .conf_tx = mac80211_hwsim_conf_tx,
+24 -86
drivers/net/wireless/mwl8k.c
··· 188 188 bool sniffer_enabled; 189 189 bool wmm_enabled; 190 190 191 - struct work_struct sta_notify_worker; 192 - spinlock_t sta_notify_list_lock; 193 - struct list_head sta_notify_list; 194 - 195 191 /* XXX need to convert this to handle multiple interfaces */ 196 192 bool capture_beacon; 197 193 u8 capture_bssid[ETH_ALEN]; ··· 3702 3706 return mwl8k_cmd_set_rts_threshold(hw, value); 3703 3707 } 3704 3708 3705 - struct mwl8k_sta_notify_item 3706 - { 3707 - struct list_head list; 3708 - struct ieee80211_vif *vif; 3709 - enum sta_notify_cmd cmd; 3710 - struct ieee80211_sta sta; 3711 - }; 3712 - 3713 - static void 3714 - mwl8k_do_sta_notify(struct ieee80211_hw *hw, struct mwl8k_sta_notify_item *s) 3709 + static int mwl8k_sta_remove(struct ieee80211_hw *hw, 3710 + struct ieee80211_vif *vif, 3711 + struct ieee80211_sta *sta) 3715 3712 { 3716 3713 struct mwl8k_priv *priv = hw->priv; 3717 3714 3718 - /* 3719 - * STA firmware uses UPDATE_STADB, AP firmware uses SET_NEW_STN. 3720 - */ 3721 - if (!priv->ap_fw && s->cmd == STA_NOTIFY_ADD) { 3722 - int rc; 3715 + if (priv->ap_fw) 3716 + return mwl8k_cmd_set_new_stn_del(hw, vif, sta->addr); 3717 + else 3718 + return mwl8k_cmd_update_stadb_del(hw, vif, sta->addr); 3719 + } 3723 3720 3724 - rc = mwl8k_cmd_update_stadb_add(hw, s->vif, &s->sta); 3725 - if (rc >= 0) { 3726 - struct ieee80211_sta *sta; 3721 + static int mwl8k_sta_add(struct ieee80211_hw *hw, 3722 + struct ieee80211_vif *vif, 3723 + struct ieee80211_sta *sta) 3724 + { 3725 + struct mwl8k_priv *priv = hw->priv; 3726 + int ret; 3727 3727 3728 - rcu_read_lock(); 3729 - sta = ieee80211_find_sta(s->vif, s->sta.addr); 3730 - if (sta != NULL) 3731 - MWL8K_STA(sta)->peer_id = rc; 3732 - rcu_read_unlock(); 3728 + if (!priv->ap_fw) { 3729 + ret = mwl8k_cmd_update_stadb_add(hw, vif, sta); 3730 + if (ret >= 0) { 3731 + MWL8K_STA(sta)->peer_id = ret; 3732 + return 0; 3733 3733 } 3734 - } else if (!priv->ap_fw && s->cmd == STA_NOTIFY_REMOVE) { 3735 - mwl8k_cmd_update_stadb_del(hw, s->vif, s->sta.addr); 3736 - } else if (priv->ap_fw && s->cmd == STA_NOTIFY_ADD) { 3737 - mwl8k_cmd_set_new_stn_add(hw, s->vif, &s->sta); 3738 - } else if (priv->ap_fw && s->cmd == STA_NOTIFY_REMOVE) { 3739 - mwl8k_cmd_set_new_stn_del(hw, s->vif, s->sta.addr); 3734 + 3735 + return ret; 3740 3736 } 3741 - } 3742 3737 3743 - static void mwl8k_sta_notify_worker(struct work_struct *work) 3744 - { 3745 - struct mwl8k_priv *priv = 3746 - container_of(work, struct mwl8k_priv, sta_notify_worker); 3747 - struct ieee80211_hw *hw = priv->hw; 3748 - 3749 - spin_lock_bh(&priv->sta_notify_list_lock); 3750 - while (!list_empty(&priv->sta_notify_list)) { 3751 - struct mwl8k_sta_notify_item *s; 3752 - 3753 - s = list_entry(priv->sta_notify_list.next, 3754 - struct mwl8k_sta_notify_item, list); 3755 - list_del(&s->list); 3756 - 3757 - spin_unlock_bh(&priv->sta_notify_list_lock); 3758 - 3759 - mwl8k_do_sta_notify(hw, s); 3760 - kfree(s); 3761 - 3762 - spin_lock_bh(&priv->sta_notify_list_lock); 3763 - } 3764 - spin_unlock_bh(&priv->sta_notify_list_lock); 3765 - } 3766 - 3767 - static void 3768 - mwl8k_sta_notify(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 3769 - enum sta_notify_cmd cmd, struct ieee80211_sta *sta) 3770 - { 3771 - struct mwl8k_priv *priv = hw->priv; 3772 - struct mwl8k_sta_notify_item *s; 3773 - 3774 - if (cmd != STA_NOTIFY_ADD && cmd != STA_NOTIFY_REMOVE) 3775 - return; 3776 - 3777 - s = kmalloc(sizeof(*s), GFP_ATOMIC); 3778 - if (s != NULL) { 3779 - s->vif = vif; 3780 - s->cmd = cmd; 3781 - s->sta = *sta; 3782 - 3783 - spin_lock(&priv->sta_notify_list_lock); 3784 - list_add_tail(&s->list, &priv->sta_notify_list); 3785 - spin_unlock(&priv->sta_notify_list_lock); 3786 - 3787 - ieee80211_queue_work(hw, &priv->sta_notify_worker); 3788 - } 3738 + return mwl8k_cmd_set_new_stn_add(hw, vif, sta); 3789 3739 } 3790 3740 3791 3741 static int mwl8k_conf_tx(struct ieee80211_hw *hw, u16 queue, ··· 3791 3849 .prepare_multicast = mwl8k_prepare_multicast, 3792 3850 .configure_filter = mwl8k_configure_filter, 3793 3851 .set_rts_threshold = mwl8k_set_rts_threshold, 3794 - .sta_notify = mwl8k_sta_notify, 3852 + .sta_add = mwl8k_sta_add, 3853 + .sta_remove = mwl8k_sta_remove, 3795 3854 .conf_tx = mwl8k_conf_tx, 3796 3855 .get_stats = mwl8k_get_stats, 3797 3856 .ampdu_action = mwl8k_ampdu_action, ··· 3993 4050 /* Set default radio state and preamble */ 3994 4051 priv->radio_on = 0; 3995 4052 priv->radio_short_preamble = 0; 3996 - 3997 - /* Station database handling */ 3998 - INIT_WORK(&priv->sta_notify_worker, mwl8k_sta_notify_worker); 3999 - spin_lock_init(&priv->sta_notify_list_lock); 4000 - INIT_LIST_HEAD(&priv->sta_notify_list); 4001 4053 4002 4054 /* Finalize join worker */ 4003 4055 INIT_WORK(&priv->finalize_join_worker, mwl8k_finalize_join_worker);
+4 -5
drivers/net/wireless/orinoco/orinoco_cs.c
··· 407 407 PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3), 408 408 PCMCIA_DEVICE_PROD_ID12("ACTIONTEC", "PRISM Wireless LAN PC Card", 0x393089da, 0xa71e69d5), 409 409 PCMCIA_DEVICE_PROD_ID12("Addtron", "AWP-100 Wireless PCMCIA", 0xe6ec52ce, 0x08649af2), 410 - PCMCIA_DEVICE_PROD_ID123("AIRVAST", "IEEE 802.11b Wireless PCMCIA Card", "HFA3863", 0xea569531, 0x4bcb9645, 0x355cb092), 411 410 PCMCIA_DEVICE_PROD_ID12("Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio", 0x5cd01705, 0x4271660f), 412 411 PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11b_PC_CARD_25", 0x78fc06ee, 0xdb9aa842), 413 412 PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11B_CF_CARD_25", 0x78fc06ee, 0x45a50c1e), ··· 416 417 PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-CF-S11G", 0x2decece3, 0x82067c18), 417 418 PCMCIA_DEVICE_PROD_ID12("Cabletron", "RoamAbout 802.11 DS", 0x32d445f5, 0xedeffd90), 418 419 PCMCIA_DEVICE_PROD_ID12("Compaq", "WL200_11Mbps_Wireless_PCI_Card", 0x54f7c49c, 0x15a75e5b), 419 - PCMCIA_DEVICE_PROD_ID123("corega", "WL PCCL-11", "ISL37300P", 0x0a21501a, 0x59868926, 0xc9049a39), 420 420 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCC-11", 0x5261440f, 0xa6405584), 421 421 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCCA-11", 0x5261440f, 0xdf6115f9), 422 422 PCMCIA_DEVICE_PROD_ID12("corega_K.K.", "Wireless_LAN_PCCB-11", 0x29e33311, 0xee7a27ae), ··· 430 432 PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE", 0x74c5e40d, 0xdb472a18), 431 433 PCMCIA_DEVICE_PROD_ID12("INTERSIL", "I-GATE 11M PC Card / PC Card plus", 0x74c5e40d, 0x8304ff77), 432 434 PCMCIA_DEVICE_PROD_ID12("Intersil", "PRISM 2_5 PCMCIA ADAPTER", 0x4b801a17, 0x6345a0bf), 433 - PCMCIA_DEVICE_PROD_ID123("Intersil", "PRISM Freedom PCMCIA Adapter", "ISL37100P", 0x4b801a17, 0xf222ec2d, 0x630d52b2), 434 435 PCMCIA_DEVICE_PROD_ID12("LeArtery", "SYNCBYAIR 11Mbps Wireless LAN PC Card", 0x7e3b326a, 0x49893e92), 435 436 PCMCIA_DEVICE_PROD_ID12("Linksys", "Wireless CompactFlash Card", 0x0733cc81, 0x0c52f395), 436 437 PCMCIA_DEVICE_PROD_ID12("Lucent Technologies", "WaveLAN/IEEE", 0x23eb9949, 0xc562e72a), ··· 442 445 PCMCIA_DEVICE_PROD_ID12("Nortel Networks", "emobility 802.11 Wireless LAN PC Card", 0x2d617ea0, 0x88cd5767), 443 446 PCMCIA_DEVICE_PROD_ID12("OEM", "PRISM2 IEEE 802.11 PC-Card", 0xfea54c90, 0x48f2bdd6), 444 447 PCMCIA_DEVICE_PROD_ID12("OTC", "Wireless AirEZY 2411-PCC WLAN Card", 0x4ac44287, 0x235a6bed), 445 - PCMCIA_DEVICE_PROD_ID123("PCMCIA", "11M WLAN Card v2.5", "ISL37300P", 0x281f1c5d, 0x6e440487, 0xc9049a39), 446 448 PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-CF110", 0x209f40ab, 0xd9715264), 447 449 PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-NS110", 0x209f40ab, 0x46263178), 448 450 PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PC CARD HARMONY 80211B", 0xc6536a5e, 0x090c3cd9), ··· 450 454 PCMCIA_DEVICE_PROD_ID12("SMC", "SMC2532W-B EliteConnect Wireless Adapter", 0xc4f8b18b, 0x196bd757), 451 455 PCMCIA_DEVICE_PROD_ID12("SMC", "SMC2632W", 0xc4f8b18b, 0x474a1f2a), 452 456 PCMCIA_DEVICE_PROD_ID12("Symbol Technologies", "LA4111 Spectrum24 Wireless LAN PC Card", 0x3f02b4d6, 0x3663cb0e), 453 - PCMCIA_DEVICE_PROD_ID123("The Linksys Group, Inc.", "Instant Wireless Network PC Card", "ISL37300P", 0xa5f472c2, 0x590eb502, 0xc9049a39), 454 457 PCMCIA_DEVICE_PROD_ID12("ZoomAir 11Mbps High", "Rate wireless Networking", 0x273fe3db, 0x32a1eaee), 458 + PCMCIA_DEVICE_PROD_ID3("HFA3863", 0x355cb092), 459 + PCMCIA_DEVICE_PROD_ID3("ISL37100P", 0x630d52b2), 460 + PCMCIA_DEVICE_PROD_ID3("ISL37101P-10", 0xdd97a26b), 461 + PCMCIA_DEVICE_PROD_ID3("ISL37300P", 0xc9049a39), 455 462 PCMCIA_DEVICE_NULL, 456 463 }; 457 464 MODULE_DEVICE_TABLE(pcmcia, orinoco_cs_ids);
+19 -9
drivers/net/wireless/p54/main.c
··· 33 33 MODULE_LICENSE("GPL"); 34 34 MODULE_ALIAS("prism54common"); 35 35 36 + static int p54_sta_add_remove(struct ieee80211_hw *hw, 37 + struct ieee80211_vif *vif, 38 + struct ieee80211_sta *sta) 39 + { 40 + struct p54_common *priv = hw->priv; 41 + 42 + /* 43 + * Notify the firmware that we don't want or we don't 44 + * need to buffer frames for this station anymore. 45 + */ 46 + 47 + p54_sta_unlock(priv, sta->addr); 48 + 49 + return 0; 50 + } 51 + 36 52 static void p54_sta_notify(struct ieee80211_hw *dev, struct ieee80211_vif *vif, 37 53 enum sta_notify_cmd notify_cmd, 38 54 struct ieee80211_sta *sta) 39 55 { 40 56 struct p54_common *priv = dev->priv; 41 - switch (notify_cmd) { 42 - case STA_NOTIFY_ADD: 43 - case STA_NOTIFY_REMOVE: 44 - /* 45 - * Notify the firmware that we don't want or we don't 46 - * need to buffer frames for this station anymore. 47 - */ 48 57 49 - p54_sta_unlock(priv, sta->addr); 50 - break; 58 + switch (notify_cmd) { 51 59 case STA_NOTIFY_AWAKE: 52 60 /* update the firmware's filter table */ 53 61 p54_sta_unlock(priv, sta->addr); ··· 514 506 .remove_interface = p54_remove_interface, 515 507 .set_tim = p54_set_tim, 516 508 .sta_notify = p54_sta_notify, 509 + .sta_add = p54_sta_add_remove, 510 + .sta_remove = p54_sta_add_remove, 517 511 .set_key = p54_set_key, 518 512 .config = p54_config, 519 513 .bss_info_changed = p54_bss_info_changed,
+2
drivers/net/wireless/p54/p54usb.c
··· 36 36 /* Version 1 devices (pci chip + net2280) */ 37 37 {USB_DEVICE(0x0506, 0x0a11)}, /* 3COM 3CRWE254G72 */ 38 38 {USB_DEVICE(0x0707, 0xee06)}, /* SMC 2862W-G */ 39 + {USB_DEVICE(0x07aa, 0x001c)}, /* Corega CG-WLUSB2GT */ 39 40 {USB_DEVICE(0x083a, 0x4501)}, /* Accton 802.11g WN4501 USB */ 40 41 {USB_DEVICE(0x083a, 0x4502)}, /* Siemens Gigaset USB Adapter */ 41 42 {USB_DEVICE(0x083a, 0x5501)}, /* Phillips CPWUA054 */ ··· 61 60 {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */ 62 61 {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ 63 62 {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ 63 + {USB_DEVICE(0x083a, 0xf503)}, /* Accton FD7050E ver 1010ec */ 64 64 {USB_DEVICE(0x0846, 0x4240)}, /* Netgear WG111 (v2) */ 65 65 {USB_DEVICE(0x0915, 0x2000)}, /* Cohiba Proto board */ 66 66 {USB_DEVICE(0x0915, 0x2002)}, /* Cohiba Proto board */
+1 -1
drivers/net/wireless/p54/txrx.c
··· 186 186 struct p54_tx_queue_stats *queue; 187 187 unsigned long flags; 188 188 189 - if (WARN_ON(p54_queue > P54_QUEUE_NUM)) 189 + if (WARN_ON(p54_queue >= P54_QUEUE_NUM)) 190 190 return -EINVAL; 191 191 192 192 queue = &priv->tx_stats[p54_queue];
+65 -2
drivers/net/wireless/rt2x00/Kconfig
··· 64 64 default y 65 65 66 66 config RT2800PCI 67 - tristate "Ralink rt2800 (PCI/PCMCIA) support (VERY EXPERIMENTAL)" 67 + tristate "Ralink rt28xx/rt30xx/rt35xx (PCI/PCIe/PCMCIA) support (EXPERIMENTAL)" 68 68 depends on (RT2800PCI_PCI || RT2800PCI_SOC) && EXPERIMENTAL 69 69 select RT2800_LIB 70 70 select RT2X00_LIB_PCI if RT2800PCI_PCI ··· 75 75 select CRC_CCITT 76 76 select EEPROM_93CX6 77 77 ---help--- 78 - This adds support for rt2800 wireless chipset family. 78 + This adds support for rt2800/rt3000/rt3500 wireless chipset family. 79 79 Supported chips: RT2760, RT2790, RT2860, RT2880, RT2890 & RT3052 80 80 81 81 This driver is non-functional at the moment and is intended for 82 82 developers. 83 83 84 84 When compiled as a module, this driver will be called "rt2800pci.ko". 85 + 86 + if RT2800PCI 87 + 88 + config RT2800PCI_RT30XX 89 + bool "rt2800pci - Include support for rt30xx (PCI/PCIe/PCMCIA) devices" 90 + default n 91 + ---help--- 92 + This adds support for rt30xx wireless chipset family to the 93 + rt2800pci driver. 94 + Supported chips: RT3090, RT3091 & RT3092 95 + 96 + Support for these devices is non-functional at the moment and is 97 + intended for testers and developers. 98 + 99 + config RT2800PCI_RT35XX 100 + bool "rt2800pci - Include support for rt35xx (PCI/PCIe/PCMCIA) devices" 101 + default n 102 + ---help--- 103 + This adds support for rt35xx wireless chipset family to the 104 + rt2800pci driver. 105 + Supported chips: RT3060, RT3062, RT3562, RT3592 106 + 107 + Support for these devices is non-functional at the moment and is 108 + intended for testers and developers. 109 + 110 + endif 85 111 86 112 config RT2500USB 87 113 tristate "Ralink rt2500 (USB) support" ··· 151 125 - support for RT3070 chips is non-functional at the moment 152 126 153 127 When compiled as a module, this driver will be called "rt2800usb.ko". 128 + 129 + if RT2800USB 130 + 131 + config RT2800USB_RT30XX 132 + bool "rt2800usb - Include support for rt30xx (USB) devices" 133 + default n 134 + ---help--- 135 + This adds support for rt30xx wireless chipset family to the 136 + rt2800usb driver. 137 + Supported chips: RT3070, RT3071 & RT3072 138 + 139 + Support for these devices is non-functional at the moment and is 140 + intended for testers and developers. 141 + 142 + config RT2800USB_RT35XX 143 + bool "rt2800usb - Include support for rt35xx (USB) devices" 144 + default n 145 + ---help--- 146 + This adds support for rt35xx wireless chipset family to the 147 + rt2800usb driver. 148 + Supported chips: RT3572 149 + 150 + Support for these devices is non-functional at the moment and is 151 + intended for testers and developers. 152 + 153 + config RT2800USB_UNKNOWN 154 + bool "rt2800usb - Include support for unknown (USB) devices" 155 + default n 156 + ---help--- 157 + This adds support for rt2800 family devices that are known to 158 + have a rt2800 family chipset, but for which the exact chipset 159 + is unknown. 160 + 161 + Support status for these devices is unknown, and enabling these 162 + devices may or may not work. 163 + 164 + endif 154 165 155 166 config RT2800_LIB 156 167 tristate
+2 -2
drivers/net/wireless/rt2x00/rt2400pci.c
··· 1340 1340 */ 1341 1341 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); 1342 1342 rt2x00pci_register_read(rt2x00dev, CSR0, &reg); 1343 - rt2x00_set_chip_rf(rt2x00dev, value, reg); 1344 - rt2x00_print_chip(rt2x00dev); 1343 + rt2x00_set_chip(rt2x00dev, RT2460, value, 1344 + rt2x00_get_field32(reg, CSR0_REVISION)); 1345 1345 1346 1346 if (!rt2x00_rf(rt2x00dev, RF2420) && !rt2x00_rf(rt2x00dev, RF2421)) { 1347 1347 ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
+1
drivers/net/wireless/rt2x00/rt2400pci.h
··· 65 65 * CSR0: ASIC revision number. 66 66 */ 67 67 #define CSR0 0x0000 68 + #define CSR0_REVISION FIELD32(0x0000ffff) 68 69 69 70 /* 70 71 * CSR1: System control register.
+2 -2
drivers/net/wireless/rt2x00/rt2500pci.c
··· 1503 1503 */ 1504 1504 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); 1505 1505 rt2x00pci_register_read(rt2x00dev, CSR0, &reg); 1506 - rt2x00_set_chip_rf(rt2x00dev, value, reg); 1507 - rt2x00_print_chip(rt2x00dev); 1506 + rt2x00_set_chip(rt2x00dev, RT2560, value, 1507 + rt2x00_get_field32(reg, CSR0_REVISION)); 1508 1508 1509 1509 if (!rt2x00_rf(rt2x00dev, RF2522) && 1510 1510 !rt2x00_rf(rt2x00dev, RF2523) &&
+1
drivers/net/wireless/rt2x00/rt2500pci.h
··· 76 76 * CSR0: ASIC revision number. 77 77 */ 78 78 #define CSR0 0x0000 79 + #define CSR0_REVISION FIELD32(0x0000ffff) 79 80 80 81 /* 81 82 * CSR1: System control register.
+1 -3
drivers/net/wireless/rt2x00/rt2500usb.c
··· 1408 1408 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); 1409 1409 rt2500usb_register_read(rt2x00dev, MAC_CSR0, &reg); 1410 1410 rt2x00_set_chip(rt2x00dev, RT2570, value, reg); 1411 - rt2x00_print_chip(rt2x00dev); 1412 1411 1413 - if (!rt2x00_check_rev(rt2x00dev, 0x000ffff0, 0) || 1414 - rt2x00_check_rev(rt2x00dev, 0x0000000f, 0)) { 1412 + if (((reg & 0xfff0) != 0) || ((reg & 0x0000000f) == 0)) { 1415 1413 ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); 1416 1414 return -ENODEV; 1417 1415 }
+7 -7
drivers/net/wireless/rt2x00/rt2800.h
··· 60 60 /* 61 61 * Chipset version. 62 62 */ 63 - #define RT2860C_VERSION 0x28600100 64 - #define RT2860D_VERSION 0x28600101 65 - #define RT2880E_VERSION 0x28720200 66 - #define RT2883_VERSION 0x28830300 67 - #define RT3070_VERSION 0x30700200 63 + #define RT2860C_VERSION 0x0100 64 + #define RT2860D_VERSION 0x0101 65 + #define RT2880E_VERSION 0x0200 66 + #define RT2883_VERSION 0x0300 67 + #define RT3070_VERSION 0x0200 68 68 69 69 /* 70 70 * Signal information. ··· 408 408 * ASIC_VER: 2860 or 2870 409 409 */ 410 410 #define MAC_CSR0 0x1000 411 - #define MAC_CSR0_ASIC_REV FIELD32(0x0000ffff) 412 - #define MAC_CSR0_ASIC_VER FIELD32(0xffff0000) 411 + #define MAC_CSR0_REVISION FIELD32(0x0000ffff) 412 + #define MAC_CSR0_CHIPSET FIELD32(0xffff0000) 413 413 414 414 /* 415 415 * MAC_SYS_CTRL:
+67 -46
drivers/net/wireless/rt2x00/rt2800lib.c
··· 40 40 #if defined(CONFIG_RT2X00_LIB_USB) || defined(CONFIG_RT2X00_LIB_USB_MODULE) 41 41 #include "rt2x00usb.h" 42 42 #endif 43 + #if defined(CONFIG_RT2X00_LIB_PCI) || defined(CONFIG_RT2X00_LIB_PCI_MODULE) 44 + #include "rt2x00pci.h" 45 + #endif 43 46 #include "rt2800lib.h" 44 47 #include "rt2800.h" 45 48 #include "rt2800usb.h" ··· 92 89 rt2x00_set_field32(&reg, BBP_CSR_CFG_REGNUM, word); 93 90 rt2x00_set_field32(&reg, BBP_CSR_CFG_BUSY, 1); 94 91 rt2x00_set_field32(&reg, BBP_CSR_CFG_READ_CONTROL, 0); 95 - if (rt2x00_intf_is_pci(rt2x00dev)) 92 + if (rt2x00_is_pci(rt2x00dev) || rt2x00_is_soc(rt2x00dev)) 96 93 rt2x00_set_field32(&reg, BBP_CSR_CFG_BBP_RW_MODE, 1); 97 94 98 95 rt2800_register_write_lock(rt2x00dev, BBP_CSR_CFG, reg); ··· 121 118 rt2x00_set_field32(&reg, BBP_CSR_CFG_REGNUM, word); 122 119 rt2x00_set_field32(&reg, BBP_CSR_CFG_BUSY, 1); 123 120 rt2x00_set_field32(&reg, BBP_CSR_CFG_READ_CONTROL, 1); 124 - if (rt2x00_intf_is_pci(rt2x00dev)) 121 + if (rt2x00_is_pci(rt2x00dev) || rt2x00_is_soc(rt2x00dev)) 125 122 rt2x00_set_field32(&reg, BBP_CSR_CFG_BBP_RW_MODE, 1); 126 123 127 124 rt2800_register_write_lock(rt2x00dev, BBP_CSR_CFG, reg); ··· 221 218 u32 reg; 222 219 223 220 /* 224 - * RT2880 and RT3052 don't support MCU requests. 221 + * SOC devices don't support MCU requests. 225 222 */ 226 - if (rt2x00_rt(rt2x00dev, RT2880) || rt2x00_rt(rt2x00dev, RT3052)) 223 + if (rt2x00_is_soc(rt2x00dev)) 227 224 return; 228 225 229 226 mutex_lock(&rt2x00dev->csr_mutex); ··· 663 660 switch ((int)ant->tx) { 664 661 case 1: 665 662 rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 0); 666 - if (rt2x00_intf_is_pci(rt2x00dev)) 663 + if (rt2x00_is_pci(rt2x00dev) || rt2x00_is_soc(rt2x00dev)) 667 664 rt2x00_set_field8(&r3, BBP3_RX_ANTENNA, 0); 668 665 break; 669 666 case 2: ··· 898 895 rt2x00_set_field8(&bbp, BBP3_HT40_PLUS, conf_is_ht40_plus(conf)); 899 896 rt2800_bbp_write(rt2x00dev, 3, bbp); 900 897 901 - if (rt2x00_rev(rt2x00dev) == RT2860C_VERSION) { 898 + if (rt2x00_rt(rt2x00dev, RT2860) && 899 + (rt2x00_rev(rt2x00dev) == RT2860C_VERSION)) { 902 900 if (conf_is_ht40(conf)) { 903 901 rt2800_bbp_write(rt2x00dev, 69, 0x1a); 904 902 rt2800_bbp_write(rt2x00dev, 70, 0x0a); ··· 1061 1057 static u8 rt2800_get_default_vgc(struct rt2x00_dev *rt2x00dev) 1062 1058 { 1063 1059 if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) { 1064 - if (rt2x00_intf_is_usb(rt2x00dev) && 1065 - rt2x00_rev(rt2x00dev) == RT3070_VERSION) 1060 + if (rt2x00_is_usb(rt2x00dev) && 1061 + rt2x00_rt(rt2x00dev, RT3070) && 1062 + (rt2x00_rev(rt2x00dev) == RT3070_VERSION)) 1066 1063 return 0x1c + (2 * rt2x00dev->lna_gain); 1067 1064 else 1068 1065 return 0x2e + rt2x00dev->lna_gain; ··· 1094 1089 void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual, 1095 1090 const u32 count) 1096 1091 { 1097 - if (rt2x00_rev(rt2x00dev) == RT2860C_VERSION) 1092 + if (rt2x00_rt(rt2x00dev, RT2860) && 1093 + (rt2x00_rev(rt2x00dev) == RT2860C_VERSION)) 1098 1094 return; 1099 1095 1100 1096 /* ··· 1115 1109 u32 reg; 1116 1110 unsigned int i; 1117 1111 1118 - if (rt2x00_intf_is_usb(rt2x00dev)) { 1112 + if (rt2x00_is_usb(rt2x00dev)) { 1119 1113 /* 1120 1114 * Wait until BBP and RF are ready. 1121 1115 */ ··· 1134 1128 rt2800_register_read(rt2x00dev, PBF_SYS_CTRL, &reg); 1135 1129 rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 1136 1130 reg & ~0x00002000); 1137 - } else if (rt2x00_intf_is_pci(rt2x00dev)) 1131 + } else if (rt2x00_is_pci(rt2x00dev) || rt2x00_is_soc(rt2x00dev)) 1138 1132 rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003); 1139 1133 1140 1134 rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, &reg); ··· 1142 1136 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_BBP, 1); 1143 1137 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); 1144 1138 1145 - if (rt2x00_intf_is_usb(rt2x00dev)) { 1139 + if (rt2x00_is_usb(rt2x00dev)) { 1146 1140 rt2800_register_write(rt2x00dev, USB_DMA_CFG, 0x00000000); 1147 1141 #if defined(CONFIG_RT2X00_LIB_USB) || defined(CONFIG_RT2X00_LIB_USB_MODULE) 1148 1142 rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0, ··· 1180 1174 rt2x00_set_field32(&reg, BCN_TIME_CFG_TX_TIME_COMPENSATE, 0); 1181 1175 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); 1182 1176 1183 - if (rt2x00_intf_is_usb(rt2x00dev) && 1184 - rt2x00_rev(rt2x00dev) == RT3070_VERSION) { 1177 + if (rt2x00_is_usb(rt2x00dev) && 1178 + rt2x00_rt(rt2x00dev, RT3070) && 1179 + (rt2x00_rev(rt2x00dev) == RT3070_VERSION)) { 1185 1180 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400); 1186 1181 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000); 1187 1182 rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); ··· 1209 1202 1210 1203 rt2800_register_read(rt2x00dev, MAX_LEN_CFG, &reg); 1211 1204 rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_MPDU, AGGREGATION_SIZE); 1212 - if (rt2x00_rev(rt2x00dev) >= RT2880E_VERSION && 1213 - rt2x00_rev(rt2x00dev) < RT3070_VERSION) 1205 + if ((rt2x00_rt(rt2x00dev, RT2872) && 1206 + (rt2x00_rev(rt2x00dev) >= RT2880E_VERSION)) || 1207 + rt2x00_rt(rt2x00dev, RT2880) || 1208 + rt2x00_rt(rt2x00dev, RT2883) || 1209 + rt2x00_rt(rt2x00dev, RT2890) || 1210 + rt2x00_rt(rt2x00dev, RT3052) || 1211 + (rt2x00_rt(rt2x00dev, RT3070) && 1212 + (rt2x00_rev(rt2x00dev) < RT3070_VERSION))) 1214 1213 rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 2); 1215 1214 else 1216 1215 rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 1); ··· 1306 1293 rt2x00_set_field32(&reg, GF40_PROT_CFG_TX_OP_ALLOW_GF40, 1); 1307 1294 rt2800_register_write(rt2x00dev, GF40_PROT_CFG, reg); 1308 1295 1309 - if (rt2x00_intf_is_usb(rt2x00dev)) { 1296 + if (rt2x00_is_usb(rt2x00dev)) { 1310 1297 rt2800_register_write(rt2x00dev, PBF_CFG, 0xf40006); 1311 1298 1312 1299 rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg); ··· 1366 1353 rt2800_register_write(rt2x00dev, HW_BEACON_BASE6, 0); 1367 1354 rt2800_register_write(rt2x00dev, HW_BEACON_BASE7, 0); 1368 1355 1369 - if (rt2x00_intf_is_usb(rt2x00dev)) { 1356 + if (rt2x00_is_usb(rt2x00dev)) { 1370 1357 rt2800_register_read(rt2x00dev, USB_CYC_CFG, &reg); 1371 1358 rt2x00_set_field32(&reg, USB_CYC_CFG_CLOCK_CYCLE, 30); 1372 1359 rt2800_register_write(rt2x00dev, USB_CYC_CFG, reg); ··· 1495 1482 rt2800_bbp_write(rt2x00dev, 103, 0x00); 1496 1483 rt2800_bbp_write(rt2x00dev, 105, 0x05); 1497 1484 1498 - if (rt2x00_rev(rt2x00dev) == RT2860C_VERSION) { 1485 + if (rt2x00_rt(rt2x00dev, RT2860) && 1486 + (rt2x00_rev(rt2x00dev) == RT2860C_VERSION)) { 1499 1487 rt2800_bbp_write(rt2x00dev, 69, 0x16); 1500 1488 rt2800_bbp_write(rt2x00dev, 73, 0x12); 1501 1489 } 1502 1490 1503 - if (rt2x00_rev(rt2x00dev) > RT2860D_VERSION) 1491 + if (rt2x00_rt(rt2x00dev, RT2860) && 1492 + (rt2x00_rev(rt2x00dev) > RT2860D_VERSION)) 1504 1493 rt2800_bbp_write(rt2x00dev, 84, 0x19); 1505 1494 1506 - if (rt2x00_intf_is_usb(rt2x00dev) && 1507 - rt2x00_rev(rt2x00dev) == RT3070_VERSION) { 1495 + if (rt2x00_is_usb(rt2x00dev) && 1496 + rt2x00_rt(rt2x00dev, RT3070) && 1497 + (rt2x00_rev(rt2x00dev) == RT3070_VERSION)) { 1508 1498 rt2800_bbp_write(rt2x00dev, 70, 0x0a); 1509 1499 rt2800_bbp_write(rt2x00dev, 84, 0x99); 1510 1500 rt2800_bbp_write(rt2x00dev, 105, 0x05); ··· 1598 1582 u8 rfcsr; 1599 1583 u8 bbp; 1600 1584 1601 - if (rt2x00_intf_is_usb(rt2x00dev) && 1602 - rt2x00_rev(rt2x00dev) != RT3070_VERSION) 1585 + if (rt2x00_is_usb(rt2x00dev) && 1586 + rt2x00_rt(rt2x00dev, RT3070) && 1587 + (rt2x00_rev(rt2x00dev) != RT3070_VERSION)) 1603 1588 return 0; 1604 1589 1605 - if (rt2x00_intf_is_pci(rt2x00dev)) { 1590 + if (rt2x00_is_pci(rt2x00dev) || rt2x00_is_soc(rt2x00dev)) { 1606 1591 if (!rt2x00_rf(rt2x00dev, RF3020) && 1607 1592 !rt2x00_rf(rt2x00dev, RF3021) && 1608 1593 !rt2x00_rf(rt2x00dev, RF3022)) ··· 1620 1603 rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 0); 1621 1604 rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); 1622 1605 1623 - if (rt2x00_intf_is_usb(rt2x00dev)) { 1606 + if (rt2x00_is_usb(rt2x00dev)) { 1624 1607 rt2800_rfcsr_write(rt2x00dev, 4, 0x40); 1625 1608 rt2800_rfcsr_write(rt2x00dev, 5, 0x03); 1626 1609 rt2800_rfcsr_write(rt2x00dev, 6, 0x02); ··· 1641 1624 rt2800_rfcsr_write(rt2x00dev, 25, 0x01); 1642 1625 rt2800_rfcsr_write(rt2x00dev, 27, 0x03); 1643 1626 rt2800_rfcsr_write(rt2x00dev, 29, 0x1f); 1644 - } else if (rt2x00_intf_is_pci(rt2x00dev)) { 1627 + } else if (rt2x00_is_pci(rt2x00dev) || rt2x00_is_soc(rt2x00dev)) { 1645 1628 rt2800_rfcsr_write(rt2x00dev, 0, 0x50); 1646 1629 rt2800_rfcsr_write(rt2x00dev, 1, 0x01); 1647 1630 rt2800_rfcsr_write(rt2x00dev, 2, 0xf7); ··· 1771 1754 rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2820); 1772 1755 rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word); 1773 1756 EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word); 1774 - } else if (rt2x00_rev(rt2x00dev) < RT2883_VERSION) { 1757 + } else if (rt2x00_rt(rt2x00dev, RT2860) || 1758 + rt2x00_rt(rt2x00dev, RT2870) || 1759 + rt2x00_rt(rt2x00dev, RT2872) || 1760 + rt2x00_rt(rt2x00dev, RT2880) || 1761 + (rt2x00_rt(rt2x00dev, RT2883) && 1762 + (rt2x00_rev(rt2x00dev) < RT2883_VERSION))) { 1775 1763 /* 1776 1764 * There is a max of 2 RX streams for RT28x0 series 1777 1765 */ ··· 1875 1853 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); 1876 1854 rt2800_register_read(rt2x00dev, MAC_CSR0, &reg); 1877 1855 1878 - rt2x00_set_chip_rf(rt2x00dev, value, reg); 1856 + rt2x00_set_chip(rt2x00dev, rt2x00_get_field32(reg, MAC_CSR0_CHIPSET), 1857 + value, rt2x00_get_field32(reg, MAC_CSR0_REVISION)); 1879 1858 1880 - if (rt2x00_intf_is_usb(rt2x00dev)) { 1881 - /* 1882 - * The check for rt2860 is not a typo, some rt2870 hardware 1883 - * identifies itself as rt2860 in the CSR register. 1884 - */ 1885 - if (rt2x00_check_rev(rt2x00dev, 0xfff00000, 0x28600000) || 1886 - rt2x00_check_rev(rt2x00dev, 0xfff00000, 0x28700000) || 1887 - rt2x00_check_rev(rt2x00dev, 0xfff00000, 0x28800000)) { 1888 - rt2x00_set_chip_rt(rt2x00dev, RT2870); 1889 - } else if (rt2x00_check_rev(rt2x00dev, 0xffff0000, 0x30700000)) { 1890 - rt2x00_set_chip_rt(rt2x00dev, RT3070); 1891 - } else { 1892 - ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); 1893 - return -ENODEV; 1894 - } 1859 + if (!rt2x00_rt(rt2x00dev, RT2860) && 1860 + !rt2x00_rt(rt2x00dev, RT2870) && 1861 + !rt2x00_rt(rt2x00dev, RT2872) && 1862 + !rt2x00_rt(rt2x00dev, RT2880) && 1863 + !rt2x00_rt(rt2x00dev, RT2883) && 1864 + !rt2x00_rt(rt2x00dev, RT2890) && 1865 + !rt2x00_rt(rt2x00dev, RT3052) && 1866 + !rt2x00_rt(rt2x00dev, RT3070) && 1867 + !rt2x00_rt(rt2x00dev, RT3071) && 1868 + !rt2x00_rt(rt2x00dev, RT3090) && 1869 + !rt2x00_rt(rt2x00dev, RT3390) && 1870 + !rt2x00_rt(rt2x00dev, RT3572)) { 1871 + ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); 1872 + return -ENODEV; 1895 1873 } 1896 - rt2x00_print_chip(rt2x00dev); 1897 1874 1898 1875 if (!rt2x00_rf(rt2x00dev, RF2820) && 1899 1876 !rt2x00_rf(rt2x00dev, RF2850) && ··· 2060 2039 /* 2061 2040 * Disable powersaving as default on PCI devices. 2062 2041 */ 2063 - if (rt2x00_intf_is_pci(rt2x00dev)) 2042 + if (rt2x00_is_pci(rt2x00dev) || rt2x00_is_soc(rt2x00dev)) 2064 2043 rt2x00dev->hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; 2065 2044 2066 2045 /*
+23 -26
drivers/net/wireless/rt2x00/rt2800pci.c
··· 1041 1041 /* 1042 1042 * Read EEPROM into buffer 1043 1043 */ 1044 - switch (rt2x00dev->chip.rt) { 1045 - case RT2880: 1046 - case RT3052: 1044 + if (rt2x00_is_soc(rt2x00dev)) 1047 1045 rt2800pci_read_eeprom_soc(rt2x00dev); 1048 - break; 1049 - default: 1050 - if (rt2800pci_efuse_detect(rt2x00dev)) 1051 - rt2800pci_read_eeprom_efuse(rt2x00dev); 1052 - else 1053 - rt2800pci_read_eeprom_pci(rt2x00dev); 1054 - break; 1055 - } 1046 + else if (rt2800pci_efuse_detect(rt2x00dev)) 1047 + rt2800pci_read_eeprom_efuse(rt2x00dev); 1048 + else 1049 + rt2800pci_read_eeprom_pci(rt2x00dev); 1056 1050 1057 1051 return rt2800_validate_eeprom(rt2x00dev); 1058 1052 } ··· 1097 1103 /* 1098 1104 * This device requires firmware. 1099 1105 */ 1100 - if (!rt2x00_rt(rt2x00dev, RT2880) && !rt2x00_rt(rt2x00dev, RT3052)) 1106 + if (!rt2x00_is_soc(rt2x00dev)) 1101 1107 __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags); 1102 1108 __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags); 1103 1109 __set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags); ··· 1185 1191 * RT2800pci module information. 1186 1192 */ 1187 1193 static DEFINE_PCI_DEVICE_TABLE(rt2800pci_device_table) = { 1188 - { PCI_DEVICE(0x1462, 0x891a), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1194 + { PCI_DEVICE(0x1814, 0x0601), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1195 + { PCI_DEVICE(0x1814, 0x0681), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1196 + { PCI_DEVICE(0x1814, 0x0701), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1197 + { PCI_DEVICE(0x1814, 0x0781), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1189 1198 { PCI_DEVICE(0x1432, 0x7708), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1190 1199 { PCI_DEVICE(0x1432, 0x7727), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1191 1200 { PCI_DEVICE(0x1432, 0x7728), PCI_DEVICE_DATA(&rt2800pci_ops) }, ··· 1196 1199 { PCI_DEVICE(0x1432, 0x7748), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1197 1200 { PCI_DEVICE(0x1432, 0x7758), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1198 1201 { PCI_DEVICE(0x1432, 0x7768), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1199 - { PCI_DEVICE(0x1814, 0x0601), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1200 - { PCI_DEVICE(0x1814, 0x0681), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1201 - { PCI_DEVICE(0x1814, 0x0701), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1202 - { PCI_DEVICE(0x1814, 0x0781), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1203 - { PCI_DEVICE(0x1814, 0x3060), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1204 - { PCI_DEVICE(0x1814, 0x3062), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1202 + { PCI_DEVICE(0x1a3b, 0x1059), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1203 + #ifdef CONFIG_RT2800PCI_RT30XX 1205 1204 { PCI_DEVICE(0x1814, 0x3090), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1206 1205 { PCI_DEVICE(0x1814, 0x3091), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1207 1206 { PCI_DEVICE(0x1814, 0x3092), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1207 + { PCI_DEVICE(0x1462, 0x891a), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1208 + #endif 1209 + #ifdef CONFIG_RT2800PCI_RT35XX 1210 + { PCI_DEVICE(0x1814, 0x3060), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1211 + { PCI_DEVICE(0x1814, 0x3062), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1208 1212 { PCI_DEVICE(0x1814, 0x3562), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1209 1213 { PCI_DEVICE(0x1814, 0x3592), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1210 - { PCI_DEVICE(0x1a3b, 0x1059), PCI_DEVICE_DATA(&rt2800pci_ops) }, 1214 + #endif 1211 1215 { 0, } 1212 1216 }; 1213 1217 ··· 1223 1225 MODULE_LICENSE("GPL"); 1224 1226 1225 1227 #ifdef CONFIG_RT2800PCI_SOC 1226 - #if defined(CONFIG_RALINK_RT288X) 1227 - __rt2x00soc_probe(RT2880, &rt2800pci_ops); 1228 - #elif defined(CONFIG_RALINK_RT305X) 1229 - __rt2x00soc_probe(RT3052, &rt2800pci_ops); 1230 - #endif 1228 + static int rt2800soc_probe(struct platform_device *pdev) 1229 + { 1230 + return rt2x00soc_probe(pdev, rt2800pci_ops); 1231 + } 1231 1232 1232 1233 static struct platform_driver rt2800soc_driver = { 1233 1234 .driver = { ··· 1234 1237 .owner = THIS_MODULE, 1235 1238 .mod_name = KBUILD_MODNAME, 1236 1239 }, 1237 - .probe = __rt2x00soc_probe, 1240 + .probe = rt2800soc_probe, 1238 1241 .remove = __devexit_p(rt2x00soc_remove), 1239 1242 .suspend = rt2x00soc_suspend, 1240 1243 .resume = rt2x00soc_resume,
+195 -121
drivers/net/wireless/rt2x00/rt2800usb.c
··· 92 92 static int rt2800usb_check_firmware(struct rt2x00_dev *rt2x00dev, 93 93 const u8 *data, const size_t len) 94 94 { 95 - u16 chipset = (rt2x00_rev(rt2x00dev) >> 16) & 0xffff; 96 95 size_t offset = 0; 97 96 98 97 /* ··· 110 111 * Check if we need the upper 4kb firmware data or not. 111 112 */ 112 113 if ((len == 4096) && 113 - (chipset != 0x2860) && 114 - (chipset != 0x2872) && 115 - (chipset != 0x3070)) 114 + !rt2x00_rt(rt2x00dev, RT2860) && 115 + !rt2x00_rt(rt2x00dev, RT2872) && 116 + !rt2x00_rt(rt2x00dev, RT3070)) 116 117 return FW_BAD_VERSION; 117 118 118 119 /* ··· 137 138 u32 reg; 138 139 u32 offset; 139 140 u32 length; 140 - u16 chipset = (rt2x00_rev(rt2x00dev) >> 16) & 0xffff; 141 141 142 142 /* 143 143 * Check which section of the firmware we need. 144 144 */ 145 - if ((chipset == 0x2860) || 146 - (chipset == 0x2872) || 147 - (chipset == 0x3070)) { 145 + if (rt2x00_rt(rt2x00dev, RT2860) || 146 + rt2x00_rt(rt2x00dev, RT2872) || 147 + rt2x00_rt(rt2x00dev, RT3070)) { 148 148 offset = 0; 149 149 length = 4096; 150 150 } else { ··· 198 200 */ 199 201 rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0xff, 0, 0); 200 202 201 - if ((chipset == 0x3070) || 202 - (chipset == 0x3071) || 203 - (chipset == 0x3572)) { 203 + if (rt2x00_rt(rt2x00dev, RT3070) || 204 + rt2x00_rt(rt2x00dev, RT3071) || 205 + rt2x00_rt(rt2x00dev, RT3572)) { 204 206 udelay(200); 205 207 rt2800_mcu_request(rt2x00dev, MCU_CURRENT, 0, 0, 0); 206 208 udelay(10); ··· 805 807 /* Abocom */ 806 808 { USB_DEVICE(0x07b8, 0x2870), USB_DEVICE_DATA(&rt2800usb_ops) }, 807 809 { USB_DEVICE(0x07b8, 0x2770), USB_DEVICE_DATA(&rt2800usb_ops) }, 808 - { USB_DEVICE(0x07b8, 0x3070), USB_DEVICE_DATA(&rt2800usb_ops) }, 809 - { USB_DEVICE(0x07b8, 0x3071), USB_DEVICE_DATA(&rt2800usb_ops) }, 810 - { USB_DEVICE(0x07b8, 0x3072), USB_DEVICE_DATA(&rt2800usb_ops) }, 811 810 { USB_DEVICE(0x1482, 0x3c09), USB_DEVICE_DATA(&rt2800usb_ops) }, 812 - /* AirTies */ 813 - { USB_DEVICE(0x1eda, 0x2310), USB_DEVICE_DATA(&rt2800usb_ops) }, 814 - /* Amigo */ 815 - { USB_DEVICE(0x0e0b, 0x9031), USB_DEVICE_DATA(&rt2800usb_ops) }, 816 - { USB_DEVICE(0x0e0b, 0x9041), USB_DEVICE_DATA(&rt2800usb_ops) }, 817 811 /* Amit */ 818 812 { USB_DEVICE(0x15c5, 0x0008), USB_DEVICE_DATA(&rt2800usb_ops) }, 819 813 /* Askey */ 820 814 { USB_DEVICE(0x1690, 0x0740), USB_DEVICE_DATA(&rt2800usb_ops) }, 821 - { USB_DEVICE(0x1690, 0x0744), USB_DEVICE_DATA(&rt2800usb_ops) }, 822 - { USB_DEVICE(0x0930, 0x0a07), USB_DEVICE_DATA(&rt2800usb_ops) }, 823 815 /* ASUS */ 824 816 { USB_DEVICE(0x0b05, 0x1731), USB_DEVICE_DATA(&rt2800usb_ops) }, 825 817 { USB_DEVICE(0x0b05, 0x1732), USB_DEVICE_DATA(&rt2800usb_ops) }, 826 818 { USB_DEVICE(0x0b05, 0x1742), USB_DEVICE_DATA(&rt2800usb_ops) }, 827 - { USB_DEVICE(0x0b05, 0x1760), USB_DEVICE_DATA(&rt2800usb_ops) }, 828 - { USB_DEVICE(0x0b05, 0x1761), USB_DEVICE_DATA(&rt2800usb_ops) }, 829 - { USB_DEVICE(0x0b05, 0x1784), USB_DEVICE_DATA(&rt2800usb_ops) }, 830 819 /* AzureWave */ 831 820 { USB_DEVICE(0x13d3, 0x3247), USB_DEVICE_DATA(&rt2800usb_ops) }, 832 - { USB_DEVICE(0x13d3, 0x3262), USB_DEVICE_DATA(&rt2800usb_ops) }, 833 - { USB_DEVICE(0x13d3, 0x3273), USB_DEVICE_DATA(&rt2800usb_ops) }, 834 - { USB_DEVICE(0x13d3, 0x3284), USB_DEVICE_DATA(&rt2800usb_ops) }, 835 - { USB_DEVICE(0x13d3, 0x3305), USB_DEVICE_DATA(&rt2800usb_ops) }, 836 821 /* Belkin */ 837 822 { USB_DEVICE(0x050d, 0x8053), USB_DEVICE_DATA(&rt2800usb_ops) }, 838 823 { USB_DEVICE(0x050d, 0x805c), USB_DEVICE_DATA(&rt2800usb_ops) }, 839 824 { USB_DEVICE(0x050d, 0x815c), USB_DEVICE_DATA(&rt2800usb_ops) }, 840 - { USB_DEVICE(0x050d, 0x825a), USB_DEVICE_DATA(&rt2800usb_ops) }, 841 825 /* Buffalo */ 842 826 { USB_DEVICE(0x0411, 0x00e8), USB_DEVICE_DATA(&rt2800usb_ops) }, 843 - { USB_DEVICE(0x0411, 0x012e), USB_DEVICE_DATA(&rt2800usb_ops) }, 844 - /* Cisco */ 845 - { USB_DEVICE(0x167b, 0x4001), USB_DEVICE_DATA(&rt2800usb_ops) }, 846 827 /* Conceptronic */ 847 828 { USB_DEVICE(0x14b2, 0x3c06), USB_DEVICE_DATA(&rt2800usb_ops) }, 848 829 { USB_DEVICE(0x14b2, 0x3c07), USB_DEVICE_DATA(&rt2800usb_ops) }, 849 - { USB_DEVICE(0x14b2, 0x3c08), USB_DEVICE_DATA(&rt2800usb_ops) }, 850 830 { USB_DEVICE(0x14b2, 0x3c09), USB_DEVICE_DATA(&rt2800usb_ops) }, 851 - { USB_DEVICE(0x14b2, 0x3c11), USB_DEVICE_DATA(&rt2800usb_ops) }, 852 - { USB_DEVICE(0x14b2, 0x3c12), USB_DEVICE_DATA(&rt2800usb_ops) }, 853 831 { USB_DEVICE(0x14b2, 0x3c23), USB_DEVICE_DATA(&rt2800usb_ops) }, 854 832 { USB_DEVICE(0x14b2, 0x3c25), USB_DEVICE_DATA(&rt2800usb_ops) }, 855 833 { USB_DEVICE(0x14b2, 0x3c27), USB_DEVICE_DATA(&rt2800usb_ops) }, ··· 834 860 { USB_DEVICE(0x07aa, 0x002f), USB_DEVICE_DATA(&rt2800usb_ops) }, 835 861 { USB_DEVICE(0x07aa, 0x003c), USB_DEVICE_DATA(&rt2800usb_ops) }, 836 862 { USB_DEVICE(0x07aa, 0x003f), USB_DEVICE_DATA(&rt2800usb_ops) }, 837 - { USB_DEVICE(0x07aa, 0x0041), USB_DEVICE_DATA(&rt2800usb_ops) }, 838 - { USB_DEVICE(0x07aa, 0x0042), USB_DEVICE_DATA(&rt2800usb_ops) }, 839 - { USB_DEVICE(0x18c5, 0x0008), USB_DEVICE_DATA(&rt2800usb_ops) }, 840 - { USB_DEVICE(0x18c5, 0x0012), USB_DEVICE_DATA(&rt2800usb_ops) }, 841 863 /* D-Link */ 842 864 { USB_DEVICE(0x07d1, 0x3c09), USB_DEVICE_DATA(&rt2800usb_ops) }, 843 - { USB_DEVICE(0x07d1, 0x3c0a), USB_DEVICE_DATA(&rt2800usb_ops) }, 844 - { USB_DEVICE(0x07d1, 0x3c0b), USB_DEVICE_DATA(&rt2800usb_ops) }, 845 - { USB_DEVICE(0x07d1, 0x3c0d), USB_DEVICE_DATA(&rt2800usb_ops) }, 846 - { USB_DEVICE(0x07d1, 0x3c0e), USB_DEVICE_DATA(&rt2800usb_ops) }, 847 - { USB_DEVICE(0x07d1, 0x3c0f), USB_DEVICE_DATA(&rt2800usb_ops) }, 848 865 { USB_DEVICE(0x07d1, 0x3c11), USB_DEVICE_DATA(&rt2800usb_ops) }, 849 - { USB_DEVICE(0x07d1, 0x3c13), USB_DEVICE_DATA(&rt2800usb_ops) }, 850 - { USB_DEVICE(0x07d1, 0x3c15), USB_DEVICE_DATA(&rt2800usb_ops) }, 851 866 /* Edimax */ 852 - { USB_DEVICE(0x7392, 0x7711), USB_DEVICE_DATA(&rt2800usb_ops) }, 853 867 { USB_DEVICE(0x7392, 0x7717), USB_DEVICE_DATA(&rt2800usb_ops) }, 854 868 { USB_DEVICE(0x7392, 0x7718), USB_DEVICE_DATA(&rt2800usb_ops) }, 855 - /* Encore */ 856 - { USB_DEVICE(0x203d, 0x1480), USB_DEVICE_DATA(&rt2800usb_ops) }, 857 - { USB_DEVICE(0x203d, 0x14a1), USB_DEVICE_DATA(&rt2800usb_ops) }, 858 - { USB_DEVICE(0x203d, 0x14a9), USB_DEVICE_DATA(&rt2800usb_ops) }, 859 869 /* EnGenius */ 860 870 { USB_DEVICE(0X1740, 0x9701), USB_DEVICE_DATA(&rt2800usb_ops) }, 861 871 { USB_DEVICE(0x1740, 0x9702), USB_DEVICE_DATA(&rt2800usb_ops) }, 862 - { USB_DEVICE(0x1740, 0x9703), USB_DEVICE_DATA(&rt2800usb_ops) }, 863 - { USB_DEVICE(0x1740, 0x9705), USB_DEVICE_DATA(&rt2800usb_ops) }, 864 - { USB_DEVICE(0x1740, 0x9706), USB_DEVICE_DATA(&rt2800usb_ops) }, 865 - { USB_DEVICE(0x1740, 0x9707), USB_DEVICE_DATA(&rt2800usb_ops) }, 866 - { USB_DEVICE(0x1740, 0x9708), USB_DEVICE_DATA(&rt2800usb_ops) }, 867 - { USB_DEVICE(0x1740, 0x9709), USB_DEVICE_DATA(&rt2800usb_ops) }, 868 - { USB_DEVICE(0x1740, 0x9801), USB_DEVICE_DATA(&rt2800usb_ops) }, 869 - /* Gemtek */ 870 - { USB_DEVICE(0x15a9, 0x0010), USB_DEVICE_DATA(&rt2800usb_ops) }, 871 872 /* Gigabyte */ 872 873 { USB_DEVICE(0x1044, 0x800b), USB_DEVICE_DATA(&rt2800usb_ops) }, 873 - { USB_DEVICE(0x1044, 0x800c), USB_DEVICE_DATA(&rt2800usb_ops) }, 874 - { USB_DEVICE(0x1044, 0x800d), USB_DEVICE_DATA(&rt2800usb_ops) }, 875 874 /* Hawking */ 876 875 { USB_DEVICE(0x0e66, 0x0001), USB_DEVICE_DATA(&rt2800usb_ops) }, 877 876 { USB_DEVICE(0x0e66, 0x0003), USB_DEVICE_DATA(&rt2800usb_ops) }, 878 - { USB_DEVICE(0x0e66, 0x0009), USB_DEVICE_DATA(&rt2800usb_ops) }, 879 - { USB_DEVICE(0x0e66, 0x000b), USB_DEVICE_DATA(&rt2800usb_ops) }, 880 - /* I-O DATA */ 881 - { USB_DEVICE(0x04bb, 0x0944), USB_DEVICE_DATA(&rt2800usb_ops) }, 882 - { USB_DEVICE(0x04bb, 0x0945), USB_DEVICE_DATA(&rt2800usb_ops) }, 883 - { USB_DEVICE(0x04bb, 0x0947), USB_DEVICE_DATA(&rt2800usb_ops) }, 884 - { USB_DEVICE(0x04bb, 0x0948), USB_DEVICE_DATA(&rt2800usb_ops) }, 885 - /* LevelOne */ 886 - { USB_DEVICE(0x1740, 0x0605), USB_DEVICE_DATA(&rt2800usb_ops) }, 887 - { USB_DEVICE(0x1740, 0x0615), USB_DEVICE_DATA(&rt2800usb_ops) }, 888 877 /* Linksys */ 889 878 { USB_DEVICE(0x1737, 0x0070), USB_DEVICE_DATA(&rt2800usb_ops) }, 890 879 { USB_DEVICE(0x1737, 0x0071), USB_DEVICE_DATA(&rt2800usb_ops) }, 891 - { USB_DEVICE(0x1737, 0x0077), USB_DEVICE_DATA(&rt2800usb_ops) }, 892 - { USB_DEVICE(0x1737, 0x0079), USB_DEVICE_DATA(&rt2800usb_ops) }, 893 880 /* Logitec */ 894 881 { USB_DEVICE(0x0789, 0x0162), USB_DEVICE_DATA(&rt2800usb_ops) }, 895 882 { USB_DEVICE(0x0789, 0x0163), USB_DEVICE_DATA(&rt2800usb_ops) }, 896 883 { USB_DEVICE(0x0789, 0x0164), USB_DEVICE_DATA(&rt2800usb_ops) }, 897 884 /* Motorola */ 898 885 { USB_DEVICE(0x100d, 0x9031), USB_DEVICE_DATA(&rt2800usb_ops) }, 899 - { USB_DEVICE(0x100d, 0x9032), USB_DEVICE_DATA(&rt2800usb_ops) }, 900 886 /* MSI */ 901 - { USB_DEVICE(0x0db0, 0x3820), USB_DEVICE_DATA(&rt2800usb_ops) }, 902 - { USB_DEVICE(0x0db0, 0x3821), USB_DEVICE_DATA(&rt2800usb_ops) }, 903 - { USB_DEVICE(0x0db0, 0x3870), USB_DEVICE_DATA(&rt2800usb_ops) }, 904 887 { USB_DEVICE(0x0db0, 0x6899), USB_DEVICE_DATA(&rt2800usb_ops) }, 905 - { USB_DEVICE(0x0db0, 0x821a), USB_DEVICE_DATA(&rt2800usb_ops) }, 906 - { USB_DEVICE(0x0db0, 0x870a), USB_DEVICE_DATA(&rt2800usb_ops) }, 907 - { USB_DEVICE(0x0db0, 0x899a), USB_DEVICE_DATA(&rt2800usb_ops) }, 908 - /* Ovislink */ 909 - { USB_DEVICE(0x1b75, 0x3072), USB_DEVICE_DATA(&rt2800usb_ops) }, 910 - /* Para */ 911 - { USB_DEVICE(0x20b8, 0x8888), USB_DEVICE_DATA(&rt2800usb_ops) }, 912 - /* Pegatron */ 913 - { USB_DEVICE(0x1d4d, 0x0002), USB_DEVICE_DATA(&rt2800usb_ops) }, 914 - { USB_DEVICE(0x1d4d, 0x000c), USB_DEVICE_DATA(&rt2800usb_ops) }, 915 - { USB_DEVICE(0x1d4d, 0x000e), USB_DEVICE_DATA(&rt2800usb_ops) }, 916 888 /* Philips */ 917 889 { USB_DEVICE(0x0471, 0x200f), USB_DEVICE_DATA(&rt2800usb_ops) }, 918 890 /* Planex */ 919 891 { USB_DEVICE(0x2019, 0xed06), USB_DEVICE_DATA(&rt2800usb_ops) }, 920 - { USB_DEVICE(0x2019, 0xab24), USB_DEVICE_DATA(&rt2800usb_ops) }, 921 - { USB_DEVICE(0x2019, 0xab25), USB_DEVICE_DATA(&rt2800usb_ops) }, 922 - /* Qcom */ 923 - { USB_DEVICE(0x18e8, 0x6259), USB_DEVICE_DATA(&rt2800usb_ops) }, 924 - /* Quanta */ 925 - { USB_DEVICE(0x1a32, 0x0304), USB_DEVICE_DATA(&rt2800usb_ops) }, 926 892 /* Ralink */ 927 - { USB_DEVICE(0x148f, 0x2070), USB_DEVICE_DATA(&rt2800usb_ops) }, 928 893 { USB_DEVICE(0x148f, 0x2770), USB_DEVICE_DATA(&rt2800usb_ops) }, 929 894 { USB_DEVICE(0x148f, 0x2870), USB_DEVICE_DATA(&rt2800usb_ops) }, 930 - { USB_DEVICE(0x148f, 0x3070), USB_DEVICE_DATA(&rt2800usb_ops) }, 931 - { USB_DEVICE(0x148f, 0x3071), USB_DEVICE_DATA(&rt2800usb_ops) }, 932 - { USB_DEVICE(0x148f, 0x3072), USB_DEVICE_DATA(&rt2800usb_ops) }, 933 - { USB_DEVICE(0x148f, 0x3572), USB_DEVICE_DATA(&rt2800usb_ops) }, 934 895 /* Samsung */ 935 896 { USB_DEVICE(0x04e8, 0x2018), USB_DEVICE_DATA(&rt2800usb_ops) }, 936 897 /* Siemens */ ··· 876 967 { USB_DEVICE(0x0df6, 0x002c), USB_DEVICE_DATA(&rt2800usb_ops) }, 877 968 { USB_DEVICE(0x0df6, 0x002d), USB_DEVICE_DATA(&rt2800usb_ops) }, 878 969 { USB_DEVICE(0x0df6, 0x0039), USB_DEVICE_DATA(&rt2800usb_ops) }, 879 - { USB_DEVICE(0x0df6, 0x003b), USB_DEVICE_DATA(&rt2800usb_ops) }, 880 - { USB_DEVICE(0x0df6, 0x003c), USB_DEVICE_DATA(&rt2800usb_ops) }, 881 - { USB_DEVICE(0x0df6, 0x003d), USB_DEVICE_DATA(&rt2800usb_ops) }, 882 - { USB_DEVICE(0x0df6, 0x003e), USB_DEVICE_DATA(&rt2800usb_ops) }, 883 970 { USB_DEVICE(0x0df6, 0x003f), USB_DEVICE_DATA(&rt2800usb_ops) }, 884 - { USB_DEVICE(0x0df6, 0x0040), USB_DEVICE_DATA(&rt2800usb_ops) }, 885 - { USB_DEVICE(0x0df6, 0x0041), USB_DEVICE_DATA(&rt2800usb_ops) }, 886 - { USB_DEVICE(0x0df6, 0x0042), USB_DEVICE_DATA(&rt2800usb_ops) }, 887 - { USB_DEVICE(0x0df6, 0x0047), USB_DEVICE_DATA(&rt2800usb_ops) }, 888 - { USB_DEVICE(0x0df6, 0x0048), USB_DEVICE_DATA(&rt2800usb_ops) }, 889 - { USB_DEVICE(0x0df6, 0x004a), USB_DEVICE_DATA(&rt2800usb_ops) }, 890 - { USB_DEVICE(0x0df6, 0x004d), USB_DEVICE_DATA(&rt2800usb_ops) }, 891 971 /* SMC */ 892 972 { USB_DEVICE(0x083a, 0x6618), USB_DEVICE_DATA(&rt2800usb_ops) }, 893 - { USB_DEVICE(0x083a, 0x7511), USB_DEVICE_DATA(&rt2800usb_ops) }, 894 973 { USB_DEVICE(0x083a, 0x7512), USB_DEVICE_DATA(&rt2800usb_ops) }, 895 974 { USB_DEVICE(0x083a, 0x7522), USB_DEVICE_DATA(&rt2800usb_ops) }, 896 975 { USB_DEVICE(0x083a, 0x8522), USB_DEVICE_DATA(&rt2800usb_ops) }, 897 - { USB_DEVICE(0x083a, 0xa512), USB_DEVICE_DATA(&rt2800usb_ops) }, 898 976 { USB_DEVICE(0x083a, 0xa618), USB_DEVICE_DATA(&rt2800usb_ops) }, 899 - { USB_DEVICE(0x083a, 0xa701), USB_DEVICE_DATA(&rt2800usb_ops) }, 900 - { USB_DEVICE(0x083a, 0xa702), USB_DEVICE_DATA(&rt2800usb_ops) }, 901 977 { USB_DEVICE(0x083a, 0xb522), USB_DEVICE_DATA(&rt2800usb_ops) }, 902 - { USB_DEVICE(0x083a, 0xc522), USB_DEVICE_DATA(&rt2800usb_ops) }, 903 978 /* Sparklan */ 904 979 { USB_DEVICE(0x15a9, 0x0006), USB_DEVICE_DATA(&rt2800usb_ops) }, 905 980 /* Sweex */ 906 - { USB_DEVICE(0x177f, 0x0153), USB_DEVICE_DATA(&rt2800usb_ops) }, 907 981 { USB_DEVICE(0x177f, 0x0302), USB_DEVICE_DATA(&rt2800usb_ops) }, 908 - { USB_DEVICE(0x177f, 0x0313), USB_DEVICE_DATA(&rt2800usb_ops) }, 909 982 /* U-Media*/ 910 983 { USB_DEVICE(0x157e, 0x300e), USB_DEVICE_DATA(&rt2800usb_ops) }, 911 984 /* ZCOM */ ··· 896 1005 /* Zinwell */ 897 1006 { USB_DEVICE(0x5a57, 0x0280), USB_DEVICE_DATA(&rt2800usb_ops) }, 898 1007 { USB_DEVICE(0x5a57, 0x0282), USB_DEVICE_DATA(&rt2800usb_ops) }, 899 - { USB_DEVICE(0x5a57, 0x0283), USB_DEVICE_DATA(&rt2800usb_ops) }, 900 - { USB_DEVICE(0x5a57, 0x0284), USB_DEVICE_DATA(&rt2800usb_ops) }, 901 - { USB_DEVICE(0x5a57, 0x5257), USB_DEVICE_DATA(&rt2800usb_ops) }, 902 1008 /* Zyxel */ 903 1009 { USB_DEVICE(0x0586, 0x3416), USB_DEVICE_DATA(&rt2800usb_ops) }, 1010 + #ifdef CONFIG_RT2800USB_RT30XX 1011 + /* Abocom */ 1012 + { USB_DEVICE(0x07b8, 0x3070), USB_DEVICE_DATA(&rt2800usb_ops) }, 1013 + { USB_DEVICE(0x07b8, 0x3071), USB_DEVICE_DATA(&rt2800usb_ops) }, 1014 + { USB_DEVICE(0x07b8, 0x3072), USB_DEVICE_DATA(&rt2800usb_ops) }, 1015 + /* AirTies */ 1016 + { USB_DEVICE(0x1eda, 0x2310), USB_DEVICE_DATA(&rt2800usb_ops) }, 1017 + /* AzureWave */ 1018 + { USB_DEVICE(0x13d3, 0x3273), USB_DEVICE_DATA(&rt2800usb_ops) }, 1019 + /* Conceptronic */ 1020 + { USB_DEVICE(0x14b2, 0x3c12), USB_DEVICE_DATA(&rt2800usb_ops) }, 1021 + /* Corega */ 1022 + { USB_DEVICE(0x18c5, 0x0012), USB_DEVICE_DATA(&rt2800usb_ops) }, 1023 + /* D-Link */ 1024 + { USB_DEVICE(0x07d1, 0x3c0a), USB_DEVICE_DATA(&rt2800usb_ops) }, 1025 + { USB_DEVICE(0x07d1, 0x3c0d), USB_DEVICE_DATA(&rt2800usb_ops) }, 1026 + { USB_DEVICE(0x07d1, 0x3c0e), USB_DEVICE_DATA(&rt2800usb_ops) }, 1027 + { USB_DEVICE(0x07d1, 0x3c0f), USB_DEVICE_DATA(&rt2800usb_ops) }, 1028 + /* Edimax */ 1029 + { USB_DEVICE(0x7392, 0x7711), USB_DEVICE_DATA(&rt2800usb_ops) }, 1030 + /* Encore */ 1031 + { USB_DEVICE(0x203d, 0x1480), USB_DEVICE_DATA(&rt2800usb_ops) }, 1032 + /* EnGenius */ 1033 + { USB_DEVICE(0x1740, 0x9703), USB_DEVICE_DATA(&rt2800usb_ops) }, 1034 + { USB_DEVICE(0x1740, 0x9705), USB_DEVICE_DATA(&rt2800usb_ops) }, 1035 + { USB_DEVICE(0x1740, 0x9706), USB_DEVICE_DATA(&rt2800usb_ops) }, 1036 + /* Gigabyte */ 1037 + { USB_DEVICE(0x1044, 0x800d), USB_DEVICE_DATA(&rt2800usb_ops) }, 1038 + /* I-O DATA */ 1039 + { USB_DEVICE(0x04bb, 0x0945), USB_DEVICE_DATA(&rt2800usb_ops) }, 1040 + /* MSI */ 1041 + { USB_DEVICE(0x0db0, 0x3820), USB_DEVICE_DATA(&rt2800usb_ops) }, 1042 + /* Pegatron */ 1043 + { USB_DEVICE(0x1d4d, 0x000c), USB_DEVICE_DATA(&rt2800usb_ops) }, 1044 + { USB_DEVICE(0x1d4d, 0x000e), USB_DEVICE_DATA(&rt2800usb_ops) }, 1045 + /* Planex */ 1046 + { USB_DEVICE(0x2019, 0xab25), USB_DEVICE_DATA(&rt2800usb_ops) }, 1047 + /* Quanta */ 1048 + { USB_DEVICE(0x1a32, 0x0304), USB_DEVICE_DATA(&rt2800usb_ops) }, 1049 + /* Ralink */ 1050 + { USB_DEVICE(0x148f, 0x2070), USB_DEVICE_DATA(&rt2800usb_ops) }, 1051 + { USB_DEVICE(0x148f, 0x3070), USB_DEVICE_DATA(&rt2800usb_ops) }, 1052 + { USB_DEVICE(0x148f, 0x3071), USB_DEVICE_DATA(&rt2800usb_ops) }, 1053 + { USB_DEVICE(0x148f, 0x3072), USB_DEVICE_DATA(&rt2800usb_ops) }, 1054 + /* Sitecom */ 1055 + { USB_DEVICE(0x0df6, 0x003e), USB_DEVICE_DATA(&rt2800usb_ops) }, 1056 + { USB_DEVICE(0x0df6, 0x0042), USB_DEVICE_DATA(&rt2800usb_ops) }, 1057 + /* SMC */ 1058 + { USB_DEVICE(0x083a, 0x7511), USB_DEVICE_DATA(&rt2800usb_ops) }, 1059 + /* Zinwell */ 1060 + { USB_DEVICE(0x5a57, 0x0283), USB_DEVICE_DATA(&rt2800usb_ops) }, 1061 + { USB_DEVICE(0x5a57, 0x5257), USB_DEVICE_DATA(&rt2800usb_ops) }, 1062 + #endif 1063 + #ifdef CONFIG_RT2800USB_RT35XX 1064 + /* Askey */ 1065 + { USB_DEVICE(0x1690, 0x0744), USB_DEVICE_DATA(&rt2800usb_ops) }, 1066 + /* Cisco */ 1067 + { USB_DEVICE(0x167b, 0x4001), USB_DEVICE_DATA(&rt2800usb_ops) }, 1068 + /* EnGenius */ 1069 + { USB_DEVICE(0x1740, 0x9801), USB_DEVICE_DATA(&rt2800usb_ops) }, 1070 + /* I-O DATA */ 1071 + { USB_DEVICE(0x04bb, 0x0944), USB_DEVICE_DATA(&rt2800usb_ops) }, 1072 + /* Ralink */ 1073 + { USB_DEVICE(0x148f, 0x3370), USB_DEVICE_DATA(&rt2800usb_ops) }, 1074 + { USB_DEVICE(0x148f, 0x3572), USB_DEVICE_DATA(&rt2800usb_ops) }, 1075 + { USB_DEVICE(0x148f, 0x8070), USB_DEVICE_DATA(&rt2800usb_ops) }, 1076 + /* Sitecom */ 1077 + { USB_DEVICE(0x0df6, 0x0041), USB_DEVICE_DATA(&rt2800usb_ops) }, 1078 + /* Zinwell */ 1079 + { USB_DEVICE(0x5a57, 0x0284), USB_DEVICE_DATA(&rt2800usb_ops) }, 1080 + #endif 1081 + #ifdef CONFIG_RT2800USB_UNKNOWN 1082 + /* 1083 + * Unclear what kind of devices these are (they aren't supported by the 1084 + * vendor driver). 1085 + */ 1086 + /* Allwin */ 1087 + { USB_DEVICE(0x8516, 0x2070), USB_DEVICE_DATA(&rt2800usb_ops) }, 1088 + { USB_DEVICE(0x8516, 0x2770), USB_DEVICE_DATA(&rt2800usb_ops) }, 1089 + { USB_DEVICE(0x8516, 0x2870), USB_DEVICE_DATA(&rt2800usb_ops) }, 1090 + { USB_DEVICE(0x8516, 0x3070), USB_DEVICE_DATA(&rt2800usb_ops) }, 1091 + { USB_DEVICE(0x8516, 0x3071), USB_DEVICE_DATA(&rt2800usb_ops) }, 1092 + { USB_DEVICE(0x8516, 0x3072), USB_DEVICE_DATA(&rt2800usb_ops) }, 1093 + { USB_DEVICE(0x8516, 0x3572), USB_DEVICE_DATA(&rt2800usb_ops) }, 1094 + /* Amigo */ 1095 + { USB_DEVICE(0x0e0b, 0x9031), USB_DEVICE_DATA(&rt2800usb_ops) }, 1096 + { USB_DEVICE(0x0e0b, 0x9041), USB_DEVICE_DATA(&rt2800usb_ops) }, 1097 + /* Askey */ 1098 + { USB_DEVICE(0x0930, 0x0a07), USB_DEVICE_DATA(&rt2800usb_ops) }, 1099 + /* ASUS */ 1100 + { USB_DEVICE(0x0b05, 0x1760), USB_DEVICE_DATA(&rt2800usb_ops) }, 1101 + { USB_DEVICE(0x0b05, 0x1761), USB_DEVICE_DATA(&rt2800usb_ops) }, 1102 + { USB_DEVICE(0x0b05, 0x1784), USB_DEVICE_DATA(&rt2800usb_ops) }, 1103 + { USB_DEVICE(0x0b05, 0x1790), USB_DEVICE_DATA(&rt2800usb_ops) }, 1104 + { USB_DEVICE(0x1761, 0x0b05), USB_DEVICE_DATA(&rt2800usb_ops) }, 1105 + /* AzureWave */ 1106 + { USB_DEVICE(0x13d3, 0x3262), USB_DEVICE_DATA(&rt2800usb_ops) }, 1107 + { USB_DEVICE(0x13d3, 0x3284), USB_DEVICE_DATA(&rt2800usb_ops) }, 1108 + { USB_DEVICE(0x13d3, 0x3305), USB_DEVICE_DATA(&rt2800usb_ops) }, 1109 + /* Belkin */ 1110 + { USB_DEVICE(0x050d, 0x825a), USB_DEVICE_DATA(&rt2800usb_ops) }, 1111 + /* Buffalo */ 1112 + { USB_DEVICE(0x0411, 0x012e), USB_DEVICE_DATA(&rt2800usb_ops) }, 1113 + { USB_DEVICE(0x0411, 0x0148), USB_DEVICE_DATA(&rt2800usb_ops) }, 1114 + { USB_DEVICE(0x0411, 0x0150), USB_DEVICE_DATA(&rt2800usb_ops) }, 1115 + { USB_DEVICE(0x0411, 0x015d), USB_DEVICE_DATA(&rt2800usb_ops) }, 1116 + /* Conceptronic */ 1117 + { USB_DEVICE(0x14b2, 0x3c08), USB_DEVICE_DATA(&rt2800usb_ops) }, 1118 + { USB_DEVICE(0x14b2, 0x3c11), USB_DEVICE_DATA(&rt2800usb_ops) }, 1119 + /* Corega */ 1120 + { USB_DEVICE(0x07aa, 0x0041), USB_DEVICE_DATA(&rt2800usb_ops) }, 1121 + { USB_DEVICE(0x07aa, 0x0042), USB_DEVICE_DATA(&rt2800usb_ops) }, 1122 + { USB_DEVICE(0x18c5, 0x0008), USB_DEVICE_DATA(&rt2800usb_ops) }, 1123 + /* D-Link */ 1124 + { USB_DEVICE(0x07d1, 0x3c0b), USB_DEVICE_DATA(&rt2800usb_ops) }, 1125 + { USB_DEVICE(0x07d1, 0x3c13), USB_DEVICE_DATA(&rt2800usb_ops) }, 1126 + { USB_DEVICE(0x07d1, 0x3c15), USB_DEVICE_DATA(&rt2800usb_ops) }, 1127 + { USB_DEVICE(0x07d1, 0x3c16), USB_DEVICE_DATA(&rt2800usb_ops) }, 1128 + /* Encore */ 1129 + { USB_DEVICE(0x203d, 0x14a1), USB_DEVICE_DATA(&rt2800usb_ops) }, 1130 + { USB_DEVICE(0x203d, 0x14a9), USB_DEVICE_DATA(&rt2800usb_ops) }, 1131 + /* EnGenius */ 1132 + { USB_DEVICE(0x1740, 0x9707), USB_DEVICE_DATA(&rt2800usb_ops) }, 1133 + { USB_DEVICE(0x1740, 0x9708), USB_DEVICE_DATA(&rt2800usb_ops) }, 1134 + { USB_DEVICE(0x1740, 0x9709), USB_DEVICE_DATA(&rt2800usb_ops) }, 1135 + /* Gemtek */ 1136 + { USB_DEVICE(0x15a9, 0x0010), USB_DEVICE_DATA(&rt2800usb_ops) }, 1137 + /* Gigabyte */ 1138 + { USB_DEVICE(0x1044, 0x800c), USB_DEVICE_DATA(&rt2800usb_ops) }, 1139 + /* Hawking */ 1140 + { USB_DEVICE(0x0e66, 0x0009), USB_DEVICE_DATA(&rt2800usb_ops) }, 1141 + { USB_DEVICE(0x0e66, 0x000b), USB_DEVICE_DATA(&rt2800usb_ops) }, 1142 + /* I-O DATA */ 1143 + { USB_DEVICE(0x04bb, 0x0947), USB_DEVICE_DATA(&rt2800usb_ops) }, 1144 + { USB_DEVICE(0x04bb, 0x0948), USB_DEVICE_DATA(&rt2800usb_ops) }, 1145 + /* LevelOne */ 1146 + { USB_DEVICE(0x1740, 0x0605), USB_DEVICE_DATA(&rt2800usb_ops) }, 1147 + { USB_DEVICE(0x1740, 0x0615), USB_DEVICE_DATA(&rt2800usb_ops) }, 1148 + /* Linksys */ 1149 + { USB_DEVICE(0x1737, 0x0077), USB_DEVICE_DATA(&rt2800usb_ops) }, 1150 + { USB_DEVICE(0x1737, 0x0078), USB_DEVICE_DATA(&rt2800usb_ops) }, 1151 + { USB_DEVICE(0x1737, 0x0079), USB_DEVICE_DATA(&rt2800usb_ops) }, 1152 + /* Motorola */ 1153 + { USB_DEVICE(0x100d, 0x9032), USB_DEVICE_DATA(&rt2800usb_ops) }, 1154 + /* MSI */ 1155 + { USB_DEVICE(0x0db0, 0x3821), USB_DEVICE_DATA(&rt2800usb_ops) }, 1156 + { USB_DEVICE(0x0db0, 0x3822), USB_DEVICE_DATA(&rt2800usb_ops) }, 1157 + { USB_DEVICE(0x0db0, 0x3870), USB_DEVICE_DATA(&rt2800usb_ops) }, 1158 + { USB_DEVICE(0x0db0, 0x3871), USB_DEVICE_DATA(&rt2800usb_ops) }, 1159 + { USB_DEVICE(0x0db0, 0x821a), USB_DEVICE_DATA(&rt2800usb_ops) }, 1160 + { USB_DEVICE(0x0db0, 0x822a), USB_DEVICE_DATA(&rt2800usb_ops) }, 1161 + { USB_DEVICE(0x0db0, 0x870a), USB_DEVICE_DATA(&rt2800usb_ops) }, 1162 + { USB_DEVICE(0x0db0, 0x871a), USB_DEVICE_DATA(&rt2800usb_ops) }, 1163 + { USB_DEVICE(0x0db0, 0x899a), USB_DEVICE_DATA(&rt2800usb_ops) }, 1164 + /* Ovislink */ 1165 + { USB_DEVICE(0x1b75, 0x3072), USB_DEVICE_DATA(&rt2800usb_ops) }, 1166 + /* Para */ 1167 + { USB_DEVICE(0x20b8, 0x8888), USB_DEVICE_DATA(&rt2800usb_ops) }, 1168 + /* Pegatron */ 1169 + { USB_DEVICE(0x05a6, 0x0101), USB_DEVICE_DATA(&rt2800usb_ops) }, 1170 + { USB_DEVICE(0x1d4d, 0x0002), USB_DEVICE_DATA(&rt2800usb_ops) }, 1171 + { USB_DEVICE(0x1d4d, 0x0010), USB_DEVICE_DATA(&rt2800usb_ops) }, 1172 + /* Planex */ 1173 + { USB_DEVICE(0x2019, 0xab24), USB_DEVICE_DATA(&rt2800usb_ops) }, 1174 + /* Qcom */ 1175 + { USB_DEVICE(0x18e8, 0x6259), USB_DEVICE_DATA(&rt2800usb_ops) }, 1176 + /* Sitecom */ 1177 + { USB_DEVICE(0x0df6, 0x003b), USB_DEVICE_DATA(&rt2800usb_ops) }, 1178 + { USB_DEVICE(0x0df6, 0x003c), USB_DEVICE_DATA(&rt2800usb_ops) }, 1179 + { USB_DEVICE(0x0df6, 0x003d), USB_DEVICE_DATA(&rt2800usb_ops) }, 1180 + { USB_DEVICE(0x0df6, 0x0040), USB_DEVICE_DATA(&rt2800usb_ops) }, 1181 + { USB_DEVICE(0x0df6, 0x0047), USB_DEVICE_DATA(&rt2800usb_ops) }, 1182 + { USB_DEVICE(0x0df6, 0x0048), USB_DEVICE_DATA(&rt2800usb_ops) }, 1183 + { USB_DEVICE(0x0df6, 0x004a), USB_DEVICE_DATA(&rt2800usb_ops) }, 1184 + { USB_DEVICE(0x0df6, 0x004d), USB_DEVICE_DATA(&rt2800usb_ops) }, 1185 + /* SMC */ 1186 + { USB_DEVICE(0x083a, 0xa512), USB_DEVICE_DATA(&rt2800usb_ops) }, 1187 + { USB_DEVICE(0x083a, 0xa701), USB_DEVICE_DATA(&rt2800usb_ops) }, 1188 + { USB_DEVICE(0x083a, 0xa702), USB_DEVICE_DATA(&rt2800usb_ops) }, 1189 + { USB_DEVICE(0x083a, 0xc522), USB_DEVICE_DATA(&rt2800usb_ops) }, 1190 + { USB_DEVICE(0x083a, 0xd522), USB_DEVICE_DATA(&rt2800usb_ops) }, 1191 + /* Sweex */ 1192 + { USB_DEVICE(0x177f, 0x0153), USB_DEVICE_DATA(&rt2800usb_ops) }, 1193 + { USB_DEVICE(0x177f, 0x0313), USB_DEVICE_DATA(&rt2800usb_ops) }, 1194 + /* Zyxel */ 904 1195 { USB_DEVICE(0x0586, 0x341a), USB_DEVICE_DATA(&rt2800usb_ops) }, 1196 + #endif 905 1197 { 0, } 906 1198 }; 907 1199
+26 -40
drivers/net/wireless/rt2x00/rt2x00.h
··· 160 160 enum rt2x00_chip_intf { 161 161 RT2X00_CHIP_INTF_PCI, 162 162 RT2X00_CHIP_INTF_USB, 163 + RT2X00_CHIP_INTF_SOC, 163 164 }; 164 165 165 166 /* ··· 170 169 */ 171 170 struct rt2x00_chip { 172 171 u16 rt; 173 - #define RT2460 0x0101 174 - #define RT2560 0x0201 175 - #define RT2570 0x1201 176 - #define RT2561s 0x0301 /* Turbo */ 177 - #define RT2561 0x0302 178 - #define RT2661 0x0401 179 - #define RT2571 0x1300 180 - #define RT2860 0x0601 /* 2.4GHz PCI/CB */ 181 - #define RT2860D 0x0681 /* 2.4GHz, 5GHz PCI/CB */ 182 - #define RT2890 0x0701 /* 2.4GHz PCIe */ 183 - #define RT2890D 0x0781 /* 2.4GHz, 5GHz PCIe */ 172 + #define RT2460 0x2460 173 + #define RT2560 0x2560 174 + #define RT2570 0x2570 175 + #define RT2661 0x2661 176 + #define RT2573 0x2573 177 + #define RT2860 0x2860 /* 2.4GHz PCI/CB */ 178 + #define RT2870 0x2870 179 + #define RT2872 0x2872 184 180 #define RT2880 0x2880 /* WSOC */ 181 + #define RT2883 0x2883 /* WSOC */ 182 + #define RT2890 0x2890 /* 2.4GHz PCIe */ 185 183 #define RT3052 0x3052 /* WSOC */ 184 + #define RT3070 0x3070 185 + #define RT3071 0x3071 186 186 #define RT3090 0x3090 /* 2.4GHz PCIe */ 187 - #define RT2870 0x1600 188 - #define RT3070 0x1800 187 + #define RT3390 0x3390 188 + #define RT3572 0x3572 189 189 190 190 u16 rf; 191 - u32 rev; 191 + u16 rev; 192 192 193 193 enum rt2x00_chip_intf intf; 194 194 }; ··· 919 917 * Chipset handlers 920 918 */ 921 919 static inline void rt2x00_set_chip(struct rt2x00_dev *rt2x00dev, 922 - const u16 rt, const u16 rf, const u32 rev) 920 + const u16 rt, const u16 rf, const u16 rev) 923 921 { 924 922 rt2x00dev->chip.rt = rt; 925 923 rt2x00dev->chip.rf = rf; 926 924 rt2x00dev->chip.rev = rev; 927 - } 928 925 929 - static inline void rt2x00_set_chip_rt(struct rt2x00_dev *rt2x00dev, 930 - const u16 rt) 931 - { 932 - rt2x00dev->chip.rt = rt; 933 - } 934 - 935 - static inline void rt2x00_set_chip_rf(struct rt2x00_dev *rt2x00dev, 936 - const u16 rf, const u32 rev) 937 - { 938 - rt2x00_set_chip(rt2x00dev, rt2x00dev->chip.rt, rf, rev); 939 - } 940 - 941 - static inline void rt2x00_print_chip(struct rt2x00_dev *rt2x00dev) 942 - { 943 926 INFO(rt2x00dev, 944 - "Chipset detected - rt: %04x, rf: %04x, rev: %08x.\n", 927 + "Chipset detected - rt: %04x, rf: %04x, rev: %04x.\n", 945 928 rt2x00dev->chip.rt, rt2x00dev->chip.rf, rt2x00dev->chip.rev); 946 929 } 947 930 ··· 940 953 return (rt2x00dev->chip.rf == rf); 941 954 } 942 955 943 - static inline u32 rt2x00_rev(struct rt2x00_dev *rt2x00dev) 956 + static inline u16 rt2x00_rev(struct rt2x00_dev *rt2x00dev) 944 957 { 945 958 return rt2x00dev->chip.rev; 946 - } 947 - 948 - static inline bool rt2x00_check_rev(struct rt2x00_dev *rt2x00dev, 949 - const u32 mask, const u32 rev) 950 - { 951 - return ((rt2x00dev->chip.rev & mask) == rev); 952 959 } 953 960 954 961 static inline void rt2x00_set_chip_intf(struct rt2x00_dev *rt2x00dev, ··· 957 976 return (rt2x00dev->chip.intf == intf); 958 977 } 959 978 960 - static inline bool rt2x00_intf_is_pci(struct rt2x00_dev *rt2x00dev) 979 + static inline bool rt2x00_is_pci(struct rt2x00_dev *rt2x00dev) 961 980 { 962 981 return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_PCI); 963 982 } 964 983 965 - static inline bool rt2x00_intf_is_usb(struct rt2x00_dev *rt2x00dev) 984 + static inline bool rt2x00_is_usb(struct rt2x00_dev *rt2x00dev) 966 985 { 967 986 return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_USB); 987 + } 988 + 989 + static inline bool rt2x00_is_soc(struct rt2x00_dev *rt2x00dev) 990 + { 991 + return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC); 968 992 } 969 993 970 994 /**
+2 -2
drivers/net/wireless/rt2x00/rt2x00debug.c
··· 184 184 dump_hdr->data_length = cpu_to_le32(skb->len); 185 185 dump_hdr->chip_rt = cpu_to_le16(rt2x00dev->chip.rt); 186 186 dump_hdr->chip_rf = cpu_to_le16(rt2x00dev->chip.rf); 187 - dump_hdr->chip_rev = cpu_to_le32(rt2x00dev->chip.rev); 187 + dump_hdr->chip_rev = cpu_to_le16(rt2x00dev->chip.rev); 188 188 dump_hdr->type = cpu_to_le16(type); 189 189 dump_hdr->queue_index = desc->entry->queue->qid; 190 190 dump_hdr->entry_index = desc->entry->entry_idx; ··· 573 573 blob->data = data; 574 574 data += sprintf(data, "rt chip:\t%04x\n", intf->rt2x00dev->chip.rt); 575 575 data += sprintf(data, "rf chip:\t%04x\n", intf->rt2x00dev->chip.rf); 576 - data += sprintf(data, "revision:\t%08x\n", intf->rt2x00dev->chip.rev); 576 + data += sprintf(data, "revision:\t%04x\n", intf->rt2x00dev->chip.rev); 577 577 data += sprintf(data, "\n"); 578 578 data += sprintf(data, "register\tbase\twords\twordsize\n"); 579 579 data += sprintf(data, "csr\t%d\t%d\t%d\n",
-7
drivers/net/wireless/rt2x00/rt2x00pci.c
··· 272 272 struct ieee80211_hw *hw; 273 273 struct rt2x00_dev *rt2x00dev; 274 274 int retval; 275 - u16 chip; 276 275 277 276 retval = pci_request_regions(pci_dev, pci_name(pci_dev)); 278 277 if (retval) { ··· 313 314 rt2x00dev->name = pci_name(pci_dev); 314 315 315 316 rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_PCI); 316 - 317 - /* 318 - * Determine RT chipset by reading PCI header. 319 - */ 320 - pci_read_config_word(pci_dev, PCI_DEVICE_ID, &chip); 321 - rt2x00_set_chip_rt(rt2x00dev, chip); 322 317 323 318 retval = rt2x00pci_alloc_reg(rt2x00dev); 324 319 if (retval)
+1
drivers/net/wireless/rt2x00/rt2x00pci.h
··· 27 27 #define RT2X00PCI_H 28 28 29 29 #include <linux/io.h> 30 + #include <linux/pci.h> 30 31 31 32 /* 32 33 * This variable should be used with the
+2 -9
drivers/net/wireless/rt2x00/rt2x00soc.c
··· 71 71 return -ENOMEM; 72 72 } 73 73 74 - int rt2x00soc_probe(struct platform_device *pdev, 75 - const unsigned short chipset, 76 - const struct rt2x00_ops *ops) 74 + int rt2x00soc_probe(struct platform_device *pdev, const struct rt2x00_ops *ops) 77 75 { 78 76 struct ieee80211_hw *hw; 79 77 struct rt2x00_dev *rt2x00dev; ··· 92 94 rt2x00dev->irq = platform_get_irq(pdev, 0); 93 95 rt2x00dev->name = pdev->dev.driver->name; 94 96 95 - /* 96 - * SoC devices mimic PCI behavior. 97 - */ 98 - rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_PCI); 99 - 100 - rt2x00_set_chip_rt(rt2x00dev, chipset); 97 + rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC); 101 98 102 99 retval = rt2x00soc_alloc_reg(rt2x00dev); 103 100 if (retval)
+1 -9
drivers/net/wireless/rt2x00/rt2x00soc.h
··· 28 28 29 29 #define KSEG1ADDR(__ptr) __ptr 30 30 31 - #define __rt2x00soc_probe(__chipset, __ops) \ 32 - static int __rt2x00soc_probe(struct platform_device *pdev) \ 33 - { \ 34 - return rt2x00soc_probe(pdev, (__chipset), (__ops)); \ 35 - } 36 - 37 31 /* 38 32 * SoC driver handlers. 39 33 */ 40 - int rt2x00soc_probe(struct platform_device *pdev, 41 - const unsigned short chipset, 42 - const struct rt2x00_ops *ops); 34 + int rt2x00soc_probe(struct platform_device *pdev, const struct rt2x00_ops *ops); 43 35 int rt2x00soc_remove(struct platform_device *pdev); 44 36 #ifdef CONFIG_PM 45 37 int rt2x00soc_suspend(struct platform_device *pdev, pm_message_t state);
+8 -6
drivers/net/wireless/rt2x00/rt61pci.c
··· 1131 1131 */ 1132 1132 static char *rt61pci_get_firmware_name(struct rt2x00_dev *rt2x00dev) 1133 1133 { 1134 + u16 chip; 1134 1135 char *fw_name; 1135 1136 1136 - switch (rt2x00dev->chip.rt) { 1137 - case RT2561: 1137 + pci_read_config_word(to_pci_dev(rt2x00dev->dev), PCI_DEVICE_ID, &chip); 1138 + switch (chip) { 1139 + case RT2561_PCI_ID: 1138 1140 fw_name = FIRMWARE_RT2561; 1139 1141 break; 1140 - case RT2561s: 1142 + case RT2561s_PCI_ID: 1141 1143 fw_name = FIRMWARE_RT2561s; 1142 1144 break; 1143 - case RT2661: 1145 + case RT2661_PCI_ID: 1144 1146 fw_name = FIRMWARE_RT2661; 1145 1147 break; 1146 1148 default: ··· 2297 2295 */ 2298 2296 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); 2299 2297 rt2x00pci_register_read(rt2x00dev, MAC_CSR0, &reg); 2300 - rt2x00_set_chip_rf(rt2x00dev, value, reg); 2301 - rt2x00_print_chip(rt2x00dev); 2298 + rt2x00_set_chip(rt2x00dev, rt2x00_get_field32(reg, MAC_CSR0_CHIPSET), 2299 + value, rt2x00_get_field32(reg, MAC_CSR0_REVISION)); 2302 2300 2303 2301 if (!rt2x00_rf(rt2x00dev, RF5225) && 2304 2302 !rt2x00_rf(rt2x00dev, RF5325) &&
+9
drivers/net/wireless/rt2x00/rt61pci.h
··· 28 28 #define RT61PCI_H 29 29 30 30 /* 31 + * RT chip PCI IDs. 32 + */ 33 + #define RT2561s_PCI_ID 0x0301 34 + #define RT2561_PCI_ID 0x0302 35 + #define RT2661_PCI_ID 0x0401 36 + 37 + /* 31 38 * RF chip defines. 32 39 */ 33 40 #define RF5225 0x0001 ··· 232 225 * MAC_CSR0: ASIC revision number. 233 226 */ 234 227 #define MAC_CSR0 0x3000 228 + #define MAC_CSR0_REVISION FIELD32(0x0000000f) 229 + #define MAC_CSR0_CHIPSET FIELD32(0x000ffff0) 235 230 236 231 /* 237 232 * MAC_CSR1: System control register.
+3 -4
drivers/net/wireless/rt2x00/rt73usb.c
··· 1820 1820 */ 1821 1821 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); 1822 1822 rt2x00usb_register_read(rt2x00dev, MAC_CSR0, &reg); 1823 - rt2x00_set_chip(rt2x00dev, RT2571, value, reg); 1824 - rt2x00_print_chip(rt2x00dev); 1823 + rt2x00_set_chip(rt2x00dev, rt2x00_get_field32(reg, MAC_CSR0_CHIPSET), 1824 + value, rt2x00_get_field32(reg, MAC_CSR0_REVISION)); 1825 1825 1826 - if (!rt2x00_check_rev(rt2x00dev, 0x000ffff0, 0x25730) || 1827 - rt2x00_check_rev(rt2x00dev, 0x0000000f, 0)) { 1826 + if (!rt2x00_rt(rt2x00dev, RT2573) || (rt2x00_rev(rt2x00dev) == 0)) { 1828 1827 ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); 1829 1828 return -ENODEV; 1830 1829 }
+2
drivers/net/wireless/rt2x00/rt73usb.h
··· 142 142 * MAC_CSR0: ASIC revision number. 143 143 */ 144 144 #define MAC_CSR0 0x3000 145 + #define MAC_CSR0_REVISION FIELD32(0x0000000f) 146 + #define MAC_CSR0_CHIPSET FIELD32(0x000ffff0) 145 147 146 148 /* 147 149 * MAC_CSR1: System control register.
+1 -1
drivers/net/wireless/rtl818x/rtl8187_leds.c
··· 241 241 cancel_delayed_work_sync(&priv->led_off); 242 242 cancel_delayed_work_sync(&priv->led_on); 243 243 } 244 - #endif /* def CONFIG_RTL8187_LED */ 244 + #endif /* def CONFIG_RTL8187_LEDS */ 245 245
+1 -1
drivers/net/wireless/rtl818x/rtl8187_leds.h
··· 54 54 void rtl8187_leds_init(struct ieee80211_hw *dev, u16 code); 55 55 void rtl8187_leds_exit(struct ieee80211_hw *dev); 56 56 57 - #endif /* def CONFIG_RTL8187_LED */ 57 + #endif /* def CONFIG_RTL8187_LEDS */ 58 58 59 59 #endif /* RTL8187_LED_H */
+3 -1
drivers/net/wireless/wl12xx/Makefile
··· 10 10 wl1271-objs = wl1271_main.o wl1271_spi.o wl1271_cmd.o \ 11 11 wl1271_event.o wl1271_tx.o wl1271_rx.o \ 12 12 wl1271_ps.o wl1271_acx.o wl1271_boot.o \ 13 - wl1271_init.o wl1271_debugfs.o 13 + wl1271_init.o wl1271_debugfs.o wl1271_io.o 14 + 15 + wl1271-$(CONFIG_NL80211_TESTMODE) += wl1271_testmode.o 14 16 obj-$(CONFIG_WL1271) += wl1271.o
+30 -4
drivers/net/wireless/wl12xx/wl1271.h
··· 43 43 DEBUG_SPI = BIT(1), 44 44 DEBUG_BOOT = BIT(2), 45 45 DEBUG_MAILBOX = BIT(3), 46 - DEBUG_NETLINK = BIT(4), 46 + DEBUG_TESTMODE = BIT(4), 47 47 DEBUG_EVENT = BIT(5), 48 48 DEBUG_TX = BIT(6), 49 49 DEBUG_RX = BIT(7), ··· 109 109 110 110 #define WL1271_FW_NAME "wl1271-fw.bin" 111 111 #define WL1271_NVS_NAME "wl1271-nvs.bin" 112 - #define WL1271_NVS_LEN 468 112 + 113 + /* NVS data structure */ 114 + #define WL1271_NVS_SECTION_SIZE 468 115 + 116 + #define WL1271_NVS_GENERAL_PARAMS_SIZE 57 117 + #define WL1271_NVS_GENERAL_PARAMS_SIZE_PADDED \ 118 + (WL1271_NVS_GENERAL_PARAMS_SIZE + 1) 119 + #define WL1271_NVS_STAT_RADIO_PARAMS_SIZE 17 120 + #define WL1271_NVS_STAT_RADIO_PARAMS_SIZE_PADDED \ 121 + (WL1271_NVS_STAT_RADIO_PARAMS_SIZE + 1) 122 + #define WL1271_NVS_DYN_RADIO_PARAMS_SIZE 65 123 + #define WL1271_NVS_DYN_RADIO_PARAMS_SIZE_PADDED \ 124 + (WL1271_NVS_DYN_RADIO_PARAMS_SIZE + 1) 125 + #define WL1271_NVS_FEM_COUNT 2 126 + #define WL1271_NVS_INI_SPARE_SIZE 124 127 + 128 + struct wl1271_nvs_file { 129 + /* NVS section */ 130 + u8 nvs[WL1271_NVS_SECTION_SIZE]; 131 + 132 + /* INI section */ 133 + u8 general_params[WL1271_NVS_GENERAL_PARAMS_SIZE_PADDED]; 134 + u8 stat_radio_params[WL1271_NVS_STAT_RADIO_PARAMS_SIZE_PADDED]; 135 + u8 dyn_radio_params[WL1271_NVS_FEM_COUNT] 136 + [WL1271_NVS_DYN_RADIO_PARAMS_SIZE_PADDED]; 137 + u8 ini_spare[WL1271_NVS_INI_SPARE_SIZE]; 138 + } __attribute__ ((packed)); 113 139 114 140 /* 115 141 * Enable/disable 802.11a support for WL1273 ··· 368 342 369 343 u8 *fw; 370 344 size_t fw_len; 371 - u8 *nvs; 372 - size_t nvs_len; 345 + struct wl1271_nvs_file *nvs; 373 346 374 347 u8 bssid[ETH_ALEN]; 375 348 u8 mac_addr[ETH_ALEN]; ··· 486 461 487 462 static inline bool wl1271_11a_enabled(void) 488 463 { 464 + /* FIXME: this could be determined based on the NVS-INI file */ 489 465 #ifdef WL1271_80211A_ENABLED 490 466 return true; 491 467 #else
+29 -33
drivers/net/wireless/wl12xx/wl1271_acx.c
··· 830 830 return ret; 831 831 } 832 832 833 - int wl1271_acx_ac_cfg(struct wl1271 *wl) 833 + int wl1271_acx_ac_cfg(struct wl1271 *wl, u8 ac, u8 cw_min, u16 cw_max, 834 + u8 aifsn, u16 txop) 834 835 { 835 836 struct acx_ac_cfg *acx; 836 - int i, ret = 0; 837 + int ret = 0; 837 838 838 - wl1271_debug(DEBUG_ACX, "acx access category config"); 839 + wl1271_debug(DEBUG_ACX, "acx ac cfg %d cw_ming %d cw_max %d " 840 + "aifs %d txop %d", ac, cw_min, cw_max, aifsn, txop); 839 841 840 842 acx = kzalloc(sizeof(*acx), GFP_KERNEL); 841 843 ··· 846 844 goto out; 847 845 } 848 846 849 - for (i = 0; i < wl->conf.tx.ac_conf_count; i++) { 850 - struct conf_tx_ac_category *c = &(wl->conf.tx.ac_conf[i]); 851 - acx->ac = c->ac; 852 - acx->cw_min = c->cw_min; 853 - acx->cw_max = cpu_to_le16(c->cw_max); 854 - acx->aifsn = c->aifsn; 855 - acx->reserved = 0; 856 - acx->tx_op_limit = cpu_to_le16(c->tx_op_limit); 847 + acx->ac = ac; 848 + acx->cw_min = cw_min; 849 + acx->cw_max = cpu_to_le16(cw_max); 850 + acx->aifsn = aifsn; 851 + acx->tx_op_limit = cpu_to_le16(txop); 857 852 858 - ret = wl1271_cmd_configure(wl, ACX_AC_CFG, acx, sizeof(*acx)); 859 - if (ret < 0) { 860 - wl1271_warning("Setting of access category " 861 - "config: %d", ret); 862 - goto out; 863 - } 853 + ret = wl1271_cmd_configure(wl, ACX_AC_CFG, acx, sizeof(*acx)); 854 + if (ret < 0) { 855 + wl1271_warning("acx ac cfg failed: %d", ret); 856 + goto out; 864 857 } 865 858 866 859 out: ··· 863 866 return ret; 864 867 } 865 868 866 - int wl1271_acx_tid_cfg(struct wl1271 *wl) 869 + int wl1271_acx_tid_cfg(struct wl1271 *wl, u8 queue_id, u8 channel_type, 870 + u8 tsid, u8 ps_scheme, u8 ack_policy, 871 + u32 apsd_conf0, u32 apsd_conf1) 867 872 { 868 873 struct acx_tid_config *acx; 869 - int i, ret = 0; 874 + int ret = 0; 870 875 871 876 wl1271_debug(DEBUG_ACX, "acx tid config"); 872 877 ··· 879 880 goto out; 880 881 } 881 882 882 - for (i = 0; i < wl->conf.tx.tid_conf_count; i++) { 883 - struct conf_tx_tid *c = &(wl->conf.tx.tid_conf[i]); 884 - acx->queue_id = c->queue_id; 885 - acx->channel_type = c->channel_type; 886 - acx->tsid = c->tsid; 887 - acx->ps_scheme = c->ps_scheme; 888 - acx->ack_policy = c->ack_policy; 889 - acx->apsd_conf[0] = cpu_to_le32(c->apsd_conf[0]); 890 - acx->apsd_conf[1] = cpu_to_le32(c->apsd_conf[1]); 883 + acx->queue_id = queue_id; 884 + acx->channel_type = channel_type; 885 + acx->tsid = tsid; 886 + acx->ps_scheme = ps_scheme; 887 + acx->ack_policy = ack_policy; 888 + acx->apsd_conf[0] = cpu_to_le32(apsd_conf0); 889 + acx->apsd_conf[1] = cpu_to_le32(apsd_conf1); 891 890 892 - ret = wl1271_cmd_configure(wl, ACX_TID_CFG, acx, sizeof(*acx)); 893 - if (ret < 0) { 894 - wl1271_warning("Setting of tid config failed: %d", ret); 895 - goto out; 896 - } 891 + ret = wl1271_cmd_configure(wl, ACX_TID_CFG, acx, sizeof(*acx)); 892 + if (ret < 0) { 893 + wl1271_warning("Setting of tid config failed: %d", ret); 894 + goto out; 897 895 } 898 896 899 897 out:
+8 -5
drivers/net/wireless/wl12xx/wl1271_acx.h
··· 2 2 * This file is part of wl1271 3 3 * 4 4 * Copyright (C) 1998-2009 Texas Instruments. All rights reserved. 5 - * Copyright (C) 2008-2009 Nokia Corporation 5 + * Copyright (C) 2008-2010 Nokia Corporation 6 6 * 7 7 * Contact: Luciano Coelho <luciano.coelho@nokia.com> 8 8 * ··· 348 348 * ACXBeaconFilterEntry (not 221) 349 349 * Byte Offset Size (Bytes) Definition 350 350 * =========== ============ ========== 351 - * 0 1 IE identifier 351 + * 0 1 IE identifier 352 352 * 1 1 Treatment bit mask 353 353 * 354 354 * ACXBeaconFilterEntry (221) ··· 381 381 struct acx_header header; 382 382 383 383 u8 num_ie; 384 - u8 table[BEACON_FILTER_TABLE_MAX_SIZE]; 385 384 u8 pad[3]; 385 + u8 table[BEACON_FILTER_TABLE_MAX_SIZE]; 386 386 } __attribute__ ((packed)); 387 387 388 388 struct acx_conn_monit_params { ··· 1070 1070 enum acx_ctsprotect_type ctsprotect); 1071 1071 int wl1271_acx_statistics(struct wl1271 *wl, struct acx_statistics *stats); 1072 1072 int wl1271_acx_rate_policies(struct wl1271 *wl); 1073 - int wl1271_acx_ac_cfg(struct wl1271 *wl); 1074 - int wl1271_acx_tid_cfg(struct wl1271 *wl); 1073 + int wl1271_acx_ac_cfg(struct wl1271 *wl, u8 ac, u8 cw_min, u16 cw_max, 1074 + u8 aifsn, u16 txop); 1075 + int wl1271_acx_tid_cfg(struct wl1271 *wl, u8 queue_id, u8 channel_type, 1076 + u8 tsid, u8 ps_scheme, u8 ack_policy, 1077 + u32 apsd_conf0, u32 apsd_conf1); 1075 1078 int wl1271_acx_frag_threshold(struct wl1271 *wl); 1076 1079 int wl1271_acx_tx_config_options(struct wl1271 *wl); 1077 1080 int wl1271_acx_mem_cfg(struct wl1271 *wl);
+47 -59
drivers/net/wireless/wl12xx/wl1271_boot.c
··· 27 27 #include "wl1271_reg.h" 28 28 #include "wl1271_boot.h" 29 29 #include "wl1271_spi.h" 30 + #include "wl1271_io.h" 30 31 #include "wl1271_event.h" 31 32 32 33 static struct wl1271_partition_set part_table[PART_TABLE_LEN] = { ··· 94 93 u32 cpu_ctrl; 95 94 96 95 /* 10.5.0 run the firmware (I) */ 97 - cpu_ctrl = wl1271_spi_read32(wl, ACX_REG_ECPU_CONTROL); 96 + cpu_ctrl = wl1271_read32(wl, ACX_REG_ECPU_CONTROL); 98 97 99 98 /* 10.5.1 run the firmware (II) */ 100 99 cpu_ctrl |= flag; 101 - wl1271_spi_write32(wl, ACX_REG_ECPU_CONTROL, cpu_ctrl); 100 + wl1271_write32(wl, ACX_REG_ECPU_CONTROL, cpu_ctrl); 102 101 } 103 102 104 103 static void wl1271_boot_fw_version(struct wl1271 *wl) 105 104 { 106 105 struct wl1271_static_data static_data; 107 106 108 - wl1271_spi_read(wl, wl->cmd_box_addr, 109 - &static_data, sizeof(static_data), false); 107 + wl1271_read(wl, wl->cmd_box_addr, &static_data, sizeof(static_data), 108 + false); 110 109 111 110 strncpy(wl->chip.fw_ver, static_data.fw_version, 112 111 sizeof(wl->chip.fw_ver)); ··· 165 164 memcpy(chunk, p, CHUNK_SIZE); 166 165 wl1271_debug(DEBUG_BOOT, "uploading fw chunk 0x%p to 0x%x", 167 166 p, addr); 168 - wl1271_spi_write(wl, addr, chunk, CHUNK_SIZE, false); 167 + wl1271_write(wl, addr, chunk, CHUNK_SIZE, false); 169 168 170 169 chunk_num++; 171 170 } ··· 176 175 memcpy(chunk, p, fw_data_len % CHUNK_SIZE); 177 176 wl1271_debug(DEBUG_BOOT, "uploading fw last chunk (%zd B) 0x%p to 0x%x", 178 177 fw_data_len % CHUNK_SIZE, p, addr); 179 - wl1271_spi_write(wl, addr, chunk, fw_data_len % CHUNK_SIZE, false); 178 + wl1271_write(wl, addr, chunk, fw_data_len % CHUNK_SIZE, false); 180 179 181 180 kfree(chunk); 182 181 return 0; ··· 220 219 size_t nvs_len, burst_len; 221 220 int i; 222 221 u32 dest_addr, val; 223 - u8 *nvs_ptr, *nvs, *nvs_aligned; 222 + u8 *nvs_ptr, *nvs_aligned; 224 223 225 - nvs = wl->nvs; 226 - if (nvs == NULL) 224 + if (wl->nvs == NULL) 227 225 return -ENODEV; 228 226 229 - if (wl->nvs_len < WL1271_NVS_LEN) 230 - return -EINVAL; 231 - 232 - nvs_ptr = nvs; 233 - 234 227 /* only the first part of the NVS needs to be uploaded */ 235 - nvs_len = WL1271_NVS_LEN; 236 - 237 - /* FIXME: read init settings from the remaining part of the NVS */ 238 - 239 - /* Update the device MAC address into the nvs */ 240 - nvs[11] = wl->mac_addr[0]; 241 - nvs[10] = wl->mac_addr[1]; 242 - nvs[6] = wl->mac_addr[2]; 243 - nvs[5] = wl->mac_addr[3]; 244 - nvs[4] = wl->mac_addr[4]; 245 - nvs[3] = wl->mac_addr[5]; 228 + nvs_len = sizeof(wl->nvs->nvs); 229 + nvs_ptr = (u8 *)wl->nvs->nvs; 246 230 247 231 /* 248 232 * Layout before the actual NVS tables: ··· 257 271 wl1271_debug(DEBUG_BOOT, 258 272 "nvs burst write 0x%x: 0x%x", 259 273 dest_addr, val); 260 - wl1271_spi_write32(wl, dest_addr, val); 274 + wl1271_write32(wl, dest_addr, val); 261 275 262 276 nvs_ptr += 4; 263 277 dest_addr += 4; ··· 269 283 * is 7 bytes further. 270 284 */ 271 285 nvs_ptr += 7; 272 - nvs_len -= nvs_ptr - nvs; 286 + nvs_len -= nvs_ptr - (u8 *)wl->nvs->nvs; 273 287 nvs_len = ALIGN(nvs_len, 4); 274 288 275 289 /* FIXME: The driver sets the partition here, but this is not needed, ··· 278 292 wl1271_set_partition(wl, &part_table[PART_WORK]); 279 293 280 294 /* Copy the NVS tables to a new block to ensure alignment */ 281 - nvs_aligned = kmemdup(nvs_ptr, nvs_len, GFP_KERNEL); 282 - if (!nvs_aligned) 283 - return -ENOMEM; 295 + /* FIXME: We jump 3 more bytes before uploading the NVS. It seems 296 + that our NVS files have three extra zeros here. I'm not sure whether 297 + the problem is in our NVS generation or we should really jumpt these 298 + 3 bytes here */ 299 + nvs_ptr += 3; 300 + 301 + nvs_aligned = kmemdup(nvs_ptr, nvs_len, GFP_KERNEL); if 302 + (!nvs_aligned) return -ENOMEM; 284 303 285 304 /* And finally we upload the NVS tables */ 286 305 /* FIXME: In wl1271, we upload everything at once. 287 306 No endianness handling needed here?! The ref driver doesn't do 288 307 anything about it at this point */ 289 - wl1271_spi_write(wl, CMD_MBOX_ADDRESS, nvs_aligned, nvs_len, false); 308 + wl1271_write(wl, CMD_MBOX_ADDRESS, nvs_aligned, nvs_len, false); 290 309 291 310 kfree(nvs_aligned); 292 311 return 0; ··· 300 309 static void wl1271_boot_enable_interrupts(struct wl1271 *wl) 301 310 { 302 311 enable_irq(wl->irq); 303 - wl1271_spi_write32(wl, ACX_REG_INTERRUPT_MASK, 304 - WL1271_ACX_INTR_ALL & ~(WL1271_INTR_MASK)); 305 - wl1271_spi_write32(wl, HI_CFG, HI_CFG_DEF_VAL); 312 + wl1271_write32(wl, ACX_REG_INTERRUPT_MASK, 313 + WL1271_ACX_INTR_ALL & ~(WL1271_INTR_MASK)); 314 + wl1271_write32(wl, HI_CFG, HI_CFG_DEF_VAL); 306 315 } 307 316 308 317 static int wl1271_boot_soft_reset(struct wl1271 *wl) ··· 311 320 u32 boot_data; 312 321 313 322 /* perform soft reset */ 314 - wl1271_spi_write32(wl, ACX_REG_SLV_SOFT_RESET, 315 - ACX_SLV_SOFT_RESET_BIT); 323 + wl1271_write32(wl, ACX_REG_SLV_SOFT_RESET, ACX_SLV_SOFT_RESET_BIT); 316 324 317 325 /* SOFT_RESET is self clearing */ 318 326 timeout = jiffies + usecs_to_jiffies(SOFT_RESET_MAX_TIME); 319 327 while (1) { 320 - boot_data = wl1271_spi_read32(wl, ACX_REG_SLV_SOFT_RESET); 328 + boot_data = wl1271_read32(wl, ACX_REG_SLV_SOFT_RESET); 321 329 wl1271_debug(DEBUG_BOOT, "soft reset bootdata 0x%x", boot_data); 322 330 if ((boot_data & ACX_SLV_SOFT_RESET_BIT) == 0) 323 331 break; ··· 332 342 } 333 343 334 344 /* disable Rx/Tx */ 335 - wl1271_spi_write32(wl, ENABLE, 0x0); 345 + wl1271_write32(wl, ENABLE, 0x0); 336 346 337 347 /* disable auto calibration on start*/ 338 - wl1271_spi_write32(wl, SPARE_A2, 0xffff); 348 + wl1271_write32(wl, SPARE_A2, 0xffff); 339 349 340 350 return 0; 341 351 } ··· 347 357 348 358 wl1271_boot_set_ecpu_ctrl(wl, ECPU_CONTROL_HALT); 349 359 350 - chip_id = wl1271_spi_read32(wl, CHIP_ID_B); 360 + chip_id = wl1271_read32(wl, CHIP_ID_B); 351 361 352 362 wl1271_debug(DEBUG_BOOT, "chip id after firmware boot: 0x%x", chip_id); 353 363 ··· 360 370 loop = 0; 361 371 while (loop++ < INIT_LOOP) { 362 372 udelay(INIT_LOOP_DELAY); 363 - interrupt = wl1271_spi_read32(wl, 364 - ACX_REG_INTERRUPT_NO_CLEAR); 373 + interrupt = wl1271_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR); 365 374 366 375 if (interrupt == 0xffffffff) { 367 376 wl1271_error("error reading hardware complete " ··· 369 380 } 370 381 /* check that ACX_INTR_INIT_COMPLETE is enabled */ 371 382 else if (interrupt & WL1271_ACX_INTR_INIT_COMPLETE) { 372 - wl1271_spi_write32(wl, ACX_REG_INTERRUPT_ACK, 373 - WL1271_ACX_INTR_INIT_COMPLETE); 383 + wl1271_write32(wl, ACX_REG_INTERRUPT_ACK, 384 + WL1271_ACX_INTR_INIT_COMPLETE); 374 385 break; 375 386 } 376 387 } ··· 382 393 } 383 394 384 395 /* get hardware config command mail box */ 385 - wl->cmd_box_addr = wl1271_spi_read32(wl, REG_COMMAND_MAILBOX_PTR); 396 + wl->cmd_box_addr = wl1271_read32(wl, REG_COMMAND_MAILBOX_PTR); 386 397 387 398 /* get hardware config event mail box */ 388 - wl->event_box_addr = wl1271_spi_read32(wl, REG_EVENT_MAILBOX_PTR); 399 + wl->event_box_addr = wl1271_read32(wl, REG_EVENT_MAILBOX_PTR); 389 400 390 401 /* set the working partition to its "running" mode offset */ 391 402 wl1271_set_partition(wl, &part_table[PART_WORK]); ··· 458 469 wl1271_top_reg_write(wl, OCP_REG_CLK_POLARITY, val); 459 470 } 460 471 461 - wl1271_spi_write32(wl, PLL_PARAMETERS, clk); 472 + wl1271_write32(wl, PLL_PARAMETERS, clk); 462 473 463 - pause = wl1271_spi_read32(wl, PLL_PARAMETERS); 474 + pause = wl1271_read32(wl, PLL_PARAMETERS); 464 475 465 476 wl1271_debug(DEBUG_BOOT, "pause1 0x%x", pause); 466 477 ··· 469 480 * 0x3ff (magic number ). How does 470 481 * this work?! */ 471 482 pause |= WU_COUNTER_PAUSE_VAL; 472 - wl1271_spi_write32(wl, WU_COUNTER_PAUSE, pause); 483 + wl1271_write32(wl, WU_COUNTER_PAUSE, pause); 473 484 474 485 /* Continue the ELP wake up sequence */ 475 - wl1271_spi_write32(wl, WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL); 486 + wl1271_write32(wl, WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL); 476 487 udelay(500); 477 488 478 489 wl1271_set_partition(wl, &part_table[PART_DRPW]); ··· 482 493 before taking DRPw out of reset */ 483 494 484 495 wl1271_debug(DEBUG_BOOT, "DRPW_SCRATCH_START %08x", DRPW_SCRATCH_START); 485 - clk = wl1271_spi_read32(wl, DRPW_SCRATCH_START); 496 + clk = wl1271_read32(wl, DRPW_SCRATCH_START); 486 497 487 498 wl1271_debug(DEBUG_BOOT, "clk2 0x%x", clk); 488 499 489 500 /* 2 */ 490 501 clk |= (REF_CLOCK << 1) << 4; 491 - wl1271_spi_write32(wl, DRPW_SCRATCH_START, clk); 502 + wl1271_write32(wl, DRPW_SCRATCH_START, clk); 492 503 493 504 wl1271_set_partition(wl, &part_table[PART_WORK]); 494 505 495 506 /* Disable interrupts */ 496 - wl1271_spi_write32(wl, ACX_REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL); 507 + wl1271_write32(wl, ACX_REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL); 497 508 498 509 ret = wl1271_boot_soft_reset(wl); 499 510 if (ret < 0) ··· 508 519 * ACX_EEPROMLESS_IND_REG */ 509 520 wl1271_debug(DEBUG_BOOT, "ACX_EEPROMLESS_IND_REG"); 510 521 511 - wl1271_spi_write32(wl, ACX_EEPROMLESS_IND_REG, 512 - ACX_EEPROMLESS_IND_REG); 522 + wl1271_write32(wl, ACX_EEPROMLESS_IND_REG, ACX_EEPROMLESS_IND_REG); 513 523 514 - tmp = wl1271_spi_read32(wl, CHIP_ID_B); 524 + tmp = wl1271_read32(wl, CHIP_ID_B); 515 525 516 526 wl1271_debug(DEBUG_BOOT, "chip id 0x%x", tmp); 517 527 518 528 /* 6. read the EEPROM parameters */ 519 - tmp = wl1271_spi_read32(wl, SCR_PAD2); 529 + tmp = wl1271_read32(wl, SCR_PAD2); 520 530 521 531 ret = wl1271_boot_write_irq_polarity(wl); 522 532 if (ret < 0) 523 533 goto out; 524 534 525 535 /* FIXME: Need to check whether this is really what we want */ 526 - wl1271_spi_write32(wl, ACX_REG_INTERRUPT_MASK, 527 - WL1271_ACX_ALL_EVENTS_VECTOR); 536 + wl1271_write32(wl, ACX_REG_INTERRUPT_MASK, 537 + WL1271_ACX_ALL_EVENTS_VECTOR); 528 538 529 539 /* WL1271: The reference driver skips steps 7 to 10 (jumps directly 530 540 * to upload_fw) */
+27 -107
drivers/net/wireless/wl12xx/wl1271_cmd.c
··· 30 30 #include "wl1271.h" 31 31 #include "wl1271_reg.h" 32 32 #include "wl1271_spi.h" 33 + #include "wl1271_io.h" 33 34 #include "wl1271_acx.h" 34 35 #include "wl12xx_80211.h" 35 36 #include "wl1271_cmd.h" ··· 58 57 59 58 WARN_ON(len % 4 != 0); 60 59 61 - wl1271_spi_write(wl, wl->cmd_box_addr, buf, len, false); 60 + wl1271_write(wl, wl->cmd_box_addr, buf, len, false); 62 61 63 - wl1271_spi_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_CMD); 62 + wl1271_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_CMD); 64 63 65 64 timeout = jiffies + msecs_to_jiffies(WL1271_COMMAND_TIMEOUT); 66 65 67 - intr = wl1271_spi_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR); 66 + intr = wl1271_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR); 68 67 while (!(intr & WL1271_ACX_INTR_CMD_COMPLETE)) { 69 68 if (time_after(jiffies, timeout)) { 70 69 wl1271_error("command complete timeout"); ··· 74 73 75 74 msleep(1); 76 75 77 - intr = wl1271_spi_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR); 76 + intr = wl1271_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR); 78 77 } 79 78 80 79 /* read back the status code of the command */ 81 80 if (res_len == 0) 82 81 res_len = sizeof(struct wl1271_cmd_header); 83 - wl1271_spi_read(wl, wl->cmd_box_addr, cmd, res_len, false); 82 + wl1271_read(wl, wl->cmd_box_addr, cmd, res_len, false); 84 83 85 84 status = le16_to_cpu(cmd->status); 86 85 if (status != CMD_STATUS_SUCCESS) { ··· 88 87 ret = -EIO; 89 88 } 90 89 91 - wl1271_spi_write32(wl, ACX_REG_INTERRUPT_ACK, 92 - WL1271_ACX_INTR_CMD_COMPLETE); 90 + wl1271_write32(wl, ACX_REG_INTERRUPT_ACK, 91 + WL1271_ACX_INTR_CMD_COMPLETE); 93 92 94 93 out: 95 94 return ret; ··· 192 191 int wl1271_cmd_general_parms(struct wl1271 *wl) 193 192 { 194 193 struct wl1271_general_parms_cmd *gen_parms; 195 - struct conf_general_parms *g = &wl->conf.init.genparam; 196 194 int ret; 195 + 196 + if (!wl->nvs) 197 + return -ENODEV; 197 198 198 199 gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL); 199 200 if (!gen_parms) ··· 203 200 204 201 gen_parms->test.id = TEST_CMD_INI_FILE_GENERAL_PARAM; 205 202 206 - gen_parms->ref_clk = g->ref_clk; 207 - gen_parms->settling_time = g->settling_time; 208 - gen_parms->clk_valid_on_wakeup = g->clk_valid_on_wakeup; 209 - gen_parms->dc2dcmode = g->dc2dcmode; 210 - gen_parms->single_dual_band = g->single_dual_band; 211 - gen_parms->tx_bip_fem_autodetect = g->tx_bip_fem_autodetect; 212 - gen_parms->tx_bip_fem_manufacturer = g->tx_bip_fem_manufacturer; 213 - gen_parms->settings = g->settings; 214 - 215 - gen_parms->sr_state = g->sr_state; 216 - 217 - memcpy(gen_parms->srf1, 218 - g->srf1, 219 - CONF_MAX_SMART_REFLEX_PARAMS); 220 - memcpy(gen_parms->srf2, 221 - g->srf2, 222 - CONF_MAX_SMART_REFLEX_PARAMS); 223 - memcpy(gen_parms->srf3, 224 - g->srf3, 225 - CONF_MAX_SMART_REFLEX_PARAMS); 226 - memcpy(gen_parms->sr_debug_table, 227 - g->sr_debug_table, 228 - CONF_MAX_SMART_REFLEX_PARAMS); 229 - 230 - gen_parms->sr_sen_n_p = g->sr_sen_n_p; 231 - gen_parms->sr_sen_n_p_gain = g->sr_sen_n_p_gain; 232 - gen_parms->sr_sen_nrn = g->sr_sen_nrn; 233 - gen_parms->sr_sen_prn = g->sr_sen_prn; 203 + memcpy(gen_parms->params, wl->nvs->general_params, 204 + WL1271_NVS_GENERAL_PARAMS_SIZE); 234 205 235 206 ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), 0); 236 207 if (ret < 0) ··· 217 240 int wl1271_cmd_radio_parms(struct wl1271 *wl) 218 241 { 219 242 struct wl1271_radio_parms_cmd *radio_parms; 220 - struct conf_radio_parms *r = &wl->conf.init.radioparam; 221 - int i, ret; 243 + struct conf_radio_parms *rparam = &wl->conf.init.radioparam; 244 + int ret; 245 + 246 + if (!wl->nvs) 247 + return -ENODEV; 222 248 223 249 radio_parms = kzalloc(sizeof(*radio_parms), GFP_KERNEL); 224 250 if (!radio_parms) ··· 229 249 230 250 radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM; 231 251 232 - /* Static radio parameters */ 233 - radio_parms->rx_trace_loss = r->rx_trace_loss; 234 - radio_parms->tx_trace_loss = r->tx_trace_loss; 235 - memcpy(radio_parms->rx_rssi_and_proc_compens, 236 - r->rx_rssi_and_proc_compens, 237 - CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE); 252 + memcpy(radio_parms->stat_radio_params, wl->nvs->stat_radio_params, 253 + WL1271_NVS_STAT_RADIO_PARAMS_SIZE); 254 + memcpy(radio_parms->dyn_radio_params, 255 + wl->nvs->dyn_radio_params[rparam->fem], 256 + WL1271_NVS_DYN_RADIO_PARAMS_SIZE); 238 257 239 - memcpy(radio_parms->rx_trace_loss_5, r->rx_trace_loss_5, 240 - CONF_NUMBER_OF_SUB_BANDS_5); 241 - memcpy(radio_parms->tx_trace_loss_5, r->tx_trace_loss_5, 242 - CONF_NUMBER_OF_SUB_BANDS_5); 243 - memcpy(radio_parms->rx_rssi_and_proc_compens_5, 244 - r->rx_rssi_and_proc_compens_5, 245 - CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE); 246 - 247 - /* Dynamic radio parameters */ 248 - radio_parms->tx_ref_pd_voltage = cpu_to_le16(r->tx_ref_pd_voltage); 249 - radio_parms->tx_ref_power = r->tx_ref_power; 250 - radio_parms->tx_offset_db = r->tx_offset_db; 251 - 252 - memcpy(radio_parms->tx_rate_limits_normal, r->tx_rate_limits_normal, 253 - CONF_NUMBER_OF_RATE_GROUPS); 254 - memcpy(radio_parms->tx_rate_limits_degraded, r->tx_rate_limits_degraded, 255 - CONF_NUMBER_OF_RATE_GROUPS); 256 - memcpy(radio_parms->tx_rate_limits_extreme, r->tx_rate_limits_extreme, 257 - CONF_NUMBER_OF_RATE_GROUPS); 258 - 259 - memcpy(radio_parms->tx_channel_limits_11b, r->tx_channel_limits_11b, 260 - CONF_NUMBER_OF_CHANNELS_2_4); 261 - memcpy(radio_parms->tx_channel_limits_ofdm, r->tx_channel_limits_ofdm, 262 - CONF_NUMBER_OF_CHANNELS_2_4); 263 - memcpy(radio_parms->tx_pdv_rate_offsets, r->tx_pdv_rate_offsets, 264 - CONF_NUMBER_OF_RATE_GROUPS); 265 - memcpy(radio_parms->tx_ibias, r->tx_ibias, CONF_NUMBER_OF_RATE_GROUPS); 266 - 267 - radio_parms->rx_fem_insertion_loss = r->rx_fem_insertion_loss; 268 - radio_parms->degraded_low_to_normal_threshold = 269 - r->degraded_low_to_normal_threshold; 270 - radio_parms->degraded_normal_to_high_threshold = 271 - r->degraded_normal_to_high_threshold; 272 - 273 - 274 - for (i = 0; i < CONF_NUMBER_OF_SUB_BANDS_5; i++) 275 - radio_parms->tx_ref_pd_voltage_5[i] = 276 - cpu_to_le16(r->tx_ref_pd_voltage_5[i]); 277 - memcpy(radio_parms->tx_ref_power_5, r->tx_ref_power_5, 278 - CONF_NUMBER_OF_SUB_BANDS_5); 279 - memcpy(radio_parms->tx_offset_db_5, r->tx_offset_db_5, 280 - CONF_NUMBER_OF_SUB_BANDS_5); 281 - memcpy(radio_parms->tx_rate_limits_normal_5, 282 - r->tx_rate_limits_normal_5, CONF_NUMBER_OF_RATE_GROUPS); 283 - memcpy(radio_parms->tx_rate_limits_degraded_5, 284 - r->tx_rate_limits_degraded_5, CONF_NUMBER_OF_RATE_GROUPS); 285 - memcpy(radio_parms->tx_rate_limits_extreme_5, 286 - r->tx_rate_limits_extreme_5, CONF_NUMBER_OF_RATE_GROUPS); 287 - memcpy(radio_parms->tx_channel_limits_ofdm_5, 288 - r->tx_channel_limits_ofdm_5, CONF_NUMBER_OF_CHANNELS_5); 289 - memcpy(radio_parms->tx_pdv_rate_offsets_5, r->tx_pdv_rate_offsets_5, 290 - CONF_NUMBER_OF_RATE_GROUPS); 291 - memcpy(radio_parms->tx_ibias_5, r->tx_ibias_5, 292 - CONF_NUMBER_OF_RATE_GROUPS); 293 - memcpy(radio_parms->rx_fem_insertion_loss_5, 294 - r->rx_fem_insertion_loss_5, CONF_NUMBER_OF_SUB_BANDS_5); 295 - radio_parms->degraded_low_to_normal_threshold_5 = 296 - r->degraded_low_to_normal_threshold_5; 297 - radio_parms->degraded_normal_to_high_threshold_5 = 298 - r->degraded_normal_to_high_threshold_5; 258 + /* FIXME: current NVS is missing 5GHz parameters */ 299 259 300 260 wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_RADIO_PARAM: ", 301 261 radio_parms, sizeof(*radio_parms)); ··· 475 555 return ret; 476 556 } 477 557 478 - int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode) 558 + int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode, bool send) 479 559 { 480 560 struct wl1271_cmd_ps_params *ps_params = NULL; 481 561 int ret = 0; ··· 496 576 } 497 577 498 578 ps_params->ps_mode = ps_mode; 499 - ps_params->send_null_data = 1; 579 + ps_params->send_null_data = send; 500 580 ps_params->retries = 5; 501 581 ps_params->hang_over_period = 128; 502 582 ps_params->null_data_rate = cpu_to_le32(1); /* 1 Mbps */ ··· 942 1022 ret = wl1271_cmd_send(wl, CMD_SET_KEYS, cmd, sizeof(*cmd), 0); 943 1023 if (ret < 0) { 944 1024 wl1271_warning("could not set keys"); 945 - goto out; 1025 + goto out; 946 1026 } 947 1027 948 1028 out:
+11 -77
drivers/net/wireless/wl12xx/wl1271_cmd.h
··· 38 38 int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len); 39 39 int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len); 40 40 int wl1271_cmd_data_path(struct wl1271 *wl, bool enable); 41 - int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode); 41 + int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode, bool send); 42 42 int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer, 43 43 size_t len); 44 44 int wl1271_cmd_scan(struct wl1271 *wl, u8 *ssid, size_t len, ··· 428 428 429 429 struct wl1271_cmd_test_header test; 430 430 431 - u8 ref_clk; 432 - u8 settling_time; 433 - u8 clk_valid_on_wakeup; 434 - u8 dc2dcmode; 435 - u8 single_dual_band; 436 - 437 - u8 tx_bip_fem_autodetect; 438 - u8 tx_bip_fem_manufacturer; 439 - u8 settings; 440 - 441 - u8 sr_state; 442 - 443 - s8 srf1[CONF_MAX_SMART_REFLEX_PARAMS]; 444 - s8 srf2[CONF_MAX_SMART_REFLEX_PARAMS]; 445 - s8 srf3[CONF_MAX_SMART_REFLEX_PARAMS]; 446 - 447 - s8 sr_debug_table[CONF_MAX_SMART_REFLEX_PARAMS]; 448 - 449 - u8 sr_sen_n_p; 450 - u8 sr_sen_n_p_gain; 451 - u8 sr_sen_nrn; 452 - u8 sr_sen_prn; 453 - 454 - u8 padding[3]; 431 + u8 params[WL1271_NVS_GENERAL_PARAMS_SIZE]; 432 + s8 reserved[23]; 455 433 } __attribute__ ((packed)); 434 + 435 + #define WL1271_STAT_RADIO_PARAMS_5_SIZE 29 436 + #define WL1271_DYN_RADIO_PARAMS_5_SIZE 104 456 437 457 438 struct wl1271_radio_parms_cmd { 458 439 struct wl1271_cmd_header header; 459 440 460 441 struct wl1271_cmd_test_header test; 461 442 462 - /* Static radio parameters */ 463 - /* 2.4GHz */ 464 - u8 rx_trace_loss; 465 - u8 tx_trace_loss; 466 - s8 rx_rssi_and_proc_compens[CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE]; 443 + u8 stat_radio_params[WL1271_NVS_STAT_RADIO_PARAMS_SIZE]; 444 + u8 stat_radio_params_5[WL1271_STAT_RADIO_PARAMS_5_SIZE]; 467 445 468 - /* 5GHz */ 469 - u8 rx_trace_loss_5[CONF_NUMBER_OF_SUB_BANDS_5]; 470 - u8 tx_trace_loss_5[CONF_NUMBER_OF_SUB_BANDS_5]; 471 - s8 rx_rssi_and_proc_compens_5[CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE]; 472 - 473 - /* Dynamic radio parameters */ 474 - /* 2.4GHz */ 475 - __le16 tx_ref_pd_voltage; 476 - u8 tx_ref_power; 477 - s8 tx_offset_db; 478 - 479 - s8 tx_rate_limits_normal[CONF_NUMBER_OF_RATE_GROUPS]; 480 - s8 tx_rate_limits_degraded[CONF_NUMBER_OF_RATE_GROUPS]; 481 - s8 tx_rate_limits_extreme[CONF_NUMBER_OF_RATE_GROUPS]; 482 - 483 - s8 tx_channel_limits_11b[CONF_NUMBER_OF_CHANNELS_2_4]; 484 - s8 tx_channel_limits_ofdm[CONF_NUMBER_OF_CHANNELS_2_4]; 485 - s8 tx_pdv_rate_offsets[CONF_NUMBER_OF_RATE_GROUPS]; 486 - 487 - u8 tx_ibias[CONF_NUMBER_OF_RATE_GROUPS]; 488 - u8 rx_fem_insertion_loss; 489 - 490 - u8 degraded_low_to_normal_threshold; 491 - u8 degraded_normal_to_high_threshold; 492 - 493 - u8 padding1; /* our own padding, not in ref driver */ 494 - 495 - /* 5GHz */ 496 - __le16 tx_ref_pd_voltage_5[CONF_NUMBER_OF_SUB_BANDS_5]; 497 - u8 tx_ref_power_5[CONF_NUMBER_OF_SUB_BANDS_5]; 498 - s8 tx_offset_db_5[CONF_NUMBER_OF_SUB_BANDS_5]; 499 - 500 - s8 tx_rate_limits_normal_5[CONF_NUMBER_OF_RATE_GROUPS]; 501 - s8 tx_rate_limits_degraded_5[CONF_NUMBER_OF_RATE_GROUPS]; 502 - s8 tx_rate_limits_extreme_5[CONF_NUMBER_OF_RATE_GROUPS]; 503 - 504 - s8 tx_channel_limits_ofdm_5[CONF_NUMBER_OF_CHANNELS_5]; 505 - s8 tx_pdv_rate_offsets_5[CONF_NUMBER_OF_RATE_GROUPS]; 506 - 507 - /* FIXME: this is inconsistent with the types for 2.4GHz */ 508 - s8 tx_ibias_5[CONF_NUMBER_OF_RATE_GROUPS]; 509 - s8 rx_fem_insertion_loss_5[CONF_NUMBER_OF_SUB_BANDS_5]; 510 - 511 - u8 degraded_low_to_normal_threshold_5; 512 - u8 degraded_normal_to_high_threshold_5; 513 - 514 - u8 padding2[2]; 446 + u8 dyn_radio_params[WL1271_NVS_DYN_RADIO_PARAMS_SIZE]; 447 + u8 reserved; 448 + u8 dyn_radio_params_5[WL1271_DYN_RADIO_PARAMS_5_SIZE]; 515 449 } __attribute__ ((packed)); 516 450 517 451 struct wl1271_cmd_cal_channel_tune {
+3 -141
drivers/net/wireless/wl12xx/wl1271_conf.h
··· 735 735 CONF_DUAL_BAND 736 736 }; 737 737 738 - 739 - #define CONF_MAX_SMART_REFLEX_PARAMS 16 740 - 741 - struct conf_general_parms { 742 - /* 743 - * RF Reference Clock type / speed 744 - * 745 - * Range: CONF_REF_CLK_* 746 - */ 747 - u8 ref_clk; 748 - 749 - /* 750 - * Settling time of the reference clock after boot. 751 - * 752 - * Range: u8 753 - */ 754 - u8 settling_time; 755 - 756 - /* 757 - * Flag defining whether clock is valid on wakeup. 758 - * 759 - * Range: 0 - not valid on wakeup, 1 - valid on wakeup 760 - */ 761 - u8 clk_valid_on_wakeup; 762 - 763 - /* 764 - * DC-to-DC mode. 765 - * 766 - * Range: Unknown 767 - */ 768 - u8 dc2dcmode; 769 - 770 - /* 771 - * Flag defining whether used as single or dual-band. 772 - * 773 - * Range: CONF_SINGLE_BAND, CONF_DUAL_BAND 774 - */ 775 - u8 single_dual_band; 776 - 777 - /* 778 - * TX bip fem autodetect flag. 779 - * 780 - * Range: Unknown 781 - */ 782 - u8 tx_bip_fem_autodetect; 783 - 784 - /* 785 - * TX bip gem manufacturer. 786 - * 787 - * Range: Unknown 788 - */ 789 - u8 tx_bip_fem_manufacturer; 790 - 791 - /* 792 - * Settings flags. 793 - * 794 - * Range: Unknown 795 - */ 796 - u8 settings; 797 - 798 - /* Smart reflex settings */ 799 - u8 sr_state; 800 - 801 - s8 srf1[CONF_MAX_SMART_REFLEX_PARAMS]; 802 - s8 srf2[CONF_MAX_SMART_REFLEX_PARAMS]; 803 - s8 srf3[CONF_MAX_SMART_REFLEX_PARAMS]; 804 - 805 - s8 sr_debug_table[CONF_MAX_SMART_REFLEX_PARAMS]; 806 - 807 - u8 sr_sen_n_p; 808 - u8 sr_sen_n_p_gain; 809 - u8 sr_sen_nrn; 810 - u8 sr_sen_prn; 811 - }; 812 - 813 738 #define CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE 15 814 739 #define CONF_NUMBER_OF_SUB_BANDS_5 7 815 740 #define CONF_NUMBER_OF_RATE_GROUPS 6 ··· 743 818 744 819 struct conf_radio_parms { 745 820 /* 746 - * Static radio parameters for 2.4GHz 821 + * FEM parameter set to use 747 822 * 748 - * Range: unknown 823 + * Range: 0 or 1 749 824 */ 750 - u8 rx_trace_loss; 751 - u8 tx_trace_loss; 752 - s8 rx_rssi_and_proc_compens[CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE]; 753 - 754 - /* 755 - * Static radio parameters for 5GHz 756 - * 757 - * Range: unknown 758 - */ 759 - u8 rx_trace_loss_5[CONF_NUMBER_OF_SUB_BANDS_5]; 760 - u8 tx_trace_loss_5[CONF_NUMBER_OF_SUB_BANDS_5]; 761 - s8 rx_rssi_and_proc_compens_5[CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE]; 762 - 763 - /* 764 - * Dynamic radio parameters for 2.4GHz 765 - * 766 - * Range: unknown 767 - */ 768 - u16 tx_ref_pd_voltage; 769 - u8 tx_ref_power; 770 - s8 tx_offset_db; 771 - 772 - s8 tx_rate_limits_normal[CONF_NUMBER_OF_RATE_GROUPS]; 773 - s8 tx_rate_limits_degraded[CONF_NUMBER_OF_RATE_GROUPS]; 774 - s8 tx_rate_limits_extreme[CONF_NUMBER_OF_RATE_GROUPS]; 775 - 776 - s8 tx_channel_limits_11b[CONF_NUMBER_OF_CHANNELS_2_4]; 777 - s8 tx_channel_limits_ofdm[CONF_NUMBER_OF_CHANNELS_2_4]; 778 - s8 tx_pdv_rate_offsets[CONF_NUMBER_OF_RATE_GROUPS]; 779 - 780 - u8 tx_ibias[CONF_NUMBER_OF_RATE_GROUPS]; 781 - u8 rx_fem_insertion_loss; 782 - 783 - u8 degraded_low_to_normal_threshold; 784 - u8 degraded_normal_to_high_threshold; 785 - 786 - 787 - /* 788 - * Dynamic radio parameters for 5GHz 789 - * 790 - * Range: unknown 791 - */ 792 - u16 tx_ref_pd_voltage_5[CONF_NUMBER_OF_SUB_BANDS_5]; 793 - u8 tx_ref_power_5[CONF_NUMBER_OF_SUB_BANDS_5]; 794 - s8 tx_offset_db_5[CONF_NUMBER_OF_SUB_BANDS_5]; 795 - 796 - s8 tx_rate_limits_normal_5[CONF_NUMBER_OF_RATE_GROUPS]; 797 - s8 tx_rate_limits_degraded_5[CONF_NUMBER_OF_RATE_GROUPS]; 798 - s8 tx_rate_limits_extreme_5[CONF_NUMBER_OF_RATE_GROUPS]; 799 - 800 - s8 tx_channel_limits_ofdm_5[CONF_NUMBER_OF_CHANNELS_5]; 801 - s8 tx_pdv_rate_offsets_5[CONF_NUMBER_OF_RATE_GROUPS]; 802 - 803 - /* FIXME: this is inconsistent with the types for 2.4GHz */ 804 - s8 tx_ibias_5[CONF_NUMBER_OF_RATE_GROUPS]; 805 - s8 rx_fem_insertion_loss_5[CONF_NUMBER_OF_SUB_BANDS_5]; 806 - 807 - u8 degraded_low_to_normal_threshold_5; 808 - u8 degraded_normal_to_high_threshold_5; 825 + u8 fem; 809 826 }; 810 827 811 828 struct conf_init_settings { 812 - /* 813 - * Configure general parameters. 814 - */ 815 - struct conf_general_parms genparam; 816 - 817 829 /* 818 830 * Configure radio parameters. 819 831 */
+44 -6
drivers/net/wireless/wl12xx/wl1271_event.c
··· 24 24 #include "wl1271.h" 25 25 #include "wl1271_reg.h" 26 26 #include "wl1271_spi.h" 27 + #include "wl1271_io.h" 27 28 #include "wl1271_event.h" 28 29 #include "wl1271_ps.h" 29 30 #include "wl12xx_80211.h" ··· 79 78 80 79 switch (mbox->ps_status) { 81 80 case EVENT_ENTER_POWER_SAVE_FAIL: 81 + wl1271_debug(DEBUG_PSM, "PSM entry failed"); 82 + 82 83 if (!test_bit(WL1271_FLAG_PSM, &wl->flags)) { 84 + /* remain in active mode */ 83 85 wl->psm_entry_retry = 0; 84 86 break; 85 87 } 86 88 87 89 if (wl->psm_entry_retry < wl->conf.conn.psm_entry_retries) { 88 90 wl->psm_entry_retry++; 89 - ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE); 91 + ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, 92 + true); 90 93 } else { 91 94 wl1271_error("PSM entry failed, giving up.\n"); 95 + /* FIXME: this may need to be reconsidered. for now it 96 + is not possible to indicate to the mac80211 97 + afterwards that PSM entry failed. To maximize 98 + functionality (receiving data and remaining 99 + associated) make sure that we are in sync with the 100 + AP in regard of PSM mode. */ 101 + ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE, 102 + false); 92 103 wl->psm_entry_retry = 0; 93 104 } 94 105 break; 95 106 case EVENT_ENTER_POWER_SAVE_SUCCESS: 96 107 wl->psm_entry_retry = 0; 108 + 109 + /* enable beacon filtering */ 110 + ret = wl1271_acx_beacon_filter_opt(wl, true); 111 + if (ret < 0) 112 + break; 113 + 114 + /* enable beacon early termination */ 115 + ret = wl1271_acx_bet_enable(wl, true); 116 + if (ret < 0) 117 + break; 118 + 119 + /* go to extremely low power mode */ 120 + wl1271_ps_elp_sleep(wl); 121 + if (ret < 0) 122 + break; 97 123 break; 98 124 case EVENT_EXIT_POWER_SAVE_FAIL: 99 - wl1271_info("PSM exit failed"); 125 + wl1271_debug(DEBUG_PSM, "PSM exit failed"); 126 + 127 + if (test_bit(WL1271_FLAG_PSM, &wl->flags)) { 128 + wl->psm_entry_retry = 0; 129 + break; 130 + } 131 + 132 + /* make sure the firmware goes to active mode - the frame to 133 + be sent next will indicate to the AP, that we are active. */ 134 + ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE, 135 + false); 100 136 break; 101 137 case EVENT_EXIT_POWER_SAVE_SUCCESS: 102 138 default: ··· 215 177 216 178 void wl1271_event_mbox_config(struct wl1271 *wl) 217 179 { 218 - wl->mbox_ptr[0] = wl1271_spi_read32(wl, REG_EVENT_MAILBOX_PTR); 180 + wl->mbox_ptr[0] = wl1271_read32(wl, REG_EVENT_MAILBOX_PTR); 219 181 wl->mbox_ptr[1] = wl->mbox_ptr[0] + sizeof(struct event_mailbox); 220 182 221 183 wl1271_debug(DEBUG_EVENT, "MBOX ptrs: 0x%x 0x%x", ··· 233 195 return -EINVAL; 234 196 235 197 /* first we read the mbox descriptor */ 236 - wl1271_spi_read(wl, wl->mbox_ptr[mbox_num], &mbox, 237 - sizeof(struct event_mailbox), false); 198 + wl1271_read(wl, wl->mbox_ptr[mbox_num], &mbox, 199 + sizeof(struct event_mailbox), false); 238 200 239 201 /* process the descriptor */ 240 202 ret = wl1271_event_process(wl, &mbox); ··· 242 204 return ret; 243 205 244 206 /* then we let the firmware know it can go on...*/ 245 - wl1271_spi_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_EVENT_ACK); 207 + wl1271_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_EVENT_ACK); 246 208 247 209 return 0; 248 210 }
+27 -11
drivers/net/wireless/wl12xx/wl1271_init.c
··· 49 49 return 0; 50 50 } 51 51 52 - static int wl1271_init_templates_config(struct wl1271 *wl) 52 + int wl1271_init_templates_config(struct wl1271 *wl) 53 53 { 54 54 int ret; 55 55 ··· 113 113 return 0; 114 114 } 115 115 116 - static int wl1271_init_phy_config(struct wl1271 *wl) 116 + int wl1271_init_phy_config(struct wl1271 *wl) 117 117 { 118 118 int ret; 119 119 ··· 156 156 return 0; 157 157 } 158 158 159 - static int wl1271_init_pta(struct wl1271 *wl) 159 + int wl1271_init_pta(struct wl1271 *wl) 160 160 { 161 161 int ret; 162 162 ··· 171 171 return 0; 172 172 } 173 173 174 - static int wl1271_init_energy_detection(struct wl1271 *wl) 174 + int wl1271_init_energy_detection(struct wl1271 *wl) 175 175 { 176 176 int ret; 177 177 ··· 195 195 196 196 int wl1271_hw_init(struct wl1271 *wl) 197 197 { 198 - int ret; 198 + struct conf_tx_ac_category *conf_ac; 199 + struct conf_tx_tid *conf_tid; 200 + int ret, i; 199 201 200 202 ret = wl1271_cmd_general_parms(wl); 201 203 if (ret < 0) ··· 276 274 goto out_free_memmap; 277 275 278 276 /* Default TID configuration */ 279 - ret = wl1271_acx_tid_cfg(wl); 280 - if (ret < 0) 281 - goto out_free_memmap; 277 + for (i = 0; i < wl->conf.tx.tid_conf_count; i++) { 278 + conf_tid = &wl->conf.tx.tid_conf[i]; 279 + ret = wl1271_acx_tid_cfg(wl, conf_tid->queue_id, 280 + conf_tid->channel_type, 281 + conf_tid->tsid, 282 + conf_tid->ps_scheme, 283 + conf_tid->ack_policy, 284 + conf_tid->apsd_conf[0], 285 + conf_tid->apsd_conf[1]); 286 + if (ret < 0) 287 + goto out_free_memmap; 288 + } 282 289 283 290 /* Default AC configuration */ 284 - ret = wl1271_acx_ac_cfg(wl); 285 - if (ret < 0) 286 - goto out_free_memmap; 291 + for (i = 0; i < wl->conf.tx.ac_conf_count; i++) { 292 + conf_ac = &wl->conf.tx.ac_conf[i]; 293 + ret = wl1271_acx_ac_cfg(wl, conf_ac->ac, conf_ac->cw_min, 294 + conf_ac->cw_max, conf_ac->aifsn, 295 + conf_ac->tx_op_limit); 296 + if (ret < 0) 297 + goto out_free_memmap; 298 + } 287 299 288 300 /* Configure TX rate classes */ 289 301 ret = wl1271_acx_rate_policies(wl);
+4
drivers/net/wireless/wl12xx/wl1271_init.h
··· 27 27 #include "wl1271.h" 28 28 29 29 int wl1271_hw_init_power_auth(struct wl1271 *wl); 30 + int wl1271_init_templates_config(struct wl1271 *wl); 31 + int wl1271_init_phy_config(struct wl1271 *wl); 32 + int wl1271_init_pta(struct wl1271 *wl); 33 + int wl1271_init_energy_detection(struct wl1271 *wl); 30 34 int wl1271_hw_init(struct wl1271 *wl); 31 35 32 36 #endif
+213
drivers/net/wireless/wl12xx/wl1271_io.c
··· 1 + /* 2 + * This file is part of wl1271 3 + * 4 + * Copyright (C) 2008-2010 Nokia Corporation 5 + * 6 + * Contact: Luciano Coelho <luciano.coelho@nokia.com> 7 + * 8 + * This program is free software; you can redistribute it and/or 9 + * modify it under the terms of the GNU General Public License 10 + * version 2 as published by the Free Software Foundation. 11 + * 12 + * This program is distributed in the hope that it will be useful, but 13 + * WITHOUT ANY WARRANTY; without even the implied warranty of 14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 + * General Public License for more details. 16 + * 17 + * You should have received a copy of the GNU General Public License 18 + * along with this program; if not, write to the Free Software 19 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 20 + * 02110-1301 USA 21 + * 22 + */ 23 + 24 + #include <linux/module.h> 25 + #include <linux/platform_device.h> 26 + #include <linux/crc7.h> 27 + #include <linux/spi/spi.h> 28 + 29 + #include "wl1271.h" 30 + #include "wl12xx_80211.h" 31 + #include "wl1271_spi.h" 32 + #include "wl1271_io.h" 33 + 34 + static int wl1271_translate_addr(struct wl1271 *wl, int addr) 35 + { 36 + /* 37 + * To translate, first check to which window of addresses the 38 + * particular address belongs. Then subtract the starting address 39 + * of that window from the address. Then, add offset of the 40 + * translated region. 41 + * 42 + * The translated regions occur next to each other in physical device 43 + * memory, so just add the sizes of the preceeding address regions to 44 + * get the offset to the new region. 45 + * 46 + * Currently, only the two first regions are addressed, and the 47 + * assumption is that all addresses will fall into either of those 48 + * two. 49 + */ 50 + if ((addr >= wl->part.reg.start) && 51 + (addr < wl->part.reg.start + wl->part.reg.size)) 52 + return addr - wl->part.reg.start + wl->part.mem.size; 53 + else 54 + return addr - wl->part.mem.start; 55 + } 56 + 57 + /* Set the SPI partitions to access the chip addresses 58 + * 59 + * To simplify driver code, a fixed (virtual) memory map is defined for 60 + * register and memory addresses. Because in the chipset, in different stages 61 + * of operation, those addresses will move around, an address translation 62 + * mechanism is required. 63 + * 64 + * There are four partitions (three memory and one register partition), 65 + * which are mapped to two different areas of the hardware memory. 66 + * 67 + * Virtual address 68 + * space 69 + * 70 + * | | 71 + * ...+----+--> mem.start 72 + * Physical address ... | | 73 + * space ... | | [PART_0] 74 + * ... | | 75 + * 00000000 <--+----+... ...+----+--> mem.start + mem.size 76 + * | | ... | | 77 + * |MEM | ... | | 78 + * | | ... | | 79 + * mem.size <--+----+... | | {unused area) 80 + * | | ... | | 81 + * |REG | ... | | 82 + * mem.size | | ... | | 83 + * + <--+----+... ...+----+--> reg.start 84 + * reg.size | | ... | | 85 + * |MEM2| ... | | [PART_1] 86 + * | | ... | | 87 + * ...+----+--> reg.start + reg.size 88 + * | | 89 + * 90 + */ 91 + int wl1271_set_partition(struct wl1271 *wl, 92 + struct wl1271_partition_set *p) 93 + { 94 + /* copy partition info */ 95 + memcpy(&wl->part, p, sizeof(*p)); 96 + 97 + wl1271_debug(DEBUG_SPI, "mem_start %08X mem_size %08X", 98 + p->mem.start, p->mem.size); 99 + wl1271_debug(DEBUG_SPI, "reg_start %08X reg_size %08X", 100 + p->reg.start, p->reg.size); 101 + wl1271_debug(DEBUG_SPI, "mem2_start %08X mem2_size %08X", 102 + p->mem2.start, p->mem2.size); 103 + wl1271_debug(DEBUG_SPI, "mem3_start %08X mem3_size %08X", 104 + p->mem3.start, p->mem3.size); 105 + 106 + /* write partition info to the chipset */ 107 + wl1271_raw_write32(wl, HW_PART0_START_ADDR, p->mem.start); 108 + wl1271_raw_write32(wl, HW_PART0_SIZE_ADDR, p->mem.size); 109 + wl1271_raw_write32(wl, HW_PART1_START_ADDR, p->reg.start); 110 + wl1271_raw_write32(wl, HW_PART1_SIZE_ADDR, p->reg.size); 111 + wl1271_raw_write32(wl, HW_PART2_START_ADDR, p->mem2.start); 112 + wl1271_raw_write32(wl, HW_PART2_SIZE_ADDR, p->mem2.size); 113 + wl1271_raw_write32(wl, HW_PART3_START_ADDR, p->mem3.start); 114 + 115 + return 0; 116 + } 117 + 118 + void wl1271_io_reset(struct wl1271 *wl) 119 + { 120 + wl1271_spi_reset(wl); 121 + } 122 + 123 + void wl1271_io_init(struct wl1271 *wl) 124 + { 125 + wl1271_spi_init(wl); 126 + } 127 + 128 + void wl1271_raw_write(struct wl1271 *wl, int addr, void *buf, 129 + size_t len, bool fixed) 130 + { 131 + wl1271_spi_raw_write(wl, addr, buf, len, fixed); 132 + } 133 + 134 + void wl1271_raw_read(struct wl1271 *wl, int addr, void *buf, 135 + size_t len, bool fixed) 136 + { 137 + wl1271_spi_raw_read(wl, addr, buf, len, fixed); 138 + } 139 + 140 + void wl1271_read(struct wl1271 *wl, int addr, void *buf, size_t len, 141 + bool fixed) 142 + { 143 + int physical; 144 + 145 + physical = wl1271_translate_addr(wl, addr); 146 + 147 + wl1271_spi_raw_read(wl, physical, buf, len, fixed); 148 + } 149 + 150 + void wl1271_write(struct wl1271 *wl, int addr, void *buf, size_t len, 151 + bool fixed) 152 + { 153 + int physical; 154 + 155 + physical = wl1271_translate_addr(wl, addr); 156 + 157 + wl1271_spi_raw_write(wl, physical, buf, len, fixed); 158 + } 159 + 160 + u32 wl1271_read32(struct wl1271 *wl, int addr) 161 + { 162 + return wl1271_raw_read32(wl, wl1271_translate_addr(wl, addr)); 163 + } 164 + 165 + void wl1271_write32(struct wl1271 *wl, int addr, u32 val) 166 + { 167 + wl1271_raw_write32(wl, wl1271_translate_addr(wl, addr), val); 168 + } 169 + 170 + void wl1271_top_reg_write(struct wl1271 *wl, int addr, u16 val) 171 + { 172 + /* write address >> 1 + 0x30000 to OCP_POR_CTR */ 173 + addr = (addr >> 1) + 0x30000; 174 + wl1271_write32(wl, OCP_POR_CTR, addr); 175 + 176 + /* write value to OCP_POR_WDATA */ 177 + wl1271_write32(wl, OCP_DATA_WRITE, val); 178 + 179 + /* write 1 to OCP_CMD */ 180 + wl1271_write32(wl, OCP_CMD, OCP_CMD_WRITE); 181 + } 182 + 183 + u16 wl1271_top_reg_read(struct wl1271 *wl, int addr) 184 + { 185 + u32 val; 186 + int timeout = OCP_CMD_LOOP; 187 + 188 + /* write address >> 1 + 0x30000 to OCP_POR_CTR */ 189 + addr = (addr >> 1) + 0x30000; 190 + wl1271_write32(wl, OCP_POR_CTR, addr); 191 + 192 + /* write 2 to OCP_CMD */ 193 + wl1271_write32(wl, OCP_CMD, OCP_CMD_READ); 194 + 195 + /* poll for data ready */ 196 + do { 197 + val = wl1271_read32(wl, OCP_DATA_READ); 198 + } while (!(val & OCP_READY_MASK) && --timeout); 199 + 200 + if (!timeout) { 201 + wl1271_warning("Top register access timed out."); 202 + return 0xffff; 203 + } 204 + 205 + /* check data status and return if OK */ 206 + if ((val & OCP_STATUS_MASK) == OCP_STATUS_OK) 207 + return val & 0xffff; 208 + else { 209 + wl1271_warning("Top register access returned error."); 210 + return 0xffff; 211 + } 212 + } 213 +
+68
drivers/net/wireless/wl12xx/wl1271_io.h
··· 1 + /* 2 + * This file is part of wl1271 3 + * 4 + * Copyright (C) 1998-2009 Texas Instruments. All rights reserved. 5 + * Copyright (C) 2008-2010 Nokia Corporation 6 + * 7 + * Contact: Luciano Coelho <luciano.coelho@nokia.com> 8 + * 9 + * This program is free software; you can redistribute it and/or 10 + * modify it under the terms of the GNU General Public License 11 + * version 2 as published by the Free Software Foundation. 12 + * 13 + * This program is distributed in the hope that it will be useful, but 14 + * WITHOUT ANY WARRANTY; without even the implied warranty of 15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 + * General Public License for more details. 17 + * 18 + * You should have received a copy of the GNU General Public License 19 + * along with this program; if not, write to the Free Software 20 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 21 + * 02110-1301 USA 22 + * 23 + */ 24 + 25 + #ifndef __WL1271_IO_H__ 26 + #define __WL1271_IO_H__ 27 + 28 + struct wl1271; 29 + 30 + void wl1271_io_reset(struct wl1271 *wl); 31 + void wl1271_io_init(struct wl1271 *wl); 32 + 33 + /* Raw target IO, address is not translated */ 34 + void wl1271_raw_write(struct wl1271 *wl, int addr, void *buf, 35 + size_t len, bool fixed); 36 + void wl1271_raw_read(struct wl1271 *wl, int addr, void *buf, 37 + size_t len, bool fixed); 38 + 39 + /* Translated target IO */ 40 + void wl1271_read(struct wl1271 *wl, int addr, void *buf, size_t len, 41 + bool fixed); 42 + void wl1271_write(struct wl1271 *wl, int addr, void *buf, size_t len, 43 + bool fixed); 44 + u32 wl1271_read32(struct wl1271 *wl, int addr); 45 + void wl1271_write32(struct wl1271 *wl, int addr, u32 val); 46 + 47 + /* Top Register IO */ 48 + void wl1271_top_reg_write(struct wl1271 *wl, int addr, u16 val); 49 + u16 wl1271_top_reg_read(struct wl1271 *wl, int addr); 50 + 51 + int wl1271_set_partition(struct wl1271 *wl, 52 + struct wl1271_partition_set *p); 53 + 54 + static inline u32 wl1271_raw_read32(struct wl1271 *wl, int addr) 55 + { 56 + wl1271_raw_read(wl, addr, &wl->buffer_32, 57 + sizeof(wl->buffer_32), false); 58 + 59 + return wl->buffer_32; 60 + } 61 + 62 + static inline void wl1271_raw_write32(struct wl1271 *wl, int addr, u32 val) 63 + { 64 + wl->buffer_32 = val; 65 + wl1271_raw_write(wl, addr, &wl->buffer_32, 66 + sizeof(wl->buffer_32), false); 67 + } 68 + #endif
+303 -178
drivers/net/wireless/wl12xx/wl1271_main.c
··· 1 1 /* 2 2 * This file is part of wl1271 3 3 * 4 - * Copyright (C) 2008-2009 Nokia Corporation 4 + * Copyright (C) 2008-2010 Nokia Corporation 5 5 * 6 6 * Contact: Luciano Coelho <luciano.coelho@nokia.com> 7 7 * ··· 38 38 #include "wl12xx_80211.h" 39 39 #include "wl1271_reg.h" 40 40 #include "wl1271_spi.h" 41 + #include "wl1271_io.h" 41 42 #include "wl1271_event.h" 42 43 #include "wl1271_tx.h" 43 44 #include "wl1271_rx.h" ··· 47 46 #include "wl1271_debugfs.h" 48 47 #include "wl1271_cmd.h" 49 48 #include "wl1271_boot.h" 49 + #include "wl1271_testmode.h" 50 50 51 51 #define WL1271_BOOT_RETRIES 3 52 52 ··· 231 229 .psm_entry_retries = 3 232 230 }, 233 231 .init = { 234 - .genparam = { 235 - .ref_clk = CONF_REF_CLK_38_4_E, 236 - .settling_time = 5, 237 - .clk_valid_on_wakeup = 0, 238 - .dc2dcmode = 0, 239 - .single_dual_band = CONF_SINGLE_BAND, 240 - .tx_bip_fem_autodetect = 1, 241 - .tx_bip_fem_manufacturer = 1, 242 - .settings = 1, 243 - .sr_state = 1, 244 - .srf1 = { 0x07, 0x03, 0x18, 0x10, 0x05, 0xfb, 0xf0, 245 - 0xe8, 0, 0, 0, 0, 0, 0, 0, 0 }, 246 - .srf2 = { 0x07, 0x03, 0x18, 0x10, 0x05, 0xfb, 0xf0, 247 - 0xe8, 0, 0, 0, 0, 0, 0, 0, 0 }, 248 - .srf3 = { 0x07, 0x03, 0x18, 0x10, 0x05, 0xfb, 0xf0, 249 - 0xe8, 0, 0, 0, 0, 0, 0, 0, 0 }, 250 - .sr_debug_table = { 0, 0, 0, 0, 0, 0, 0, 0, 251 - 0, 0, 0, 0, 0, 0, 0, 0 }, 252 - .sr_sen_n_p = 0, 253 - .sr_sen_n_p_gain = 0, 254 - .sr_sen_nrn = 0, 255 - .sr_sen_prn = 0, 256 - }, 257 232 .radioparam = { 258 - .rx_trace_loss = 0x24, 259 - .tx_trace_loss = 0x0, 260 - .rx_rssi_and_proc_compens = { 261 - 0xec, 0xf6, 0x00, 0x0c, 0x18, 0xf8, 262 - 0xfc, 0x00, 0x80, 0x10, 0xf0, 0xf8, 263 - 0x00, 0x0a, 0x14 }, 264 - .rx_trace_loss_5 = { 0, 0, 0, 0, 0, 0, 0 }, 265 - .tx_trace_loss_5 = { 0, 0, 0, 0, 0, 0, 0 }, 266 - .rx_rssi_and_proc_compens_5 = { 267 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 268 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 269 - 0x00, 0x00, 0x00 }, 270 - .tx_ref_pd_voltage = 0x1a9, 271 - .tx_ref_power = 0x80, 272 - .tx_offset_db = 0x0, 273 - .tx_rate_limits_normal = { 274 - 0x1d, 0x1f, 0x24, 0x28, 0x28, 0x29 }, 275 - .tx_rate_limits_degraded = { 276 - 0x19, 0x1f, 0x22, 0x23, 0x27, 0x28 }, 277 - .tx_rate_limits_extreme = { 278 - 0x19, 0x1c, 0x1e, 0x20, 0x24, 0x25 }, 279 - .tx_channel_limits_11b = { 280 - 0x22, 0x50, 0x50, 0x50, 0x50, 0x50, 281 - 0x50, 0x50, 0x50, 0x50, 0x22, 0x50, 282 - 0x22, 0x50 }, 283 - .tx_channel_limits_ofdm = { 284 - 0x20, 0x50, 0x50, 0x50, 0x50, 0x50, 285 - 0x50, 0x50, 0x50, 0x50, 0x20, 0x50, 286 - 0x20, 0x50 }, 287 - .tx_pdv_rate_offsets = { 288 - 0x07, 0x08, 0x04, 0x02, 0x02, 0x00 }, 289 - .tx_ibias = { 290 - 0x11, 0x11, 0x15, 0x11, 0x15, 0x0f }, 291 - .rx_fem_insertion_loss = 0x0e, 292 - .degraded_low_to_normal_threshold = 0x1e, 293 - .degraded_normal_to_high_threshold = 0x2d, 294 - .tx_ref_pd_voltage_5 = { 295 - 0x0190, 0x01a4, 0x01c3, 0x01d8, 296 - 0x020a, 0x021c }, 297 - .tx_ref_power_5 = { 298 - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }, 299 - .tx_offset_db_5 = { 300 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 301 - .tx_rate_limits_normal_5 = { 302 - 0x1b, 0x1e, 0x21, 0x23, 0x27, 0x00 }, 303 - .tx_rate_limits_degraded_5 = { 304 - 0x1b, 0x1e, 0x21, 0x23, 0x27, 0x00 }, 305 - .tx_rate_limits_extreme_5 = { 306 - 0x1b, 0x1e, 0x21, 0x23, 0x27, 0x00 }, 307 - .tx_channel_limits_ofdm_5 = { 308 - 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 309 - 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 310 - 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 311 - 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 312 - 0x50, 0x50, 0x50 }, 313 - .tx_pdv_rate_offsets_5 = { 314 - 0x01, 0x02, 0x02, 0x02, 0x02, 0x00 }, 315 - .tx_ibias_5 = { 316 - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10 }, 317 - .rx_fem_insertion_loss_5 = { 318 - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10 }, 319 - .degraded_low_to_normal_threshold_5 = 0x00, 320 - .degraded_normal_to_high_threshold_5 = 0x00 233 + .fem = 1, 321 234 } 322 235 }, 323 236 .itrim = { ··· 262 345 263 346 /* apply driver default configuration */ 264 347 memcpy(&wl->conf, &default_conf, sizeof(default_conf)); 265 - 266 - if (wl1271_11a_enabled()) 267 - wl->conf.init.genparam.single_dual_band = CONF_DUAL_BAND; 268 348 } 269 349 270 350 271 351 static int wl1271_plt_init(struct wl1271 *wl) 272 352 { 273 - int ret; 353 + struct conf_tx_ac_category *conf_ac; 354 + struct conf_tx_tid *conf_tid; 355 + int ret, i; 274 356 275 357 ret = wl1271_cmd_general_parms(wl); 276 358 if (ret < 0) ··· 279 363 if (ret < 0) 280 364 return ret; 281 365 366 + ret = wl1271_init_templates_config(wl); 367 + if (ret < 0) 368 + return ret; 369 + 282 370 ret = wl1271_acx_init_mem_config(wl); 283 371 if (ret < 0) 284 372 return ret; 285 373 374 + /* PHY layer config */ 375 + ret = wl1271_init_phy_config(wl); 376 + if (ret < 0) 377 + goto out_free_memmap; 378 + 379 + ret = wl1271_acx_dco_itrim_params(wl); 380 + if (ret < 0) 381 + goto out_free_memmap; 382 + 383 + /* Initialize connection monitoring thresholds */ 384 + ret = wl1271_acx_conn_monit_params(wl); 385 + if (ret < 0) 386 + goto out_free_memmap; 387 + 388 + /* Bluetooth WLAN coexistence */ 389 + ret = wl1271_init_pta(wl); 390 + if (ret < 0) 391 + goto out_free_memmap; 392 + 393 + /* Energy detection */ 394 + ret = wl1271_init_energy_detection(wl); 395 + if (ret < 0) 396 + goto out_free_memmap; 397 + 398 + /* Default fragmentation threshold */ 399 + ret = wl1271_acx_frag_threshold(wl); 400 + if (ret < 0) 401 + goto out_free_memmap; 402 + 403 + /* Default TID configuration */ 404 + for (i = 0; i < wl->conf.tx.tid_conf_count; i++) { 405 + conf_tid = &wl->conf.tx.tid_conf[i]; 406 + ret = wl1271_acx_tid_cfg(wl, conf_tid->queue_id, 407 + conf_tid->channel_type, 408 + conf_tid->tsid, 409 + conf_tid->ps_scheme, 410 + conf_tid->ack_policy, 411 + conf_tid->apsd_conf[0], 412 + conf_tid->apsd_conf[1]); 413 + if (ret < 0) 414 + goto out_free_memmap; 415 + } 416 + 417 + /* Default AC configuration */ 418 + for (i = 0; i < wl->conf.tx.ac_conf_count; i++) { 419 + conf_ac = &wl->conf.tx.ac_conf[i]; 420 + ret = wl1271_acx_ac_cfg(wl, conf_ac->ac, conf_ac->cw_min, 421 + conf_ac->cw_max, conf_ac->aifsn, 422 + conf_ac->tx_op_limit); 423 + if (ret < 0) 424 + goto out_free_memmap; 425 + } 426 + 427 + /* Enable data path */ 286 428 ret = wl1271_cmd_data_path(wl, 1); 287 429 if (ret < 0) 288 - return ret; 430 + goto out_free_memmap; 431 + 432 + /* Configure for CAM power saving (ie. always active) */ 433 + ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM); 434 + if (ret < 0) 435 + goto out_free_memmap; 436 + 437 + /* configure PM */ 438 + ret = wl1271_acx_pm_config(wl); 439 + if (ret < 0) 440 + goto out_free_memmap; 289 441 290 442 return 0; 443 + 444 + out_free_memmap: 445 + kfree(wl->target_mem_map); 446 + wl->target_mem_map = NULL; 447 + 448 + return ret; 291 449 } 292 450 293 451 static void wl1271_disable_interrupts(struct wl1271 *wl) ··· 387 397 u32 total = 0; 388 398 int i; 389 399 390 - wl1271_spi_read(wl, FW_STATUS_ADDR, status, 391 - sizeof(*status), false); 400 + wl1271_read(wl, FW_STATUS_ADDR, status, sizeof(*status), false); 392 401 393 402 wl1271_debug(DEBUG_IRQ, "intr: 0x%x (fw_rx_counter = %d, " 394 403 "drv_rx_counter = %d, tx_results_counter = %d)", ··· 434 445 if (ret < 0) 435 446 goto out; 436 447 437 - wl1271_spi_write32(wl, ACX_REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL); 448 + wl1271_write32(wl, ACX_REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL); 438 449 439 450 wl1271_fw_status(wl, wl->fw_status); 440 451 intr = le32_to_cpu(wl->fw_status->intr); ··· 476 487 } 477 488 478 489 out_sleep: 479 - wl1271_spi_write32(wl, ACX_REG_INTERRUPT_MASK, 480 - WL1271_ACX_INTR_ALL & ~(WL1271_INTR_MASK)); 490 + wl1271_write32(wl, ACX_REG_INTERRUPT_MASK, 491 + WL1271_ACX_INTR_ALL & ~(WL1271_INTR_MASK)); 481 492 wl1271_ps_elp_sleep(wl); 482 493 483 494 out: ··· 544 555 return ret; 545 556 } 546 557 558 + static int wl1271_update_mac_addr(struct wl1271 *wl) 559 + { 560 + int ret = 0; 561 + u8 *nvs_ptr = (u8 *)wl->nvs->nvs; 562 + 563 + /* get mac address from the NVS */ 564 + wl->mac_addr[0] = nvs_ptr[11]; 565 + wl->mac_addr[1] = nvs_ptr[10]; 566 + wl->mac_addr[2] = nvs_ptr[6]; 567 + wl->mac_addr[3] = nvs_ptr[5]; 568 + wl->mac_addr[4] = nvs_ptr[4]; 569 + wl->mac_addr[5] = nvs_ptr[3]; 570 + 571 + /* FIXME: if it is a zero-address, we should bail out. Now, instead, 572 + we randomize an address */ 573 + if (is_zero_ether_addr(wl->mac_addr)) { 574 + static const u8 nokia_oui[3] = {0x00, 0x1f, 0xdf}; 575 + memcpy(wl->mac_addr, nokia_oui, 3); 576 + get_random_bytes(wl->mac_addr + 3, 3); 577 + 578 + /* update this address to the NVS */ 579 + nvs_ptr[11] = wl->mac_addr[0]; 580 + nvs_ptr[10] = wl->mac_addr[1]; 581 + nvs_ptr[6] = wl->mac_addr[2]; 582 + nvs_ptr[5] = wl->mac_addr[3]; 583 + nvs_ptr[4] = wl->mac_addr[4]; 584 + nvs_ptr[3] = wl->mac_addr[5]; 585 + } 586 + 587 + SET_IEEE80211_PERM_ADDR(wl->hw, wl->mac_addr); 588 + 589 + return ret; 590 + } 591 + 547 592 static int wl1271_fetch_nvs(struct wl1271 *wl) 548 593 { 549 594 const struct firmware *fw; ··· 590 567 return ret; 591 568 } 592 569 593 - if (fw->size % 4) { 594 - wl1271_error("nvs size is not multiple of 32 bits: %zu", 595 - fw->size); 570 + if (fw->size != sizeof(struct wl1271_nvs_file)) { 571 + wl1271_error("nvs size is not as expected: %zu != %zu", 572 + fw->size, sizeof(struct wl1271_nvs_file)); 596 573 ret = -EILSEQ; 597 574 goto out; 598 575 } 599 576 600 - wl->nvs_len = fw->size; 601 - wl->nvs = kmalloc(wl->nvs_len, GFP_KERNEL); 577 + wl->nvs = kmalloc(sizeof(struct wl1271_nvs_file), GFP_KERNEL); 602 578 603 579 if (!wl->nvs) { 604 580 wl1271_error("could not allocate memory for the nvs file"); ··· 605 583 goto out; 606 584 } 607 585 608 - memcpy(wl->nvs, fw->data, wl->nvs_len); 586 + memcpy(wl->nvs, fw->data, sizeof(struct wl1271_nvs_file)); 609 587 610 - ret = 0; 588 + ret = wl1271_update_mac_addr(wl); 611 589 612 590 out: 613 591 release_firmware(fw); ··· 648 626 msleep(WL1271_PRE_POWER_ON_SLEEP); 649 627 wl1271_power_on(wl); 650 628 msleep(WL1271_POWER_ON_SLEEP); 651 - wl1271_spi_reset(wl); 652 - wl1271_spi_init(wl); 629 + wl1271_io_reset(wl); 630 + wl1271_io_init(wl); 653 631 654 632 /* We don't need a real memory partition here, because we only want 655 633 * to use the registers at this point. */ ··· 664 642 /* whal_FwCtrl_BootSm() */ 665 643 666 644 /* 0. read chip id from CHIP_ID */ 667 - wl->chip.id = wl1271_spi_read32(wl, CHIP_ID_B); 645 + wl->chip.id = wl1271_read32(wl, CHIP_ID_B); 668 646 669 647 /* 1. check if chip id is valid */ 670 648 ··· 735 713 goto power_off; 736 714 737 715 ret = wl1271_plt_init(wl); 738 - if (ret < 0) 739 - goto irq_disable; 740 - 741 - /* Make sure power saving is disabled */ 742 - ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM); 743 716 if (ret < 0) 744 717 goto irq_disable; 745 718 ··· 1251 1234 } 1252 1235 1253 1236 /* if the channel changes while joined, join again */ 1254 - if (channel != wl->channel && test_bit(WL1271_FLAG_JOINED, &wl->flags)) 1255 - wl1271_join_channel(wl, channel); 1237 + if (channel != wl->channel && 1238 + test_bit(WL1271_FLAG_JOINED, &wl->flags)) { 1239 + wl->channel = channel; 1240 + /* FIXME: maybe use CMD_CHANNEL_SWITCH for this? */ 1241 + ret = wl1271_cmd_join(wl); 1242 + if (ret < 0) 1243 + wl1271_warning("cmd join to update channel failed %d", 1244 + ret); 1245 + } else 1246 + wl->channel = channel; 1256 1247 1257 1248 if (conf->flags & IEEE80211_CONF_PS && 1258 1249 !test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags)) { ··· 1273 1248 */ 1274 1249 if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) { 1275 1250 wl1271_info("psm enabled"); 1276 - ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE); 1251 + ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, 1252 + true); 1277 1253 } 1278 1254 } else if (!(conf->flags & IEEE80211_CONF_PS) && 1279 1255 test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags)) { ··· 1283 1257 clear_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags); 1284 1258 1285 1259 if (test_bit(WL1271_FLAG_PSM, &wl->flags)) 1286 - ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE); 1260 + ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE, 1261 + true); 1287 1262 } 1288 1263 1289 1264 if (conf->power_level != wl->power_level) { ··· 1476 1449 wl1271_error("Could not add or replace key"); 1477 1450 goto out_sleep; 1478 1451 } 1452 + 1453 + /* the default WEP key needs to be configured at least once */ 1454 + if (key_type == KEY_WEP) { 1455 + ret = wl1271_cmd_set_default_wep_key(wl, 1456 + wl->default_key); 1457 + if (ret < 0) 1458 + goto out_sleep; 1459 + } 1479 1460 break; 1480 1461 1481 1462 case DISABLE_KEY: 1463 + /* The wl1271 does not allow to remove unicast keys - they 1464 + will be cleared automatically on next CMD_JOIN. Ignore the 1465 + request silently, as we dont want the mac80211 to emit 1466 + an error message. */ 1467 + if (!is_broadcast_ether_addr(addr)) 1468 + break; 1469 + 1482 1470 ret = wl1271_cmd_set_key(wl, KEY_REMOVE, 1483 1471 key_conf->keyidx, key_type, 1484 1472 key_conf->keylen, key_conf->key, ··· 1581 1539 return ret; 1582 1540 } 1583 1541 1542 + static void wl1271_ssid_set(struct wl1271 *wl, struct sk_buff *beacon) 1543 + { 1544 + u8 *ptr = beacon->data + 1545 + offsetof(struct ieee80211_mgmt, u.beacon.variable); 1546 + 1547 + /* find the location of the ssid in the beacon */ 1548 + while (ptr < beacon->data + beacon->len) { 1549 + if (ptr[0] == WLAN_EID_SSID) { 1550 + wl->ssid_len = ptr[1]; 1551 + memcpy(wl->ssid, ptr+2, wl->ssid_len); 1552 + return; 1553 + } 1554 + ptr += ptr[1]; 1555 + } 1556 + wl1271_error("ad-hoc beacon template has no SSID!\n"); 1557 + } 1558 + 1584 1559 static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, 1585 1560 struct ieee80211_vif *vif, 1586 1561 struct ieee80211_bss_conf *bss_conf, ··· 1605 1546 { 1606 1547 enum wl1271_cmd_ps_mode mode; 1607 1548 struct wl1271 *wl = hw->priv; 1549 + bool do_join = false; 1608 1550 int ret; 1609 1551 1610 1552 wl1271_debug(DEBUG_MAC80211, "mac80211 bss info changed"); ··· 1616 1556 if (ret < 0) 1617 1557 goto out; 1618 1558 1619 - if ((changed & BSS_CHANGED_BSSID) && 1620 - /* 1621 - * Now we know the correct bssid, so we send a new join command 1622 - * and enable the BSSID filter 1623 - */ 1624 - memcmp(wl->bssid, bss_conf->bssid, ETH_ALEN)) { 1625 - wl->rx_config |= CFG_BSSID_FILTER_EN; 1626 - memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN); 1627 - ret = wl1271_cmd_build_null_data(wl); 1628 - if (ret < 0) { 1629 - wl1271_warning("cmd buld null data failed %d", 1630 - ret); 1631 - goto out_sleep; 1632 - } 1633 - ret = wl1271_cmd_join(wl); 1634 - if (ret < 0) { 1635 - wl1271_warning("cmd join failed %d", ret); 1636 - goto out_sleep; 1637 - } 1638 - set_bit(WL1271_FLAG_JOINED, &wl->flags); 1639 - } 1640 - 1641 1559 if (wl->bss_type == BSS_TYPE_IBSS) { 1642 1560 /* FIXME: This implements rudimentary ad-hoc support - 1643 1561 proper templates are on the wish list and notification 1644 1562 on when they change. This patch will update the templates 1645 - on every call to this function. Also, the firmware will not 1646 - answer to probe-requests as it does not have the proper 1647 - SSID set in the JOIN command. The probe-response template 1648 - is set nevertheless, as the FW will ASSERT without it */ 1563 + on every call to this function. */ 1649 1564 struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); 1650 1565 1651 1566 if (beacon) { 1652 1567 struct ieee80211_hdr *hdr; 1568 + 1569 + wl1271_ssid_set(wl, beacon); 1653 1570 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_BEACON, 1654 1571 beacon->data, 1655 1572 beacon->len); ··· 1648 1611 dev_kfree_skb(beacon); 1649 1612 if (ret < 0) 1650 1613 goto out_sleep; 1614 + 1615 + /* Need to update the SSID (for filtering etc) */ 1616 + do_join = true; 1651 1617 } 1618 + } 1619 + 1620 + if ((changed & BSS_CHANGED_BSSID) && 1621 + /* 1622 + * Now we know the correct bssid, so we send a new join command 1623 + * and enable the BSSID filter 1624 + */ 1625 + memcmp(wl->bssid, bss_conf->bssid, ETH_ALEN)) { 1626 + wl->rx_config |= CFG_BSSID_FILTER_EN; 1627 + memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN); 1628 + ret = wl1271_cmd_build_null_data(wl); 1629 + if (ret < 0) { 1630 + wl1271_warning("cmd buld null data failed %d", 1631 + ret); 1632 + goto out_sleep; 1633 + } 1634 + 1635 + /* Need to update the BSSID (for filtering etc) */ 1636 + do_join = true; 1652 1637 } 1653 1638 1654 1639 if (changed & BSS_CHANGED_ASSOC) { ··· 1696 1637 if (test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags) && 1697 1638 !test_bit(WL1271_FLAG_PSM, &wl->flags)) { 1698 1639 mode = STATION_POWER_SAVE_MODE; 1699 - ret = wl1271_ps_set_mode(wl, mode); 1640 + ret = wl1271_ps_set_mode(wl, mode, true); 1700 1641 if (ret < 0) 1701 1642 goto out_sleep; 1702 1643 } ··· 1737 1678 } 1738 1679 } 1739 1680 1681 + if (do_join) { 1682 + ret = wl1271_cmd_join(wl); 1683 + if (ret < 0) { 1684 + wl1271_warning("cmd join failed %d", ret); 1685 + goto out_sleep; 1686 + } 1687 + set_bit(WL1271_FLAG_JOINED, &wl->flags); 1688 + } 1689 + 1740 1690 out_sleep: 1741 1691 wl1271_ps_elp_sleep(wl); 1742 1692 1743 1693 out: 1744 1694 mutex_unlock(&wl->mutex); 1695 + } 1696 + 1697 + static int wl1271_op_conf_tx(struct ieee80211_hw *hw, u16 queue, 1698 + const struct ieee80211_tx_queue_params *params) 1699 + { 1700 + struct wl1271 *wl = hw->priv; 1701 + int ret; 1702 + 1703 + mutex_lock(&wl->mutex); 1704 + 1705 + wl1271_debug(DEBUG_MAC80211, "mac80211 conf tx %d", queue); 1706 + 1707 + ret = wl1271_ps_elp_wakeup(wl, false); 1708 + if (ret < 0) 1709 + goto out; 1710 + 1711 + ret = wl1271_acx_ac_cfg(wl, wl1271_tx_get_queue(queue), 1712 + params->cw_min, params->cw_max, 1713 + params->aifs, params->txop); 1714 + if (ret < 0) 1715 + goto out_sleep; 1716 + 1717 + ret = wl1271_acx_tid_cfg(wl, wl1271_tx_get_queue(queue), 1718 + CONF_CHANNEL_TYPE_EDCF, 1719 + wl1271_tx_get_queue(queue), 1720 + CONF_PS_SCHEME_LEGACY_PSPOLL, 1721 + CONF_ACK_POLICY_LEGACY, 0, 0); 1722 + if (ret < 0) 1723 + goto out_sleep; 1724 + 1725 + out_sleep: 1726 + wl1271_ps_elp_sleep(wl); 1727 + 1728 + out: 1729 + mutex_unlock(&wl->mutex); 1730 + 1731 + return ret; 1745 1732 } 1746 1733 1747 1734 ··· 1955 1850 .hw_scan = wl1271_op_hw_scan, 1956 1851 .bss_info_changed = wl1271_op_bss_info_changed, 1957 1852 .set_rts_threshold = wl1271_op_set_rts_threshold, 1853 + .conf_tx = wl1271_op_conf_tx, 1854 + CFG80211_TESTMODE_CMD(wl1271_tm_cmd) 1958 1855 }; 1959 1856 1960 1857 static int wl1271_register_hw(struct wl1271 *wl) ··· 2025 1918 }; 2026 1919 2027 1920 #define WL1271_DEFAULT_CHANNEL 0 2028 - static int __devinit wl1271_probe(struct spi_device *spi) 1921 + 1922 + static struct ieee80211_hw *wl1271_alloc_hw(void) 2029 1923 { 2030 - struct wl12xx_platform_data *pdata; 2031 1924 struct ieee80211_hw *hw; 2032 1925 struct wl1271 *wl; 2033 - int ret, i; 2034 - static const u8 nokia_oui[3] = {0x00, 0x1f, 0xdf}; 2035 - 2036 - pdata = spi->dev.platform_data; 2037 - if (!pdata) { 2038 - wl1271_error("no platform data"); 2039 - return -ENODEV; 2040 - } 1926 + int i; 2041 1927 2042 1928 hw = ieee80211_alloc_hw(sizeof(*wl), &wl1271_ops); 2043 1929 if (!hw) { 2044 1930 wl1271_error("could not alloc ieee80211_hw"); 2045 - return -ENOMEM; 1931 + return ERR_PTR(-ENOMEM); 2046 1932 } 2047 1933 2048 1934 wl = hw->priv; ··· 2044 1944 INIT_LIST_HEAD(&wl->list); 2045 1945 2046 1946 wl->hw = hw; 2047 - dev_set_drvdata(&spi->dev, wl); 2048 - wl->spi = spi; 2049 1947 2050 1948 skb_queue_head_init(&wl->tx_queue); 2051 1949 ··· 2067 1969 2068 1970 spin_lock_init(&wl->wl_lock); 2069 1971 2070 - /* 2071 - * In case our MAC address is not correctly set, 2072 - * we use a random but Nokia MAC. 2073 - */ 2074 - memcpy(wl->mac_addr, nokia_oui, 3); 2075 - get_random_bytes(wl->mac_addr + 3, 3); 2076 - 2077 1972 wl->state = WL1271_STATE_OFF; 2078 1973 mutex_init(&wl->mutex); 1974 + 1975 + /* Apply default driver configuration. */ 1976 + wl1271_conf_init(wl); 1977 + 1978 + return hw; 1979 + } 1980 + 1981 + int wl1271_free_hw(struct wl1271 *wl) 1982 + { 1983 + ieee80211_unregister_hw(wl->hw); 1984 + 1985 + wl1271_debugfs_exit(wl); 1986 + 1987 + kfree(wl->target_mem_map); 1988 + vfree(wl->fw); 1989 + wl->fw = NULL; 1990 + kfree(wl->nvs); 1991 + wl->nvs = NULL; 1992 + 1993 + kfree(wl->fw_status); 1994 + kfree(wl->tx_res_if); 1995 + 1996 + ieee80211_free_hw(wl->hw); 1997 + 1998 + return 0; 1999 + } 2000 + 2001 + static int __devinit wl1271_probe(struct spi_device *spi) 2002 + { 2003 + struct wl12xx_platform_data *pdata; 2004 + struct ieee80211_hw *hw; 2005 + struct wl1271 *wl; 2006 + int ret; 2007 + 2008 + pdata = spi->dev.platform_data; 2009 + if (!pdata) { 2010 + wl1271_error("no platform data"); 2011 + return -ENODEV; 2012 + } 2013 + 2014 + hw = wl1271_alloc_hw(); 2015 + if (IS_ERR(hw)) 2016 + return PTR_ERR(hw); 2017 + 2018 + wl = hw->priv; 2019 + 2020 + dev_set_drvdata(&spi->dev, wl); 2021 + wl->spi = spi; 2079 2022 2080 2023 /* This is the only SPI value that we need to set here, the rest 2081 2024 * comes from the board-peripherals file */ ··· 2159 2020 } 2160 2021 dev_set_drvdata(&wl1271_device.dev, wl); 2161 2022 2162 - /* Apply default driver configuration. */ 2163 - wl1271_conf_init(wl); 2164 - 2165 2023 ret = wl1271_init_ieee80211(wl); 2166 2024 if (ret) 2167 2025 goto out_platform; ··· 2189 2053 { 2190 2054 struct wl1271 *wl = dev_get_drvdata(&spi->dev); 2191 2055 2192 - ieee80211_unregister_hw(wl->hw); 2193 - 2194 - wl1271_debugfs_exit(wl); 2195 2056 platform_device_unregister(&wl1271_device); 2196 2057 free_irq(wl->irq, wl); 2197 - kfree(wl->target_mem_map); 2198 - vfree(wl->fw); 2199 - wl->fw = NULL; 2200 - kfree(wl->nvs); 2201 - wl->nvs = NULL; 2202 2058 2203 - kfree(wl->fw_status); 2204 - kfree(wl->tx_res_if); 2205 - 2206 - ieee80211_free_hw(wl->hw); 2059 + wl1271_free_hw(wl); 2207 2060 2208 2061 return 0; 2209 2062 }
+5 -17
drivers/net/wireless/wl12xx/wl1271_ps.c
··· 24 24 #include "wl1271_reg.h" 25 25 #include "wl1271_ps.h" 26 26 #include "wl1271_spi.h" 27 + #include "wl1271_io.h" 27 28 28 29 #define WL1271_WAKEUP_TIMEOUT 500 29 30 ··· 119 118 return 0; 120 119 } 121 120 122 - int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode) 121 + int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode, 122 + bool send) 123 123 { 124 124 int ret; 125 125 ··· 128 126 case STATION_POWER_SAVE_MODE: 129 127 wl1271_debug(DEBUG_PSM, "entering psm"); 130 128 131 - /* enable beacon filtering */ 132 - ret = wl1271_acx_beacon_filter_opt(wl, true); 133 - if (ret < 0) 134 - return ret; 135 - 136 - /* enable beacon early termination */ 137 - ret = wl1271_acx_bet_enable(wl, true); 138 - if (ret < 0) 139 - return ret; 140 - 141 - ret = wl1271_cmd_ps_mode(wl, STATION_POWER_SAVE_MODE); 142 - if (ret < 0) 143 - return ret; 144 - 145 - wl1271_ps_elp_sleep(wl); 129 + ret = wl1271_cmd_ps_mode(wl, STATION_POWER_SAVE_MODE, send); 146 130 if (ret < 0) 147 131 return ret; 148 132 ··· 151 163 if (ret < 0) 152 164 return ret; 153 165 154 - ret = wl1271_cmd_ps_mode(wl, STATION_ACTIVE_MODE); 166 + ret = wl1271_cmd_ps_mode(wl, STATION_ACTIVE_MODE, send); 155 167 if (ret < 0) 156 168 return ret; 157 169
+2 -1
drivers/net/wireless/wl12xx/wl1271_ps.h
··· 27 27 #include "wl1271.h" 28 28 #include "wl1271_acx.h" 29 29 30 - int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode); 30 + int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode, 31 + bool send); 31 32 void wl1271_ps_elp_sleep(struct wl1271 *wl); 32 33 int wl1271_ps_elp_wakeup(struct wl1271 *wl, bool chip_awake); 33 34 void wl1271_elp_work(struct work_struct *work);
+5 -6
drivers/net/wireless/wl12xx/wl1271_rx.c
··· 26 26 #include "wl1271_reg.h" 27 27 #include "wl1271_rx.h" 28 28 #include "wl1271_spi.h" 29 + #include "wl1271_io.h" 29 30 30 31 static u8 wl1271_rx_get_mem_block(struct wl1271_fw_status *status, 31 32 u32 drv_rx_counter) ··· 167 166 } 168 167 169 168 buf = skb_put(skb, length); 170 - wl1271_spi_read(wl, WL1271_SLV_MEM_DATA, buf, length, true); 169 + wl1271_read(wl, WL1271_SLV_MEM_DATA, buf, length, true); 171 170 172 171 /* the data read starts with the descriptor */ 173 172 desc = (struct wl1271_rx_descriptor *) buf; ··· 211 210 wl->rx_mem_pool_addr.addr + 4; 212 211 213 212 /* Choose the block we want to read */ 214 - wl1271_spi_write(wl, WL1271_SLV_REG_DATA, 215 - &wl->rx_mem_pool_addr, 216 - sizeof(wl->rx_mem_pool_addr), false); 213 + wl1271_write(wl, WL1271_SLV_REG_DATA, &wl->rx_mem_pool_addr, 214 + sizeof(wl->rx_mem_pool_addr), false); 217 215 218 216 wl1271_rx_handle_data(wl, buf_size); 219 217 220 218 wl->rx_counter++; 221 219 drv_rx_counter = wl->rx_counter & NUM_RX_PKT_DESC_MOD_MASK; 220 + wl1271_write32(wl, RX_DRIVER_COUNTER_ADDRESS, wl->rx_counter); 222 221 } 223 - 224 - wl1271_spi_write32(wl, RX_DRIVER_COUNTER_ADDRESS, wl->rx_counter); 225 222 }
-157
drivers/net/wireless/wl12xx/wl1271_spi.c
··· 30 30 #include "wl12xx_80211.h" 31 31 #include "wl1271_spi.h" 32 32 33 - static int wl1271_translate_addr(struct wl1271 *wl, int addr) 34 - { 35 - /* 36 - * To translate, first check to which window of addresses the 37 - * particular address belongs. Then subtract the starting address 38 - * of that window from the address. Then, add offset of the 39 - * translated region. 40 - * 41 - * The translated regions occur next to each other in physical device 42 - * memory, so just add the sizes of the preceeding address regions to 43 - * get the offset to the new region. 44 - * 45 - * Currently, only the two first regions are addressed, and the 46 - * assumption is that all addresses will fall into either of those 47 - * two. 48 - */ 49 - if ((addr >= wl->part.reg.start) && 50 - (addr < wl->part.reg.start + wl->part.reg.size)) 51 - return addr - wl->part.reg.start + wl->part.mem.size; 52 - else 53 - return addr - wl->part.mem.start; 54 - } 55 33 56 34 void wl1271_spi_reset(struct wl1271 *wl) 57 35 { ··· 109 131 spi_sync(wl->spi, &m); 110 132 111 133 wl1271_dump(DEBUG_SPI, "spi init -> ", cmd, WSPI_INIT_CMD_LEN); 112 - } 113 - 114 - /* Set the SPI partitions to access the chip addresses 115 - * 116 - * To simplify driver code, a fixed (virtual) memory map is defined for 117 - * register and memory addresses. Because in the chipset, in different stages 118 - * of operation, those addresses will move around, an address translation 119 - * mechanism is required. 120 - * 121 - * There are four partitions (three memory and one register partition), 122 - * which are mapped to two different areas of the hardware memory. 123 - * 124 - * Virtual address 125 - * space 126 - * 127 - * | | 128 - * ...+----+--> mem.start 129 - * Physical address ... | | 130 - * space ... | | [PART_0] 131 - * ... | | 132 - * 00000000 <--+----+... ...+----+--> mem.start + mem.size 133 - * | | ... | | 134 - * |MEM | ... | | 135 - * | | ... | | 136 - * mem.size <--+----+... | | {unused area) 137 - * | | ... | | 138 - * |REG | ... | | 139 - * mem.size | | ... | | 140 - * + <--+----+... ...+----+--> reg.start 141 - * reg.size | | ... | | 142 - * |MEM2| ... | | [PART_1] 143 - * | | ... | | 144 - * ...+----+--> reg.start + reg.size 145 - * | | 146 - * 147 - */ 148 - int wl1271_set_partition(struct wl1271 *wl, 149 - struct wl1271_partition_set *p) 150 - { 151 - /* copy partition info */ 152 - memcpy(&wl->part, p, sizeof(*p)); 153 - 154 - wl1271_debug(DEBUG_SPI, "mem_start %08X mem_size %08X", 155 - p->mem.start, p->mem.size); 156 - wl1271_debug(DEBUG_SPI, "reg_start %08X reg_size %08X", 157 - p->reg.start, p->reg.size); 158 - wl1271_debug(DEBUG_SPI, "mem2_start %08X mem2_size %08X", 159 - p->mem2.start, p->mem2.size); 160 - wl1271_debug(DEBUG_SPI, "mem3_start %08X mem3_size %08X", 161 - p->mem3.start, p->mem3.size); 162 - 163 - /* write partition info to the chipset */ 164 - wl1271_raw_write32(wl, HW_PART0_START_ADDR, p->mem.start); 165 - wl1271_raw_write32(wl, HW_PART0_SIZE_ADDR, p->mem.size); 166 - wl1271_raw_write32(wl, HW_PART1_START_ADDR, p->reg.start); 167 - wl1271_raw_write32(wl, HW_PART1_SIZE_ADDR, p->reg.size); 168 - wl1271_raw_write32(wl, HW_PART2_START_ADDR, p->mem2.start); 169 - wl1271_raw_write32(wl, HW_PART2_SIZE_ADDR, p->mem2.size); 170 - wl1271_raw_write32(wl, HW_PART3_START_ADDR, p->mem3.start); 171 - 172 - return 0; 173 134 } 174 135 175 136 #define WL1271_BUSY_WORD_TIMEOUT 1000 ··· 254 337 255 338 wl1271_dump(DEBUG_SPI, "spi_write cmd -> ", cmd, sizeof(*cmd)); 256 339 wl1271_dump(DEBUG_SPI, "spi_write buf -> ", buf, len); 257 - } 258 - 259 - void wl1271_spi_read(struct wl1271 *wl, int addr, void *buf, size_t len, 260 - bool fixed) 261 - { 262 - int physical; 263 - 264 - physical = wl1271_translate_addr(wl, addr); 265 - 266 - wl1271_spi_raw_read(wl, physical, buf, len, fixed); 267 - } 268 - 269 - void wl1271_spi_write(struct wl1271 *wl, int addr, void *buf, size_t len, 270 - bool fixed) 271 - { 272 - int physical; 273 - 274 - physical = wl1271_translate_addr(wl, addr); 275 - 276 - wl1271_spi_raw_write(wl, physical, buf, len, fixed); 277 - } 278 - 279 - u32 wl1271_spi_read32(struct wl1271 *wl, int addr) 280 - { 281 - return wl1271_raw_read32(wl, wl1271_translate_addr(wl, addr)); 282 - } 283 - 284 - void wl1271_spi_write32(struct wl1271 *wl, int addr, u32 val) 285 - { 286 - wl1271_raw_write32(wl, wl1271_translate_addr(wl, addr), val); 287 - } 288 - 289 - void wl1271_top_reg_write(struct wl1271 *wl, int addr, u16 val) 290 - { 291 - /* write address >> 1 + 0x30000 to OCP_POR_CTR */ 292 - addr = (addr >> 1) + 0x30000; 293 - wl1271_spi_write32(wl, OCP_POR_CTR, addr); 294 - 295 - /* write value to OCP_POR_WDATA */ 296 - wl1271_spi_write32(wl, OCP_DATA_WRITE, val); 297 - 298 - /* write 1 to OCP_CMD */ 299 - wl1271_spi_write32(wl, OCP_CMD, OCP_CMD_WRITE); 300 - } 301 - 302 - u16 wl1271_top_reg_read(struct wl1271 *wl, int addr) 303 - { 304 - u32 val; 305 - int timeout = OCP_CMD_LOOP; 306 - 307 - /* write address >> 1 + 0x30000 to OCP_POR_CTR */ 308 - addr = (addr >> 1) + 0x30000; 309 - wl1271_spi_write32(wl, OCP_POR_CTR, addr); 310 - 311 - /* write 2 to OCP_CMD */ 312 - wl1271_spi_write32(wl, OCP_CMD, OCP_CMD_READ); 313 - 314 - /* poll for data ready */ 315 - do { 316 - val = wl1271_spi_read32(wl, OCP_DATA_READ); 317 - } while (!(val & OCP_READY_MASK) && --timeout); 318 - 319 - if (!timeout) { 320 - wl1271_warning("Top register access timed out."); 321 - return 0xffff; 322 - } 323 - 324 - /* check data status and return if OK */ 325 - if ((val & OCP_STATUS_MASK) == OCP_STATUS_OK) 326 - return val & 0xffff; 327 - else { 328 - wl1271_warning("Top register access returned error."); 329 - return 0xffff; 330 - } 331 340 }
-30
drivers/net/wireless/wl12xx/wl1271_spi.h
··· 90 90 void wl1271_spi_raw_read(struct wl1271 *wl, int addr, void *buf, 91 91 size_t len, bool fixed); 92 92 93 - /* Translated target IO */ 94 - void wl1271_spi_read(struct wl1271 *wl, int addr, void *buf, size_t len, 95 - bool fixed); 96 - void wl1271_spi_write(struct wl1271 *wl, int addr, void *buf, size_t len, 97 - bool fixed); 98 - u32 wl1271_spi_read32(struct wl1271 *wl, int addr); 99 - void wl1271_spi_write32(struct wl1271 *wl, int addr, u32 val); 100 - 101 - /* Top Register IO */ 102 - void wl1271_top_reg_write(struct wl1271 *wl, int addr, u16 val); 103 - u16 wl1271_top_reg_read(struct wl1271 *wl, int addr); 104 - 105 93 /* INIT and RESET words */ 106 94 void wl1271_spi_reset(struct wl1271 *wl); 107 95 void wl1271_spi_init(struct wl1271 *wl); 108 - int wl1271_set_partition(struct wl1271 *wl, 109 - struct wl1271_partition_set *p); 110 - 111 - static inline u32 wl1271_raw_read32(struct wl1271 *wl, int addr) 112 - { 113 - wl1271_spi_raw_read(wl, addr, &wl->buffer_32, 114 - sizeof(wl->buffer_32), false); 115 - 116 - return wl->buffer_32; 117 - } 118 - 119 - static inline void wl1271_raw_write32(struct wl1271 *wl, int addr, u32 val) 120 - { 121 - wl->buffer_32 = val; 122 - wl1271_spi_raw_write(wl, addr, &wl->buffer_32, 123 - sizeof(wl->buffer_32), false); 124 - } 125 - 126 96 #endif /* __WL1271_SPI_H__ */
+283
drivers/net/wireless/wl12xx/wl1271_testmode.c
··· 1 + /* 2 + * This file is part of wl1271 3 + * 4 + * Copyright (C) 2010 Nokia Corporation 5 + * 6 + * Contact: Luciano Coelho <luciano.coelho@nokia.com> 7 + * 8 + * This program is free software; you can redistribute it and/or 9 + * modify it under the terms of the GNU General Public License 10 + * version 2 as published by the Free Software Foundation. 11 + * 12 + * This program is distributed in the hope that it will be useful, but 13 + * WITHOUT ANY WARRANTY; without even the implied warranty of 14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 + * General Public License for more details. 16 + * 17 + * You should have received a copy of the GNU General Public License 18 + * along with this program; if not, write to the Free Software 19 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 20 + * 02110-1301 USA 21 + * 22 + */ 23 + #include "wl1271_testmode.h" 24 + 25 + #include <net/genetlink.h> 26 + 27 + #include "wl1271.h" 28 + #include "wl1271_spi.h" 29 + #include "wl1271_acx.h" 30 + 31 + #define WL1271_TM_MAX_DATA_LENGTH 1024 32 + 33 + enum wl1271_tm_commands { 34 + WL1271_TM_CMD_UNSPEC, 35 + WL1271_TM_CMD_TEST, 36 + WL1271_TM_CMD_INTERROGATE, 37 + WL1271_TM_CMD_CONFIGURE, 38 + WL1271_TM_CMD_NVS_PUSH, 39 + WL1271_TM_CMD_SET_PLT_MODE, 40 + 41 + __WL1271_TM_CMD_AFTER_LAST 42 + }; 43 + #define WL1271_TM_CMD_MAX (__WL1271_TM_CMD_AFTER_LAST - 1) 44 + 45 + enum wl1271_tm_attrs { 46 + WL1271_TM_ATTR_UNSPEC, 47 + WL1271_TM_ATTR_CMD_ID, 48 + WL1271_TM_ATTR_ANSWER, 49 + WL1271_TM_ATTR_DATA, 50 + WL1271_TM_ATTR_IE_ID, 51 + WL1271_TM_ATTR_PLT_MODE, 52 + 53 + __WL1271_TM_ATTR_AFTER_LAST 54 + }; 55 + #define WL1271_TM_ATTR_MAX (__WL1271_TM_ATTR_AFTER_LAST - 1) 56 + 57 + static struct nla_policy wl1271_tm_policy[WL1271_TM_ATTR_MAX + 1] = { 58 + [WL1271_TM_ATTR_CMD_ID] = { .type = NLA_U32 }, 59 + [WL1271_TM_ATTR_ANSWER] = { .type = NLA_U8 }, 60 + [WL1271_TM_ATTR_DATA] = { .type = NLA_BINARY, 61 + .len = WL1271_TM_MAX_DATA_LENGTH }, 62 + [WL1271_TM_ATTR_IE_ID] = { .type = NLA_U32 }, 63 + [WL1271_TM_ATTR_PLT_MODE] = { .type = NLA_U32 }, 64 + }; 65 + 66 + 67 + static int wl1271_tm_cmd_test(struct wl1271 *wl, struct nlattr *tb[]) 68 + { 69 + int buf_len, ret, len; 70 + struct sk_buff *skb; 71 + void *buf; 72 + u8 answer = 0; 73 + 74 + wl1271_debug(DEBUG_TESTMODE, "testmode cmd test"); 75 + 76 + if (!tb[WL1271_TM_ATTR_DATA]) 77 + return -EINVAL; 78 + 79 + buf = nla_data(tb[WL1271_TM_ATTR_DATA]); 80 + buf_len = nla_len(tb[WL1271_TM_ATTR_DATA]); 81 + 82 + if (tb[WL1271_TM_ATTR_ANSWER]) 83 + answer = nla_get_u8(tb[WL1271_TM_ATTR_ANSWER]); 84 + 85 + if (buf_len > sizeof(struct wl1271_command)) 86 + return -EMSGSIZE; 87 + 88 + mutex_lock(&wl->mutex); 89 + ret = wl1271_cmd_test(wl, buf, buf_len, answer); 90 + mutex_unlock(&wl->mutex); 91 + 92 + if (ret < 0) { 93 + wl1271_warning("testmode cmd test failed: %d", ret); 94 + return ret; 95 + } 96 + 97 + if (answer) { 98 + len = nla_total_size(buf_len); 99 + skb = cfg80211_testmode_alloc_reply_skb(wl->hw->wiphy, len); 100 + if (!skb) 101 + return -ENOMEM; 102 + 103 + NLA_PUT(skb, WL1271_TM_ATTR_DATA, buf_len, buf); 104 + ret = cfg80211_testmode_reply(skb); 105 + if (ret < 0) 106 + return ret; 107 + } 108 + 109 + return 0; 110 + 111 + nla_put_failure: 112 + kfree_skb(skb); 113 + return -EMSGSIZE; 114 + } 115 + 116 + static int wl1271_tm_cmd_interrogate(struct wl1271 *wl, struct nlattr *tb[]) 117 + { 118 + int ret; 119 + struct wl1271_command *cmd; 120 + struct sk_buff *skb; 121 + u8 ie_id; 122 + 123 + wl1271_debug(DEBUG_TESTMODE, "testmode cmd interrogate"); 124 + 125 + if (!tb[WL1271_TM_ATTR_IE_ID]) 126 + return -EINVAL; 127 + 128 + ie_id = nla_get_u8(tb[WL1271_TM_ATTR_IE_ID]); 129 + 130 + cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); 131 + if (!cmd) 132 + return -ENOMEM; 133 + 134 + mutex_lock(&wl->mutex); 135 + ret = wl1271_cmd_interrogate(wl, ie_id, cmd, sizeof(*cmd)); 136 + mutex_unlock(&wl->mutex); 137 + 138 + if (ret < 0) { 139 + wl1271_warning("testmode cmd interrogate failed: %d", ret); 140 + return ret; 141 + } 142 + 143 + skb = cfg80211_testmode_alloc_reply_skb(wl->hw->wiphy, sizeof(*cmd)); 144 + if (!skb) 145 + return -ENOMEM; 146 + 147 + NLA_PUT(skb, WL1271_TM_ATTR_DATA, sizeof(*cmd), cmd); 148 + 149 + return 0; 150 + 151 + nla_put_failure: 152 + kfree_skb(skb); 153 + return -EMSGSIZE; 154 + } 155 + 156 + static int wl1271_tm_cmd_configure(struct wl1271 *wl, struct nlattr *tb[]) 157 + { 158 + int buf_len, ret; 159 + void *buf; 160 + u8 ie_id; 161 + 162 + wl1271_debug(DEBUG_TESTMODE, "testmode cmd configure"); 163 + 164 + if (!tb[WL1271_TM_ATTR_DATA]) 165 + return -EINVAL; 166 + if (!tb[WL1271_TM_ATTR_IE_ID]) 167 + return -EINVAL; 168 + 169 + ie_id = nla_get_u8(tb[WL1271_TM_ATTR_IE_ID]); 170 + buf = nla_data(tb[WL1271_TM_ATTR_DATA]); 171 + buf_len = nla_len(tb[WL1271_TM_ATTR_DATA]); 172 + 173 + if (buf_len > sizeof(struct wl1271_command)) 174 + return -EMSGSIZE; 175 + 176 + mutex_lock(&wl->mutex); 177 + ret = wl1271_cmd_configure(wl, ie_id, buf, buf_len); 178 + mutex_unlock(&wl->mutex); 179 + 180 + if (ret < 0) { 181 + wl1271_warning("testmode cmd configure failed: %d", ret); 182 + return ret; 183 + } 184 + 185 + return 0; 186 + } 187 + 188 + static int wl1271_tm_cmd_nvs_push(struct wl1271 *wl, struct nlattr *tb[]) 189 + { 190 + int ret = 0; 191 + size_t len; 192 + void *buf; 193 + 194 + wl1271_debug(DEBUG_TESTMODE, "testmode cmd nvs push"); 195 + 196 + if (!tb[WL1271_TM_ATTR_DATA]) 197 + return -EINVAL; 198 + 199 + buf = nla_data(tb[WL1271_TM_ATTR_DATA]); 200 + len = nla_len(tb[WL1271_TM_ATTR_DATA]); 201 + 202 + if (len != sizeof(struct wl1271_nvs_file)) { 203 + wl1271_error("nvs size is not as expected: %zu != %zu", 204 + len, sizeof(struct wl1271_nvs_file)); 205 + return -EMSGSIZE; 206 + } 207 + 208 + mutex_lock(&wl->mutex); 209 + 210 + kfree(wl->nvs); 211 + 212 + wl->nvs = kmalloc(sizeof(struct wl1271_nvs_file), GFP_KERNEL); 213 + if (!wl->nvs) { 214 + wl1271_error("could not allocate memory for the nvs file"); 215 + ret = -ENOMEM; 216 + goto out; 217 + } 218 + 219 + memcpy(wl->nvs, buf, len); 220 + 221 + wl1271_debug(DEBUG_TESTMODE, "testmode pushed nvs"); 222 + 223 + out: 224 + mutex_unlock(&wl->mutex); 225 + 226 + return ret; 227 + } 228 + 229 + static int wl1271_tm_cmd_set_plt_mode(struct wl1271 *wl, struct nlattr *tb[]) 230 + { 231 + u32 val; 232 + int ret; 233 + 234 + wl1271_debug(DEBUG_TESTMODE, "testmode cmd set plt mode"); 235 + 236 + if (!tb[WL1271_TM_ATTR_PLT_MODE]) 237 + return -EINVAL; 238 + 239 + val = nla_get_u32(tb[WL1271_TM_ATTR_PLT_MODE]); 240 + 241 + switch (val) { 242 + case 0: 243 + ret = wl1271_plt_stop(wl); 244 + break; 245 + case 1: 246 + ret = wl1271_plt_start(wl); 247 + break; 248 + default: 249 + ret = -EINVAL; 250 + break; 251 + } 252 + 253 + return ret; 254 + } 255 + 256 + int wl1271_tm_cmd(struct ieee80211_hw *hw, void *data, int len) 257 + { 258 + struct wl1271 *wl = hw->priv; 259 + struct nlattr *tb[WL1271_TM_ATTR_MAX + 1]; 260 + int err; 261 + 262 + err = nla_parse(tb, WL1271_TM_ATTR_MAX, data, len, wl1271_tm_policy); 263 + if (err) 264 + return err; 265 + 266 + if (!tb[WL1271_TM_ATTR_CMD_ID]) 267 + return -EINVAL; 268 + 269 + switch (nla_get_u32(tb[WL1271_TM_ATTR_CMD_ID])) { 270 + case WL1271_TM_CMD_TEST: 271 + return wl1271_tm_cmd_test(wl, tb); 272 + case WL1271_TM_CMD_INTERROGATE: 273 + return wl1271_tm_cmd_interrogate(wl, tb); 274 + case WL1271_TM_CMD_CONFIGURE: 275 + return wl1271_tm_cmd_configure(wl, tb); 276 + case WL1271_TM_CMD_NVS_PUSH: 277 + return wl1271_tm_cmd_nvs_push(wl, tb); 278 + case WL1271_TM_CMD_SET_PLT_MODE: 279 + return wl1271_tm_cmd_set_plt_mode(wl, tb); 280 + default: 281 + return -EOPNOTSUPP; 282 + } 283 + }
+31
drivers/net/wireless/wl12xx/wl1271_testmode.h
··· 1 + /* 2 + * This file is part of wl1271 3 + * 4 + * Copyright (C) 2010 Nokia Corporation 5 + * 6 + * Contact: Luciano Coelho <luciano.coelho@nokia.com> 7 + * 8 + * This program is free software; you can redistribute it and/or 9 + * modify it under the terms of the GNU General Public License 10 + * version 2 as published by the Free Software Foundation. 11 + * 12 + * This program is distributed in the hope that it will be useful, but 13 + * WITHOUT ANY WARRANTY; without even the implied warranty of 14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 + * General Public License for more details. 16 + * 17 + * You should have received a copy of the GNU General Public License 18 + * along with this program; if not, write to the Free Software 19 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 20 + * 02110-1301 USA 21 + * 22 + */ 23 + 24 + #ifndef __WL1271_TESTMODE_H__ 25 + #define __WL1271_TESTMODE_H__ 26 + 27 + #include <net/mac80211.h> 28 + 29 + int wl1271_tm_cmd(struct ieee80211_hw *hw, void *data, int len); 30 + 31 + #endif /* __WL1271_TESTMODE_H__ */
+16 -12
drivers/net/wireless/wl12xx/wl1271_tx.c
··· 26 26 27 27 #include "wl1271.h" 28 28 #include "wl1271_spi.h" 29 + #include "wl1271_io.h" 29 30 #include "wl1271_reg.h" 30 31 #include "wl1271_ps.h" 31 32 #include "wl1271_tx.h" ··· 88 87 u32 extra, struct ieee80211_tx_info *control) 89 88 { 90 89 struct wl1271_tx_hw_descr *desc; 91 - int pad; 90 + int pad, ac; 92 91 u16 tx_attr; 93 92 94 93 desc = (struct wl1271_tx_hw_descr *) skb->data; ··· 108 107 109 108 /* configure the tx attributes */ 110 109 tx_attr = wl->session_counter << TX_HW_ATTR_OFST_SESSION_COUNTER; 111 - /* FIXME: do we know the packet priority? can we identify mgmt 112 - packets, and use max prio for them at least? */ 113 - desc->tid = 0; 110 + 111 + /* queue */ 112 + ac = wl1271_tx_get_queue(skb_get_queue_mapping(skb)); 113 + desc->tid = wl1271_tx_ac_to_tid(ac); 114 + 114 115 desc->aid = TX_HW_DEFAULT_AID; 115 116 desc->reserved = 0; 116 117 ··· 166 163 len = WL1271_TX_ALIGN(skb->len); 167 164 168 165 /* perform a fixed address block write with the packet */ 169 - wl1271_spi_write(wl, WL1271_SLV_MEM_DATA, skb->data, len, true); 166 + wl1271_write(wl, WL1271_SLV_MEM_DATA, skb->data, len, true); 170 167 171 168 /* write packet new counter into the write access register */ 172 169 wl->tx_packets_count++; 173 - wl1271_spi_write32(wl, WL1271_HOST_WR_ACCESS, wl->tx_packets_count); 170 + wl1271_write32(wl, WL1271_HOST_WR_ACCESS, wl->tx_packets_count); 174 171 175 172 desc = (struct wl1271_tx_hw_descr *) skb->data; 176 173 wl1271_debug(DEBUG_TX, "tx id %u skb 0x%p payload %u (%u words)", ··· 204 201 ret = wl1271_cmd_set_default_wep_key(wl, idx); 205 202 if (ret < 0) 206 203 return ret; 204 + wl->default_key = idx; 207 205 } 208 206 } 209 207 ··· 376 372 wl1271_debug(DEBUG_TX, "tx_complete received, packets: %d", count); 377 373 378 374 /* read the tx results from the chipset */ 379 - wl1271_spi_read(wl, le32_to_cpu(memmap->tx_result), 380 - wl->tx_res_if, sizeof(*wl->tx_res_if), false); 375 + wl1271_read(wl, le32_to_cpu(memmap->tx_result), 376 + wl->tx_res_if, sizeof(*wl->tx_res_if), false); 381 377 382 378 /* verify that the result buffer is not getting overrun */ 383 379 if (count > TX_HW_RESULT_QUEUE_LEN) { ··· 398 394 } 399 395 400 396 /* write host counter to chipset (to ack) */ 401 - wl1271_spi_write32(wl, le32_to_cpu(memmap->tx_result) + 402 - offsetof(struct wl1271_tx_hw_res_if, 403 - tx_result_host_counter), 404 - le32_to_cpu(wl->tx_res_if->tx_result_fw_counter)); 397 + wl1271_write32(wl, le32_to_cpu(memmap->tx_result) + 398 + offsetof(struct wl1271_tx_hw_res_if, 399 + tx_result_host_counter), 400 + le32_to_cpu(wl->tx_res_if->tx_result_fw_counter)); 405 401 } 406 402 407 403 /* caller must hold wl->mutex */
+36
drivers/net/wireless/wl12xx/wl1271_tx.h
··· 123 123 struct wl1271_tx_hw_res_descr tx_results_queue[TX_HW_RESULT_QUEUE_LEN]; 124 124 } __attribute__ ((packed)); 125 125 126 + static inline int wl1271_tx_get_queue(int queue) 127 + { 128 + /* FIXME: use best effort until WMM is enabled */ 129 + return CONF_TX_AC_BE; 130 + 131 + switch (queue) { 132 + case 0: 133 + return CONF_TX_AC_VO; 134 + case 1: 135 + return CONF_TX_AC_VI; 136 + case 2: 137 + return CONF_TX_AC_BE; 138 + case 3: 139 + return CONF_TX_AC_BK; 140 + default: 141 + return CONF_TX_AC_BE; 142 + } 143 + } 144 + 145 + /* wl1271 tx descriptor needs the tid and we need to convert it from ac */ 146 + static inline int wl1271_tx_ac_to_tid(int ac) 147 + { 148 + switch (ac) { 149 + case 0: 150 + return 0; 151 + case 1: 152 + return 2; 153 + case 2: 154 + return 4; 155 + case 3: 156 + return 6; 157 + default: 158 + return 0; 159 + } 160 + } 161 + 126 162 void wl1271_tx_work(struct work_struct *work); 127 163 void wl1271_tx_complete(struct wl1271 *wl, u32 count); 128 164 void wl1271_tx_flush(struct wl1271 *wl);
+7
drivers/ssb/driver_chipcommon_pmu.c
··· 332 332 case 0x5354: 333 333 ssb_pmu0_pllinit_r0(cc, crystalfreq); 334 334 break; 335 + case 0x4322: 336 + if (cc->pmu.rev == 2) { 337 + chipco_write32(cc, SSB_CHIPCO_PLLCTL_ADDR, 0x0000000A); 338 + chipco_write32(cc, SSB_CHIPCO_PLLCTL_DATA, 0x380005C0); 339 + } 340 + break; 335 341 default: 336 342 ssb_printk(KERN_ERR PFX 337 343 "ERROR: PLL init unknown for device %04X\n", ··· 423 417 424 418 switch (bus->chip_id) { 425 419 case 0x4312: 420 + case 0x4322: 426 421 /* We keep the default settings: 427 422 * min_msk = 0xCBB 428 423 * max_msk = 0x7FFFF
+2 -2
drivers/ssb/ssb_private.h
··· 196 196 #ifdef CONFIG_SSB_B43_PCI_BRIDGE 197 197 extern int __init b43_pci_ssb_bridge_init(void); 198 198 extern void __exit b43_pci_ssb_bridge_exit(void); 199 - #else /* CONFIG_SSB_B43_PCI_BRIDGR */ 199 + #else /* CONFIG_SSB_B43_PCI_BRIDGE */ 200 200 static inline int b43_pci_ssb_bridge_init(void) 201 201 { 202 202 return 0; ··· 204 204 static inline void b43_pci_ssb_bridge_exit(void) 205 205 { 206 206 } 207 - #endif /* CONFIG_SSB_PCIHOST */ 207 + #endif /* CONFIG_SSB_B43_PCI_BRIDGE */ 208 208 209 209 #endif /* LINUX_SSB_PRIVATE_H_ */
+1 -11
drivers/staging/rtl8192su/ieee80211/ieee80211.h
··· 609 609 u8 payload[0]; 610 610 } __attribute__ ((packed)); 611 611 612 - struct ieee80211_hdr_3addr { 613 - __le16 frame_ctl; 614 - __le16 duration_id; 615 - u8 addr1[ETH_ALEN]; 616 - u8 addr2[ETH_ALEN]; 617 - u8 addr3[ETH_ALEN]; 618 - __le16 seq_ctl; 619 - u8 payload[0]; 620 - } __attribute__ ((packed)); 621 - 622 612 struct ieee80211_hdr_4addr { 623 613 __le16 frame_ctl; 624 614 __le16 duration_id; ··· 1662 1672 case IEEE80211_2ADDR_LEN: 1663 1673 return ((struct ieee80211_hdr_2addr *)hdr)->payload; 1664 1674 case IEEE80211_3ADDR_LEN: 1665 - return ((struct ieee80211_hdr_3addr *)hdr)->payload; 1675 + return (void *)hdr+sizeof(struct ieee80211_hdr_3addr); 1666 1676 case IEEE80211_4ADDR_LEN: 1667 1677 return ((struct ieee80211_hdr_4addr *)hdr)->payload; 1668 1678 }
+1 -1
drivers/staging/rtl8192su/ieee80211/ieee80211_r8192s.h
··· 201 201 static inline u8 Frame_QoSTID(u8 *buf) 202 202 { 203 203 struct ieee80211_hdr_3addr *hdr = (struct ieee80211_hdr_3addr *)buf; 204 - u16 fc = le16_to_cpu(hdr->frame_ctl); 204 + u16 fc = le16_to_cpu(hdr->frame_control); 205 205 206 206 return (u8)((frameqos *)(buf + 207 207 (((fc & IEEE80211_FCTL_TODS) &&
+9 -9
drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c
··· 744 744 struct ieee80211_rxb *rxb,u8* src,u8* dst) 745 745 { 746 746 struct ieee80211_hdr_3addr *hdr = (struct ieee80211_hdr_3addr* )skb->data; 747 - u16 fc = le16_to_cpu(hdr->frame_ctl); 747 + u16 fc = le16_to_cpu(hdr->frame_control); 748 748 749 749 u16 LLCOffset= sizeof(struct ieee80211_hdr_3addr); 750 750 u16 ChkLength; ··· 756 756 struct sk_buff *sub_skb; 757 757 u8 *data_ptr; 758 758 /* just for debug purpose */ 759 - SeqNum = WLAN_GET_SEQ_SEQ(le16_to_cpu(hdr->seq_ctl)); 759 + SeqNum = WLAN_GET_SEQ_SEQ(le16_to_cpu(hdr->seq_ctrl)); 760 760 761 761 if((IEEE80211_QOS_HAS_SEQ(fc))&&\ 762 762 (((frameqos *)(skb->data + IEEE80211_3ADDR_LEN))->field.reserved)) { ··· 2370 2370 escape_essid(info_element->data, 2371 2371 info_element->len), 2372 2372 MAC_ARG(beacon->header.addr3), 2373 - WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == 2373 + WLAN_FC_GET_STYPE(beacon->header.frame_control) == 2374 2374 IEEE80211_STYPE_PROBE_RESP ? 2375 2375 "PROBE RESPONSE" : "BEACON"); 2376 2376 return; ··· 2387 2387 return; 2388 2388 if(ieee->bGlobalDomain) 2389 2389 { 2390 - if (WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == IEEE80211_STYPE_PROBE_RESP) 2390 + if (WLAN_FC_GET_STYPE(beacon->header.frame_control) == IEEE80211_STYPE_PROBE_RESP) 2391 2391 { 2392 2392 // Case 1: Country code 2393 2393 if(IS_COUNTRY_IE_VALID(ieee) ) ··· 2454 2454 else 2455 2455 ieee->current_network.buseprotection = false; 2456 2456 } 2457 - if(is_beacon(beacon->header.frame_ctl)) 2457 + if(is_beacon(beacon->header.frame_control)) 2458 2458 { 2459 2459 if(ieee->state == IEEE80211_LINKED) 2460 2460 ieee->LinkDetectInfo.NumRecvBcnInPeriod++; ··· 2496 2496 escape_essid(network.ssid, 2497 2497 network.ssid_len), 2498 2498 MAC_ARG(network.bssid), 2499 - WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == 2499 + WLAN_FC_GET_STYPE(beacon->header.frame_control) == 2500 2500 IEEE80211_STYPE_PROBE_RESP ? 2501 2501 "PROBE RESPONSE" : "BEACON"); 2502 2502 #endif ··· 2509 2509 escape_essid(target->ssid, 2510 2510 target->ssid_len), 2511 2511 MAC_ARG(target->bssid), 2512 - WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == 2512 + WLAN_FC_GET_STYPE(beacon->header.frame_control) == 2513 2513 IEEE80211_STYPE_PROBE_RESP ? 2514 2514 "PROBE RESPONSE" : "BEACON"); 2515 2515 ··· 2519 2519 */ 2520 2520 renew = !time_after(target->last_scanned + ieee->scan_age, jiffies); 2521 2521 //YJ,add,080819,for hidden ap 2522 - if(is_beacon(beacon->header.frame_ctl) == 0) 2522 + if(is_beacon(beacon->header.frame_control) == 0) 2523 2523 network.flags = (~NETWORK_EMPTY_ESSID & network.flags)|(NETWORK_EMPTY_ESSID & target->flags); 2524 2524 //if(strncmp(network.ssid, "linksys-c",9) == 0) 2525 2525 // printk("====>2 network.ssid=%s FLAG=%d target.ssid=%s FLAG=%d\n", network.ssid, network.flags, target->ssid, target->flags); ··· 2535 2535 } 2536 2536 2537 2537 spin_unlock_irqrestore(&ieee->lock, flags); 2538 - if (is_beacon(beacon->header.frame_ctl)&&is_same_network(&ieee->current_network, &network, ieee)&&\ 2538 + if (is_beacon(beacon->header.frame_control)&&is_same_network(&ieee->current_network, &network, ieee)&&\ 2539 2539 (ieee->state == IEEE80211_LINKED)) { 2540 2540 if(ieee->handle_beacon != NULL) { 2541 2541 ieee->handle_beacon(ieee->dev,beacon,&ieee->current_network);
+19 -19
drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c
··· 242 242 if(ieee->queue_stop){ 243 243 enqueue_mgmt(ieee,skb); 244 244 }else{ 245 - header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0]<<4); 245 + header->seq_ctrl = cpu_to_le16(ieee->seq_ctrl[0]<<4); 246 246 247 247 if (ieee->seq_ctrl[0] == 0xFFF) 248 248 ieee->seq_ctrl[0] = 0; ··· 260 260 spin_unlock_irqrestore(&ieee->lock, flags); 261 261 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags); 262 262 263 - header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4); 263 + header->seq_ctrl = cpu_to_le16(ieee->seq_ctrl[0] << 4); 264 264 265 265 if (ieee->seq_ctrl[0] == 0xFFF) 266 266 ieee->seq_ctrl[0] = 0; ··· 302 302 //printk("=============>%s()\n", __FUNCTION__); 303 303 if(single){ 304 304 305 - header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4); 305 + header->seq_ctrl = cpu_to_le16(ieee->seq_ctrl[0] << 4); 306 306 307 307 if (ieee->seq_ctrl[0] == 0xFFF) 308 308 ieee->seq_ctrl[0] = 0; ··· 315 315 316 316 }else{ 317 317 318 - header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4); 318 + header->seq_ctrl = cpu_to_le16(ieee->seq_ctrl[0] << 4); 319 319 320 320 if (ieee->seq_ctrl[0] == 0xFFF) 321 321 ieee->seq_ctrl[0] = 0; ··· 347 347 skb_reserve(skb, ieee->tx_headroom); 348 348 349 349 req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request)); 350 - req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); 350 + req->header.frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); 351 351 req->header.duration_id = 0; //FIXME: is this OK ? 352 352 353 353 memset(req->header.addr1, 0xff, ETH_ALEN); ··· 662 662 auth = (struct ieee80211_authentication *) 663 663 skb_put(skb, sizeof(struct ieee80211_authentication)); 664 664 665 - auth->header.frame_ctl = IEEE80211_STYPE_AUTH; 666 - if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP; 665 + auth->header.frame_control = IEEE80211_STYPE_AUTH; 666 + if (challengelen) auth->header.frame_control |= IEEE80211_FCTL_WEP; 667 667 668 668 auth->header.duration_id = 0x013a; //FIXME 669 669 ··· 801 801 beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); 802 802 803 803 804 - beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP); 804 + beacon_buf->header.frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP); 805 805 beacon_buf->info_element[0].id = MFIE_TYPE_SSID; 806 806 beacon_buf->info_element[0].len = ssid_len; 807 807 ··· 880 880 assoc = (struct ieee80211_assoc_response_frame *) 881 881 skb_put(skb,sizeof(struct ieee80211_assoc_response_frame)); 882 882 883 - assoc->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP); 883 + assoc->header.frame_control = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP); 884 884 memcpy(assoc->header.addr1, dest,ETH_ALEN); 885 885 memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN); 886 886 memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN); ··· 935 935 memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN); 936 936 memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN); 937 937 memcpy(auth->header.addr1, dest, ETH_ALEN); 938 - auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH); 938 + auth->header.frame_control = cpu_to_le16(IEEE80211_STYPE_AUTH); 939 939 return skb; 940 940 941 941 ··· 957 957 memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN); 958 958 memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN); 959 959 960 - hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA | 960 + hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA | 961 961 IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS | 962 962 (pwr ? IEEE80211_FCTL_PM:0)); 963 963 ··· 1083 1083 skb_put(skb, sizeof(struct ieee80211_assoc_request_frame)+2); 1084 1084 1085 1085 1086 - hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ; 1086 + hdr->header.frame_control = IEEE80211_STYPE_ASSOC_REQ; 1087 1087 hdr->header.duration_id= 37; //FIXME 1088 1088 memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN); 1089 1089 memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN); ··· 1940 1940 if(!ieee->proto_started) 1941 1941 return 0; 1942 1942 1943 - switch (WLAN_FC_GET_STYPE(header->frame_ctl)) { 1943 + switch (WLAN_FC_GET_STYPE(header->frame_control)) { 1944 1944 1945 1945 case IEEE80211_STYPE_ASSOC_RESP: 1946 1946 case IEEE80211_STYPE_REASSOC_RESP: 1947 1947 1948 1948 IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n", 1949 - WLAN_FC_GET_STYPE(header->frame_ctl)); 1949 + WLAN_FC_GET_STYPE(header->frame_control)); 1950 1950 if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && 1951 1951 ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED && 1952 1952 ieee->iw_mode == IW_MODE_INFRA){ ··· 2088 2088 if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && 2089 2089 ieee->state == IEEE80211_LINKED && 2090 2090 ieee->iw_mode == IW_MODE_INFRA){ 2091 - printk("==========>received disassoc/deauth(%x) frame, reason code:%x\n",WLAN_FC_GET_STYPE(header->frame_ctl), ((struct ieee80211_disassoc*)skb->data)->reason); 2091 + printk("==========>received disassoc/deauth(%x) frame, reason code:%x\n",WLAN_FC_GET_STYPE(header->frame_control), ((struct ieee80211_disassoc*)skb->data)->reason); 2092 2092 ieee->state = IEEE80211_ASSOCIATING; 2093 2093 ieee->softmac_stats.reassoc++; 2094 2094 ieee->is_roaming = true; ··· 2239 2239 2240 2240 header = (struct ieee80211_hdr_3addr *) skb->data; 2241 2241 2242 - header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4); 2242 + header->seq_ctrl = cpu_to_le16(ieee->seq_ctrl[0] << 4); 2243 2243 2244 2244 if (ieee->seq_ctrl[0] == 0xFFF) 2245 2245 ieee->seq_ctrl[0] = 0; ··· 2574 2574 return NULL; 2575 2575 2576 2576 b = (struct ieee80211_probe_response *) skb->data; 2577 - b->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_BEACON); 2577 + b->header.frame_control = cpu_to_le16(IEEE80211_STYPE_BEACON); 2578 2578 2579 2579 return skb; 2580 2580 ··· 2590 2590 return NULL; 2591 2591 2592 2592 b = (struct ieee80211_probe_response *) skb->data; 2593 - b->header.seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4); 2593 + b->header.seq_ctrl = cpu_to_le16(ieee->seq_ctrl[0] << 4); 2594 2594 2595 2595 if (ieee->seq_ctrl[0] == 0xFFF) 2596 2596 ieee->seq_ctrl[0] = 0; ··· 3139 3139 return NULL; 3140 3140 3141 3141 disass = (struct ieee80211_disassoc *) skb_put(skb,sizeof(struct ieee80211_disassoc)); 3142 - disass->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_DISASSOC); 3142 + disass->header.frame_control = cpu_to_le16(IEEE80211_STYPE_DISASSOC); 3143 3143 disass->header.duration_id = 0; 3144 3144 3145 3145 memcpy(disass->header.addr1, beacon->bssid, ETH_ALEN);
+2 -2
drivers/staging/rtl8192su/ieee80211/rtl819x_BAProc.c
··· 136 136 137 137 memcpy(BAReq->addr3, ieee->current_network.bssid, ETH_ALEN); 138 138 139 - BAReq->frame_ctl = cpu_to_le16(IEEE80211_STYPE_MANAGE_ACT); //action frame 139 + BAReq->frame_control = cpu_to_le16(IEEE80211_STYPE_MANAGE_ACT); //action frame 140 140 141 141 //tag += sizeof( struct ieee80211_hdr_3addr); //move to action field 142 142 tag = (u8*)skb_put(skb, 9); ··· 221 221 memcpy(Delba->addr1, dst, ETH_ALEN); 222 222 memcpy(Delba->addr2, ieee->dev->dev_addr, ETH_ALEN); 223 223 memcpy(Delba->addr3, ieee->current_network.bssid, ETH_ALEN); 224 - Delba->frame_ctl = cpu_to_le16(IEEE80211_STYPE_MANAGE_ACT); //action frame 224 + Delba->frame_control = cpu_to_le16(IEEE80211_STYPE_MANAGE_ACT); //action frame 225 225 226 226 tag = (u8*)skb_put(skb, 6); 227 227
+2 -2
drivers/staging/rtl8192su/r8192U_core.c
··· 6168 6168 u16 sc ; 6169 6169 unsigned int frag,seq; 6170 6170 hdr = (struct ieee80211_hdr_3addr *)buffer; 6171 - sc = le16_to_cpu(hdr->seq_ctl); 6171 + sc = le16_to_cpu(hdr->seq_ctrl); 6172 6172 frag = WLAN_GET_SEQ_FRAG(sc); 6173 6173 seq = WLAN_GET_SEQ_SEQ(sc); 6174 6174 //cosa add 04292008 to record the sequence number ··· 6827 6827 tmp_buf = (u8*)skb->data;// + get_rxpacket_shiftbytes_819xusb(pstats); 6828 6828 6829 6829 hdr = (struct ieee80211_hdr_3addr *)tmp_buf; 6830 - fc = le16_to_cpu(hdr->frame_ctl); 6830 + fc = le16_to_cpu(hdr->frame_control); 6831 6831 type = WLAN_FC_GET_TYPE(fc); 6832 6832 praddr = hdr->addr1; 6833 6833
+50 -1
include/linux/nl80211.h
··· 3 3 /* 4 4 * 802.11 netlink interface public header 5 5 * 6 - * Copyright 2006, 2007, 2008 Johannes Berg <johannes@sipsolutions.net> 6 + * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> 7 7 * Copyright 2008 Michael Wu <flamingice@sourmilk.net> 8 8 * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com> 9 9 * Copyright 2008 Michael Buesch <mb@bu3sch.de> ··· 299 299 * rate selection. %NL80211_ATTR_IFINDEX is used to specify the interface 300 300 * and @NL80211_ATTR_TX_RATES the set of allowed rates. 301 301 * 302 + * @NL80211_CMD_REGISTER_ACTION: Register for receiving certain action frames 303 + * (via @NL80211_CMD_ACTION) for processing in userspace. This command 304 + * requires an interface index and a match attribute containing the first 305 + * few bytes of the frame that should match, e.g. a single byte for only 306 + * a category match or four bytes for vendor frames including the OUI. 307 + * The registration cannot be dropped, but is removed automatically 308 + * when the netlink socket is closed. Multiple registrations can be made. 309 + * @NL80211_CMD_ACTION: Action frame TX request and RX notification. This 310 + * command is used both as a request to transmit an Action frame and as an 311 + * event indicating reception of an Action frame that was not processed in 312 + * kernel code, but is for us (i.e., which may need to be processed in a 313 + * user space application). %NL80211_ATTR_FRAME is used to specify the 314 + * frame contents (including header). %NL80211_ATTR_WIPHY_FREQ (and 315 + * optionally %NL80211_ATTR_WIPHY_CHANNEL_TYPE) is used to indicate on 316 + * which channel the frame is to be transmitted or was received. This 317 + * channel has to be the current channel (remain-on-channel or the 318 + * operational channel). When called, this operation returns a cookie 319 + * (%NL80211_ATTR_COOKIE) that will be included with the TX status event 320 + * pertaining to the TX request. 321 + * @NL80211_CMD_ACTION_TX_STATUS: Report TX status of an Action frame 322 + * transmitted with %NL80211_CMD_ACTION. %NL80211_ATTR_COOKIE identifies 323 + * the TX command and %NL80211_ATTR_FRAME includes the contents of the 324 + * frame. %NL80211_ATTR_ACK flag is included if the recipient acknowledged 325 + * the frame. 326 + * 302 327 * @NL80211_CMD_MAX: highest used command number 303 328 * @__NL80211_CMD_AFTER_LAST: internal use 304 329 */ ··· 411 386 NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL, 412 387 413 388 NL80211_CMD_SET_TX_BITRATE_MASK, 389 + 390 + NL80211_CMD_REGISTER_ACTION, 391 + NL80211_CMD_ACTION, 392 + NL80211_CMD_ACTION_TX_STATUS, 393 + 394 + NL80211_CMD_SET_POWER_SAVE, 395 + NL80211_CMD_GET_POWER_SAVE, 414 396 415 397 /* add new commands above here */ 416 398 ··· 685 653 * rates based on negotiated supported rates information. This attribute 686 654 * is used with %NL80211_CMD_SET_TX_BITRATE_MASK. 687 655 * 656 + * @NL80211_ATTR_FRAME_MATCH: A binary attribute which typically must contain 657 + * at least one byte, currently used with @NL80211_CMD_REGISTER_ACTION. 658 + * 659 + * @NL80211_ATTR_ACK: Flag attribute indicating that the frame was 660 + * acknowledged by the recipient. 661 + * 688 662 * @NL80211_ATTR_MAX: highest attribute number currently defined 689 663 * @__NL80211_ATTR_AFTER_LAST: internal use 690 664 */ ··· 835 797 NL80211_ATTR_WIPHY_COVERAGE_CLASS, 836 798 837 799 NL80211_ATTR_TX_RATES, 800 + 801 + NL80211_ATTR_FRAME_MATCH, 802 + 803 + NL80211_ATTR_ACK, 804 + 805 + NL80211_ATTR_PS_STATE, 838 806 839 807 /* add attributes here, update the policy in nl80211.c */ 840 808 ··· 1576 1532 enum nl80211_band { 1577 1533 NL80211_BAND_2GHZ, 1578 1534 NL80211_BAND_5GHZ, 1535 + }; 1536 + 1537 + enum nl80211_ps_state { 1538 + NL80211_PS_DISABLED, 1539 + NL80211_PS_ENABLED, 1579 1540 }; 1580 1541 1581 1542 #endif /* __LINUX_NL80211_H */
+50 -4
include/net/cfg80211.h
··· 3 3 /* 4 4 * 802.11 device and configuration interface 5 5 * 6 - * Copyright 2006-2009 Johannes Berg <johannes@sipsolutions.net> 6 + * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify 9 9 * it under the terms of the GNU General Public License version 2 as ··· 998 998 * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 999 999 * This allows the operation to be terminated prior to timeout based on 1000 1000 * the duration value. 1001 + * @action: Transmit an action frame 1001 1002 * 1002 1003 * @testmode_cmd: run a test mode command 1003 1004 * ··· 1145 1144 struct net_device *dev, 1146 1145 u64 cookie); 1147 1146 1148 - /* some temporary stuff to finish wext */ 1147 + int (*action)(struct wiphy *wiphy, struct net_device *dev, 1148 + struct ieee80211_channel *chan, 1149 + enum nl80211_channel_type channel_type, 1150 + const u8 *buf, size_t len, u64 *cookie); 1151 + 1149 1152 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 1150 1153 bool enabled, int timeout); 1151 1154 }; ··· 1450 1445 * set by driver (if supported) on add_interface BEFORE registering the 1451 1446 * netdev and may otherwise be used by driver read-only, will be update 1452 1447 * by cfg80211 on change_interface 1448 + * @action_registrations: list of registrations for action frames 1449 + * @action_registrations_lock: lock for the list 1453 1450 */ 1454 1451 struct wireless_dev { 1455 1452 struct wiphy *wiphy; ··· 1460 1453 /* the remainder of this struct should be private to cfg80211 */ 1461 1454 struct list_head list; 1462 1455 struct net_device *netdev; 1456 + 1457 + struct list_head action_registrations; 1458 + spinlock_t action_registrations_lock; 1463 1459 1464 1460 struct mutex mtx; 1465 1461 ··· 1488 1478 struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES]; 1489 1479 struct cfg80211_internal_bss *current_bss; /* associated / joined */ 1490 1480 1481 + bool ps; 1482 + int ps_timeout; 1483 + 1491 1484 #ifdef CONFIG_CFG80211_WEXT 1492 1485 /* wext data */ 1493 1486 struct { ··· 1502 1489 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 1503 1490 u8 ssid[IEEE80211_MAX_SSID_LEN]; 1504 1491 s8 default_key, default_mgmt_key; 1505 - bool ps, prev_bssid_valid; 1506 - int ps_timeout; 1492 + bool prev_bssid_valid; 1507 1493 } wext; 1508 1494 #endif 1509 1495 }; ··· 2302 2290 */ 2303 2291 void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, 2304 2292 struct station_info *sinfo, gfp_t gfp); 2293 + 2294 + /** 2295 + * cfg80211_rx_action - notification of received, unprocessed Action frame 2296 + * @dev: network device 2297 + * @freq: Frequency on which the frame was received in MHz 2298 + * @buf: Action frame (header + body) 2299 + * @len: length of the frame data 2300 + * @gfp: context flags 2301 + * Returns %true if a user space application is responsible for rejecting the 2302 + * unrecognized Action frame; %false if no such application is registered 2303 + * (i.e., the driver is responsible for rejecting the unrecognized Action 2304 + * frame) 2305 + * 2306 + * This function is called whenever an Action frame is received for a station 2307 + * mode interface, but is not processed in kernel. 2308 + */ 2309 + bool cfg80211_rx_action(struct net_device *dev, int freq, const u8 *buf, 2310 + size_t len, gfp_t gfp); 2311 + 2312 + /** 2313 + * cfg80211_action_tx_status - notification of TX status for Action frame 2314 + * @dev: network device 2315 + * @cookie: Cookie returned by cfg80211_ops::action() 2316 + * @buf: Action frame (header + body) 2317 + * @len: length of the frame data 2318 + * @ack: Whether frame was acknowledged 2319 + * @gfp: context flags 2320 + * 2321 + * This function is called whenever an Action frame was requested to be 2322 + * transmitted with cfg80211_ops::action() to report the TX status of the 2323 + * transmission attempt. 2324 + */ 2325 + void cfg80211_action_tx_status(struct net_device *dev, u64 cookie, 2326 + const u8 *buf, size_t len, bool ack, gfp_t gfp); 2305 2327 2306 2328 #endif /* __NET_CFG80211_H */
+5 -1
include/net/mac80211.h
··· 3 3 * 4 4 * Copyright 2002-2005, Devicescape Software, Inc. 5 5 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 6 - * Copyright 2007-2008 Johannes Berg <johannes@sipsolutions.net> 6 + * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net> 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify 9 9 * it under the terms of the GNU General Public License version 2 as ··· 264 264 * be modified again (no seqno assignment, crypto, etc.) 265 265 * @IEEE80211_TX_INTFL_HAS_RADIOTAP: This frame was injected and still 266 266 * has a radiotap header at skb->data. 267 + * @IEEE80211_TX_INTFL_NL80211_FRAME_TX: Frame was requested through nl80211 268 + * MLME command (internal to mac80211 to figure out whether to send TX 269 + * status to user space) 267 270 */ 268 271 enum mac80211_tx_control_flags { 269 272 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), ··· 289 286 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18), 290 287 IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19), 291 288 IEEE80211_TX_INTFL_HAS_RADIOTAP = BIT(20), 289 + IEEE80211_TX_INTFL_NL80211_FRAME_TX = BIT(21), 292 290 }; 293 291 294 292 /**
+5
include/pcmcia/device_id.h
··· 34 34 .prod_id = { NULL, (v2), NULL, NULL }, \ 35 35 .prod_id_hash = { 0, (vh2), 0, 0 }, } 36 36 37 + #define PCMCIA_DEVICE_PROD_ID3(v3, vh3) { \ 38 + .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID3, \ 39 + .prod_id = { NULL, NULL, (v3), NULL }, \ 40 + .prod_id_hash = { 0, 0, (vh3), 0 }, } 41 + 37 42 #define PCMCIA_DEVICE_PROD_ID12(v1, v2, vh1, vh2) { \ 38 43 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ 39 44 PCMCIA_DEV_ID_MATCH_PROD_ID2, \
+11 -1
net/mac80211/cfg.c
··· 1 1 /* 2 2 * mac80211 configuration hooks for cfg80211 3 3 * 4 - * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net> 4 + * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> 5 5 * 6 6 * This file is GPLv2 as found in COPYING. 7 7 */ ··· 1448 1448 return ieee80211_wk_cancel_remain_on_channel(sdata, cookie); 1449 1449 } 1450 1450 1451 + static int ieee80211_action(struct wiphy *wiphy, struct net_device *dev, 1452 + struct ieee80211_channel *chan, 1453 + enum nl80211_channel_type channel_type, 1454 + const u8 *buf, size_t len, u64 *cookie) 1455 + { 1456 + return ieee80211_mgd_action(IEEE80211_DEV_TO_SUB_IF(dev), chan, 1457 + channel_type, buf, len, cookie); 1458 + } 1459 + 1451 1460 struct cfg80211_ops mac80211_config_ops = { 1452 1461 .add_virtual_intf = ieee80211_add_iface, 1453 1462 .del_virtual_intf = ieee80211_del_iface, ··· 1505 1496 .set_bitrate_mask = ieee80211_set_bitrate_mask, 1506 1497 .remain_on_channel = ieee80211_remain_on_channel, 1507 1498 .cancel_remain_on_channel = ieee80211_cancel_remain_on_channel, 1499 + .action = ieee80211_action, 1508 1500 };
+5 -1
net/mac80211/ieee80211_i.h
··· 2 2 * Copyright 2002-2005, Instant802 Networks, Inc. 3 3 * Copyright 2005, Devicescape Software, Inc. 4 4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 5 - * Copyright 2007-2008 Johannes Berg <johannes@sipsolutions.net> 5 + * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net> 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify 8 8 * it under the terms of the GNU General Public License version 2 as ··· 966 966 int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, 967 967 struct cfg80211_disassoc_request *req, 968 968 void *cookie); 969 + int ieee80211_mgd_action(struct ieee80211_sub_if_data *sdata, 970 + struct ieee80211_channel *chan, 971 + enum nl80211_channel_type channel_type, 972 + const u8 *buf, size_t len, u64 *cookie); 969 973 ieee80211_rx_result ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, 970 974 struct sk_buff *skb); 971 975 void ieee80211_send_pspoll(struct ieee80211_local *local,
+1 -1
net/mac80211/iface.c
··· 1031 1031 1032 1032 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1033 1033 1034 - memcpy(sdata->name, sdata->name, IFNAMSIZ); 1034 + memcpy(sdata->name, dev->name, IFNAMSIZ); 1035 1035 1036 1036 ieee80211_debugfs_rename_netdev(sdata); 1037 1037 return 0;
+35
net/mac80211/mlme.c
··· 2084 2084 2085 2085 return 0; 2086 2086 } 2087 + 2088 + int ieee80211_mgd_action(struct ieee80211_sub_if_data *sdata, 2089 + struct ieee80211_channel *chan, 2090 + enum nl80211_channel_type channel_type, 2091 + const u8 *buf, size_t len, u64 *cookie) 2092 + { 2093 + struct ieee80211_local *local = sdata->local; 2094 + struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 2095 + struct sk_buff *skb; 2096 + 2097 + /* Check that we are on the requested channel for transmission */ 2098 + if ((chan != local->tmp_channel || 2099 + channel_type != local->tmp_channel_type) && 2100 + (chan != local->oper_channel || 2101 + channel_type != local->oper_channel_type)) 2102 + return -EBUSY; 2103 + 2104 + skb = dev_alloc_skb(local->hw.extra_tx_headroom + len); 2105 + if (!skb) 2106 + return -ENOMEM; 2107 + skb_reserve(skb, local->hw.extra_tx_headroom); 2108 + 2109 + memcpy(skb_put(skb, len), buf, len); 2110 + 2111 + if (!(ifmgd->flags & IEEE80211_STA_MFP_ENABLED)) 2112 + IEEE80211_SKB_CB(skb)->flags |= 2113 + IEEE80211_TX_INTFL_DONT_ENCRYPT; 2114 + IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_NL80211_FRAME_TX | 2115 + IEEE80211_TX_CTL_REQ_TX_STATUS; 2116 + skb->dev = sdata->dev; 2117 + ieee80211_tx_skb(sdata, skb); 2118 + 2119 + *cookie = (unsigned long) skb; 2120 + return 0; 2121 + }
+100 -42
net/mac80211/rx.c
··· 2 2 * Copyright 2002-2005, Instant802 Networks, Inc. 3 3 * Copyright 2005-2006, Devicescape Software, Inc. 4 4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 5 - * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> 5 + * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net> 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify 8 8 * it under the terms of the GNU General Public License version 2 as ··· 1397 1397 ieee80211_is_data(fc) && 1398 1398 (rx->key || rx->sdata->drop_unencrypted))) 1399 1399 return -EACCES; 1400 + 1401 + return 0; 1402 + } 1403 + 1404 + static int 1405 + ieee80211_drop_unencrypted_mgmt(struct ieee80211_rx_data *rx) 1406 + { 1407 + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; 1408 + __le16 fc = hdr->frame_control; 1409 + int res; 1410 + 1411 + res = ieee80211_drop_unencrypted(rx, fc); 1412 + if (unlikely(res)) 1413 + return res; 1414 + 1400 1415 if (rx->sta && test_sta_flags(rx->sta, WLAN_STA_MFP)) { 1401 1416 if (unlikely(ieee80211_is_unicast_robust_mgmt_frame(rx->skb) && 1402 1417 rx->key)) ··· 1870 1855 struct ieee80211_local *local = rx->local; 1871 1856 struct ieee80211_sub_if_data *sdata = rx->sdata; 1872 1857 struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *) rx->skb->data; 1858 + struct sk_buff *nskb; 1859 + struct ieee80211_rx_status *status; 1873 1860 int len = rx->skb->len; 1874 1861 1875 1862 if (!ieee80211_is_action(mgmt->frame_control)) 1876 1863 return RX_CONTINUE; 1877 1864 1878 - if (!rx->sta) 1879 - return RX_DROP_MONITOR; 1865 + /* drop too small frames */ 1866 + if (len < IEEE80211_MIN_ACTION_SIZE) 1867 + return RX_DROP_UNUSABLE; 1868 + 1869 + if (!rx->sta && mgmt->u.action.category != WLAN_CATEGORY_PUBLIC) 1870 + return RX_DROP_UNUSABLE; 1880 1871 1881 1872 if (!(rx->flags & IEEE80211_RX_RA_MATCH)) 1882 - return RX_DROP_MONITOR; 1873 + return RX_DROP_UNUSABLE; 1883 1874 1884 - if (ieee80211_drop_unencrypted(rx, mgmt->frame_control)) 1885 - return RX_DROP_MONITOR; 1886 - 1887 - /* all categories we currently handle have action_code */ 1888 - if (len < IEEE80211_MIN_ACTION_SIZE + 1) 1889 - return RX_DROP_MONITOR; 1875 + if (ieee80211_drop_unencrypted_mgmt(rx)) 1876 + return RX_DROP_UNUSABLE; 1890 1877 1891 1878 switch (mgmt->u.action.category) { 1892 1879 case WLAN_CATEGORY_BACK: ··· 1901 1884 if (sdata->vif.type != NL80211_IFTYPE_STATION && 1902 1885 sdata->vif.type != NL80211_IFTYPE_AP_VLAN && 1903 1886 sdata->vif.type != NL80211_IFTYPE_AP) 1904 - return RX_DROP_MONITOR; 1887 + break; 1888 + 1889 + /* verify action_code is present */ 1890 + if (len < IEEE80211_MIN_ACTION_SIZE + 1) 1891 + break; 1905 1892 1906 1893 switch (mgmt->u.action.u.addba_req.action_code) { 1907 1894 case WLAN_ACTION_ADDBA_REQ: ··· 1913 1892 sizeof(mgmt->u.action.u.addba_req))) 1914 1893 return RX_DROP_MONITOR; 1915 1894 ieee80211_process_addba_request(local, rx->sta, mgmt, len); 1916 - break; 1895 + goto handled; 1917 1896 case WLAN_ACTION_ADDBA_RESP: 1918 1897 if (len < (IEEE80211_MIN_ACTION_SIZE + 1919 1898 sizeof(mgmt->u.action.u.addba_resp))) 1920 - return RX_DROP_MONITOR; 1899 + break; 1921 1900 ieee80211_process_addba_resp(local, rx->sta, mgmt, len); 1922 - break; 1901 + goto handled; 1923 1902 case WLAN_ACTION_DELBA: 1924 1903 if (len < (IEEE80211_MIN_ACTION_SIZE + 1925 1904 sizeof(mgmt->u.action.u.delba))) 1926 - return RX_DROP_MONITOR; 1905 + break; 1927 1906 ieee80211_process_delba(sdata, rx->sta, mgmt, len); 1928 - break; 1907 + goto handled; 1929 1908 } 1930 1909 break; 1931 1910 case WLAN_CATEGORY_SPECTRUM_MGMT: 1932 1911 if (local->hw.conf.channel->band != IEEE80211_BAND_5GHZ) 1933 - return RX_DROP_MONITOR; 1912 + break; 1934 1913 1935 1914 if (sdata->vif.type != NL80211_IFTYPE_STATION) 1936 - return RX_DROP_MONITOR; 1915 + break; 1916 + 1917 + /* verify action_code is present */ 1918 + if (len < IEEE80211_MIN_ACTION_SIZE + 1) 1919 + break; 1937 1920 1938 1921 switch (mgmt->u.action.u.measurement.action_code) { 1939 1922 case WLAN_ACTION_SPCT_MSR_REQ: 1940 1923 if (len < (IEEE80211_MIN_ACTION_SIZE + 1941 1924 sizeof(mgmt->u.action.u.measurement))) 1942 - return RX_DROP_MONITOR; 1925 + break; 1943 1926 ieee80211_process_measurement_req(sdata, mgmt, len); 1944 - break; 1927 + goto handled; 1945 1928 case WLAN_ACTION_SPCT_CHL_SWITCH: 1946 1929 if (len < (IEEE80211_MIN_ACTION_SIZE + 1947 1930 sizeof(mgmt->u.action.u.chan_switch))) 1948 - return RX_DROP_MONITOR; 1931 + break; 1949 1932 1950 1933 if (sdata->vif.type != NL80211_IFTYPE_STATION) 1951 - return RX_DROP_MONITOR; 1934 + break; 1952 1935 1953 1936 if (memcmp(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN)) 1954 - return RX_DROP_MONITOR; 1937 + break; 1955 1938 1956 1939 return ieee80211_sta_rx_mgmt(sdata, rx->skb); 1957 1940 } ··· 1963 1938 case WLAN_CATEGORY_SA_QUERY: 1964 1939 if (len < (IEEE80211_MIN_ACTION_SIZE + 1965 1940 sizeof(mgmt->u.action.u.sa_query))) 1966 - return RX_DROP_MONITOR; 1941 + break; 1942 + 1967 1943 switch (mgmt->u.action.u.sa_query.action) { 1968 1944 case WLAN_ACTION_SA_QUERY_REQUEST: 1969 1945 if (sdata->vif.type != NL80211_IFTYPE_STATION) 1970 - return RX_DROP_MONITOR; 1946 + break; 1971 1947 ieee80211_process_sa_query_req(sdata, mgmt, len); 1972 - break; 1973 - case WLAN_ACTION_SA_QUERY_RESPONSE: 1974 - /* 1975 - * SA Query response is currently only used in AP mode 1976 - * and it is processed in user space. 1977 - */ 1978 - return RX_CONTINUE; 1948 + goto handled; 1979 1949 } 1980 1950 break; 1981 - default: 1982 - /* do not process rejected action frames */ 1983 - if (mgmt->u.action.category & 0x80) 1984 - return RX_DROP_MONITOR; 1985 - 1986 - return RX_CONTINUE; 1987 1951 } 1988 1952 1989 - rx->sta->rx_packets++; 1953 + /* 1954 + * For AP mode, hostapd is responsible for handling any action 1955 + * frames that we didn't handle, including returning unknown 1956 + * ones. For all other modes we will return them to the sender, 1957 + * setting the 0x80 bit in the action category, as required by 1958 + * 802.11-2007 7.3.1.11. 1959 + */ 1960 + if (sdata->vif.type == NL80211_IFTYPE_AP || 1961 + sdata->vif.type == NL80211_IFTYPE_AP_VLAN) 1962 + return RX_DROP_MONITOR; 1963 + 1964 + /* 1965 + * Getting here means the kernel doesn't know how to handle 1966 + * it, but maybe userspace does ... include returned frames 1967 + * so userspace can register for those to know whether ones 1968 + * it transmitted were processed or returned. 1969 + */ 1970 + status = IEEE80211_SKB_RXCB(rx->skb); 1971 + 1972 + if (sdata->vif.type == NL80211_IFTYPE_STATION && 1973 + cfg80211_rx_action(rx->sdata->dev, status->freq, 1974 + rx->skb->data, rx->skb->len, 1975 + GFP_ATOMIC)) 1976 + goto handled; 1977 + 1978 + /* do not return rejected action frames */ 1979 + if (mgmt->u.action.category & 0x80) 1980 + return RX_DROP_UNUSABLE; 1981 + 1982 + nskb = skb_copy_expand(rx->skb, local->hw.extra_tx_headroom, 0, 1983 + GFP_ATOMIC); 1984 + if (nskb) { 1985 + struct ieee80211_mgmt *mgmt = (void *)nskb->data; 1986 + 1987 + mgmt->u.action.category |= 0x80; 1988 + memcpy(mgmt->da, mgmt->sa, ETH_ALEN); 1989 + memcpy(mgmt->sa, rx->sdata->vif.addr, ETH_ALEN); 1990 + 1991 + memset(nskb->cb, 0, sizeof(nskb->cb)); 1992 + 1993 + ieee80211_tx_skb(rx->sdata, nskb); 1994 + } 1995 + 1996 + handled: 1997 + if (rx->sta) 1998 + rx->sta->rx_packets++; 1990 1999 dev_kfree_skb(rx->skb); 1991 2000 return RX_QUEUED; 1992 2001 } ··· 2029 1970 ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx) 2030 1971 { 2031 1972 struct ieee80211_sub_if_data *sdata = rx->sdata; 2032 - struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *) rx->skb->data; 2033 1973 ieee80211_rx_result rxs; 2034 1974 2035 1975 if (!(rx->flags & IEEE80211_RX_RA_MATCH)) 2036 1976 return RX_DROP_MONITOR; 2037 1977 2038 - if (ieee80211_drop_unencrypted(rx, mgmt->frame_control)) 2039 - return RX_DROP_MONITOR; 1978 + if (ieee80211_drop_unencrypted_mgmt(rx)) 1979 + return RX_DROP_UNUSABLE; 2040 1980 2041 1981 rxs = ieee80211_work_rx_mgmt(rx->sdata, rx->skb); 2042 1982 if (rxs != RX_CONTINUE)
+6 -1
net/mac80211/status.c
··· 2 2 * Copyright 2002-2005, Instant802 Networks, Inc. 3 3 * Copyright 2005-2006, Devicescape Software, Inc. 4 4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 5 - * Copyright 2008-2009 Johannes Berg <johannes@sipsolutions.net> 5 + * Copyright 2008-2010 Johannes Berg <johannes@sipsolutions.net> 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify 8 8 * it under the terms of the GNU General Public License version 2 as ··· 287 287 mod_timer(&local->dynamic_ps_timer, jiffies + 288 288 msecs_to_jiffies(10)); 289 289 } 290 + 291 + if (info->flags & IEEE80211_TX_INTFL_NL80211_FRAME_TX) 292 + cfg80211_action_tx_status( 293 + skb->dev, (unsigned long) skb, skb->data, skb->len, 294 + !!(info->flags & IEEE80211_TX_STAT_ACK), GFP_ATOMIC); 290 295 291 296 /* this was a transmitted frame, but now we want to reuse it */ 292 297 skb_orphan(skb);
+13 -7
net/wireless/core.c
··· 677 677 INIT_WORK(&wdev->cleanup_work, wdev_cleanup_work); 678 678 INIT_LIST_HEAD(&wdev->event_list); 679 679 spin_lock_init(&wdev->event_lock); 680 + INIT_LIST_HEAD(&wdev->action_registrations); 681 + spin_lock_init(&wdev->action_registrations_lock); 682 + 680 683 mutex_lock(&rdev->devlist_mtx); 681 684 list_add_rcu(&wdev->list, &rdev->netdev_list); 682 685 rdev->devlist_generation++; ··· 698 695 wdev->wext.default_key = -1; 699 696 wdev->wext.default_mgmt_key = -1; 700 697 wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC; 698 + #endif 699 + 701 700 if (wdev->wiphy->flags & WIPHY_FLAG_PS_ON_BY_DEFAULT) 702 - wdev->wext.ps = true; 701 + wdev->ps = true; 703 702 else 704 - wdev->wext.ps = false; 705 - wdev->wext.ps_timeout = 100; 703 + wdev->ps = false; 704 + wdev->ps_timeout = 100; 706 705 if (rdev->ops->set_power_mgmt) 707 706 if (rdev->ops->set_power_mgmt(wdev->wiphy, dev, 708 - wdev->wext.ps, 709 - wdev->wext.ps_timeout)) { 707 + wdev->ps, 708 + wdev->ps_timeout)) { 710 709 /* assume this means it's off */ 711 - wdev->wext.ps = false; 710 + wdev->ps = false; 712 711 } 713 - #endif 712 + 714 713 if (!dev->ethtool_ops) 715 714 dev->ethtool_ops = &cfg80211_ethtool_ops; 716 715 ··· 797 792 sysfs_remove_link(&dev->dev.kobj, "phy80211"); 798 793 list_del_rcu(&wdev->list); 799 794 rdev->devlist_generation++; 795 + cfg80211_mlme_purge_actions(wdev); 800 796 #ifdef CONFIG_CFG80211_WEXT 801 797 kfree(wdev->wext.keys); 802 798 #endif
+9
net/wireless/core.h
··· 329 329 const u8 *resp_ie, size_t resp_ie_len, 330 330 u16 status, bool wextev, 331 331 struct cfg80211_bss *bss); 332 + int cfg80211_mlme_register_action(struct wireless_dev *wdev, u32 snd_pid, 333 + const u8 *match_data, int match_len); 334 + void cfg80211_mlme_unregister_actions(struct wireless_dev *wdev, u32 nlpid); 335 + void cfg80211_mlme_purge_actions(struct wireless_dev *wdev); 336 + int cfg80211_mlme_action(struct cfg80211_registered_device *rdev, 337 + struct net_device *dev, 338 + struct ieee80211_channel *chan, 339 + enum nl80211_channel_type channel_type, 340 + const u8 *buf, size_t len, u64 *cookie); 332 341 333 342 /* SME */ 334 343 int __cfg80211_connect(struct cfg80211_registered_device *rdev,
+166
net/wireless/mlme.c
··· 728 728 nl80211_send_sta_event(rdev, dev, mac_addr, sinfo, gfp); 729 729 } 730 730 EXPORT_SYMBOL(cfg80211_new_sta); 731 + 732 + struct cfg80211_action_registration { 733 + struct list_head list; 734 + 735 + u32 nlpid; 736 + 737 + int match_len; 738 + 739 + u8 match[]; 740 + }; 741 + 742 + int cfg80211_mlme_register_action(struct wireless_dev *wdev, u32 snd_pid, 743 + const u8 *match_data, int match_len) 744 + { 745 + struct cfg80211_action_registration *reg, *nreg; 746 + int err = 0; 747 + 748 + nreg = kzalloc(sizeof(*reg) + match_len, GFP_KERNEL); 749 + if (!nreg) 750 + return -ENOMEM; 751 + 752 + spin_lock_bh(&wdev->action_registrations_lock); 753 + 754 + list_for_each_entry(reg, &wdev->action_registrations, list) { 755 + int mlen = min(match_len, reg->match_len); 756 + 757 + if (memcmp(reg->match, match_data, mlen) == 0) { 758 + err = -EALREADY; 759 + break; 760 + } 761 + } 762 + 763 + if (err) { 764 + kfree(nreg); 765 + goto out; 766 + } 767 + 768 + memcpy(nreg->match, match_data, match_len); 769 + nreg->match_len = match_len; 770 + nreg->nlpid = snd_pid; 771 + list_add(&nreg->list, &wdev->action_registrations); 772 + 773 + out: 774 + spin_unlock_bh(&wdev->action_registrations_lock); 775 + return err; 776 + } 777 + 778 + void cfg80211_mlme_unregister_actions(struct wireless_dev *wdev, u32 nlpid) 779 + { 780 + struct cfg80211_action_registration *reg, *tmp; 781 + 782 + spin_lock_bh(&wdev->action_registrations_lock); 783 + 784 + list_for_each_entry_safe(reg, tmp, &wdev->action_registrations, list) { 785 + if (reg->nlpid == nlpid) { 786 + list_del(&reg->list); 787 + kfree(reg); 788 + } 789 + } 790 + 791 + spin_unlock_bh(&wdev->action_registrations_lock); 792 + } 793 + 794 + void cfg80211_mlme_purge_actions(struct wireless_dev *wdev) 795 + { 796 + struct cfg80211_action_registration *reg, *tmp; 797 + 798 + spin_lock_bh(&wdev->action_registrations_lock); 799 + 800 + list_for_each_entry_safe(reg, tmp, &wdev->action_registrations, list) { 801 + list_del(&reg->list); 802 + kfree(reg); 803 + } 804 + 805 + spin_unlock_bh(&wdev->action_registrations_lock); 806 + } 807 + 808 + int cfg80211_mlme_action(struct cfg80211_registered_device *rdev, 809 + struct net_device *dev, 810 + struct ieee80211_channel *chan, 811 + enum nl80211_channel_type channel_type, 812 + const u8 *buf, size_t len, u64 *cookie) 813 + { 814 + struct wireless_dev *wdev = dev->ieee80211_ptr; 815 + const struct ieee80211_mgmt *mgmt; 816 + 817 + if (rdev->ops->action == NULL) 818 + return -EOPNOTSUPP; 819 + if (len < 24 + 1) 820 + return -EINVAL; 821 + 822 + mgmt = (const struct ieee80211_mgmt *) buf; 823 + if (!ieee80211_is_action(mgmt->frame_control)) 824 + return -EINVAL; 825 + if (mgmt->u.action.category != WLAN_CATEGORY_PUBLIC) { 826 + /* Verify that we are associated with the destination AP */ 827 + if (!wdev->current_bss || 828 + memcmp(wdev->current_bss->pub.bssid, mgmt->bssid, 829 + ETH_ALEN) != 0 || 830 + memcmp(wdev->current_bss->pub.bssid, mgmt->da, 831 + ETH_ALEN) != 0) 832 + return -ENOTCONN; 833 + } 834 + 835 + if (memcmp(mgmt->sa, dev->dev_addr, ETH_ALEN) != 0) 836 + return -EINVAL; 837 + 838 + /* Transmit the Action frame as requested by user space */ 839 + return rdev->ops->action(&rdev->wiphy, dev, chan, channel_type, 840 + buf, len, cookie); 841 + } 842 + 843 + bool cfg80211_rx_action(struct net_device *dev, int freq, const u8 *buf, 844 + size_t len, gfp_t gfp) 845 + { 846 + struct wireless_dev *wdev = dev->ieee80211_ptr; 847 + struct wiphy *wiphy = wdev->wiphy; 848 + struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 849 + struct cfg80211_action_registration *reg; 850 + const u8 *action_data; 851 + int action_data_len; 852 + bool result = false; 853 + 854 + /* frame length - min size excluding category */ 855 + action_data_len = len - (IEEE80211_MIN_ACTION_SIZE - 1); 856 + 857 + /* action data starts with category */ 858 + action_data = buf + IEEE80211_MIN_ACTION_SIZE - 1; 859 + 860 + spin_lock_bh(&wdev->action_registrations_lock); 861 + 862 + list_for_each_entry(reg, &wdev->action_registrations, list) { 863 + if (reg->match_len > action_data_len) 864 + continue; 865 + 866 + if (memcmp(reg->match, action_data, reg->match_len)) 867 + continue; 868 + 869 + /* found match! */ 870 + 871 + /* Indicate the received Action frame to user space */ 872 + if (nl80211_send_action(rdev, dev, reg->nlpid, freq, 873 + buf, len, gfp)) 874 + continue; 875 + 876 + result = true; 877 + break; 878 + } 879 + 880 + spin_unlock_bh(&wdev->action_registrations_lock); 881 + 882 + return result; 883 + } 884 + EXPORT_SYMBOL(cfg80211_rx_action); 885 + 886 + void cfg80211_action_tx_status(struct net_device *dev, u64 cookie, 887 + const u8 *buf, size_t len, bool ack, gfp_t gfp) 888 + { 889 + struct wireless_dev *wdev = dev->ieee80211_ptr; 890 + struct wiphy *wiphy = wdev->wiphy; 891 + struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 892 + 893 + /* Indicate TX status of the Action frame to user space */ 894 + nl80211_send_action_tx_status(rdev, dev, cookie, buf, len, ack, gfp); 895 + } 896 + EXPORT_SYMBOL(cfg80211_action_tx_status);
+403 -37
net/wireless/nl80211.c
··· 1 1 /* 2 2 * This is the new netlink-based wireless configuration interface. 3 3 * 4 - * Copyright 2006-2009 Johannes Berg <johannes@sipsolutions.net> 4 + * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> 5 5 */ 6 6 7 7 #include <linux/if.h> ··· 145 145 [NL80211_ATTR_DURATION] = { .type = NLA_U32 }, 146 146 [NL80211_ATTR_COOKIE] = { .type = NLA_U64 }, 147 147 [NL80211_ATTR_TX_RATES] = { .type = NLA_NESTED }, 148 + [NL80211_ATTR_FRAME] = { .type = NLA_BINARY, 149 + .len = IEEE80211_MAX_DATA_LEN }, 150 + [NL80211_ATTR_FRAME_MATCH] = { .type = NLA_BINARY, }, 151 + [NL80211_ATTR_PS_STATE] = { .type = NLA_U32 }, 148 152 }; 149 153 150 154 /* policy for the attributes */ ··· 580 576 CMD(flush_pmksa, FLUSH_PMKSA); 581 577 CMD(remain_on_channel, REMAIN_ON_CHANNEL); 582 578 CMD(set_bitrate_mask, SET_TX_BITRATE_MASK); 579 + CMD(action, ACTION); 583 580 if (dev->wiphy.flags & WIPHY_FLAG_NETNS_OK) { 584 581 i++; 585 582 NLA_PUT_U32(msg, i, NL80211_CMD_SET_WIPHY_NETNS); ··· 2014 2009 if (!info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]) 2015 2010 return -EINVAL; 2016 2011 2012 + if (!info->attrs[NL80211_ATTR_STA_AID]) 2013 + return -EINVAL; 2014 + 2017 2015 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); 2018 2016 params.supported_rates = 2019 2017 nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]); ··· 2025 2017 params.listen_interval = 2026 2018 nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]); 2027 2019 2028 - if (info->attrs[NL80211_ATTR_STA_AID]) { 2029 - params.aid = nla_get_u16(info->attrs[NL80211_ATTR_STA_AID]); 2030 - if (!params.aid || params.aid > IEEE80211_MAX_AID) 2031 - return -EINVAL; 2032 - } 2020 + params.aid = nla_get_u16(info->attrs[NL80211_ATTR_STA_AID]); 2021 + if (!params.aid || params.aid > IEEE80211_MAX_AID) 2022 + return -EINVAL; 2033 2023 2034 2024 if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) 2035 2025 params.ht_capa = ··· 2042 2036 if (err) 2043 2037 goto out_rtnl; 2044 2038 2039 + if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && 2040 + dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN) { 2041 + err = -EINVAL; 2042 + goto out; 2043 + } 2044 + 2045 2045 err = get_vlan(info, rdev, &params.vlan); 2046 2046 if (err) 2047 2047 goto out; 2048 2048 2049 2049 /* validate settings */ 2050 2050 err = 0; 2051 - 2052 - switch (dev->ieee80211_ptr->iftype) { 2053 - case NL80211_IFTYPE_AP: 2054 - case NL80211_IFTYPE_AP_VLAN: 2055 - /* all ok but must have AID */ 2056 - if (!params.aid) 2057 - err = -EINVAL; 2058 - break; 2059 - case NL80211_IFTYPE_MESH_POINT: 2060 - /* disallow things mesh doesn't support */ 2061 - if (params.vlan) 2062 - err = -EINVAL; 2063 - if (params.aid) 2064 - err = -EINVAL; 2065 - if (params.ht_capa) 2066 - err = -EINVAL; 2067 - if (params.listen_interval >= 0) 2068 - err = -EINVAL; 2069 - if (params.supported_rates) 2070 - err = -EINVAL; 2071 - if (params.sta_flags_mask) 2072 - err = -EINVAL; 2073 - break; 2074 - default: 2075 - err = -EINVAL; 2076 - } 2077 - 2078 - if (err) 2079 - goto out; 2080 2051 2081 2052 if (!rdev->ops->add_station) { 2082 2053 err = -EOPNOTSUPP; ··· 2095 2112 goto out_rtnl; 2096 2113 2097 2114 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && 2098 - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN && 2099 - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) { 2115 + dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN) { 2100 2116 err = -EINVAL; 2101 2117 goto out; 2102 2118 } ··· 4527 4545 return err; 4528 4546 } 4529 4547 4548 + static int nl80211_register_action(struct sk_buff *skb, struct genl_info *info) 4549 + { 4550 + struct cfg80211_registered_device *rdev; 4551 + struct net_device *dev; 4552 + int err; 4553 + 4554 + if (!info->attrs[NL80211_ATTR_FRAME_MATCH]) 4555 + return -EINVAL; 4556 + 4557 + if (nla_len(info->attrs[NL80211_ATTR_FRAME_MATCH]) < 1) 4558 + return -EINVAL; 4559 + 4560 + rtnl_lock(); 4561 + 4562 + err = get_rdev_dev_by_info_ifindex(info, &rdev, &dev); 4563 + if (err) 4564 + goto unlock_rtnl; 4565 + 4566 + if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION) { 4567 + err = -EOPNOTSUPP; 4568 + goto out; 4569 + } 4570 + 4571 + /* not much point in registering if we can't reply */ 4572 + if (!rdev->ops->action) { 4573 + err = -EOPNOTSUPP; 4574 + goto out; 4575 + } 4576 + 4577 + err = cfg80211_mlme_register_action(dev->ieee80211_ptr, info->snd_pid, 4578 + nla_data(info->attrs[NL80211_ATTR_FRAME_MATCH]), 4579 + nla_len(info->attrs[NL80211_ATTR_FRAME_MATCH])); 4580 + out: 4581 + cfg80211_unlock_rdev(rdev); 4582 + dev_put(dev); 4583 + unlock_rtnl: 4584 + rtnl_unlock(); 4585 + return err; 4586 + } 4587 + 4588 + static int nl80211_action(struct sk_buff *skb, struct genl_info *info) 4589 + { 4590 + struct cfg80211_registered_device *rdev; 4591 + struct net_device *dev; 4592 + struct ieee80211_channel *chan; 4593 + enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; 4594 + u32 freq; 4595 + int err; 4596 + void *hdr; 4597 + u64 cookie; 4598 + struct sk_buff *msg; 4599 + 4600 + if (!info->attrs[NL80211_ATTR_FRAME] || 4601 + !info->attrs[NL80211_ATTR_WIPHY_FREQ]) 4602 + return -EINVAL; 4603 + 4604 + rtnl_lock(); 4605 + 4606 + err = get_rdev_dev_by_info_ifindex(info, &rdev, &dev); 4607 + if (err) 4608 + goto unlock_rtnl; 4609 + 4610 + if (!rdev->ops->action) { 4611 + err = -EOPNOTSUPP; 4612 + goto out; 4613 + } 4614 + 4615 + if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION) { 4616 + err = -EOPNOTSUPP; 4617 + goto out; 4618 + } 4619 + 4620 + if (!netif_running(dev)) { 4621 + err = -ENETDOWN; 4622 + goto out; 4623 + } 4624 + 4625 + if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) { 4626 + channel_type = nla_get_u32( 4627 + info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]); 4628 + if (channel_type != NL80211_CHAN_NO_HT && 4629 + channel_type != NL80211_CHAN_HT20 && 4630 + channel_type != NL80211_CHAN_HT40PLUS && 4631 + channel_type != NL80211_CHAN_HT40MINUS) 4632 + err = -EINVAL; 4633 + goto out; 4634 + } 4635 + 4636 + freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); 4637 + chan = rdev_freq_to_chan(rdev, freq, channel_type); 4638 + if (chan == NULL) { 4639 + err = -EINVAL; 4640 + goto out; 4641 + } 4642 + 4643 + msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); 4644 + if (!msg) { 4645 + err = -ENOMEM; 4646 + goto out; 4647 + } 4648 + 4649 + hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, 4650 + NL80211_CMD_ACTION); 4651 + 4652 + if (IS_ERR(hdr)) { 4653 + err = PTR_ERR(hdr); 4654 + goto free_msg; 4655 + } 4656 + err = cfg80211_mlme_action(rdev, dev, chan, channel_type, 4657 + nla_data(info->attrs[NL80211_ATTR_FRAME]), 4658 + nla_len(info->attrs[NL80211_ATTR_FRAME]), 4659 + &cookie); 4660 + if (err) 4661 + goto free_msg; 4662 + 4663 + NLA_PUT_U64(msg, NL80211_ATTR_COOKIE, cookie); 4664 + 4665 + genlmsg_end(msg, hdr); 4666 + err = genlmsg_reply(msg, info); 4667 + goto out; 4668 + 4669 + nla_put_failure: 4670 + err = -ENOBUFS; 4671 + free_msg: 4672 + nlmsg_free(msg); 4673 + out: 4674 + cfg80211_unlock_rdev(rdev); 4675 + dev_put(dev); 4676 + unlock_rtnl: 4677 + rtnl_unlock(); 4678 + return err; 4679 + } 4680 + 4681 + static int nl80211_set_power_save(struct sk_buff *skb, struct genl_info *info) 4682 + { 4683 + struct cfg80211_registered_device *rdev; 4684 + struct wireless_dev *wdev; 4685 + struct net_device *dev; 4686 + u8 ps_state; 4687 + bool state; 4688 + int err; 4689 + 4690 + if (!info->attrs[NL80211_ATTR_PS_STATE]) { 4691 + err = -EINVAL; 4692 + goto out; 4693 + } 4694 + 4695 + ps_state = nla_get_u32(info->attrs[NL80211_ATTR_PS_STATE]); 4696 + 4697 + if (ps_state != NL80211_PS_DISABLED && ps_state != NL80211_PS_ENABLED) { 4698 + err = -EINVAL; 4699 + goto out; 4700 + } 4701 + 4702 + rtnl_lock(); 4703 + 4704 + err = get_rdev_dev_by_info_ifindex(info, &rdev, &dev); 4705 + if (err) 4706 + goto unlock_rdev; 4707 + 4708 + wdev = dev->ieee80211_ptr; 4709 + 4710 + if (!rdev->ops->set_power_mgmt) { 4711 + err = -EOPNOTSUPP; 4712 + goto unlock_rdev; 4713 + } 4714 + 4715 + state = (ps_state == NL80211_PS_ENABLED) ? true : false; 4716 + 4717 + if (state == wdev->ps) 4718 + goto unlock_rdev; 4719 + 4720 + wdev->ps = state; 4721 + 4722 + if (rdev->ops->set_power_mgmt(wdev->wiphy, dev, wdev->ps, 4723 + wdev->ps_timeout)) 4724 + /* assume this means it's off */ 4725 + wdev->ps = false; 4726 + 4727 + unlock_rdev: 4728 + cfg80211_unlock_rdev(rdev); 4729 + dev_put(dev); 4730 + rtnl_unlock(); 4731 + 4732 + out: 4733 + return err; 4734 + } 4735 + 4736 + static int nl80211_get_power_save(struct sk_buff *skb, struct genl_info *info) 4737 + { 4738 + struct cfg80211_registered_device *rdev; 4739 + enum nl80211_ps_state ps_state; 4740 + struct wireless_dev *wdev; 4741 + struct net_device *dev; 4742 + struct sk_buff *msg; 4743 + void *hdr; 4744 + int err; 4745 + 4746 + rtnl_lock(); 4747 + 4748 + err = get_rdev_dev_by_info_ifindex(info, &rdev, &dev); 4749 + if (err) 4750 + goto unlock_rtnl; 4751 + 4752 + wdev = dev->ieee80211_ptr; 4753 + 4754 + if (!rdev->ops->set_power_mgmt) { 4755 + err = -EOPNOTSUPP; 4756 + goto out; 4757 + } 4758 + 4759 + msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); 4760 + if (!msg) { 4761 + err = -ENOMEM; 4762 + goto out; 4763 + } 4764 + 4765 + hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, 4766 + NL80211_CMD_GET_POWER_SAVE); 4767 + if (!hdr) { 4768 + err = -ENOMEM; 4769 + goto free_msg; 4770 + } 4771 + 4772 + if (wdev->ps) 4773 + ps_state = NL80211_PS_ENABLED; 4774 + else 4775 + ps_state = NL80211_PS_DISABLED; 4776 + 4777 + NLA_PUT_U32(msg, NL80211_ATTR_PS_STATE, ps_state); 4778 + 4779 + genlmsg_end(msg, hdr); 4780 + err = genlmsg_reply(msg, info); 4781 + goto out; 4782 + 4783 + nla_put_failure: 4784 + err = -ENOBUFS; 4785 + 4786 + free_msg: 4787 + nlmsg_free(msg); 4788 + 4789 + out: 4790 + cfg80211_unlock_rdev(rdev); 4791 + dev_put(dev); 4792 + 4793 + unlock_rtnl: 4794 + rtnl_unlock(); 4795 + 4796 + return err; 4797 + } 4798 + 4530 4799 static struct genl_ops nl80211_ops[] = { 4531 4800 { 4532 4801 .cmd = NL80211_CMD_GET_WIPHY, ··· 5057 4824 .doit = nl80211_set_tx_bitrate_mask, 5058 4825 .policy = nl80211_policy, 5059 4826 .flags = GENL_ADMIN_PERM, 4827 + }, 4828 + { 4829 + .cmd = NL80211_CMD_REGISTER_ACTION, 4830 + .doit = nl80211_register_action, 4831 + .policy = nl80211_policy, 4832 + .flags = GENL_ADMIN_PERM, 4833 + }, 4834 + { 4835 + .cmd = NL80211_CMD_ACTION, 4836 + .doit = nl80211_action, 4837 + .policy = nl80211_policy, 4838 + .flags = GENL_ADMIN_PERM, 4839 + }, 4840 + { 4841 + .cmd = NL80211_CMD_SET_POWER_SAVE, 4842 + .doit = nl80211_set_power_save, 4843 + .policy = nl80211_policy, 4844 + .flags = GENL_ADMIN_PERM, 4845 + }, 4846 + { 4847 + .cmd = NL80211_CMD_GET_POWER_SAVE, 4848 + .doit = nl80211_get_power_save, 4849 + .policy = nl80211_policy, 4850 + /* can be retrieved by unprivileged users */ 5060 4851 }, 5061 4852 }; 5062 4853 ··· 5754 5497 nl80211_mlme_mcgrp.id, gfp); 5755 5498 } 5756 5499 5500 + int nl80211_send_action(struct cfg80211_registered_device *rdev, 5501 + struct net_device *netdev, u32 nlpid, 5502 + int freq, const u8 *buf, size_t len, gfp_t gfp) 5503 + { 5504 + struct sk_buff *msg; 5505 + void *hdr; 5506 + int err; 5507 + 5508 + msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); 5509 + if (!msg) 5510 + return -ENOMEM; 5511 + 5512 + hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_ACTION); 5513 + if (!hdr) { 5514 + nlmsg_free(msg); 5515 + return -ENOMEM; 5516 + } 5517 + 5518 + NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); 5519 + NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); 5520 + NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq); 5521 + NLA_PUT(msg, NL80211_ATTR_FRAME, len, buf); 5522 + 5523 + err = genlmsg_end(msg, hdr); 5524 + if (err < 0) { 5525 + nlmsg_free(msg); 5526 + return err; 5527 + } 5528 + 5529 + err = genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlpid); 5530 + if (err < 0) 5531 + return err; 5532 + return 0; 5533 + 5534 + nla_put_failure: 5535 + genlmsg_cancel(msg, hdr); 5536 + nlmsg_free(msg); 5537 + return -ENOBUFS; 5538 + } 5539 + 5540 + void nl80211_send_action_tx_status(struct cfg80211_registered_device *rdev, 5541 + struct net_device *netdev, u64 cookie, 5542 + const u8 *buf, size_t len, bool ack, 5543 + gfp_t gfp) 5544 + { 5545 + struct sk_buff *msg; 5546 + void *hdr; 5547 + 5548 + msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); 5549 + if (!msg) 5550 + return; 5551 + 5552 + hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_ACTION_TX_STATUS); 5553 + if (!hdr) { 5554 + nlmsg_free(msg); 5555 + return; 5556 + } 5557 + 5558 + NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); 5559 + NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); 5560 + NLA_PUT(msg, NL80211_ATTR_FRAME, len, buf); 5561 + NLA_PUT_U64(msg, NL80211_ATTR_COOKIE, cookie); 5562 + if (ack) 5563 + NLA_PUT_FLAG(msg, NL80211_ATTR_ACK); 5564 + 5565 + if (genlmsg_end(msg, hdr) < 0) { 5566 + nlmsg_free(msg); 5567 + return; 5568 + } 5569 + 5570 + genlmsg_multicast(msg, 0, nl80211_mlme_mcgrp.id, gfp); 5571 + return; 5572 + 5573 + nla_put_failure: 5574 + genlmsg_cancel(msg, hdr); 5575 + nlmsg_free(msg); 5576 + } 5577 + 5578 + static int nl80211_netlink_notify(struct notifier_block * nb, 5579 + unsigned long state, 5580 + void *_notify) 5581 + { 5582 + struct netlink_notify *notify = _notify; 5583 + struct cfg80211_registered_device *rdev; 5584 + struct wireless_dev *wdev; 5585 + 5586 + if (state != NETLINK_URELEASE) 5587 + return NOTIFY_DONE; 5588 + 5589 + rcu_read_lock(); 5590 + 5591 + list_for_each_entry_rcu(rdev, &cfg80211_rdev_list, list) 5592 + list_for_each_entry_rcu(wdev, &rdev->netdev_list, list) 5593 + cfg80211_mlme_unregister_actions(wdev, notify->pid); 5594 + 5595 + rcu_read_unlock(); 5596 + 5597 + return NOTIFY_DONE; 5598 + } 5599 + 5600 + static struct notifier_block nl80211_netlink_notifier = { 5601 + .notifier_call = nl80211_netlink_notify, 5602 + }; 5603 + 5757 5604 /* initialisation/exit functions */ 5758 5605 5759 5606 int nl80211_init(void) ··· 5891 5530 goto err_out; 5892 5531 #endif 5893 5532 5533 + err = netlink_register_notifier(&nl80211_netlink_notifier); 5534 + if (err) 5535 + goto err_out; 5536 + 5894 5537 return 0; 5895 5538 err_out: 5896 5539 genl_unregister_family(&nl80211_fam); ··· 5903 5538 5904 5539 void nl80211_exit(void) 5905 5540 { 5541 + netlink_unregister_notifier(&nl80211_netlink_notifier); 5906 5542 genl_unregister_family(&nl80211_fam); 5907 5543 }
+8
net/wireless/nl80211.h
··· 74 74 struct net_device *dev, const u8 *mac_addr, 75 75 struct station_info *sinfo, gfp_t gfp); 76 76 77 + int nl80211_send_action(struct cfg80211_registered_device *rdev, 78 + struct net_device *netdev, u32 nlpid, int freq, 79 + const u8 *buf, size_t len, gfp_t gfp); 80 + void nl80211_send_action_tx_status(struct cfg80211_registered_device *rdev, 81 + struct net_device *netdev, u64 cookie, 82 + const u8 *buf, size_t len, bool ack, 83 + gfp_t gfp); 84 + 77 85 #endif /* __NET_WIRELESS_NL80211_H */
+5 -5
net/wireless/wext-compat.c
··· 1099 1099 { 1100 1100 struct wireless_dev *wdev = dev->ieee80211_ptr; 1101 1101 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); 1102 - bool ps = wdev->wext.ps; 1103 - int timeout = wdev->wext.ps_timeout; 1102 + bool ps = wdev->ps; 1103 + int timeout = wdev->ps_timeout; 1104 1104 int err; 1105 1105 1106 1106 if (wdev->iftype != NL80211_IFTYPE_STATION) ··· 1133 1133 if (err) 1134 1134 return err; 1135 1135 1136 - wdev->wext.ps = ps; 1137 - wdev->wext.ps_timeout = timeout; 1136 + wdev->ps = ps; 1137 + wdev->ps_timeout = timeout; 1138 1138 1139 1139 return 0; 1140 1140 ··· 1147 1147 { 1148 1148 struct wireless_dev *wdev = dev->ieee80211_ptr; 1149 1149 1150 - wrq->disabled = !wdev->wext.ps; 1150 + wrq->disabled = !wdev->ps; 1151 1151 1152 1152 return 0; 1153 1153 }