diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 88 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945.c | 35 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945.h | 13 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965-rs.c | 82 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 43 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.h | 16 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 445 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 438 |
8 files changed, 371 insertions, 789 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index 80d31ae51e77..f018ce464d97 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |||
@@ -100,14 +100,6 @@ static struct iwl3945_tpt_entry iwl3945_tpt_table_a[] = { | |||
100 | {-89, IWL_RATE_6M_INDEX} | 100 | {-89, IWL_RATE_6M_INDEX} |
101 | }; | 101 | }; |
102 | 102 | ||
103 | static struct iwl3945_tpt_entry iwl3945_tpt_table_b[] = { | ||
104 | {-86, IWL_RATE_11M_INDEX}, | ||
105 | {-88, IWL_RATE_5M_INDEX}, | ||
106 | {-90, IWL_RATE_2M_INDEX}, | ||
107 | {-92, IWL_RATE_1M_INDEX} | ||
108 | |||
109 | }; | ||
110 | |||
111 | static struct iwl3945_tpt_entry iwl3945_tpt_table_g[] = { | 103 | static struct iwl3945_tpt_entry iwl3945_tpt_table_g[] = { |
112 | {-60, IWL_RATE_54M_INDEX}, | 104 | {-60, IWL_RATE_54M_INDEX}, |
113 | {-64, IWL_RATE_48M_INDEX}, | 105 | {-64, IWL_RATE_48M_INDEX}, |
@@ -129,7 +121,7 @@ static struct iwl3945_tpt_entry iwl3945_tpt_table_g[] = { | |||
129 | #define IWL_RATE_MIN_SUCCESS_TH 8 | 121 | #define IWL_RATE_MIN_SUCCESS_TH 8 |
130 | #define IWL_RATE_DECREASE_TH 1920 | 122 | #define IWL_RATE_DECREASE_TH 1920 |
131 | 123 | ||
132 | static u8 iwl3945_get_rate_index_by_rssi(s32 rssi, u8 mode) | 124 | static u8 iwl3945_get_rate_index_by_rssi(s32 rssi, enum ieee80211_band band) |
133 | { | 125 | { |
134 | u32 index = 0; | 126 | u32 index = 0; |
135 | u32 table_size = 0; | 127 | u32 table_size = 0; |
@@ -138,21 +130,19 @@ static u8 iwl3945_get_rate_index_by_rssi(s32 rssi, u8 mode) | |||
138 | if ((rssi < IWL_MIN_RSSI_VAL) || (rssi > IWL_MAX_RSSI_VAL)) | 130 | if ((rssi < IWL_MIN_RSSI_VAL) || (rssi > IWL_MAX_RSSI_VAL)) |
139 | rssi = IWL_MIN_RSSI_VAL; | 131 | rssi = IWL_MIN_RSSI_VAL; |
140 | 132 | ||
141 | switch (mode) { | 133 | switch (band) { |
142 | case MODE_IEEE80211G: | 134 | case IEEE80211_BAND_2GHZ: |
143 | tpt_table = iwl3945_tpt_table_g; | 135 | tpt_table = iwl3945_tpt_table_g; |
144 | table_size = ARRAY_SIZE(iwl3945_tpt_table_g); | 136 | table_size = ARRAY_SIZE(iwl3945_tpt_table_g); |
145 | break; | 137 | break; |
146 | 138 | ||
147 | case MODE_IEEE80211A: | 139 | case IEEE80211_BAND_5GHZ: |
148 | tpt_table = iwl3945_tpt_table_a; | 140 | tpt_table = iwl3945_tpt_table_a; |
149 | table_size = ARRAY_SIZE(iwl3945_tpt_table_a); | 141 | table_size = ARRAY_SIZE(iwl3945_tpt_table_a); |
150 | break; | 142 | break; |
151 | 143 | ||
152 | default: | 144 | default: |
153 | case MODE_IEEE80211B: | 145 | BUG(); |
154 | tpt_table = iwl3945_tpt_table_b; | ||
155 | table_size = ARRAY_SIZE(iwl3945_tpt_table_b); | ||
156 | break; | 146 | break; |
157 | } | 147 | } |
158 | 148 | ||
@@ -340,17 +330,17 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, | |||
340 | * after assoc.. */ | 330 | * after assoc.. */ |
341 | 331 | ||
342 | for (i = IWL_RATE_COUNT - 1; i >= 0; i--) { | 332 | for (i = IWL_RATE_COUNT - 1; i >= 0; i--) { |
343 | if (sta->supp_rates & (1 << i)) { | 333 | if (sta->supp_rates[local->hw.conf.channel->band] & (1 << i)) { |
344 | sta->txrate = i; | 334 | sta->txrate_idx = i; |
345 | break; | 335 | break; |
346 | } | 336 | } |
347 | } | 337 | } |
348 | 338 | ||
349 | sta->last_txrate = sta->txrate; | 339 | sta->last_txrate_idx = sta->txrate_idx; |
350 | 340 | ||
351 | /* For MODE_IEEE80211A mode it start at IWL_FIRST_OFDM_RATE */ | 341 | /* For 5 GHz band it start at IWL_FIRST_OFDM_RATE */ |
352 | if (local->hw.conf.phymode == MODE_IEEE80211A) | 342 | if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) |
353 | sta->last_txrate += IWL_FIRST_OFDM_RATE; | 343 | sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; |
354 | 344 | ||
355 | IWL_DEBUG_RATE("leave\n"); | 345 | IWL_DEBUG_RATE("leave\n"); |
356 | } | 346 | } |
@@ -429,17 +419,19 @@ static int rs_adjust_next_rate(struct iwl3945_priv *priv, int rate) | |||
429 | { | 419 | { |
430 | int next_rate = iwl3945_get_prev_ieee_rate(rate); | 420 | int next_rate = iwl3945_get_prev_ieee_rate(rate); |
431 | 421 | ||
432 | switch (priv->phymode) { | 422 | switch (priv->band) { |
433 | case MODE_IEEE80211A: | 423 | case IEEE80211_BAND_5GHZ: |
434 | if (rate == IWL_RATE_12M_INDEX) | 424 | if (rate == IWL_RATE_12M_INDEX) |
435 | next_rate = IWL_RATE_9M_INDEX; | 425 | next_rate = IWL_RATE_9M_INDEX; |
436 | else if (rate == IWL_RATE_6M_INDEX) | 426 | else if (rate == IWL_RATE_6M_INDEX) |
437 | next_rate = IWL_RATE_6M_INDEX; | 427 | next_rate = IWL_RATE_6M_INDEX; |
438 | break; | 428 | break; |
429 | /* XXX cannot be invoked in current mac80211 so not a regression | ||
439 | case MODE_IEEE80211B: | 430 | case MODE_IEEE80211B: |
440 | if (rate == IWL_RATE_11M_INDEX_TABLE) | 431 | if (rate == IWL_RATE_11M_INDEX_TABLE) |
441 | next_rate = IWL_RATE_5M_INDEX_TABLE; | 432 | next_rate = IWL_RATE_5M_INDEX_TABLE; |
442 | break; | 433 | break; |
434 | */ | ||
443 | default: | 435 | default: |
444 | break; | 436 | break; |
445 | } | 437 | } |
@@ -465,15 +457,17 @@ static void rs_tx_status(void *priv_rate, | |||
465 | struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate; | 457 | struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate; |
466 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 458 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
467 | struct iwl3945_rs_sta *rs_sta; | 459 | struct iwl3945_rs_sta *rs_sta; |
460 | struct ieee80211_supported_band *sband; | ||
461 | |||
462 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
468 | 463 | ||
469 | IWL_DEBUG_RATE("enter\n"); | 464 | IWL_DEBUG_RATE("enter\n"); |
470 | 465 | ||
471 | retries = tx_resp->retry_count; | 466 | retries = tx_resp->retry_count; |
472 | 467 | ||
473 | first_index = tx_resp->control.tx_rate; | 468 | first_index = &sband->bitrates[0] - tx_resp->control.tx_rate; |
474 | if ((first_index < 0) || (first_index >= IWL_RATE_COUNT)) { | 469 | if ((first_index < 0) || (first_index >= IWL_RATE_COUNT)) { |
475 | IWL_DEBUG_RATE("leave: Rate out of bounds: %0x for %d\n", | 470 | IWL_DEBUG_RATE("leave: Rate out of bounds: %d\n", first_index); |
476 | tx_resp->control.tx_rate, first_index); | ||
477 | return; | 471 | return; |
478 | } | 472 | } |
479 | 473 | ||
@@ -561,14 +555,14 @@ static void rs_tx_status(void *priv_rate, | |||
561 | } | 555 | } |
562 | 556 | ||
563 | static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta, | 557 | static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta, |
564 | u8 index, u16 rate_mask, int phymode) | 558 | u8 index, u16 rate_mask, enum ieee80211_band band) |
565 | { | 559 | { |
566 | u8 high = IWL_RATE_INVALID; | 560 | u8 high = IWL_RATE_INVALID; |
567 | u8 low = IWL_RATE_INVALID; | 561 | u8 low = IWL_RATE_INVALID; |
568 | 562 | ||
569 | /* 802.11A walks to the next literal adjacent rate in | 563 | /* 802.11A walks to the next literal adjacent rate in |
570 | * the rate table */ | 564 | * the rate table */ |
571 | if (unlikely(phymode == MODE_IEEE80211A)) { | 565 | if (unlikely(band == IEEE80211_BAND_5GHZ)) { |
572 | int i; | 566 | int i; |
573 | u32 mask; | 567 | u32 mask; |
574 | 568 | ||
@@ -639,7 +633,8 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta, | |||
639 | * | 633 | * |
640 | */ | 634 | */ |
641 | static void rs_get_rate(void *priv_rate, struct net_device *dev, | 635 | static void rs_get_rate(void *priv_rate, struct net_device *dev, |
642 | struct ieee80211_hw_mode *mode, struct sk_buff *skb, | 636 | struct ieee80211_supported_band *band, |
637 | struct sk_buff *skb, | ||
643 | struct rate_selection *sel) | 638 | struct rate_selection *sel) |
644 | { | 639 | { |
645 | u8 low = IWL_RATE_INVALID; | 640 | u8 low = IWL_RATE_INVALID; |
@@ -672,16 +667,16 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, | |||
672 | is_multicast_ether_addr(hdr->addr1) || | 667 | is_multicast_ether_addr(hdr->addr1) || |
673 | !sta || !sta->rate_ctrl_priv) { | 668 | !sta || !sta->rate_ctrl_priv) { |
674 | IWL_DEBUG_RATE("leave: No STA priv data to update!\n"); | 669 | IWL_DEBUG_RATE("leave: No STA priv data to update!\n"); |
675 | sel->rate = rate_lowest(local, local->oper_hw_mode, sta); | 670 | sel->rate = rate_lowest(local, band, sta); |
676 | if (sta) | 671 | if (sta) |
677 | sta_info_put(sta); | 672 | sta_info_put(sta); |
678 | return; | 673 | return; |
679 | } | 674 | } |
680 | 675 | ||
681 | rate_mask = sta->supp_rates; | 676 | rate_mask = sta->supp_rates[band->band]; |
682 | index = min(sta->last_txrate & 0xffff, IWL_RATE_COUNT - 1); | 677 | index = min(sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT - 1); |
683 | 678 | ||
684 | if (priv->phymode == (u8) MODE_IEEE80211A) | 679 | if (priv->band == IEEE80211_BAND_5GHZ) |
685 | rate_mask = rate_mask << IWL_FIRST_OFDM_RATE; | 680 | rate_mask = rate_mask << IWL_FIRST_OFDM_RATE; |
686 | 681 | ||
687 | rs_sta = (void *)sta->rate_ctrl_priv; | 682 | rs_sta = (void *)sta->rate_ctrl_priv; |
@@ -732,7 +727,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, | |||
732 | current_tpt = window->average_tpt; | 727 | current_tpt = window->average_tpt; |
733 | 728 | ||
734 | high_low = iwl3945_get_adjacent_rate(rs_sta, index, rate_mask, | 729 | high_low = iwl3945_get_adjacent_rate(rs_sta, index, rate_mask, |
735 | local->hw.conf.phymode); | 730 | band->band); |
736 | low = high_low & 0xff; | 731 | low = high_low & 0xff; |
737 | high = (high_low >> 8) & 0xff; | 732 | high = (high_low >> 8) & 0xff; |
738 | 733 | ||
@@ -810,11 +805,11 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, | |||
810 | 805 | ||
811 | out: | 806 | out: |
812 | 807 | ||
813 | sta->last_txrate = index; | 808 | sta->last_txrate_idx = index; |
814 | if (priv->phymode == (u8) MODE_IEEE80211A) | 809 | if (priv->band == IEEE80211_BAND_5GHZ) |
815 | sta->txrate = sta->last_txrate - IWL_FIRST_OFDM_RATE; | 810 | sta->txrate_idx = sta->last_txrate_idx - IWL_FIRST_OFDM_RATE; |
816 | else | 811 | else |
817 | sta->txrate = sta->last_txrate; | 812 | sta->txrate_idx = sta->last_txrate_idx; |
818 | 813 | ||
819 | sta_info_put(sta); | 814 | sta_info_put(sta); |
820 | 815 | ||
@@ -945,8 +940,9 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) | |||
945 | spin_lock_irqsave(&rs_sta->lock, flags); | 940 | spin_lock_irqsave(&rs_sta->lock, flags); |
946 | 941 | ||
947 | rs_sta->tgg = 0; | 942 | rs_sta->tgg = 0; |
948 | switch (priv->phymode) { | 943 | switch (priv->band) { |
949 | case MODE_IEEE80211G: | 944 | case IEEE80211_BAND_2GHZ: |
945 | /* TODO: this always does G, not a regression */ | ||
950 | if (priv->active_rxon.flags & RXON_FLG_TGG_PROTECT_MSK) { | 946 | if (priv->active_rxon.flags & RXON_FLG_TGG_PROTECT_MSK) { |
951 | rs_sta->tgg = 1; | 947 | rs_sta->tgg = 1; |
952 | rs_sta->expected_tpt = iwl3945_expected_tpt_g_prot; | 948 | rs_sta->expected_tpt = iwl3945_expected_tpt_g_prot; |
@@ -954,14 +950,11 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) | |||
954 | rs_sta->expected_tpt = iwl3945_expected_tpt_g; | 950 | rs_sta->expected_tpt = iwl3945_expected_tpt_g; |
955 | break; | 951 | break; |
956 | 952 | ||
957 | case MODE_IEEE80211A: | 953 | case IEEE80211_BAND_5GHZ: |
958 | rs_sta->expected_tpt = iwl3945_expected_tpt_a; | 954 | rs_sta->expected_tpt = iwl3945_expected_tpt_a; |
959 | break; | 955 | break; |
960 | 956 | case IEEE80211_NUM_BANDS: | |
961 | default: | 957 | BUG(); |
962 | IWL_WARNING("Invalid phymode. Defaulting to 802.11b\n"); | ||
963 | case MODE_IEEE80211B: | ||
964 | rs_sta->expected_tpt = iwl3945_expected_tpt_b; | ||
965 | break; | 958 | break; |
966 | } | 959 | } |
967 | 960 | ||
@@ -974,8 +967,7 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) | |||
974 | 967 | ||
975 | IWL_DEBUG(IWL_DL_INFO | IWL_DL_RATE, "Network RSSI: %d\n", rssi); | 968 | IWL_DEBUG(IWL_DL_INFO | IWL_DL_RATE, "Network RSSI: %d\n", rssi); |
976 | 969 | ||
977 | rs_sta->start_rate = | 970 | rs_sta->start_rate = iwl3945_get_rate_index_by_rssi(rssi, priv->band); |
978 | iwl3945_get_rate_index_by_rssi(rssi, priv->phymode); | ||
979 | 971 | ||
980 | IWL_DEBUG_RATE("leave: rssi %d assign rate index: " | 972 | IWL_DEBUG_RATE("leave: rssi %d assign rate index: " |
981 | "%d (plcp 0x%x)\n", rssi, rs_sta->start_rate, | 973 | "%d (plcp 0x%x)\n", rssi, rs_sta->start_rate, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 8d4d91d35fd2..50d927bb2170 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -247,7 +247,7 @@ static void iwl3945_add_radiotap(struct iwl3945_priv *priv, | |||
247 | * the information provided in the skb from the hardware */ | 247 | * the information provided in the skb from the hardware */ |
248 | s8 signal = stats->ssi; | 248 | s8 signal = stats->ssi; |
249 | s8 noise = 0; | 249 | s8 noise = 0; |
250 | int rate = stats->rate; | 250 | int rate = stats->rate_idx; |
251 | u64 tsf = stats->mactime; | 251 | u64 tsf = stats->mactime; |
252 | __le16 phy_flags_hw = rx_hdr->phy_flags; | 252 | __le16 phy_flags_hw = rx_hdr->phy_flags; |
253 | 253 | ||
@@ -315,7 +315,6 @@ static void iwl3945_add_radiotap(struct iwl3945_priv *priv, | |||
315 | IEEE80211_CHAN_2GHZ), | 315 | IEEE80211_CHAN_2GHZ), |
316 | &iwl3945_rt->rt_chbitmask); | 316 | &iwl3945_rt->rt_chbitmask); |
317 | 317 | ||
318 | rate = iwl3945_rate_index_from_plcp(rate); | ||
319 | if (rate == -1) | 318 | if (rate == -1) |
320 | iwl3945_rt->rt_rate = 0; | 319 | iwl3945_rt->rt_rate = 0; |
321 | else | 320 | else |
@@ -387,11 +386,10 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv, | |||
387 | struct ieee80211_rx_status stats = { | 386 | struct ieee80211_rx_status stats = { |
388 | .mactime = le64_to_cpu(rx_end->timestamp), | 387 | .mactime = le64_to_cpu(rx_end->timestamp), |
389 | .freq = ieee80211chan2mhz(le16_to_cpu(rx_hdr->channel)), | 388 | .freq = ieee80211chan2mhz(le16_to_cpu(rx_hdr->channel)), |
390 | .channel = le16_to_cpu(rx_hdr->channel), | 389 | .band = (rx_hdr->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ? |
391 | .phymode = (rx_hdr->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ? | 390 | IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ, |
392 | MODE_IEEE80211G : MODE_IEEE80211A, | ||
393 | .antenna = 0, | 391 | .antenna = 0, |
394 | .rate = rx_hdr->rate, | 392 | .rate_idx = iwl3945_rate_index_from_plcp(rx_hdr->rate), |
395 | .flag = 0, | 393 | .flag = 0, |
396 | }; | 394 | }; |
397 | u8 network_packet; | 395 | u8 network_packet; |
@@ -450,8 +448,6 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv, | |||
450 | stats.ssi, stats.noise, stats.signal, | 448 | stats.ssi, stats.noise, stats.signal, |
451 | rx_stats_sig_avg, rx_stats_noise_diff); | 449 | rx_stats_sig_avg, rx_stats_noise_diff); |
452 | 450 | ||
453 | stats.freq = ieee80211chan2mhz(stats.channel); | ||
454 | |||
455 | /* can be covered by iwl3945_report_frame() in most cases */ | 451 | /* can be covered by iwl3945_report_frame() in most cases */ |
456 | /* IWL_DEBUG_RX("RX status: 0x%08X\n", rx_end->status); */ | 452 | /* IWL_DEBUG_RX("RX status: 0x%08X\n", rx_end->status); */ |
457 | 453 | ||
@@ -464,8 +460,9 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv, | |||
464 | IWL_DEBUG_STATS | 460 | IWL_DEBUG_STATS |
465 | ("[%c] %d RSSI: %d Signal: %u, Noise: %u, Rate: %u\n", | 461 | ("[%c] %d RSSI: %d Signal: %u, Noise: %u, Rate: %u\n", |
466 | network_packet ? '*' : ' ', | 462 | network_packet ? '*' : ' ', |
467 | stats.channel, stats.ssi, stats.ssi, | 463 | le16_to_cpu(rx_hdr->channel), |
468 | stats.ssi, stats.rate); | 464 | stats.ssi, stats.ssi, |
465 | stats.ssi, stats.rate_idx); | ||
469 | 466 | ||
470 | if (iwl3945_debug_level & (IWL_DL_RX)) | 467 | if (iwl3945_debug_level & (IWL_DL_RX)) |
471 | /* Set "1" to report good data frames in groups of 100 */ | 468 | /* Set "1" to report good data frames in groups of 100 */ |
@@ -689,7 +686,7 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv, | |||
689 | struct ieee80211_hdr *hdr, int sta_id, int tx_id) | 686 | struct ieee80211_hdr *hdr, int sta_id, int tx_id) |
690 | { | 687 | { |
691 | unsigned long flags; | 688 | unsigned long flags; |
692 | u16 rate_index = min(ctrl->tx_rate & 0xffff, IWL_RATE_COUNT - 1); | 689 | u16 rate_index = min(ctrl->tx_rate->hw_value & 0xffff, IWL_RATE_COUNT - 1); |
693 | u16 rate_mask; | 690 | u16 rate_mask; |
694 | int rate; | 691 | int rate; |
695 | u8 rts_retry_limit; | 692 | u8 rts_retry_limit; |
@@ -1552,14 +1549,14 @@ int iwl3945_hw_reg_send_txpower(struct iwl3945_priv *priv) | |||
1552 | .channel = priv->active_rxon.channel, | 1549 | .channel = priv->active_rxon.channel, |
1553 | }; | 1550 | }; |
1554 | 1551 | ||
1555 | txpower.band = (priv->phymode == MODE_IEEE80211A) ? 0 : 1; | 1552 | txpower.band = (priv->band == IEEE80211_BAND_5GHZ) ? 0 : 1; |
1556 | ch_info = iwl3945_get_channel_info(priv, | 1553 | ch_info = iwl3945_get_channel_info(priv, |
1557 | priv->phymode, | 1554 | priv->band, |
1558 | le16_to_cpu(priv->active_rxon.channel)); | 1555 | le16_to_cpu(priv->active_rxon.channel)); |
1559 | if (!ch_info) { | 1556 | if (!ch_info) { |
1560 | IWL_ERROR | 1557 | IWL_ERROR |
1561 | ("Failed to get channel info for channel %d [%d]\n", | 1558 | ("Failed to get channel info for channel %d [%d]\n", |
1562 | le16_to_cpu(priv->active_rxon.channel), priv->phymode); | 1559 | le16_to_cpu(priv->active_rxon.channel), priv->band); |
1563 | return -EINVAL; | 1560 | return -EINVAL; |
1564 | } | 1561 | } |
1565 | 1562 | ||
@@ -2241,8 +2238,8 @@ int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv) | |||
2241 | table[index].next_rate_index = iwl3945_rates[prev_index].table_rs_index; | 2238 | table[index].next_rate_index = iwl3945_rates[prev_index].table_rs_index; |
2242 | } | 2239 | } |
2243 | 2240 | ||
2244 | switch (priv->phymode) { | 2241 | switch (priv->band) { |
2245 | case MODE_IEEE80211A: | 2242 | case IEEE80211_BAND_5GHZ: |
2246 | IWL_DEBUG_RATE("Select A mode rate scale\n"); | 2243 | IWL_DEBUG_RATE("Select A mode rate scale\n"); |
2247 | /* If one of the following CCK rates is used, | 2244 | /* If one of the following CCK rates is used, |
2248 | * have it fall back to the 6M OFDM rate */ | 2245 | * have it fall back to the 6M OFDM rate */ |
@@ -2257,8 +2254,8 @@ int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv) | |||
2257 | iwl3945_rates[IWL_FIRST_OFDM_RATE].table_rs_index; | 2254 | iwl3945_rates[IWL_FIRST_OFDM_RATE].table_rs_index; |
2258 | break; | 2255 | break; |
2259 | 2256 | ||
2260 | case MODE_IEEE80211B: | 2257 | case IEEE80211_BAND_2GHZ: |
2261 | IWL_DEBUG_RATE("Select B mode rate scale\n"); | 2258 | IWL_DEBUG_RATE("Select B/G mode rate scale\n"); |
2262 | /* If an OFDM rate is used, have it fall back to the | 2259 | /* If an OFDM rate is used, have it fall back to the |
2263 | * 1M CCK rates */ | 2260 | * 1M CCK rates */ |
2264 | for (i = IWL_RATE_6M_INDEX_TABLE; i <= IWL_RATE_54M_INDEX_TABLE; i++) | 2261 | for (i = IWL_RATE_6M_INDEX_TABLE; i <= IWL_RATE_54M_INDEX_TABLE; i++) |
@@ -2269,7 +2266,7 @@ int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv) | |||
2269 | break; | 2266 | break; |
2270 | 2267 | ||
2271 | default: | 2268 | default: |
2272 | IWL_DEBUG_RATE("Select G mode rate scale\n"); | 2269 | WARN_ON(1); |
2273 | break; | 2270 | break; |
2274 | } | 2271 | } |
2275 | 2272 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index 1da14f9bbe0f..1beb5b676797 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h | |||
@@ -195,7 +195,7 @@ struct iwl3945_channel_info { | |||
195 | 195 | ||
196 | u8 group_index; /* 0-4, maps channel to group1/2/3/4/5 */ | 196 | u8 group_index; /* 0-4, maps channel to group1/2/3/4/5 */ |
197 | u8 band_index; /* 0-4, maps channel to band1/2/3/4/5 */ | 197 | u8 band_index; /* 0-4, maps channel to band1/2/3/4/5 */ |
198 | u8 phymode; /* MODE_IEEE80211{A,B,G} */ | 198 | enum ieee80211_band band; |
199 | 199 | ||
200 | /* Radio/DSP gain settings for each "normal" data Tx rate. | 200 | /* Radio/DSP gain settings for each "normal" data Tx rate. |
201 | * These include, in addition to RF and DSP gain, a few fields for | 201 | * These include, in addition to RF and DSP gain, a few fields for |
@@ -699,14 +699,14 @@ struct iwl3945_priv { | |||
699 | struct list_head free_frames; | 699 | struct list_head free_frames; |
700 | int frames_count; | 700 | int frames_count; |
701 | 701 | ||
702 | u8 phymode; | 702 | enum ieee80211_band band; |
703 | int alloc_rxb_skb; | 703 | int alloc_rxb_skb; |
704 | bool add_radiotap; | 704 | bool add_radiotap; |
705 | 705 | ||
706 | void (*rx_handlers[REPLY_MAX])(struct iwl3945_priv *priv, | 706 | void (*rx_handlers[REPLY_MAX])(struct iwl3945_priv *priv, |
707 | struct iwl3945_rx_mem_buffer *rxb); | 707 | struct iwl3945_rx_mem_buffer *rxb); |
708 | 708 | ||
709 | const struct ieee80211_hw_mode *modes; | 709 | struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS]; |
710 | 710 | ||
711 | #ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT | 711 | #ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT |
712 | /* spectrum measurement report caching */ | 712 | /* spectrum measurement report caching */ |
@@ -937,13 +937,12 @@ static inline int is_channel_radar(const struct iwl3945_channel_info *ch_info) | |||
937 | 937 | ||
938 | static inline u8 is_channel_a_band(const struct iwl3945_channel_info *ch_info) | 938 | static inline u8 is_channel_a_band(const struct iwl3945_channel_info *ch_info) |
939 | { | 939 | { |
940 | return ch_info->phymode == MODE_IEEE80211A; | 940 | return ch_info->band == IEEE80211_BAND_5GHZ; |
941 | } | 941 | } |
942 | 942 | ||
943 | static inline u8 is_channel_bg_band(const struct iwl3945_channel_info *ch_info) | 943 | static inline u8 is_channel_bg_band(const struct iwl3945_channel_info *ch_info) |
944 | { | 944 | { |
945 | return ((ch_info->phymode == MODE_IEEE80211B) || | 945 | return ch_info->band == IEEE80211_BAND_2GHZ; |
946 | (ch_info->phymode == MODE_IEEE80211G)); | ||
947 | } | 946 | } |
948 | 947 | ||
949 | static inline int is_channel_passive(const struct iwl3945_channel_info *ch) | 948 | static inline int is_channel_passive(const struct iwl3945_channel_info *ch) |
@@ -967,7 +966,7 @@ static inline int iwl3945_rate_index_from_plcp(int plcp) | |||
967 | } | 966 | } |
968 | 967 | ||
969 | extern const struct iwl3945_channel_info *iwl3945_get_channel_info( | 968 | extern const struct iwl3945_channel_info *iwl3945_get_channel_info( |
970 | const struct iwl3945_priv *priv, int phymode, u16 channel); | 969 | const struct iwl3945_priv *priv, enum ieee80211_band band, u16 channel); |
971 | 970 | ||
972 | /* Requires full declaration of iwl3945_priv before including */ | 971 | /* Requires full declaration of iwl3945_priv before including */ |
973 | #include "iwl-3945-io.h" | 972 | #include "iwl-3945-io.h" |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c index 660671f17a3b..48a6a85355ec 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c | |||
@@ -139,7 +139,7 @@ struct iwl4965_lq_sta { | |||
139 | u8 valid_antenna; | 139 | u8 valid_antenna; |
140 | u8 is_green; | 140 | u8 is_green; |
141 | u8 is_dup; | 141 | u8 is_dup; |
142 | u8 phymode; | 142 | enum ieee80211_band band; |
143 | u8 ibss_sta_added; | 143 | u8 ibss_sta_added; |
144 | 144 | ||
145 | /* The following are bitmaps of rates; IWL_RATE_6M_MASK, etc. */ | 145 | /* The following are bitmaps of rates; IWL_RATE_6M_MASK, etc. */ |
@@ -563,7 +563,8 @@ static void rs_mcs_from_tbl(struct iwl4965_rate *mcs_rate, | |||
563 | * fill "search" or "active" tx mode table. | 563 | * fill "search" or "active" tx mode table. |
564 | */ | 564 | */ |
565 | static int rs_get_tbl_info_from_mcs(const struct iwl4965_rate *mcs_rate, | 565 | static int rs_get_tbl_info_from_mcs(const struct iwl4965_rate *mcs_rate, |
566 | int phymode, struct iwl4965_scale_tbl_info *tbl, | 566 | enum ieee80211_band band, |
567 | struct iwl4965_scale_tbl_info *tbl, | ||
567 | int *rate_idx) | 568 | int *rate_idx) |
568 | { | 569 | { |
569 | int index; | 570 | int index; |
@@ -588,7 +589,7 @@ static int rs_get_tbl_info_from_mcs(const struct iwl4965_rate *mcs_rate, | |||
588 | tbl->lq_type = LQ_NONE; | 589 | tbl->lq_type = LQ_NONE; |
589 | else { | 590 | else { |
590 | 591 | ||
591 | if (phymode == MODE_IEEE80211A) | 592 | if (band == IEEE80211_BAND_5GHZ) |
592 | tbl->lq_type = LQ_A; | 593 | tbl->lq_type = LQ_A; |
593 | else | 594 | else |
594 | tbl->lq_type = LQ_G; | 595 | tbl->lq_type = LQ_G; |
@@ -766,7 +767,7 @@ static void rs_get_lower_rate(struct iwl4965_lq_sta *lq_sta, | |||
766 | if (!is_legacy(tbl->lq_type) && (!ht_possible || !scale_index)) { | 767 | if (!is_legacy(tbl->lq_type) && (!ht_possible || !scale_index)) { |
767 | switch_to_legacy = 1; | 768 | switch_to_legacy = 1; |
768 | scale_index = rs_ht_to_legacy[scale_index]; | 769 | scale_index = rs_ht_to_legacy[scale_index]; |
769 | if (lq_sta->phymode == MODE_IEEE80211A) | 770 | if (lq_sta->band == IEEE80211_BAND_5GHZ) |
770 | tbl->lq_type = LQ_A; | 771 | tbl->lq_type = LQ_A; |
771 | else | 772 | else |
772 | tbl->lq_type = LQ_G; | 773 | tbl->lq_type = LQ_G; |
@@ -784,7 +785,7 @@ static void rs_get_lower_rate(struct iwl4965_lq_sta *lq_sta, | |||
784 | /* Mask with station rate restriction */ | 785 | /* Mask with station rate restriction */ |
785 | if (is_legacy(tbl->lq_type)) { | 786 | if (is_legacy(tbl->lq_type)) { |
786 | /* supp_rates has no CCK bits in A mode */ | 787 | /* supp_rates has no CCK bits in A mode */ |
787 | if (lq_sta->phymode == (u8) MODE_IEEE80211A) | 788 | if (lq_sta->band == IEEE80211_BAND_5GHZ) |
788 | rate_mask = (u16)(rate_mask & | 789 | rate_mask = (u16)(rate_mask & |
789 | (lq_sta->supp_rates << IWL_FIRST_OFDM_RATE)); | 790 | (lq_sta->supp_rates << IWL_FIRST_OFDM_RATE)); |
790 | else | 791 | else |
@@ -883,9 +884,9 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev, | |||
883 | search_win = (struct iwl4965_rate_scale_data *) | 884 | search_win = (struct iwl4965_rate_scale_data *) |
884 | &(search_tbl->win[0]); | 885 | &(search_tbl->win[0]); |
885 | 886 | ||
886 | tx_mcs.rate_n_flags = tx_resp->control.tx_rate; | 887 | tx_mcs.rate_n_flags = tx_resp->control.tx_rate->hw_value; |
887 | 888 | ||
888 | rs_get_tbl_info_from_mcs(&tx_mcs, priv->phymode, | 889 | rs_get_tbl_info_from_mcs(&tx_mcs, priv->band, |
889 | &tbl_type, &rs_index); | 890 | &tbl_type, &rs_index); |
890 | if ((rs_index < 0) || (rs_index >= IWL_RATE_COUNT)) { | 891 | if ((rs_index < 0) || (rs_index >= IWL_RATE_COUNT)) { |
891 | IWL_DEBUG_RATE("bad rate index at: %d rate 0x%X\n", | 892 | IWL_DEBUG_RATE("bad rate index at: %d rate 0x%X\n", |
@@ -918,7 +919,7 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev, | |||
918 | * Each tx attempt steps one entry deeper in the rate table. */ | 919 | * Each tx attempt steps one entry deeper in the rate table. */ |
919 | tx_mcs.rate_n_flags = | 920 | tx_mcs.rate_n_flags = |
920 | le32_to_cpu(table->rs_table[index].rate_n_flags); | 921 | le32_to_cpu(table->rs_table[index].rate_n_flags); |
921 | rs_get_tbl_info_from_mcs(&tx_mcs, priv->phymode, | 922 | rs_get_tbl_info_from_mcs(&tx_mcs, priv->band, |
922 | &tbl_type, &rs_index); | 923 | &tbl_type, &rs_index); |
923 | 924 | ||
924 | /* If type matches "search" table, | 925 | /* If type matches "search" table, |
@@ -959,12 +960,12 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev, | |||
959 | * else look up the rate that was, finally, successful. | 960 | * else look up the rate that was, finally, successful. |
960 | */ | 961 | */ |
961 | if (!tx_resp->retry_count) | 962 | if (!tx_resp->retry_count) |
962 | tx_mcs.rate_n_flags = tx_resp->control.tx_rate; | 963 | tx_mcs.rate_n_flags = tx_resp->control.tx_rate->hw_value; |
963 | else | 964 | else |
964 | tx_mcs.rate_n_flags = | 965 | tx_mcs.rate_n_flags = |
965 | le32_to_cpu(table->rs_table[index].rate_n_flags); | 966 | le32_to_cpu(table->rs_table[index].rate_n_flags); |
966 | 967 | ||
967 | rs_get_tbl_info_from_mcs(&tx_mcs, priv->phymode, | 968 | rs_get_tbl_info_from_mcs(&tx_mcs, priv->band, |
968 | &tbl_type, &rs_index); | 969 | &tbl_type, &rs_index); |
969 | 970 | ||
970 | /* Update frame history window with "success" if Tx got ACKed ... */ | 971 | /* Update frame history window with "success" if Tx got ACKed ... */ |
@@ -1801,7 +1802,7 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, | |||
1801 | is_green = lq_sta->is_green; | 1802 | is_green = lq_sta->is_green; |
1802 | 1803 | ||
1803 | /* current tx rate */ | 1804 | /* current tx rate */ |
1804 | index = sta->last_txrate; | 1805 | index = sta->last_txrate_idx; |
1805 | 1806 | ||
1806 | IWL_DEBUG_RATE("Rate scale index %d for type %d\n", index, | 1807 | IWL_DEBUG_RATE("Rate scale index %d for type %d\n", index, |
1807 | tbl->lq_type); | 1808 | tbl->lq_type); |
@@ -1814,7 +1815,7 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, | |||
1814 | 1815 | ||
1815 | /* mask with station rate restriction */ | 1816 | /* mask with station rate restriction */ |
1816 | if (is_legacy(tbl->lq_type)) { | 1817 | if (is_legacy(tbl->lq_type)) { |
1817 | if (lq_sta->phymode == (u8) MODE_IEEE80211A) | 1818 | if (lq_sta->band == IEEE80211_BAND_5GHZ) |
1818 | /* supp_rates has no CCK bits in A mode */ | 1819 | /* supp_rates has no CCK bits in A mode */ |
1819 | rate_scale_index_msk = (u16) (rate_mask & | 1820 | rate_scale_index_msk = (u16) (rate_mask & |
1820 | (lq_sta->supp_rates << IWL_FIRST_OFDM_RATE)); | 1821 | (lq_sta->supp_rates << IWL_FIRST_OFDM_RATE)); |
@@ -2134,15 +2135,15 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, | |||
2134 | out: | 2135 | out: |
2135 | rs_mcs_from_tbl(&tbl->current_rate, tbl, index, is_green); | 2136 | rs_mcs_from_tbl(&tbl->current_rate, tbl, index, is_green); |
2136 | i = index; | 2137 | i = index; |
2137 | sta->last_txrate = i; | 2138 | sta->last_txrate_idx = i; |
2138 | 2139 | ||
2139 | /* sta->txrate is an index to A mode rates which start | 2140 | /* sta->txrate_idx is an index to A mode rates which start |
2140 | * at IWL_FIRST_OFDM_RATE | 2141 | * at IWL_FIRST_OFDM_RATE |
2141 | */ | 2142 | */ |
2142 | if (lq_sta->phymode == (u8) MODE_IEEE80211A) | 2143 | if (lq_sta->band == IEEE80211_BAND_5GHZ) |
2143 | sta->txrate = i - IWL_FIRST_OFDM_RATE; | 2144 | sta->txrate_idx = i - IWL_FIRST_OFDM_RATE; |
2144 | else | 2145 | else |
2145 | sta->txrate = i; | 2146 | sta->txrate_idx = i; |
2146 | 2147 | ||
2147 | return; | 2148 | return; |
2148 | } | 2149 | } |
@@ -2164,7 +2165,7 @@ static void rs_initialize_lq(struct iwl4965_priv *priv, | |||
2164 | goto out; | 2165 | goto out; |
2165 | 2166 | ||
2166 | lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv; | 2167 | lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv; |
2167 | i = sta->last_txrate; | 2168 | i = sta->last_txrate_idx; |
2168 | 2169 | ||
2169 | if ((lq_sta->lq.sta_id == 0xff) && | 2170 | if ((lq_sta->lq.sta_id == 0xff) && |
2170 | (priv->iw_mode == IEEE80211_IF_TYPE_IBSS)) | 2171 | (priv->iw_mode == IEEE80211_IF_TYPE_IBSS)) |
@@ -2188,7 +2189,7 @@ static void rs_initialize_lq(struct iwl4965_priv *priv, | |||
2188 | mcs_rate.rate_n_flags |= RATE_MCS_CCK_MSK; | 2189 | mcs_rate.rate_n_flags |= RATE_MCS_CCK_MSK; |
2189 | 2190 | ||
2190 | tbl->antenna_type = ANT_AUX; | 2191 | tbl->antenna_type = ANT_AUX; |
2191 | rs_get_tbl_info_from_mcs(&mcs_rate, priv->phymode, tbl, &rate_idx); | 2192 | rs_get_tbl_info_from_mcs(&mcs_rate, priv->band, tbl, &rate_idx); |
2192 | if (!rs_is_ant_connected(priv->valid_antenna, tbl->antenna_type)) | 2193 | if (!rs_is_ant_connected(priv->valid_antenna, tbl->antenna_type)) |
2193 | rs_toggle_antenna(&mcs_rate, tbl); | 2194 | rs_toggle_antenna(&mcs_rate, tbl); |
2194 | 2195 | ||
@@ -2202,7 +2203,8 @@ static void rs_initialize_lq(struct iwl4965_priv *priv, | |||
2202 | } | 2203 | } |
2203 | 2204 | ||
2204 | static void rs_get_rate(void *priv_rate, struct net_device *dev, | 2205 | static void rs_get_rate(void *priv_rate, struct net_device *dev, |
2205 | struct ieee80211_hw_mode *mode, struct sk_buff *skb, | 2206 | struct ieee80211_supported_band *sband, |
2207 | struct sk_buff *skb, | ||
2206 | struct rate_selection *sel) | 2208 | struct rate_selection *sel) |
2207 | { | 2209 | { |
2208 | 2210 | ||
@@ -2224,14 +2226,14 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, | |||
2224 | fc = le16_to_cpu(hdr->frame_control); | 2226 | fc = le16_to_cpu(hdr->frame_control); |
2225 | if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) || | 2227 | if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) || |
2226 | !sta || !sta->rate_ctrl_priv) { | 2228 | !sta || !sta->rate_ctrl_priv) { |
2227 | sel->rate = rate_lowest(local, local->oper_hw_mode, sta); | 2229 | sel->rate = rate_lowest(local, sband, sta); |
2228 | if (sta) | 2230 | if (sta) |
2229 | sta_info_put(sta); | 2231 | sta_info_put(sta); |
2230 | return; | 2232 | return; |
2231 | } | 2233 | } |
2232 | 2234 | ||
2233 | lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv; | 2235 | lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv; |
2234 | i = sta->last_txrate; | 2236 | i = sta->last_txrate_idx; |
2235 | 2237 | ||
2236 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && | 2238 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && |
2237 | !lq_sta->ibss_sta_added) { | 2239 | !lq_sta->ibss_sta_added) { |
@@ -2256,7 +2258,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, | |||
2256 | 2258 | ||
2257 | done: | 2259 | done: |
2258 | if ((i < 0) || (i > IWL_RATE_COUNT)) { | 2260 | if ((i < 0) || (i > IWL_RATE_COUNT)) { |
2259 | sel->rate = rate_lowest(local, local->oper_hw_mode, sta); | 2261 | sel->rate = rate_lowest(local, sband, sta); |
2260 | return; | 2262 | return; |
2261 | } | 2263 | } |
2262 | sta_info_put(sta); | 2264 | sta_info_put(sta); |
@@ -2291,13 +2293,15 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, | |||
2291 | { | 2293 | { |
2292 | int i, j; | 2294 | int i, j; |
2293 | struct ieee80211_conf *conf = &local->hw.conf; | 2295 | struct ieee80211_conf *conf = &local->hw.conf; |
2294 | struct ieee80211_hw_mode *mode = local->oper_hw_mode; | 2296 | struct ieee80211_supported_band *sband; |
2295 | struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate; | 2297 | struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate; |
2296 | struct iwl4965_lq_sta *lq_sta = priv_sta; | 2298 | struct iwl4965_lq_sta *lq_sta = priv_sta; |
2297 | 2299 | ||
2300 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
2301 | |||
2298 | lq_sta->flush_timer = 0; | 2302 | lq_sta->flush_timer = 0; |
2299 | lq_sta->supp_rates = sta->supp_rates; | 2303 | lq_sta->supp_rates = sta->supp_rates[sband->band]; |
2300 | sta->txrate = 3; | 2304 | sta->txrate_idx = 3; |
2301 | for (j = 0; j < LQ_SIZE; j++) | 2305 | for (j = 0; j < LQ_SIZE; j++) |
2302 | for (i = 0; i < IWL_RATE_COUNT; i++) | 2306 | for (i = 0; i < IWL_RATE_COUNT; i++) |
2303 | rs_rate_scale_clear_window(&(lq_sta->lq_info[j].win[i])); | 2307 | rs_rate_scale_clear_window(&(lq_sta->lq_info[j].win[i])); |
@@ -2332,15 +2336,15 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, | |||
2332 | } | 2336 | } |
2333 | 2337 | ||
2334 | /* Find highest tx rate supported by hardware and destination station */ | 2338 | /* Find highest tx rate supported by hardware and destination station */ |
2335 | for (i = 0; i < mode->num_rates; i++) { | 2339 | for (i = 0; i < sband->n_bitrates; i++) |
2336 | if ((sta->supp_rates & BIT(i)) && | 2340 | if (sta->supp_rates[sband->band] & BIT(i)) |
2337 | (mode->rates[i].flags & IEEE80211_RATE_SUPPORTED)) | 2341 | sta->txrate_idx = i; |
2338 | sta->txrate = i; | 2342 | |
2339 | } | 2343 | sta->last_txrate_idx = sta->txrate_idx; |
2340 | sta->last_txrate = sta->txrate; | 2344 | /* WTF is with this bogus comment? A doesn't have cck rates */ |
2341 | /* For MODE_IEEE80211A, cck rates are at end of rate table */ | 2345 | /* For MODE_IEEE80211A, cck rates are at end of rate table */ |
2342 | if (local->hw.conf.phymode == MODE_IEEE80211A) | 2346 | if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) |
2343 | sta->last_txrate += IWL_FIRST_OFDM_RATE; | 2347 | sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; |
2344 | 2348 | ||
2345 | lq_sta->is_dup = 0; | 2349 | lq_sta->is_dup = 0; |
2346 | lq_sta->valid_antenna = priv->valid_antenna; | 2350 | lq_sta->valid_antenna = priv->valid_antenna; |
@@ -2349,7 +2353,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, | |||
2349 | lq_sta->active_rate = priv->active_rate; | 2353 | lq_sta->active_rate = priv->active_rate; |
2350 | lq_sta->active_rate &= ~(0x1000); | 2354 | lq_sta->active_rate &= ~(0x1000); |
2351 | lq_sta->active_rate_basic = priv->active_rate_basic; | 2355 | lq_sta->active_rate_basic = priv->active_rate_basic; |
2352 | lq_sta->phymode = priv->phymode; | 2356 | lq_sta->band = priv->band; |
2353 | #ifdef CONFIG_IWL4965_HT | 2357 | #ifdef CONFIG_IWL4965_HT |
2354 | /* | 2358 | /* |
2355 | * active_siso_rate mask includes 9 MBits (bit 5), and CCK (bits 0-3), | 2359 | * active_siso_rate mask includes 9 MBits (bit 5), and CCK (bits 0-3), |
@@ -2401,7 +2405,7 @@ static void rs_fill_link_cmd(struct iwl4965_lq_sta *lq_sta, | |||
2401 | rs_dbgfs_set_mcs(lq_sta, tx_mcs, index); | 2405 | rs_dbgfs_set_mcs(lq_sta, tx_mcs, index); |
2402 | 2406 | ||
2403 | /* Interpret rate_n_flags */ | 2407 | /* Interpret rate_n_flags */ |
2404 | rs_get_tbl_info_from_mcs(tx_mcs, lq_sta->phymode, | 2408 | rs_get_tbl_info_from_mcs(tx_mcs, lq_sta->band, |
2405 | &tbl_type, &rate_idx); | 2409 | &tbl_type, &rate_idx); |
2406 | 2410 | ||
2407 | /* How many times should we repeat the initial rate? */ | 2411 | /* How many times should we repeat the initial rate? */ |
@@ -2455,7 +2459,7 @@ static void rs_fill_link_cmd(struct iwl4965_lq_sta *lq_sta, | |||
2455 | index++; | 2459 | index++; |
2456 | } | 2460 | } |
2457 | 2461 | ||
2458 | rs_get_tbl_info_from_mcs(&new_rate, lq_sta->phymode, &tbl_type, | 2462 | rs_get_tbl_info_from_mcs(&new_rate, lq_sta->band, &tbl_type, |
2459 | &rate_idx); | 2463 | &rate_idx); |
2460 | 2464 | ||
2461 | /* Indicate to uCode which entries might be MIMO. | 2465 | /* Indicate to uCode which entries might be MIMO. |
@@ -2542,7 +2546,7 @@ static void rs_dbgfs_set_mcs(struct iwl4965_lq_sta *lq_sta, | |||
2542 | { | 2546 | { |
2543 | u32 base_rate; | 2547 | u32 base_rate; |
2544 | 2548 | ||
2545 | if (lq_sta->phymode == (u8) MODE_IEEE80211A) | 2549 | if (lq_sta->band == IEEE80211_BAND_5GHZ) |
2546 | base_rate = 0x800D; | 2550 | base_rate = 0x800D; |
2547 | else | 2551 | else |
2548 | base_rate = 0x820A; | 2552 | base_rate = 0x820A; |
@@ -2802,7 +2806,7 @@ int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) | |||
2802 | 2806 | ||
2803 | cnt += sprintf(&buf[cnt], "\nrate scale type %d antenna %d " | 2807 | cnt += sprintf(&buf[cnt], "\nrate scale type %d antenna %d " |
2804 | "active_search %d rate index %d\n", lq_type, antenna, | 2808 | "active_search %d rate index %d\n", lq_type, antenna, |
2805 | lq_sta->search_better_tbl, sta->last_txrate); | 2809 | lq_sta->search_better_tbl, sta->last_txrate_idx); |
2806 | 2810 | ||
2807 | sta_info_put(sta); | 2811 | sta_info_put(sta); |
2808 | return cnt; | 2812 | return cnt; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 0bded8570275..a89439320498 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -339,14 +339,15 @@ static int iwl4965_kw_alloc(struct iwl4965_priv *priv) | |||
339 | * | 339 | * |
340 | * Does not set up a command, or touch hardware. | 340 | * Does not set up a command, or touch hardware. |
341 | */ | 341 | */ |
342 | int iwl4965_set_fat_chan_info(struct iwl4965_priv *priv, int phymode, u16 channel, | 342 | int iwl4965_set_fat_chan_info(struct iwl4965_priv *priv, |
343 | enum ieee80211_band band, u16 channel, | ||
343 | const struct iwl4965_eeprom_channel *eeprom_ch, | 344 | const struct iwl4965_eeprom_channel *eeprom_ch, |
344 | u8 fat_extension_channel) | 345 | u8 fat_extension_channel) |
345 | { | 346 | { |
346 | struct iwl4965_channel_info *ch_info; | 347 | struct iwl4965_channel_info *ch_info; |
347 | 348 | ||
348 | ch_info = (struct iwl4965_channel_info *) | 349 | ch_info = (struct iwl4965_channel_info *) |
349 | iwl4965_get_channel_info(priv, phymode, channel); | 350 | iwl4965_get_channel_info(priv, band, channel); |
350 | 351 | ||
351 | if (!is_channel_valid(ch_info)) | 352 | if (!is_channel_valid(ch_info)) |
352 | return -1; | 353 | return -1; |
@@ -1939,11 +1940,12 @@ static s32 iwl4965_get_voltage_compensation(s32 eeprom_voltage, | |||
1939 | } | 1940 | } |
1940 | 1941 | ||
1941 | static const struct iwl4965_channel_info * | 1942 | static const struct iwl4965_channel_info * |
1942 | iwl4965_get_channel_txpower_info(struct iwl4965_priv *priv, u8 phymode, u16 channel) | 1943 | iwl4965_get_channel_txpower_info(struct iwl4965_priv *priv, |
1944 | enum ieee80211_band band, u16 channel) | ||
1943 | { | 1945 | { |
1944 | const struct iwl4965_channel_info *ch_info; | 1946 | const struct iwl4965_channel_info *ch_info; |
1945 | 1947 | ||
1946 | ch_info = iwl4965_get_channel_info(priv, phymode, channel); | 1948 | ch_info = iwl4965_get_channel_info(priv, band, channel); |
1947 | 1949 | ||
1948 | if (!is_channel_valid(ch_info)) | 1950 | if (!is_channel_valid(ch_info)) |
1949 | return NULL; | 1951 | return NULL; |
@@ -2392,7 +2394,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl4965_priv *priv, u8 band, u16 chan | |||
2392 | 2394 | ||
2393 | /* Get current (RXON) channel, band, width */ | 2395 | /* Get current (RXON) channel, band, width */ |
2394 | ch_info = | 2396 | ch_info = |
2395 | iwl4965_get_channel_txpower_info(priv, priv->phymode, channel); | 2397 | iwl4965_get_channel_txpower_info(priv, priv->band, channel); |
2396 | 2398 | ||
2397 | IWL_DEBUG_TXPOWER("chan %d band %d is_fat %d\n", channel, band, | 2399 | IWL_DEBUG_TXPOWER("chan %d band %d is_fat %d\n", channel, band, |
2398 | is_fat); | 2400 | is_fat); |
@@ -2619,8 +2621,7 @@ int iwl4965_hw_reg_send_txpower(struct iwl4965_priv *priv) | |||
2619 | return -EAGAIN; | 2621 | return -EAGAIN; |
2620 | } | 2622 | } |
2621 | 2623 | ||
2622 | band = ((priv->phymode == MODE_IEEE80211B) || | 2624 | band = priv->band == IEEE80211_BAND_2GHZ; |
2623 | (priv->phymode == MODE_IEEE80211G)); | ||
2624 | 2625 | ||
2625 | is_fat = is_fat_channel(priv->active_rxon.flags); | 2626 | is_fat = is_fat_channel(priv->active_rxon.flags); |
2626 | 2627 | ||
@@ -2650,10 +2651,9 @@ int iwl4965_hw_channel_switch(struct iwl4965_priv *priv, u16 channel) | |||
2650 | struct iwl4965_channel_switch_cmd cmd = { 0 }; | 2651 | struct iwl4965_channel_switch_cmd cmd = { 0 }; |
2651 | const struct iwl4965_channel_info *ch_info; | 2652 | const struct iwl4965_channel_info *ch_info; |
2652 | 2653 | ||
2653 | band = ((priv->phymode == MODE_IEEE80211B) || | 2654 | band = priv->band == IEEE80211_BAND_2GHZ; |
2654 | (priv->phymode == MODE_IEEE80211G)); | ||
2655 | 2655 | ||
2656 | ch_info = iwl4965_get_channel_info(priv, priv->phymode, channel); | 2656 | ch_info = iwl4965_get_channel_info(priv, priv->band, channel); |
2657 | 2657 | ||
2658 | is_fat = is_fat_channel(priv->staging_rxon.flags); | 2658 | is_fat = is_fat_channel(priv->staging_rxon.flags); |
2659 | 2659 | ||
@@ -2698,7 +2698,7 @@ void iwl4965_hw_build_tx_cmd_rate(struct iwl4965_priv *priv, | |||
2698 | u16 fc = le16_to_cpu(hdr->frame_control); | 2698 | u16 fc = le16_to_cpu(hdr->frame_control); |
2699 | u8 rate_plcp; | 2699 | u8 rate_plcp; |
2700 | u16 rate_flags = 0; | 2700 | u16 rate_flags = 0; |
2701 | int rate_idx = min(ctrl->tx_rate & 0xffff, IWL_RATE_COUNT - 1); | 2701 | int rate_idx = min(ctrl->tx_rate->hw_value & 0xffff, IWL_RATE_COUNT - 1); |
2702 | 2702 | ||
2703 | rate_plcp = iwl4965_rates[rate_idx].plcp; | 2703 | rate_plcp = iwl4965_rates[rate_idx].plcp; |
2704 | 2704 | ||
@@ -3178,7 +3178,7 @@ static void iwl4965_add_radiotap(struct iwl4965_priv *priv, | |||
3178 | { | 3178 | { |
3179 | s8 signal = stats->ssi; | 3179 | s8 signal = stats->ssi; |
3180 | s8 noise = 0; | 3180 | s8 noise = 0; |
3181 | int rate = stats->rate; | 3181 | int rate = stats->rate_idx; |
3182 | u64 tsf = stats->mactime; | 3182 | u64 tsf = stats->mactime; |
3183 | __le16 phy_flags_hw = rx_start->phy_flags; | 3183 | __le16 phy_flags_hw = rx_start->phy_flags; |
3184 | struct iwl4965_rt_rx_hdr { | 3184 | struct iwl4965_rt_rx_hdr { |
@@ -3246,7 +3246,6 @@ static void iwl4965_add_radiotap(struct iwl4965_priv *priv, | |||
3246 | IEEE80211_CHAN_2GHZ), | 3246 | IEEE80211_CHAN_2GHZ), |
3247 | &iwl4965_rt->rt_chbitmask); | 3247 | &iwl4965_rt->rt_chbitmask); |
3248 | 3248 | ||
3249 | rate = iwl4965_rate_index_from_plcp(rate); | ||
3250 | if (rate == -1) | 3249 | if (rate == -1) |
3251 | iwl4965_rt->rt_rate = 0; | 3250 | iwl4965_rt->rt_rate = 0; |
3252 | else | 3251 | else |
@@ -3542,12 +3541,13 @@ static void iwl4965_rx_reply_rx(struct iwl4965_priv *priv, | |||
3542 | u16 fc; | 3541 | u16 fc; |
3543 | struct ieee80211_rx_status stats = { | 3542 | struct ieee80211_rx_status stats = { |
3544 | .mactime = le64_to_cpu(rx_start->timestamp), | 3543 | .mactime = le64_to_cpu(rx_start->timestamp), |
3545 | .channel = le16_to_cpu(rx_start->channel), | 3544 | .freq = ieee80211chan2mhz(le16_to_cpu(rx_start->channel)), |
3546 | .phymode = | 3545 | .band = |
3547 | (rx_start->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ? | 3546 | (rx_start->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ? |
3548 | MODE_IEEE80211G : MODE_IEEE80211A, | 3547 | IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ, |
3549 | .antenna = 0, | 3548 | .antenna = 0, |
3550 | .rate = iwl4965_hw_get_rate(rx_start->rate_n_flags), | 3549 | .rate_idx = iwl4965_hw_get_rate( |
3550 | le32_to_cpu(rx_start->rate_n_flags)), | ||
3551 | .flag = 0, | 3551 | .flag = 0, |
3552 | }; | 3552 | }; |
3553 | u8 network_packet; | 3553 | u8 network_packet; |
@@ -3598,8 +3598,6 @@ static void iwl4965_rx_reply_rx(struct iwl4965_priv *priv, | |||
3598 | 3598 | ||
3599 | priv->ucode_beacon_time = le32_to_cpu(rx_start->beacon_time_stamp); | 3599 | priv->ucode_beacon_time = le32_to_cpu(rx_start->beacon_time_stamp); |
3600 | 3600 | ||
3601 | stats.freq = ieee80211chan2mhz(stats.channel); | ||
3602 | |||
3603 | /* Find max signal strength (dBm) among 3 antenna/receiver chains */ | 3601 | /* Find max signal strength (dBm) among 3 antenna/receiver chains */ |
3604 | stats.ssi = iwl4965_calc_rssi(rx_start); | 3602 | stats.ssi = iwl4965_calc_rssi(rx_start); |
3605 | 3603 | ||
@@ -4185,7 +4183,7 @@ void iwl4965_add_station(struct iwl4965_priv *priv, const u8 *addr, int is_ap) | |||
4185 | * all the way down to 1M in IEEE order, and then spin on 1M */ | 4183 | * all the way down to 1M in IEEE order, and then spin on 1M */ |
4186 | if (is_ap) | 4184 | if (is_ap) |
4187 | r = IWL_RATE_54M_INDEX; | 4185 | r = IWL_RATE_54M_INDEX; |
4188 | else if (priv->phymode == MODE_IEEE80211A) | 4186 | else if (priv->band == IEEE80211_BAND_5GHZ) |
4189 | r = IWL_RATE_6M_INDEX; | 4187 | r = IWL_RATE_6M_INDEX; |
4190 | else | 4188 | else |
4191 | r = IWL_RATE_1M_INDEX; | 4189 | r = IWL_RATE_1M_INDEX; |
@@ -4218,12 +4216,13 @@ void iwl4965_add_station(struct iwl4965_priv *priv, const u8 *addr, int is_ap) | |||
4218 | 4216 | ||
4219 | #ifdef CONFIG_IWL4965_HT | 4217 | #ifdef CONFIG_IWL4965_HT |
4220 | 4218 | ||
4221 | static u8 iwl4965_is_channel_extension(struct iwl4965_priv *priv, int phymode, | 4219 | static u8 iwl4965_is_channel_extension(struct iwl4965_priv *priv, |
4220 | enum ieee80211_band band, | ||
4222 | u16 channel, u8 extension_chan_offset) | 4221 | u16 channel, u8 extension_chan_offset) |
4223 | { | 4222 | { |
4224 | const struct iwl4965_channel_info *ch_info; | 4223 | const struct iwl4965_channel_info *ch_info; |
4225 | 4224 | ||
4226 | ch_info = iwl4965_get_channel_info(priv, phymode, channel); | 4225 | ch_info = iwl4965_get_channel_info(priv, band, channel); |
4227 | if (!is_channel_valid(ch_info)) | 4226 | if (!is_channel_valid(ch_info)) |
4228 | return 0; | 4227 | return 0; |
4229 | 4228 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index de5c1bf8fc42..cb8f7f2a8d48 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h | |||
@@ -206,7 +206,7 @@ struct iwl4965_channel_info { | |||
206 | 206 | ||
207 | u8 group_index; /* 0-4, maps channel to group1/2/3/4/5 */ | 207 | u8 group_index; /* 0-4, maps channel to group1/2/3/4/5 */ |
208 | u8 band_index; /* 0-4, maps channel to band1/2/3/4/5 */ | 208 | u8 band_index; /* 0-4, maps channel to band1/2/3/4/5 */ |
209 | u8 phymode; /* MODE_IEEE80211{A,B,G} */ | 209 | enum ieee80211_band band; |
210 | 210 | ||
211 | /* Radio/DSP gain settings for each "normal" data Tx rate. | 211 | /* Radio/DSP gain settings for each "normal" data Tx rate. |
212 | * These include, in addition to RF and DSP gain, a few fields for | 212 | * These include, in addition to RF and DSP gain, a few fields for |
@@ -764,7 +764,8 @@ extern void iwl4965_update_rate_scaling(struct iwl4965_priv *priv, u8 mode); | |||
764 | extern void iwl4965_chain_noise_reset(struct iwl4965_priv *priv); | 764 | extern void iwl4965_chain_noise_reset(struct iwl4965_priv *priv); |
765 | extern void iwl4965_init_sensitivity(struct iwl4965_priv *priv, u8 flags, | 765 | extern void iwl4965_init_sensitivity(struct iwl4965_priv *priv, u8 flags, |
766 | u8 force); | 766 | u8 force); |
767 | extern int iwl4965_set_fat_chan_info(struct iwl4965_priv *priv, int phymode, | 767 | extern int iwl4965_set_fat_chan_info(struct iwl4965_priv *priv, |
768 | enum ieee80211_band band, | ||
768 | u16 channel, | 769 | u16 channel, |
769 | const struct iwl4965_eeprom_channel *eeprom_ch, | 770 | const struct iwl4965_eeprom_channel *eeprom_ch, |
770 | u8 fat_extension_channel); | 771 | u8 fat_extension_channel); |
@@ -977,14 +978,14 @@ struct iwl4965_priv { | |||
977 | struct list_head free_frames; | 978 | struct list_head free_frames; |
978 | int frames_count; | 979 | int frames_count; |
979 | 980 | ||
980 | u8 phymode; | 981 | enum ieee80211_band band; |
981 | int alloc_rxb_skb; | 982 | int alloc_rxb_skb; |
982 | bool add_radiotap; | 983 | bool add_radiotap; |
983 | 984 | ||
984 | void (*rx_handlers[REPLY_MAX])(struct iwl4965_priv *priv, | 985 | void (*rx_handlers[REPLY_MAX])(struct iwl4965_priv *priv, |
985 | struct iwl4965_rx_mem_buffer *rxb); | 986 | struct iwl4965_rx_mem_buffer *rxb); |
986 | 987 | ||
987 | const struct ieee80211_hw_mode *modes; | 988 | struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS]; |
988 | 989 | ||
989 | #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT | 990 | #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT |
990 | /* spectrum measurement report caching */ | 991 | /* spectrum measurement report caching */ |
@@ -1243,13 +1244,12 @@ static inline int is_channel_radar(const struct iwl4965_channel_info *ch_info) | |||
1243 | 1244 | ||
1244 | static inline u8 is_channel_a_band(const struct iwl4965_channel_info *ch_info) | 1245 | static inline u8 is_channel_a_band(const struct iwl4965_channel_info *ch_info) |
1245 | { | 1246 | { |
1246 | return ch_info->phymode == MODE_IEEE80211A; | 1247 | return ch_info->band == IEEE80211_BAND_5GHZ; |
1247 | } | 1248 | } |
1248 | 1249 | ||
1249 | static inline u8 is_channel_bg_band(const struct iwl4965_channel_info *ch_info) | 1250 | static inline u8 is_channel_bg_band(const struct iwl4965_channel_info *ch_info) |
1250 | { | 1251 | { |
1251 | return ((ch_info->phymode == MODE_IEEE80211B) || | 1252 | return ch_info->band == IEEE80211_BAND_2GHZ; |
1252 | (ch_info->phymode == MODE_IEEE80211G)); | ||
1253 | } | 1253 | } |
1254 | 1254 | ||
1255 | static inline int is_channel_passive(const struct iwl4965_channel_info *ch) | 1255 | static inline int is_channel_passive(const struct iwl4965_channel_info *ch) |
@@ -1263,7 +1263,7 @@ static inline int is_channel_ibss(const struct iwl4965_channel_info *ch) | |||
1263 | } | 1263 | } |
1264 | 1264 | ||
1265 | extern const struct iwl4965_channel_info *iwl4965_get_channel_info( | 1265 | extern const struct iwl4965_channel_info *iwl4965_get_channel_info( |
1266 | const struct iwl4965_priv *priv, int phymode, u16 channel); | 1266 | const struct iwl4965_priv *priv, enum ieee80211_band band, u16 channel); |
1267 | 1267 | ||
1268 | /* Requires full declaration of iwl4965_priv before including */ | 1268 | /* Requires full declaration of iwl4965_priv before including */ |
1269 | #include "iwl-4965-io.h" | 1269 | #include "iwl-4965-io.h" |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 40b71bc2c4a4..57a1d70f2abf 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -116,16 +116,10 @@ static __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr) | |||
116 | return NULL; | 116 | return NULL; |
117 | } | 117 | } |
118 | 118 | ||
119 | static const struct ieee80211_hw_mode *iwl3945_get_hw_mode( | 119 | static const struct ieee80211_supported_band *iwl3945_get_band( |
120 | struct iwl3945_priv *priv, int mode) | 120 | struct iwl3945_priv *priv, enum ieee80211_band band) |
121 | { | 121 | { |
122 | int i; | 122 | return priv->hw->wiphy->bands[band]; |
123 | |||
124 | for (i = 0; i < 3; i++) | ||
125 | if (priv->modes[i].mode == mode) | ||
126 | return &priv->modes[i]; | ||
127 | |||
128 | return NULL; | ||
129 | } | 123 | } |
130 | 124 | ||
131 | static int iwl3945_is_empty_essid(const char *essid, int essid_len) | 125 | static int iwl3945_is_empty_essid(const char *essid, int essid_len) |
@@ -547,7 +541,7 @@ u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *addr, int is_ap, u8 | |||
547 | station->sta.sta.sta_id = index; | 541 | station->sta.sta.sta_id = index; |
548 | station->sta.station_flags = 0; | 542 | station->sta.station_flags = 0; |
549 | 543 | ||
550 | if (priv->phymode == MODE_IEEE80211A) | 544 | if (priv->band == IEEE80211_BAND_5GHZ) |
551 | rate = IWL_RATE_6M_PLCP; | 545 | rate = IWL_RATE_6M_PLCP; |
552 | else | 546 | else |
553 | rate = IWL_RATE_1M_PLCP; | 547 | rate = IWL_RATE_1M_PLCP; |
@@ -894,35 +888,37 @@ int iwl3945_send_statistics_request(struct iwl3945_priv *priv) | |||
894 | 888 | ||
895 | /** | 889 | /** |
896 | * iwl3945_set_rxon_channel - Set the phymode and channel values in staging RXON | 890 | * iwl3945_set_rxon_channel - Set the phymode and channel values in staging RXON |
897 | * @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz | 891 | * @band: 2.4 or 5 GHz band |
898 | * @channel: Any channel valid for the requested phymode | 892 | * @channel: Any channel valid for the requested band |
899 | 893 | ||
900 | * In addition to setting the staging RXON, priv->phymode is also set. | 894 | * In addition to setting the staging RXON, priv->band is also set. |
901 | * | 895 | * |
902 | * NOTE: Does not commit to the hardware; it sets appropriate bit fields | 896 | * NOTE: Does not commit to the hardware; it sets appropriate bit fields |
903 | * in the staging RXON flag structure based on the phymode | 897 | * in the staging RXON flag structure based on the band |
904 | */ | 898 | */ |
905 | static int iwl3945_set_rxon_channel(struct iwl3945_priv *priv, u8 phymode, u16 channel) | 899 | static int iwl3945_set_rxon_channel(struct iwl3945_priv *priv, |
900 | enum ieee80211_band band, | ||
901 | u16 channel) | ||
906 | { | 902 | { |
907 | if (!iwl3945_get_channel_info(priv, phymode, channel)) { | 903 | if (!iwl3945_get_channel_info(priv, band, channel)) { |
908 | IWL_DEBUG_INFO("Could not set channel to %d [%d]\n", | 904 | IWL_DEBUG_INFO("Could not set channel to %d [%d]\n", |
909 | channel, phymode); | 905 | channel, band); |
910 | return -EINVAL; | 906 | return -EINVAL; |
911 | } | 907 | } |
912 | 908 | ||
913 | if ((le16_to_cpu(priv->staging_rxon.channel) == channel) && | 909 | if ((le16_to_cpu(priv->staging_rxon.channel) == channel) && |
914 | (priv->phymode == phymode)) | 910 | (priv->band == band)) |
915 | return 0; | 911 | return 0; |
916 | 912 | ||
917 | priv->staging_rxon.channel = cpu_to_le16(channel); | 913 | priv->staging_rxon.channel = cpu_to_le16(channel); |
918 | if (phymode == MODE_IEEE80211A) | 914 | if (band == IEEE80211_BAND_5GHZ) |
919 | priv->staging_rxon.flags &= ~RXON_FLG_BAND_24G_MSK; | 915 | priv->staging_rxon.flags &= ~RXON_FLG_BAND_24G_MSK; |
920 | else | 916 | else |
921 | priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK; | 917 | priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK; |
922 | 918 | ||
923 | priv->phymode = phymode; | 919 | priv->band = band; |
924 | 920 | ||
925 | IWL_DEBUG_INFO("Staging channel set to %d [%d]\n", channel, phymode); | 921 | IWL_DEBUG_INFO("Staging channel set to %d [%d]\n", channel, band); |
926 | 922 | ||
927 | return 0; | 923 | return 0; |
928 | } | 924 | } |
@@ -1210,8 +1206,7 @@ static int iwl3945_commit_rxon(struct iwl3945_priv *priv) | |||
1210 | return -EIO; | 1206 | return -EIO; |
1211 | } | 1207 | } |
1212 | 1208 | ||
1213 | /* Init the hardware's rate fallback order based on the | 1209 | /* Init the hardware's rate fallback order based on the band */ |
1214 | * phymode */ | ||
1215 | rc = iwl3945_init_hw_rate_table(priv); | 1210 | rc = iwl3945_init_hw_rate_table(priv); |
1216 | if (rc) { | 1211 | if (rc) { |
1217 | IWL_ERROR("Error setting HW rate table: %02X\n", rc); | 1212 | IWL_ERROR("Error setting HW rate table: %02X\n", rc); |
@@ -2461,9 +2456,10 @@ static int iwl3945_set_rxon_hwcrypto(struct iwl3945_priv *priv, int hw_decrypt) | |||
2461 | return 0; | 2456 | return 0; |
2462 | } | 2457 | } |
2463 | 2458 | ||
2464 | static void iwl3945_set_flags_for_phymode(struct iwl3945_priv *priv, u8 phymode) | 2459 | static void iwl3945_set_flags_for_phymode(struct iwl3945_priv *priv, |
2460 | enum ieee80211_band band) | ||
2465 | { | 2461 | { |
2466 | if (phymode == MODE_IEEE80211A) { | 2462 | if (band == IEEE80211_BAND_5GHZ) { |
2467 | priv->staging_rxon.flags &= | 2463 | priv->staging_rxon.flags &= |
2468 | ~(RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK | 2464 | ~(RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK |
2469 | | RXON_FLG_CCK_MSK); | 2465 | | RXON_FLG_CCK_MSK); |
@@ -2526,7 +2522,7 @@ static void iwl3945_connection_init_rx_config(struct iwl3945_priv *priv) | |||
2526 | priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; | 2522 | priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; |
2527 | #endif | 2523 | #endif |
2528 | 2524 | ||
2529 | ch_info = iwl3945_get_channel_info(priv, priv->phymode, | 2525 | ch_info = iwl3945_get_channel_info(priv, priv->band, |
2530 | le16_to_cpu(priv->staging_rxon.channel)); | 2526 | le16_to_cpu(priv->staging_rxon.channel)); |
2531 | 2527 | ||
2532 | if (!ch_info) | 2528 | if (!ch_info) |
@@ -2542,11 +2538,11 @@ static void iwl3945_connection_init_rx_config(struct iwl3945_priv *priv) | |||
2542 | 2538 | ||
2543 | priv->staging_rxon.channel = cpu_to_le16(ch_info->channel); | 2539 | priv->staging_rxon.channel = cpu_to_le16(ch_info->channel); |
2544 | if (is_channel_a_band(ch_info)) | 2540 | if (is_channel_a_band(ch_info)) |
2545 | priv->phymode = MODE_IEEE80211A; | 2541 | priv->band = IEEE80211_BAND_5GHZ; |
2546 | else | 2542 | else |
2547 | priv->phymode = MODE_IEEE80211G; | 2543 | priv->band = IEEE80211_BAND_2GHZ; |
2548 | 2544 | ||
2549 | iwl3945_set_flags_for_phymode(priv, priv->phymode); | 2545 | iwl3945_set_flags_for_phymode(priv, priv->band); |
2550 | 2546 | ||
2551 | priv->staging_rxon.ofdm_basic_rates = | 2547 | priv->staging_rxon.ofdm_basic_rates = |
2552 | (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; | 2548 | (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; |
@@ -2560,7 +2556,7 @@ static int iwl3945_set_mode(struct iwl3945_priv *priv, int mode) | |||
2560 | const struct iwl3945_channel_info *ch_info; | 2556 | const struct iwl3945_channel_info *ch_info; |
2561 | 2557 | ||
2562 | ch_info = iwl3945_get_channel_info(priv, | 2558 | ch_info = iwl3945_get_channel_info(priv, |
2563 | priv->phymode, | 2559 | priv->band, |
2564 | le16_to_cpu(priv->staging_rxon.channel)); | 2560 | le16_to_cpu(priv->staging_rxon.channel)); |
2565 | 2561 | ||
2566 | if (!ch_info || !is_channel_ibss(ch_info)) { | 2562 | if (!ch_info || !is_channel_ibss(ch_info)) { |
@@ -2792,7 +2788,7 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, | |||
2792 | goto drop_unlock; | 2788 | goto drop_unlock; |
2793 | } | 2789 | } |
2794 | 2790 | ||
2795 | if ((ctl->tx_rate & 0xFF) == IWL_INVALID_RATE) { | 2791 | if ((ctl->tx_rate->hw_value & 0xFF) == IWL_INVALID_RATE) { |
2796 | IWL_ERROR("ERROR: No TX rate available.\n"); | 2792 | IWL_ERROR("ERROR: No TX rate available.\n"); |
2797 | goto drop_unlock; | 2793 | goto drop_unlock; |
2798 | } | 2794 | } |
@@ -2992,12 +2988,12 @@ drop: | |||
2992 | 2988 | ||
2993 | static void iwl3945_set_rate(struct iwl3945_priv *priv) | 2989 | static void iwl3945_set_rate(struct iwl3945_priv *priv) |
2994 | { | 2990 | { |
2995 | const struct ieee80211_hw_mode *hw = NULL; | 2991 | const struct ieee80211_supported_band *sband = NULL; |
2996 | struct ieee80211_rate *rate; | 2992 | struct ieee80211_rate *rate; |
2997 | int i; | 2993 | int i; |
2998 | 2994 | ||
2999 | hw = iwl3945_get_hw_mode(priv, priv->phymode); | 2995 | sband = iwl3945_get_band(priv, priv->band); |
3000 | if (!hw) { | 2996 | if (!sband) { |
3001 | IWL_ERROR("Failed to set rate: unable to get hw mode\n"); | 2997 | IWL_ERROR("Failed to set rate: unable to get hw mode\n"); |
3002 | return; | 2998 | return; |
3003 | } | 2999 | } |
@@ -3005,24 +3001,17 @@ static void iwl3945_set_rate(struct iwl3945_priv *priv) | |||
3005 | priv->active_rate = 0; | 3001 | priv->active_rate = 0; |
3006 | priv->active_rate_basic = 0; | 3002 | priv->active_rate_basic = 0; |
3007 | 3003 | ||
3008 | IWL_DEBUG_RATE("Setting rates for 802.11%c\n", | 3004 | IWL_DEBUG_RATE("Setting rates for %s GHz\n", |
3009 | hw->mode == MODE_IEEE80211A ? | 3005 | sband->band == IEEE80211_BAND_2GHZ ? "2.4" : "5"); |
3010 | 'a' : ((hw->mode == MODE_IEEE80211B) ? 'b' : 'g')); | 3006 | |
3011 | 3007 | for (i = 0; i < sband->n_bitrates; i++) { | |
3012 | for (i = 0; i < hw->num_rates; i++) { | 3008 | rate = &sband->bitrates[i]; |
3013 | rate = &(hw->rates[i]); | 3009 | if ((rate->hw_value < IWL_RATE_COUNT) && |
3014 | if ((rate->val < IWL_RATE_COUNT) && | 3010 | !(rate->flags & IEEE80211_CHAN_DISABLED)) { |
3015 | (rate->flags & IEEE80211_RATE_SUPPORTED)) { | 3011 | IWL_DEBUG_RATE("Adding rate index %d (plcp %d)\n", |
3016 | IWL_DEBUG_RATE("Adding rate index %d (plcp %d)%s\n", | 3012 | rate->hw_value, iwl3945_rates[rate->hw_value].plcp); |
3017 | rate->val, iwl3945_rates[rate->val].plcp, | 3013 | priv->active_rate |= (1 << rate->hw_value); |
3018 | (rate->flags & IEEE80211_RATE_BASIC) ? | 3014 | } |
3019 | "*" : ""); | ||
3020 | priv->active_rate |= (1 << rate->val); | ||
3021 | if (rate->flags & IEEE80211_RATE_BASIC) | ||
3022 | priv->active_rate_basic |= (1 << rate->val); | ||
3023 | } else | ||
3024 | IWL_DEBUG_RATE("Not adding rate %d (plcp %d)\n", | ||
3025 | rate->val, iwl3945_rates[rate->val].plcp); | ||
3026 | } | 3015 | } |
3027 | 3016 | ||
3028 | IWL_DEBUG_RATE("Set active_rate = %0x, active_rate_basic = %0x\n", | 3017 | IWL_DEBUG_RATE("Set active_rate = %0x, active_rate_basic = %0x\n", |
@@ -3436,8 +3425,6 @@ static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv, | |||
3436 | tx_status->flags = | 3425 | tx_status->flags = |
3437 | iwl3945_is_tx_success(status) ? IEEE80211_TX_STATUS_ACK : 0; | 3426 | iwl3945_is_tx_success(status) ? IEEE80211_TX_STATUS_ACK : 0; |
3438 | 3427 | ||
3439 | tx_status->control.tx_rate = iwl3945_rate_index_from_plcp(tx_resp->rate); | ||
3440 | |||
3441 | IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) plcp rate %d retries %d\n", | 3428 | IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) plcp rate %d retries %d\n", |
3442 | txq_id, iwl3945_get_tx_fail_reason(status), status, | 3429 | txq_id, iwl3945_get_tx_fail_reason(status), status, |
3443 | tx_resp->rate, tx_resp->failure_frame); | 3430 | tx_resp->rate, tx_resp->failure_frame); |
@@ -5026,24 +5013,24 @@ static void iwl3945_init_band_reference(const struct iwl3945_priv *priv, int ban | |||
5026 | * Based on band and channel number. | 5013 | * Based on band and channel number. |
5027 | */ | 5014 | */ |
5028 | const struct iwl3945_channel_info *iwl3945_get_channel_info(const struct iwl3945_priv *priv, | 5015 | const struct iwl3945_channel_info *iwl3945_get_channel_info(const struct iwl3945_priv *priv, |
5029 | int phymode, u16 channel) | 5016 | enum ieee80211_band band, u16 channel) |
5030 | { | 5017 | { |
5031 | int i; | 5018 | int i; |
5032 | 5019 | ||
5033 | switch (phymode) { | 5020 | switch (band) { |
5034 | case MODE_IEEE80211A: | 5021 | case IEEE80211_BAND_5GHZ: |
5035 | for (i = 14; i < priv->channel_count; i++) { | 5022 | for (i = 14; i < priv->channel_count; i++) { |
5036 | if (priv->channel_info[i].channel == channel) | 5023 | if (priv->channel_info[i].channel == channel) |
5037 | return &priv->channel_info[i]; | 5024 | return &priv->channel_info[i]; |
5038 | } | 5025 | } |
5039 | break; | 5026 | break; |
5040 | 5027 | ||
5041 | case MODE_IEEE80211B: | 5028 | case IEEE80211_BAND_2GHZ: |
5042 | case MODE_IEEE80211G: | ||
5043 | if (channel >= 1 && channel <= 14) | 5029 | if (channel >= 1 && channel <= 14) |
5044 | return &priv->channel_info[channel - 1]; | 5030 | return &priv->channel_info[channel - 1]; |
5045 | break; | 5031 | break; |
5046 | 5032 | case IEEE80211_NUM_BANDS: | |
5033 | WARN_ON(1); | ||
5047 | } | 5034 | } |
5048 | 5035 | ||
5049 | return NULL; | 5036 | return NULL; |
@@ -5106,8 +5093,8 @@ static int iwl3945_init_channel_map(struct iwl3945_priv *priv) | |||
5106 | /* Loop through each band adding each of the channels */ | 5093 | /* Loop through each band adding each of the channels */ |
5107 | for (ch = 0; ch < eeprom_ch_count; ch++) { | 5094 | for (ch = 0; ch < eeprom_ch_count; ch++) { |
5108 | ch_info->channel = eeprom_ch_index[ch]; | 5095 | ch_info->channel = eeprom_ch_index[ch]; |
5109 | ch_info->phymode = (band == 1) ? MODE_IEEE80211B : | 5096 | ch_info->band = (band == 1) ? IEEE80211_BAND_2GHZ : |
5110 | MODE_IEEE80211A; | 5097 | IEEE80211_BAND_5GHZ; |
5111 | 5098 | ||
5112 | /* permanently store EEPROM's channel regulatory flags | 5099 | /* permanently store EEPROM's channel regulatory flags |
5113 | * and max power in channel info database. */ | 5100 | * and max power in channel info database. */ |
@@ -5203,18 +5190,20 @@ static void iwl3945_free_channel_map(struct iwl3945_priv *priv) | |||
5203 | #define IWL_PASSIVE_DWELL_BASE (100) | 5190 | #define IWL_PASSIVE_DWELL_BASE (100) |
5204 | #define IWL_CHANNEL_TUNE_TIME 5 | 5191 | #define IWL_CHANNEL_TUNE_TIME 5 |
5205 | 5192 | ||
5206 | static inline u16 iwl3945_get_active_dwell_time(struct iwl3945_priv *priv, int phymode) | 5193 | static inline u16 iwl3945_get_active_dwell_time(struct iwl3945_priv *priv, |
5194 | enum ieee80211_band band) | ||
5207 | { | 5195 | { |
5208 | if (phymode == MODE_IEEE80211A) | 5196 | if (band == IEEE80211_BAND_5GHZ) |
5209 | return IWL_ACTIVE_DWELL_TIME_52; | 5197 | return IWL_ACTIVE_DWELL_TIME_52; |
5210 | else | 5198 | else |
5211 | return IWL_ACTIVE_DWELL_TIME_24; | 5199 | return IWL_ACTIVE_DWELL_TIME_24; |
5212 | } | 5200 | } |
5213 | 5201 | ||
5214 | static u16 iwl3945_get_passive_dwell_time(struct iwl3945_priv *priv, int phymode) | 5202 | static u16 iwl3945_get_passive_dwell_time(struct iwl3945_priv *priv, |
5203 | enum ieee80211_band band) | ||
5215 | { | 5204 | { |
5216 | u16 active = iwl3945_get_active_dwell_time(priv, phymode); | 5205 | u16 active = iwl3945_get_active_dwell_time(priv, band); |
5217 | u16 passive = (phymode != MODE_IEEE80211A) ? | 5206 | u16 passive = (band == IEEE80211_BAND_2GHZ) ? |
5218 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : | 5207 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : |
5219 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52; | 5208 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52; |
5220 | 5209 | ||
@@ -5234,28 +5223,29 @@ static u16 iwl3945_get_passive_dwell_time(struct iwl3945_priv *priv, int phymode | |||
5234 | return passive; | 5223 | return passive; |
5235 | } | 5224 | } |
5236 | 5225 | ||
5237 | static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv, int phymode, | 5226 | static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv, |
5227 | enum ieee80211_band band, | ||
5238 | u8 is_active, u8 direct_mask, | 5228 | u8 is_active, u8 direct_mask, |
5239 | struct iwl3945_scan_channel *scan_ch) | 5229 | struct iwl3945_scan_channel *scan_ch) |
5240 | { | 5230 | { |
5241 | const struct ieee80211_channel *channels = NULL; | 5231 | const struct ieee80211_channel *channels = NULL; |
5242 | const struct ieee80211_hw_mode *hw_mode; | 5232 | const struct ieee80211_supported_band *sband; |
5243 | const struct iwl3945_channel_info *ch_info; | 5233 | const struct iwl3945_channel_info *ch_info; |
5244 | u16 passive_dwell = 0; | 5234 | u16 passive_dwell = 0; |
5245 | u16 active_dwell = 0; | 5235 | u16 active_dwell = 0; |
5246 | int added, i; | 5236 | int added, i; |
5247 | 5237 | ||
5248 | hw_mode = iwl3945_get_hw_mode(priv, phymode); | 5238 | sband = iwl3945_get_band(priv, band); |
5249 | if (!hw_mode) | 5239 | if (!sband) |
5250 | return 0; | 5240 | return 0; |
5251 | 5241 | ||
5252 | channels = hw_mode->channels; | 5242 | channels = sband->channels; |
5253 | 5243 | ||
5254 | active_dwell = iwl3945_get_active_dwell_time(priv, phymode); | 5244 | active_dwell = iwl3945_get_active_dwell_time(priv, band); |
5255 | passive_dwell = iwl3945_get_passive_dwell_time(priv, phymode); | 5245 | passive_dwell = iwl3945_get_passive_dwell_time(priv, band); |
5256 | 5246 | ||
5257 | for (i = 0, added = 0; i < hw_mode->num_channels; i++) { | 5247 | for (i = 0, added = 0; i < sband->n_channels; i++) { |
5258 | if (channels[i].chan == | 5248 | if (channels[i].hw_value == |
5259 | le16_to_cpu(priv->active_rxon.channel)) { | 5249 | le16_to_cpu(priv->active_rxon.channel)) { |
5260 | if (iwl3945_is_associated(priv)) { | 5250 | if (iwl3945_is_associated(priv)) { |
5261 | IWL_DEBUG_SCAN | 5251 | IWL_DEBUG_SCAN |
@@ -5266,9 +5256,9 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv, int phymode, | |||
5266 | } else if (priv->only_active_channel) | 5256 | } else if (priv->only_active_channel) |
5267 | continue; | 5257 | continue; |
5268 | 5258 | ||
5269 | scan_ch->channel = channels[i].chan; | 5259 | scan_ch->channel = channels[i].hw_value; |
5270 | 5260 | ||
5271 | ch_info = iwl3945_get_channel_info(priv, phymode, scan_ch->channel); | 5261 | ch_info = iwl3945_get_channel_info(priv, band, scan_ch->channel); |
5272 | if (!is_channel_valid(ch_info)) { | 5262 | if (!is_channel_valid(ch_info)) { |
5273 | IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n", | 5263 | IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n", |
5274 | scan_ch->channel); | 5264 | scan_ch->channel); |
@@ -5276,7 +5266,7 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv, int phymode, | |||
5276 | } | 5266 | } |
5277 | 5267 | ||
5278 | if (!is_active || is_channel_passive(ch_info) || | 5268 | if (!is_active || is_channel_passive(ch_info) || |
5279 | !(channels[i].flag & IEEE80211_CHAN_W_ACTIVE_SCAN)) | 5269 | (channels[i].flags & IEEE80211_CHAN_PASSIVE_SCAN)) |
5280 | scan_ch->type = 0; /* passive */ | 5270 | scan_ch->type = 0; /* passive */ |
5281 | else | 5271 | else |
5282 | scan_ch->type = 1; /* active */ | 5272 | scan_ch->type = 1; /* active */ |
@@ -5295,7 +5285,7 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv, int phymode, | |||
5295 | /* scan_pwr_info->tpc.dsp_atten; */ | 5285 | /* scan_pwr_info->tpc.dsp_atten; */ |
5296 | 5286 | ||
5297 | /*scan_pwr_info->tpc.tx_gain; */ | 5287 | /*scan_pwr_info->tpc.tx_gain; */ |
5298 | if (phymode == MODE_IEEE80211A) | 5288 | if (band == IEEE80211_BAND_5GHZ) |
5299 | scan_ch->tpc.tx_gain = ((1 << 5) | (3 << 3)) | 3; | 5289 | scan_ch->tpc.tx_gain = ((1 << 5) | (3 << 3)) | 3; |
5300 | else { | 5290 | else { |
5301 | scan_ch->tpc.tx_gain = ((1 << 5) | (5 << 3)); | 5291 | scan_ch->tpc.tx_gain = ((1 << 5) | (5 << 3)); |
@@ -5319,41 +5309,23 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv, int phymode, | |||
5319 | return added; | 5309 | return added; |
5320 | } | 5310 | } |
5321 | 5311 | ||
5322 | static void iwl3945_reset_channel_flag(struct iwl3945_priv *priv) | ||
5323 | { | ||
5324 | int i, j; | ||
5325 | for (i = 0; i < 3; i++) { | ||
5326 | struct ieee80211_hw_mode *hw_mode = (void *)&priv->modes[i]; | ||
5327 | for (j = 0; j < hw_mode->num_channels; j++) | ||
5328 | hw_mode->channels[j].flag = hw_mode->channels[j].val; | ||
5329 | } | ||
5330 | } | ||
5331 | |||
5332 | static void iwl3945_init_hw_rates(struct iwl3945_priv *priv, | 5312 | static void iwl3945_init_hw_rates(struct iwl3945_priv *priv, |
5333 | struct ieee80211_rate *rates) | 5313 | struct ieee80211_rate *rates) |
5334 | { | 5314 | { |
5335 | int i; | 5315 | int i; |
5336 | 5316 | ||
5337 | for (i = 0; i < IWL_RATE_COUNT; i++) { | 5317 | for (i = 0; i < IWL_RATE_COUNT; i++) { |
5338 | rates[i].rate = iwl3945_rates[i].ieee * 5; | 5318 | rates[i].bitrate = iwl3945_rates[i].ieee * 5; |
5339 | rates[i].val = i; /* Rate scaling will work on indexes */ | 5319 | rates[i].hw_value = i; /* Rate scaling will work on indexes */ |
5340 | rates[i].val2 = i; | 5320 | rates[i].hw_value_short = i; |
5341 | rates[i].flags = IEEE80211_RATE_SUPPORTED; | 5321 | rates[i].flags = 0; |
5342 | /* Only OFDM have the bits-per-symbol set */ | 5322 | if ((i > IWL_LAST_OFDM_RATE) || (i < IWL_FIRST_OFDM_RATE)) { |
5343 | if ((i <= IWL_LAST_OFDM_RATE) && (i >= IWL_FIRST_OFDM_RATE)) | ||
5344 | rates[i].flags |= IEEE80211_RATE_OFDM; | ||
5345 | else { | ||
5346 | /* | 5323 | /* |
5347 | * If CCK 1M then set rate flag to CCK else CCK_2 | 5324 | * If CCK != 1M then set short preamble rate flag. |
5348 | * which is CCK | PREAMBLE2 | ||
5349 | */ | 5325 | */ |
5350 | rates[i].flags |= (iwl3945_rates[i].plcp == 10) ? | 5326 | rates[i].flags |= (iwl3945_rates[i].plcp == 10) ? |
5351 | IEEE80211_RATE_CCK : IEEE80211_RATE_CCK_2; | 5327 | 0 : IEEE80211_RATE_SHORT_PREAMBLE; |
5352 | } | 5328 | } |
5353 | |||
5354 | /* Set up which ones are basic rates... */ | ||
5355 | if (IWL_BASIC_RATES_MASK & (1 << i)) | ||
5356 | rates[i].flags |= IEEE80211_RATE_BASIC; | ||
5357 | } | 5329 | } |
5358 | } | 5330 | } |
5359 | 5331 | ||
@@ -5363,67 +5335,41 @@ static void iwl3945_init_hw_rates(struct iwl3945_priv *priv, | |||
5363 | static int iwl3945_init_geos(struct iwl3945_priv *priv) | 5335 | static int iwl3945_init_geos(struct iwl3945_priv *priv) |
5364 | { | 5336 | { |
5365 | struct iwl3945_channel_info *ch; | 5337 | struct iwl3945_channel_info *ch; |
5366 | struct ieee80211_hw_mode *modes; | 5338 | struct ieee80211_supported_band *band; |
5367 | struct ieee80211_channel *channels; | 5339 | struct ieee80211_channel *channels; |
5368 | struct ieee80211_channel *geo_ch; | 5340 | struct ieee80211_channel *geo_ch; |
5369 | struct ieee80211_rate *rates; | 5341 | struct ieee80211_rate *rates; |
5370 | int i = 0; | 5342 | int i = 0; |
5371 | enum { | ||
5372 | A = 0, | ||
5373 | B = 1, | ||
5374 | G = 2, | ||
5375 | }; | ||
5376 | int mode_count = 3; | ||
5377 | 5343 | ||
5378 | if (priv->modes) { | 5344 | if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates || |
5345 | priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) { | ||
5379 | IWL_DEBUG_INFO("Geography modes already initialized.\n"); | 5346 | IWL_DEBUG_INFO("Geography modes already initialized.\n"); |
5380 | set_bit(STATUS_GEO_CONFIGURED, &priv->status); | 5347 | set_bit(STATUS_GEO_CONFIGURED, &priv->status); |
5381 | return 0; | 5348 | return 0; |
5382 | } | 5349 | } |
5383 | 5350 | ||
5384 | modes = kzalloc(sizeof(struct ieee80211_hw_mode) * mode_count, | ||
5385 | GFP_KERNEL); | ||
5386 | if (!modes) | ||
5387 | return -ENOMEM; | ||
5388 | |||
5389 | channels = kzalloc(sizeof(struct ieee80211_channel) * | 5351 | channels = kzalloc(sizeof(struct ieee80211_channel) * |
5390 | priv->channel_count, GFP_KERNEL); | 5352 | priv->channel_count, GFP_KERNEL); |
5391 | if (!channels) { | 5353 | if (!channels) |
5392 | kfree(modes); | ||
5393 | return -ENOMEM; | 5354 | return -ENOMEM; |
5394 | } | ||
5395 | 5355 | ||
5396 | rates = kzalloc((sizeof(struct ieee80211_rate) * (IWL_MAX_RATES + 1)), | 5356 | rates = kzalloc((sizeof(struct ieee80211_rate) * (IWL_MAX_RATES + 1)), |
5397 | GFP_KERNEL); | 5357 | GFP_KERNEL); |
5398 | if (!rates) { | 5358 | if (!rates) { |
5399 | kfree(modes); | ||
5400 | kfree(channels); | 5359 | kfree(channels); |
5401 | return -ENOMEM; | 5360 | return -ENOMEM; |
5402 | } | 5361 | } |
5403 | 5362 | ||
5404 | /* 0 = 802.11a | ||
5405 | * 1 = 802.11b | ||
5406 | * 2 = 802.11g | ||
5407 | */ | ||
5408 | |||
5409 | /* 5.2GHz channels start after the 2.4GHz channels */ | 5363 | /* 5.2GHz channels start after the 2.4GHz channels */ |
5410 | modes[A].mode = MODE_IEEE80211A; | 5364 | band = &priv->bands[IEEE80211_BAND_5GHZ]; |
5411 | modes[A].channels = &channels[ARRAY_SIZE(iwl3945_eeprom_band_1)]; | 5365 | band->channels = &channels[ARRAY_SIZE(iwl3945_eeprom_band_1)]; |
5412 | modes[A].rates = &rates[4]; | 5366 | band->bitrates = &rates[4]; |
5413 | modes[A].num_rates = 8; /* just OFDM */ | 5367 | band->n_bitrates = 8; /* just OFDM */ |
5414 | modes[A].num_channels = 0; | 5368 | |
5415 | 5369 | band = &priv->bands[IEEE80211_BAND_2GHZ]; | |
5416 | modes[B].mode = MODE_IEEE80211B; | 5370 | band->channels = channels; |
5417 | modes[B].channels = channels; | 5371 | band->bitrates = rates; |
5418 | modes[B].rates = rates; | 5372 | band->n_bitrates = 12; /* OFDM & CCK */ |
5419 | modes[B].num_rates = 4; /* just CCK */ | ||
5420 | modes[B].num_channels = 0; | ||
5421 | |||
5422 | modes[G].mode = MODE_IEEE80211G; | ||
5423 | modes[G].channels = channels; | ||
5424 | modes[G].rates = rates; | ||
5425 | modes[G].num_rates = 12; /* OFDM & CCK */ | ||
5426 | modes[G].num_channels = 0; | ||
5427 | 5373 | ||
5428 | priv->ieee_channels = channels; | 5374 | priv->ieee_channels = channels; |
5429 | priv->ieee_rates = rates; | 5375 | priv->ieee_rates = rates; |
@@ -5442,37 +5388,32 @@ static int iwl3945_init_geos(struct iwl3945_priv *priv) | |||
5442 | } | 5388 | } |
5443 | 5389 | ||
5444 | if (is_channel_a_band(ch)) | 5390 | if (is_channel_a_band(ch)) |
5445 | geo_ch = &modes[A].channels[modes[A].num_channels++]; | 5391 | geo_ch = &priv->bands[IEEE80211_BAND_5GHZ].channels[priv->bands[IEEE80211_BAND_5GHZ].n_channels++]; |
5446 | else { | 5392 | else |
5447 | geo_ch = &modes[B].channels[modes[B].num_channels++]; | 5393 | geo_ch = &priv->bands[IEEE80211_BAND_2GHZ].channels[priv->bands[IEEE80211_BAND_2GHZ].n_channels++]; |
5448 | modes[G].num_channels++; | ||
5449 | } | ||
5450 | 5394 | ||
5451 | geo_ch->freq = ieee80211chan2mhz(ch->channel); | 5395 | geo_ch->center_freq = ieee80211chan2mhz(ch->channel); |
5452 | geo_ch->chan = ch->channel; | 5396 | geo_ch->max_power = ch->max_power_avg; |
5453 | geo_ch->power_level = ch->max_power_avg; | 5397 | geo_ch->max_antenna_gain = 0xff; |
5454 | geo_ch->antenna_max = 0xff; | ||
5455 | 5398 | ||
5456 | if (is_channel_valid(ch)) { | 5399 | if (is_channel_valid(ch)) { |
5457 | geo_ch->flag = IEEE80211_CHAN_W_SCAN; | 5400 | if (!(ch->flags & EEPROM_CHANNEL_IBSS)) |
5458 | if (ch->flags & EEPROM_CHANNEL_IBSS) | 5401 | geo_ch->flags |= IEEE80211_CHAN_NO_IBSS; |
5459 | geo_ch->flag |= IEEE80211_CHAN_W_IBSS; | ||
5460 | 5402 | ||
5461 | if (ch->flags & EEPROM_CHANNEL_ACTIVE) | 5403 | if (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) |
5462 | geo_ch->flag |= IEEE80211_CHAN_W_ACTIVE_SCAN; | 5404 | geo_ch->flags |= IEEE80211_CHAN_PASSIVE_SCAN; |
5463 | 5405 | ||
5464 | if (ch->flags & EEPROM_CHANNEL_RADAR) | 5406 | if (ch->flags & EEPROM_CHANNEL_RADAR) |
5465 | geo_ch->flag |= IEEE80211_CHAN_W_RADAR_DETECT; | 5407 | geo_ch->flags |= IEEE80211_CHAN_RADAR; |
5466 | 5408 | ||
5467 | if (ch->max_power_avg > priv->max_channel_txpower_limit) | 5409 | if (ch->max_power_avg > priv->max_channel_txpower_limit) |
5468 | priv->max_channel_txpower_limit = | 5410 | priv->max_channel_txpower_limit = |
5469 | ch->max_power_avg; | 5411 | ch->max_power_avg; |
5470 | } | 5412 | } else |
5471 | 5413 | geo_ch->flags |= IEEE80211_CHAN_DISABLED; | |
5472 | geo_ch->val = geo_ch->flag; | ||
5473 | } | 5414 | } |
5474 | 5415 | ||
5475 | if ((modes[A].num_channels == 0) && priv->is_abg) { | 5416 | if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) && priv->is_abg) { |
5476 | printk(KERN_INFO DRV_NAME | 5417 | printk(KERN_INFO DRV_NAME |
5477 | ": Incorrectly detected BG card as ABG. Please send " | 5418 | ": Incorrectly detected BG card as ABG. Please send " |
5478 | "your PCI ID 0x%04X:0x%04X to maintainer.\n", | 5419 | "your PCI ID 0x%04X:0x%04X to maintainer.\n", |
@@ -5482,24 +5423,12 @@ static int iwl3945_init_geos(struct iwl3945_priv *priv) | |||
5482 | 5423 | ||
5483 | printk(KERN_INFO DRV_NAME | 5424 | printk(KERN_INFO DRV_NAME |
5484 | ": Tunable channels: %d 802.11bg, %d 802.11a channels\n", | 5425 | ": Tunable channels: %d 802.11bg, %d 802.11a channels\n", |
5485 | modes[G].num_channels, modes[A].num_channels); | 5426 | priv->bands[IEEE80211_BAND_2GHZ].n_channels, |
5427 | priv->bands[IEEE80211_BAND_5GHZ].n_channels); | ||
5486 | 5428 | ||
5487 | /* | 5429 | priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->bands[IEEE80211_BAND_2GHZ]; |
5488 | * NOTE: We register these in preference of order -- the | 5430 | priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &priv->bands[IEEE80211_BAND_5GHZ]; |
5489 | * stack doesn't currently (as of 7.0.6 / Apr 24 '07) pick | ||
5490 | * a phymode based on rates or AP capabilities but seems to | ||
5491 | * configure it purely on if the channel being configured | ||
5492 | * is supported by a mode -- and the first match is taken | ||
5493 | */ | ||
5494 | |||
5495 | if (modes[G].num_channels) | ||
5496 | ieee80211_register_hwmode(priv->hw, &modes[G]); | ||
5497 | if (modes[B].num_channels) | ||
5498 | ieee80211_register_hwmode(priv->hw, &modes[B]); | ||
5499 | if (modes[A].num_channels) | ||
5500 | ieee80211_register_hwmode(priv->hw, &modes[A]); | ||
5501 | 5431 | ||
5502 | priv->modes = modes; | ||
5503 | set_bit(STATUS_GEO_CONFIGURED, &priv->status); | 5432 | set_bit(STATUS_GEO_CONFIGURED, &priv->status); |
5504 | 5433 | ||
5505 | return 0; | 5434 | return 0; |
@@ -5510,7 +5439,6 @@ static int iwl3945_init_geos(struct iwl3945_priv *priv) | |||
5510 | */ | 5439 | */ |
5511 | static void iwl3945_free_geos(struct iwl3945_priv *priv) | 5440 | static void iwl3945_free_geos(struct iwl3945_priv *priv) |
5512 | { | 5441 | { |
5513 | kfree(priv->modes); | ||
5514 | kfree(priv->ieee_channels); | 5442 | kfree(priv->ieee_channels); |
5515 | kfree(priv->ieee_rates); | 5443 | kfree(priv->ieee_rates); |
5516 | clear_bit(STATUS_GEO_CONFIGURED, &priv->status); | 5444 | clear_bit(STATUS_GEO_CONFIGURED, &priv->status); |
@@ -6519,7 +6447,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
6519 | struct iwl3945_scan_cmd *scan; | 6447 | struct iwl3945_scan_cmd *scan; |
6520 | struct ieee80211_conf *conf = NULL; | 6448 | struct ieee80211_conf *conf = NULL; |
6521 | u8 direct_mask; | 6449 | u8 direct_mask; |
6522 | int phymode; | 6450 | enum ieee80211_band band; |
6523 | 6451 | ||
6524 | conf = ieee80211_get_hw_conf(priv->hw); | 6452 | conf = ieee80211_get_hw_conf(priv->hw); |
6525 | 6453 | ||
@@ -6651,13 +6579,13 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
6651 | scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; | 6579 | scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; |
6652 | scan->tx_cmd.rate = IWL_RATE_1M_PLCP; | 6580 | scan->tx_cmd.rate = IWL_RATE_1M_PLCP; |
6653 | scan->good_CRC_th = 0; | 6581 | scan->good_CRC_th = 0; |
6654 | phymode = MODE_IEEE80211G; | 6582 | band = IEEE80211_BAND_2GHZ; |
6655 | break; | 6583 | break; |
6656 | 6584 | ||
6657 | case 1: | 6585 | case 1: |
6658 | scan->tx_cmd.rate = IWL_RATE_6M_PLCP; | 6586 | scan->tx_cmd.rate = IWL_RATE_6M_PLCP; |
6659 | scan->good_CRC_th = IWL_GOOD_CRC_TH; | 6587 | scan->good_CRC_th = IWL_GOOD_CRC_TH; |
6660 | phymode = MODE_IEEE80211A; | 6588 | band = IEEE80211_BAND_5GHZ; |
6661 | break; | 6589 | break; |
6662 | 6590 | ||
6663 | default: | 6591 | default: |
@@ -6680,7 +6608,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
6680 | 6608 | ||
6681 | scan->channel_count = | 6609 | scan->channel_count = |
6682 | iwl3945_get_channels_for_scan( | 6610 | iwl3945_get_channels_for_scan( |
6683 | priv, phymode, 1, /* active */ | 6611 | priv, band, 1, /* active */ |
6684 | direct_mask, | 6612 | direct_mask, |
6685 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); | 6613 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); |
6686 | 6614 | ||
@@ -6825,7 +6753,7 @@ static void iwl3945_bg_post_associate(struct work_struct *data) | |||
6825 | iwl3945_add_station(priv, iwl3945_broadcast_addr, 0, 0); | 6753 | iwl3945_add_station(priv, iwl3945_broadcast_addr, 0, 0); |
6826 | iwl3945_add_station(priv, priv->bssid, 0, 0); | 6754 | iwl3945_add_station(priv, priv->bssid, 0, 0); |
6827 | iwl3945_sync_sta(priv, IWL_STA_ID, | 6755 | iwl3945_sync_sta(priv, IWL_STA_ID, |
6828 | (priv->phymode == MODE_IEEE80211A)? | 6756 | (priv->band == IEEE80211_BAND_5GHZ) ? |
6829 | IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP, | 6757 | IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP, |
6830 | CMD_ASYNC); | 6758 | CMD_ASYNC); |
6831 | iwl3945_rate_scale_init(priv->hw, IWL_STA_ID); | 6759 | iwl3945_rate_scale_init(priv->hw, IWL_STA_ID); |
@@ -7020,7 +6948,7 @@ static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
7020 | } | 6948 | } |
7021 | 6949 | ||
7022 | IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, | 6950 | IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, |
7023 | ctl->tx_rate); | 6951 | ctl->tx_rate->bitrate); |
7024 | 6952 | ||
7025 | if (iwl3945_tx_skb(priv, skb, ctl)) | 6953 | if (iwl3945_tx_skb(priv, skb, ctl)) |
7026 | dev_kfree_skb_any(skb); | 6954 | dev_kfree_skb_any(skb); |
@@ -7079,7 +7007,7 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
7079 | int ret = 0; | 7007 | int ret = 0; |
7080 | 7008 | ||
7081 | mutex_lock(&priv->mutex); | 7009 | mutex_lock(&priv->mutex); |
7082 | IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel); | 7010 | IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel->hw_value); |
7083 | 7011 | ||
7084 | priv->add_radiotap = !!(conf->flags & IEEE80211_CONF_RADIOTAP); | 7012 | priv->add_radiotap = !!(conf->flags & IEEE80211_CONF_RADIOTAP); |
7085 | 7013 | ||
@@ -7099,19 +7027,20 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
7099 | 7027 | ||
7100 | spin_lock_irqsave(&priv->lock, flags); | 7028 | spin_lock_irqsave(&priv->lock, flags); |
7101 | 7029 | ||
7102 | ch_info = iwl3945_get_channel_info(priv, conf->phymode, conf->channel); | 7030 | ch_info = iwl3945_get_channel_info(priv, conf->channel->band, |
7031 | conf->channel->hw_value); | ||
7103 | if (!is_channel_valid(ch_info)) { | 7032 | if (!is_channel_valid(ch_info)) { |
7104 | IWL_DEBUG_SCAN("Channel %d [%d] is INVALID for this SKU.\n", | 7033 | IWL_DEBUG_SCAN("Channel %d [%d] is INVALID for this SKU.\n", |
7105 | conf->channel, conf->phymode); | 7034 | conf->channel->hw_value, conf->channel->band); |
7106 | IWL_DEBUG_MAC80211("leave - invalid channel\n"); | 7035 | IWL_DEBUG_MAC80211("leave - invalid channel\n"); |
7107 | spin_unlock_irqrestore(&priv->lock, flags); | 7036 | spin_unlock_irqrestore(&priv->lock, flags); |
7108 | ret = -EINVAL; | 7037 | ret = -EINVAL; |
7109 | goto out; | 7038 | goto out; |
7110 | } | 7039 | } |
7111 | 7040 | ||
7112 | iwl3945_set_rxon_channel(priv, conf->phymode, conf->channel); | 7041 | iwl3945_set_rxon_channel(priv, conf->channel->band, conf->channel->hw_value); |
7113 | 7042 | ||
7114 | iwl3945_set_flags_for_phymode(priv, conf->phymode); | 7043 | iwl3945_set_flags_for_phymode(priv, conf->channel->band); |
7115 | 7044 | ||
7116 | /* The list of supported rates and rate mask can be different | 7045 | /* The list of supported rates and rate mask can be different |
7117 | * for each phymode; since the phymode may have changed, reset | 7046 | * for each phymode; since the phymode may have changed, reset |
@@ -7892,65 +7821,6 @@ static ssize_t store_filter_flags(struct device *d, | |||
7892 | static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, show_filter_flags, | 7821 | static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, show_filter_flags, |
7893 | store_filter_flags); | 7822 | store_filter_flags); |
7894 | 7823 | ||
7895 | static ssize_t show_tune(struct device *d, | ||
7896 | struct device_attribute *attr, char *buf) | ||
7897 | { | ||
7898 | struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data; | ||
7899 | |||
7900 | return sprintf(buf, "0x%04X\n", | ||
7901 | (priv->phymode << 8) | | ||
7902 | le16_to_cpu(priv->active_rxon.channel)); | ||
7903 | } | ||
7904 | |||
7905 | static void iwl3945_set_flags_for_phymode(struct iwl3945_priv *priv, u8 phymode); | ||
7906 | |||
7907 | static ssize_t store_tune(struct device *d, | ||
7908 | struct device_attribute *attr, | ||
7909 | const char *buf, size_t count) | ||
7910 | { | ||
7911 | struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data; | ||
7912 | char *p = (char *)buf; | ||
7913 | u16 tune = simple_strtoul(p, &p, 0); | ||
7914 | u8 phymode = (tune >> 8) & 0xff; | ||
7915 | u16 channel = tune & 0xff; | ||
7916 | |||
7917 | IWL_DEBUG_INFO("Tune request to:%d channel:%d\n", phymode, channel); | ||
7918 | |||
7919 | mutex_lock(&priv->mutex); | ||
7920 | if ((le16_to_cpu(priv->staging_rxon.channel) != channel) || | ||
7921 | (priv->phymode != phymode)) { | ||
7922 | const struct iwl3945_channel_info *ch_info; | ||
7923 | |||
7924 | ch_info = iwl3945_get_channel_info(priv, phymode, channel); | ||
7925 | if (!ch_info) { | ||
7926 | IWL_WARNING("Requested invalid phymode/channel " | ||
7927 | "combination: %d %d\n", phymode, channel); | ||
7928 | mutex_unlock(&priv->mutex); | ||
7929 | return -EINVAL; | ||
7930 | } | ||
7931 | |||
7932 | /* Cancel any currently running scans... */ | ||
7933 | if (iwl3945_scan_cancel_timeout(priv, 100)) | ||
7934 | IWL_WARNING("Could not cancel scan.\n"); | ||
7935 | else { | ||
7936 | IWL_DEBUG_INFO("Committing phymode and " | ||
7937 | "rxon.channel = %d %d\n", | ||
7938 | phymode, channel); | ||
7939 | |||
7940 | iwl3945_set_rxon_channel(priv, phymode, channel); | ||
7941 | iwl3945_set_flags_for_phymode(priv, phymode); | ||
7942 | |||
7943 | iwl3945_set_rate(priv); | ||
7944 | iwl3945_commit_rxon(priv); | ||
7945 | } | ||
7946 | } | ||
7947 | mutex_unlock(&priv->mutex); | ||
7948 | |||
7949 | return count; | ||
7950 | } | ||
7951 | |||
7952 | static DEVICE_ATTR(tune, S_IWUSR | S_IRUGO, show_tune, store_tune); | ||
7953 | |||
7954 | #ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT | 7824 | #ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT |
7955 | 7825 | ||
7956 | static ssize_t show_measurement(struct device *d, | 7826 | static ssize_t show_measurement(struct device *d, |
@@ -8165,73 +8035,8 @@ static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level, | |||
8165 | static ssize_t show_channels(struct device *d, | 8035 | static ssize_t show_channels(struct device *d, |
8166 | struct device_attribute *attr, char *buf) | 8036 | struct device_attribute *attr, char *buf) |
8167 | { | 8037 | { |
8168 | struct iwl3945_priv *priv = dev_get_drvdata(d); | 8038 | /* all this shit doesn't belong into sysfs anyway */ |
8169 | int len = 0, i; | 8039 | return 0; |
8170 | struct ieee80211_channel *channels = NULL; | ||
8171 | const struct ieee80211_hw_mode *hw_mode = NULL; | ||
8172 | int count = 0; | ||
8173 | |||
8174 | if (!iwl3945_is_ready(priv)) | ||
8175 | return -EAGAIN; | ||
8176 | |||
8177 | hw_mode = iwl3945_get_hw_mode(priv, MODE_IEEE80211G); | ||
8178 | if (!hw_mode) | ||
8179 | hw_mode = iwl3945_get_hw_mode(priv, MODE_IEEE80211B); | ||
8180 | if (hw_mode) { | ||
8181 | channels = hw_mode->channels; | ||
8182 | count = hw_mode->num_channels; | ||
8183 | } | ||
8184 | |||
8185 | len += | ||
8186 | sprintf(&buf[len], | ||
8187 | "Displaying %d channels in 2.4GHz band " | ||
8188 | "(802.11bg):\n", count); | ||
8189 | |||
8190 | for (i = 0; i < count; i++) | ||
8191 | len += sprintf(&buf[len], "%d: %ddBm: BSS%s%s, %s.\n", | ||
8192 | channels[i].chan, | ||
8193 | channels[i].power_level, | ||
8194 | channels[i]. | ||
8195 | flag & IEEE80211_CHAN_W_RADAR_DETECT ? | ||
8196 | " (IEEE 802.11h required)" : "", | ||
8197 | (!(channels[i].flag & IEEE80211_CHAN_W_IBSS) | ||
8198 | || (channels[i]. | ||
8199 | flag & | ||
8200 | IEEE80211_CHAN_W_RADAR_DETECT)) ? "" : | ||
8201 | ", IBSS", | ||
8202 | channels[i]. | ||
8203 | flag & IEEE80211_CHAN_W_ACTIVE_SCAN ? | ||
8204 | "active/passive" : "passive only"); | ||
8205 | |||
8206 | hw_mode = iwl3945_get_hw_mode(priv, MODE_IEEE80211A); | ||
8207 | if (hw_mode) { | ||
8208 | channels = hw_mode->channels; | ||
8209 | count = hw_mode->num_channels; | ||
8210 | } else { | ||
8211 | channels = NULL; | ||
8212 | count = 0; | ||
8213 | } | ||
8214 | |||
8215 | len += sprintf(&buf[len], "Displaying %d channels in 5.2GHz band " | ||
8216 | "(802.11a):\n", count); | ||
8217 | |||
8218 | for (i = 0; i < count; i++) | ||
8219 | len += sprintf(&buf[len], "%d: %ddBm: BSS%s%s, %s.\n", | ||
8220 | channels[i].chan, | ||
8221 | channels[i].power_level, | ||
8222 | channels[i]. | ||
8223 | flag & IEEE80211_CHAN_W_RADAR_DETECT ? | ||
8224 | " (IEEE 802.11h required)" : "", | ||
8225 | (!(channels[i].flag & IEEE80211_CHAN_W_IBSS) | ||
8226 | || (channels[i]. | ||
8227 | flag & | ||
8228 | IEEE80211_CHAN_W_RADAR_DETECT)) ? "" : | ||
8229 | ", IBSS", | ||
8230 | channels[i]. | ||
8231 | flag & IEEE80211_CHAN_W_ACTIVE_SCAN ? | ||
8232 | "active/passive" : "passive only"); | ||
8233 | |||
8234 | return len; | ||
8235 | } | 8040 | } |
8236 | 8041 | ||
8237 | static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL); | 8042 | static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL); |
@@ -8411,7 +8216,6 @@ static struct attribute *iwl3945_sysfs_entries[] = { | |||
8411 | &dev_attr_statistics.attr, | 8216 | &dev_attr_statistics.attr, |
8412 | &dev_attr_status.attr, | 8217 | &dev_attr_status.attr, |
8413 | &dev_attr_temperature.attr, | 8218 | &dev_attr_temperature.attr, |
8414 | &dev_attr_tune.attr, | ||
8415 | &dev_attr_tx_power.attr, | 8219 | &dev_attr_tx_power.attr, |
8416 | 8220 | ||
8417 | NULL | 8221 | NULL |
@@ -8532,7 +8336,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
8532 | priv->data_retry_limit = -1; | 8336 | priv->data_retry_limit = -1; |
8533 | priv->ieee_channels = NULL; | 8337 | priv->ieee_channels = NULL; |
8534 | priv->ieee_rates = NULL; | 8338 | priv->ieee_rates = NULL; |
8535 | priv->phymode = -1; | 8339 | priv->band = IEEE80211_BAND_2GHZ; |
8536 | 8340 | ||
8537 | err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); | 8341 | err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); |
8538 | if (!err) | 8342 | if (!err) |
@@ -8614,7 +8418,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
8614 | priv->qos_data.qos_cap.val = 0; | 8418 | priv->qos_data.qos_cap.val = 0; |
8615 | #endif /* CONFIG_IWL3945_QOS */ | 8419 | #endif /* CONFIG_IWL3945_QOS */ |
8616 | 8420 | ||
8617 | iwl3945_set_rxon_channel(priv, MODE_IEEE80211G, 6); | 8421 | iwl3945_set_rxon_channel(priv, IEEE80211_BAND_2GHZ, 6); |
8618 | iwl3945_setup_deferred_work(priv); | 8422 | iwl3945_setup_deferred_work(priv); |
8619 | iwl3945_setup_rx_handlers(priv); | 8423 | iwl3945_setup_rx_handlers(priv); |
8620 | 8424 | ||
@@ -8665,7 +8469,6 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
8665 | IWL_ERROR("initializing geos failed: %d\n", err); | 8469 | IWL_ERROR("initializing geos failed: %d\n", err); |
8666 | goto out_free_channel_map; | 8470 | goto out_free_channel_map; |
8667 | } | 8471 | } |
8668 | iwl3945_reset_channel_flag(priv); | ||
8669 | 8472 | ||
8670 | iwl3945_rate_control_register(priv->hw); | 8473 | iwl3945_rate_control_register(priv->hw); |
8671 | err = ieee80211_register_hw(priv->hw); | 8474 | err = ieee80211_register_hw(priv->hw); |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 5f38fc585eda..6de969de4c84 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -115,16 +115,10 @@ __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr) | |||
115 | return NULL; | 115 | return NULL; |
116 | } | 116 | } |
117 | 117 | ||
118 | static const struct ieee80211_hw_mode *iwl4965_get_hw_mode( | 118 | static const struct ieee80211_supported_band *iwl4965_get_hw_mode( |
119 | struct iwl4965_priv *priv, int mode) | 119 | struct iwl4965_priv *priv, enum ieee80211_band band) |
120 | { | 120 | { |
121 | int i; | 121 | return priv->hw->wiphy->bands[band]; |
122 | |||
123 | for (i = 0; i < 3; i++) | ||
124 | if (priv->modes[i].mode == mode) | ||
125 | return &priv->modes[i]; | ||
126 | |||
127 | return NULL; | ||
128 | } | 122 | } |
129 | 123 | ||
130 | static int iwl4965_is_empty_essid(const char *essid, int essid_len) | 124 | static int iwl4965_is_empty_essid(const char *essid, int essid_len) |
@@ -937,28 +931,29 @@ static int iwl4965_rxon_add_station(struct iwl4965_priv *priv, | |||
937 | * NOTE: Does not commit to the hardware; it sets appropriate bit fields | 931 | * NOTE: Does not commit to the hardware; it sets appropriate bit fields |
938 | * in the staging RXON flag structure based on the phymode | 932 | * in the staging RXON flag structure based on the phymode |
939 | */ | 933 | */ |
940 | static int iwl4965_set_rxon_channel(struct iwl4965_priv *priv, u8 phymode, | 934 | static int iwl4965_set_rxon_channel(struct iwl4965_priv *priv, |
935 | enum ieee80211_band band, | ||
941 | u16 channel) | 936 | u16 channel) |
942 | { | 937 | { |
943 | if (!iwl4965_get_channel_info(priv, phymode, channel)) { | 938 | if (!iwl4965_get_channel_info(priv, band, channel)) { |
944 | IWL_DEBUG_INFO("Could not set channel to %d [%d]\n", | 939 | IWL_DEBUG_INFO("Could not set channel to %d [%d]\n", |
945 | channel, phymode); | 940 | channel, band); |
946 | return -EINVAL; | 941 | return -EINVAL; |
947 | } | 942 | } |
948 | 943 | ||
949 | if ((le16_to_cpu(priv->staging_rxon.channel) == channel) && | 944 | if ((le16_to_cpu(priv->staging_rxon.channel) == channel) && |
950 | (priv->phymode == phymode)) | 945 | (priv->band == band)) |
951 | return 0; | 946 | return 0; |
952 | 947 | ||
953 | priv->staging_rxon.channel = cpu_to_le16(channel); | 948 | priv->staging_rxon.channel = cpu_to_le16(channel); |
954 | if (phymode == MODE_IEEE80211A) | 949 | if (band == IEEE80211_BAND_5GHZ) |
955 | priv->staging_rxon.flags &= ~RXON_FLG_BAND_24G_MSK; | 950 | priv->staging_rxon.flags &= ~RXON_FLG_BAND_24G_MSK; |
956 | else | 951 | else |
957 | priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK; | 952 | priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK; |
958 | 953 | ||
959 | priv->phymode = phymode; | 954 | priv->band = band; |
960 | 955 | ||
961 | IWL_DEBUG_INFO("Staging channel set to %d [%d]\n", channel, phymode); | 956 | IWL_DEBUG_INFO("Staging channel set to %d [%d]\n", channel, band); |
962 | 957 | ||
963 | return 0; | 958 | return 0; |
964 | } | 959 | } |
@@ -2571,9 +2566,10 @@ static int iwl4965_set_rxon_hwcrypto(struct iwl4965_priv *priv, int hw_decrypt) | |||
2571 | return 0; | 2566 | return 0; |
2572 | } | 2567 | } |
2573 | 2568 | ||
2574 | static void iwl4965_set_flags_for_phymode(struct iwl4965_priv *priv, u8 phymode) | 2569 | static void iwl4965_set_flags_for_phymode(struct iwl4965_priv *priv, |
2570 | enum ieee80211_band band) | ||
2575 | { | 2571 | { |
2576 | if (phymode == MODE_IEEE80211A) { | 2572 | if (band == IEEE80211_BAND_5GHZ) { |
2577 | priv->staging_rxon.flags &= | 2573 | priv->staging_rxon.flags &= |
2578 | ~(RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK | 2574 | ~(RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK |
2579 | | RXON_FLG_CCK_MSK); | 2575 | | RXON_FLG_CCK_MSK); |
@@ -2636,7 +2632,7 @@ static void iwl4965_connection_init_rx_config(struct iwl4965_priv *priv) | |||
2636 | priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; | 2632 | priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; |
2637 | #endif | 2633 | #endif |
2638 | 2634 | ||
2639 | ch_info = iwl4965_get_channel_info(priv, priv->phymode, | 2635 | ch_info = iwl4965_get_channel_info(priv, priv->band, |
2640 | le16_to_cpu(priv->staging_rxon.channel)); | 2636 | le16_to_cpu(priv->staging_rxon.channel)); |
2641 | 2637 | ||
2642 | if (!ch_info) | 2638 | if (!ch_info) |
@@ -2651,12 +2647,9 @@ static void iwl4965_connection_init_rx_config(struct iwl4965_priv *priv) | |||
2651 | ch_info = &priv->channel_info[0]; | 2647 | ch_info = &priv->channel_info[0]; |
2652 | 2648 | ||
2653 | priv->staging_rxon.channel = cpu_to_le16(ch_info->channel); | 2649 | priv->staging_rxon.channel = cpu_to_le16(ch_info->channel); |
2654 | if (is_channel_a_band(ch_info)) | 2650 | priv->band = ch_info->band; |
2655 | priv->phymode = MODE_IEEE80211A; | ||
2656 | else | ||
2657 | priv->phymode = MODE_IEEE80211G; | ||
2658 | 2651 | ||
2659 | iwl4965_set_flags_for_phymode(priv, priv->phymode); | 2652 | iwl4965_set_flags_for_phymode(priv, priv->band); |
2660 | 2653 | ||
2661 | priv->staging_rxon.ofdm_basic_rates = | 2654 | priv->staging_rxon.ofdm_basic_rates = |
2662 | (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; | 2655 | (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; |
@@ -2678,7 +2671,7 @@ static int iwl4965_set_mode(struct iwl4965_priv *priv, int mode) | |||
2678 | const struct iwl4965_channel_info *ch_info; | 2671 | const struct iwl4965_channel_info *ch_info; |
2679 | 2672 | ||
2680 | ch_info = iwl4965_get_channel_info(priv, | 2673 | ch_info = iwl4965_get_channel_info(priv, |
2681 | priv->phymode, | 2674 | priv->band, |
2682 | le16_to_cpu(priv->staging_rxon.channel)); | 2675 | le16_to_cpu(priv->staging_rxon.channel)); |
2683 | 2676 | ||
2684 | if (!ch_info || !is_channel_ibss(ch_info)) { | 2677 | if (!ch_info || !is_channel_ibss(ch_info)) { |
@@ -2918,7 +2911,7 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv, | |||
2918 | goto drop_unlock; | 2911 | goto drop_unlock; |
2919 | } | 2912 | } |
2920 | 2913 | ||
2921 | if ((ctl->tx_rate & 0xFF) == IWL_INVALID_RATE) { | 2914 | if ((ctl->tx_rate->hw_value & 0xFF) == IWL_INVALID_RATE) { |
2922 | IWL_ERROR("ERROR: No TX rate available.\n"); | 2915 | IWL_ERROR("ERROR: No TX rate available.\n"); |
2923 | goto drop_unlock; | 2916 | goto drop_unlock; |
2924 | } | 2917 | } |
@@ -3125,11 +3118,11 @@ drop: | |||
3125 | 3118 | ||
3126 | static void iwl4965_set_rate(struct iwl4965_priv *priv) | 3119 | static void iwl4965_set_rate(struct iwl4965_priv *priv) |
3127 | { | 3120 | { |
3128 | const struct ieee80211_hw_mode *hw = NULL; | 3121 | const struct ieee80211_supported_band *hw = NULL; |
3129 | struct ieee80211_rate *rate; | 3122 | struct ieee80211_rate *rate; |
3130 | int i; | 3123 | int i; |
3131 | 3124 | ||
3132 | hw = iwl4965_get_hw_mode(priv, priv->phymode); | 3125 | hw = iwl4965_get_hw_mode(priv, priv->band); |
3133 | if (!hw) { | 3126 | if (!hw) { |
3134 | IWL_ERROR("Failed to set rate: unable to get hw mode\n"); | 3127 | IWL_ERROR("Failed to set rate: unable to get hw mode\n"); |
3135 | return; | 3128 | return; |
@@ -3138,24 +3131,10 @@ static void iwl4965_set_rate(struct iwl4965_priv *priv) | |||
3138 | priv->active_rate = 0; | 3131 | priv->active_rate = 0; |
3139 | priv->active_rate_basic = 0; | 3132 | priv->active_rate_basic = 0; |
3140 | 3133 | ||
3141 | IWL_DEBUG_RATE("Setting rates for 802.11%c\n", | 3134 | for (i = 0; i < hw->n_bitrates; i++) { |
3142 | hw->mode == MODE_IEEE80211A ? | 3135 | rate = &(hw->bitrates[i]); |
3143 | 'a' : ((hw->mode == MODE_IEEE80211B) ? 'b' : 'g')); | 3136 | if (rate->hw_value < IWL_RATE_COUNT) |
3144 | 3137 | priv->active_rate |= (1 << rate->hw_value); | |
3145 | for (i = 0; i < hw->num_rates; i++) { | ||
3146 | rate = &(hw->rates[i]); | ||
3147 | if ((rate->val < IWL_RATE_COUNT) && | ||
3148 | (rate->flags & IEEE80211_RATE_SUPPORTED)) { | ||
3149 | IWL_DEBUG_RATE("Adding rate index %d (plcp %d)%s\n", | ||
3150 | rate->val, iwl4965_rates[rate->val].plcp, | ||
3151 | (rate->flags & IEEE80211_RATE_BASIC) ? | ||
3152 | "*" : ""); | ||
3153 | priv->active_rate |= (1 << rate->val); | ||
3154 | if (rate->flags & IEEE80211_RATE_BASIC) | ||
3155 | priv->active_rate_basic |= (1 << rate->val); | ||
3156 | } else | ||
3157 | IWL_DEBUG_RATE("Not adding rate %d (plcp %d)\n", | ||
3158 | rate->val, iwl4965_rates[rate->val].plcp); | ||
3159 | } | 3138 | } |
3160 | 3139 | ||
3161 | IWL_DEBUG_RATE("Set active_rate = %0x, active_rate_basic = %0x\n", | 3140 | IWL_DEBUG_RATE("Set active_rate = %0x, active_rate_basic = %0x\n", |
@@ -3775,9 +3754,6 @@ static void iwl4965_rx_reply_tx(struct iwl4965_priv *priv, | |||
3775 | tx_status->flags = | 3754 | tx_status->flags = |
3776 | iwl4965_is_tx_success(status) ? IEEE80211_TX_STATUS_ACK : 0; | 3755 | iwl4965_is_tx_success(status) ? IEEE80211_TX_STATUS_ACK : 0; |
3777 | 3756 | ||
3778 | tx_status->control.tx_rate = | ||
3779 | iwl4965_hw_get_rate_n_flags(tx_resp->rate_n_flags); | ||
3780 | |||
3781 | IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) rate_n_flags 0x%x " | 3757 | IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) rate_n_flags 0x%x " |
3782 | "retries %d\n", txq_id, iwl4965_get_tx_fail_reason(status), | 3758 | "retries %d\n", txq_id, iwl4965_get_tx_fail_reason(status), |
3783 | status, le32_to_cpu(tx_resp->rate_n_flags), | 3759 | status, le32_to_cpu(tx_resp->rate_n_flags), |
@@ -5419,24 +5395,23 @@ static void iwl4965_init_band_reference(const struct iwl4965_priv *priv, | |||
5419 | * Based on band and channel number. | 5395 | * Based on band and channel number. |
5420 | */ | 5396 | */ |
5421 | const struct iwl4965_channel_info *iwl4965_get_channel_info(const struct iwl4965_priv *priv, | 5397 | const struct iwl4965_channel_info *iwl4965_get_channel_info(const struct iwl4965_priv *priv, |
5422 | int phymode, u16 channel) | 5398 | enum ieee80211_band band, u16 channel) |
5423 | { | 5399 | { |
5424 | int i; | 5400 | int i; |
5425 | 5401 | ||
5426 | switch (phymode) { | 5402 | switch (band) { |
5427 | case MODE_IEEE80211A: | 5403 | case IEEE80211_BAND_5GHZ: |
5428 | for (i = 14; i < priv->channel_count; i++) { | 5404 | for (i = 14; i < priv->channel_count; i++) { |
5429 | if (priv->channel_info[i].channel == channel) | 5405 | if (priv->channel_info[i].channel == channel) |
5430 | return &priv->channel_info[i]; | 5406 | return &priv->channel_info[i]; |
5431 | } | 5407 | } |
5432 | break; | 5408 | break; |
5433 | 5409 | case IEEE80211_BAND_2GHZ: | |
5434 | case MODE_IEEE80211B: | ||
5435 | case MODE_IEEE80211G: | ||
5436 | if (channel >= 1 && channel <= 14) | 5410 | if (channel >= 1 && channel <= 14) |
5437 | return &priv->channel_info[channel - 1]; | 5411 | return &priv->channel_info[channel - 1]; |
5438 | break; | 5412 | break; |
5439 | 5413 | default: | |
5414 | BUG(); | ||
5440 | } | 5415 | } |
5441 | 5416 | ||
5442 | return NULL; | 5417 | return NULL; |
@@ -5499,8 +5474,8 @@ static int iwl4965_init_channel_map(struct iwl4965_priv *priv) | |||
5499 | /* Loop through each band adding each of the channels */ | 5474 | /* Loop through each band adding each of the channels */ |
5500 | for (ch = 0; ch < eeprom_ch_count; ch++) { | 5475 | for (ch = 0; ch < eeprom_ch_count; ch++) { |
5501 | ch_info->channel = eeprom_ch_index[ch]; | 5476 | ch_info->channel = eeprom_ch_index[ch]; |
5502 | ch_info->phymode = (band == 1) ? MODE_IEEE80211B : | 5477 | ch_info->band = (band == 1) ? IEEE80211_BAND_2GHZ : |
5503 | MODE_IEEE80211A; | 5478 | IEEE80211_BAND_5GHZ; |
5504 | 5479 | ||
5505 | /* permanently store EEPROM's channel regulatory flags | 5480 | /* permanently store EEPROM's channel regulatory flags |
5506 | * and max power in channel info database. */ | 5481 | * and max power in channel info database. */ |
@@ -5559,14 +5534,14 @@ static int iwl4965_init_channel_map(struct iwl4965_priv *priv) | |||
5559 | 5534 | ||
5560 | /* Two additional EEPROM bands for 2.4 and 5 GHz FAT channels */ | 5535 | /* Two additional EEPROM bands for 2.4 and 5 GHz FAT channels */ |
5561 | for (band = 6; band <= 7; band++) { | 5536 | for (band = 6; band <= 7; band++) { |
5562 | int phymode; | 5537 | enum ieee80211_band ieeeband; |
5563 | u8 fat_extension_chan; | 5538 | u8 fat_extension_chan; |
5564 | 5539 | ||
5565 | iwl4965_init_band_reference(priv, band, &eeprom_ch_count, | 5540 | iwl4965_init_band_reference(priv, band, &eeprom_ch_count, |
5566 | &eeprom_ch_info, &eeprom_ch_index); | 5541 | &eeprom_ch_info, &eeprom_ch_index); |
5567 | 5542 | ||
5568 | /* EEPROM band 6 is 2.4, band 7 is 5 GHz */ | 5543 | /* EEPROM band 6 is 2.4, band 7 is 5 GHz */ |
5569 | phymode = (band == 6) ? MODE_IEEE80211B : MODE_IEEE80211A; | 5544 | ieeeband = (band == 6) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ; |
5570 | 5545 | ||
5571 | /* Loop through each band adding each of the channels */ | 5546 | /* Loop through each band adding each of the channels */ |
5572 | for (ch = 0; ch < eeprom_ch_count; ch++) { | 5547 | for (ch = 0; ch < eeprom_ch_count; ch++) { |
@@ -5580,13 +5555,13 @@ static int iwl4965_init_channel_map(struct iwl4965_priv *priv) | |||
5580 | fat_extension_chan = HT_IE_EXT_CHANNEL_ABOVE; | 5555 | fat_extension_chan = HT_IE_EXT_CHANNEL_ABOVE; |
5581 | 5556 | ||
5582 | /* Set up driver's info for lower half */ | 5557 | /* Set up driver's info for lower half */ |
5583 | iwl4965_set_fat_chan_info(priv, phymode, | 5558 | iwl4965_set_fat_chan_info(priv, ieeeband, |
5584 | eeprom_ch_index[ch], | 5559 | eeprom_ch_index[ch], |
5585 | &(eeprom_ch_info[ch]), | 5560 | &(eeprom_ch_info[ch]), |
5586 | fat_extension_chan); | 5561 | fat_extension_chan); |
5587 | 5562 | ||
5588 | /* Set up driver's info for upper half */ | 5563 | /* Set up driver's info for upper half */ |
5589 | iwl4965_set_fat_chan_info(priv, phymode, | 5564 | iwl4965_set_fat_chan_info(priv, ieeeband, |
5590 | (eeprom_ch_index[ch] + 4), | 5565 | (eeprom_ch_index[ch] + 4), |
5591 | &(eeprom_ch_info[ch]), | 5566 | &(eeprom_ch_info[ch]), |
5592 | HT_IE_EXT_CHANNEL_BELOW); | 5567 | HT_IE_EXT_CHANNEL_BELOW); |
@@ -5628,18 +5603,20 @@ static void iwl4965_free_channel_map(struct iwl4965_priv *priv) | |||
5628 | #define IWL_PASSIVE_DWELL_BASE (100) | 5603 | #define IWL_PASSIVE_DWELL_BASE (100) |
5629 | #define IWL_CHANNEL_TUNE_TIME 5 | 5604 | #define IWL_CHANNEL_TUNE_TIME 5 |
5630 | 5605 | ||
5631 | static inline u16 iwl4965_get_active_dwell_time(struct iwl4965_priv *priv, int phymode) | 5606 | static inline u16 iwl4965_get_active_dwell_time(struct iwl4965_priv *priv, |
5607 | enum ieee80211_band band) | ||
5632 | { | 5608 | { |
5633 | if (phymode == MODE_IEEE80211A) | 5609 | if (band == IEEE80211_BAND_5GHZ) |
5634 | return IWL_ACTIVE_DWELL_TIME_52; | 5610 | return IWL_ACTIVE_DWELL_TIME_52; |
5635 | else | 5611 | else |
5636 | return IWL_ACTIVE_DWELL_TIME_24; | 5612 | return IWL_ACTIVE_DWELL_TIME_24; |
5637 | } | 5613 | } |
5638 | 5614 | ||
5639 | static u16 iwl4965_get_passive_dwell_time(struct iwl4965_priv *priv, int phymode) | 5615 | static u16 iwl4965_get_passive_dwell_time(struct iwl4965_priv *priv, |
5616 | enum ieee80211_band band) | ||
5640 | { | 5617 | { |
5641 | u16 active = iwl4965_get_active_dwell_time(priv, phymode); | 5618 | u16 active = iwl4965_get_active_dwell_time(priv, band); |
5642 | u16 passive = (phymode != MODE_IEEE80211A) ? | 5619 | u16 passive = (band != IEEE80211_BAND_5GHZ) ? |
5643 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : | 5620 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : |
5644 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52; | 5621 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52; |
5645 | 5622 | ||
@@ -5659,28 +5636,29 @@ static u16 iwl4965_get_passive_dwell_time(struct iwl4965_priv *priv, int phymode | |||
5659 | return passive; | 5636 | return passive; |
5660 | } | 5637 | } |
5661 | 5638 | ||
5662 | static int iwl4965_get_channels_for_scan(struct iwl4965_priv *priv, int phymode, | 5639 | static int iwl4965_get_channels_for_scan(struct iwl4965_priv *priv, |
5640 | enum ieee80211_band band, | ||
5663 | u8 is_active, u8 direct_mask, | 5641 | u8 is_active, u8 direct_mask, |
5664 | struct iwl4965_scan_channel *scan_ch) | 5642 | struct iwl4965_scan_channel *scan_ch) |
5665 | { | 5643 | { |
5666 | const struct ieee80211_channel *channels = NULL; | 5644 | const struct ieee80211_channel *channels = NULL; |
5667 | const struct ieee80211_hw_mode *hw_mode; | 5645 | const struct ieee80211_supported_band *sband; |
5668 | const struct iwl4965_channel_info *ch_info; | 5646 | const struct iwl4965_channel_info *ch_info; |
5669 | u16 passive_dwell = 0; | 5647 | u16 passive_dwell = 0; |
5670 | u16 active_dwell = 0; | 5648 | u16 active_dwell = 0; |
5671 | int added, i; | 5649 | int added, i; |
5672 | 5650 | ||
5673 | hw_mode = iwl4965_get_hw_mode(priv, phymode); | 5651 | sband = iwl4965_get_hw_mode(priv, band); |
5674 | if (!hw_mode) | 5652 | if (!sband) |
5675 | return 0; | 5653 | return 0; |
5676 | 5654 | ||
5677 | channels = hw_mode->channels; | 5655 | channels = sband->channels; |
5678 | 5656 | ||
5679 | active_dwell = iwl4965_get_active_dwell_time(priv, phymode); | 5657 | active_dwell = iwl4965_get_active_dwell_time(priv, band); |
5680 | passive_dwell = iwl4965_get_passive_dwell_time(priv, phymode); | 5658 | passive_dwell = iwl4965_get_passive_dwell_time(priv, band); |
5681 | 5659 | ||
5682 | for (i = 0, added = 0; i < hw_mode->num_channels; i++) { | 5660 | for (i = 0, added = 0; i < sband->n_channels; i++) { |
5683 | if (channels[i].chan == | 5661 | if (ieee80211_frequency_to_channel(channels[i].center_freq) == |
5684 | le16_to_cpu(priv->active_rxon.channel)) { | 5662 | le16_to_cpu(priv->active_rxon.channel)) { |
5685 | if (iwl4965_is_associated(priv)) { | 5663 | if (iwl4965_is_associated(priv)) { |
5686 | IWL_DEBUG_SCAN | 5664 | IWL_DEBUG_SCAN |
@@ -5691,9 +5669,9 @@ static int iwl4965_get_channels_for_scan(struct iwl4965_priv *priv, int phymode, | |||
5691 | } else if (priv->only_active_channel) | 5669 | } else if (priv->only_active_channel) |
5692 | continue; | 5670 | continue; |
5693 | 5671 | ||
5694 | scan_ch->channel = channels[i].chan; | 5672 | scan_ch->channel = ieee80211_frequency_to_channel(channels[i].center_freq); |
5695 | 5673 | ||
5696 | ch_info = iwl4965_get_channel_info(priv, phymode, | 5674 | ch_info = iwl4965_get_channel_info(priv, band, |
5697 | scan_ch->channel); | 5675 | scan_ch->channel); |
5698 | if (!is_channel_valid(ch_info)) { | 5676 | if (!is_channel_valid(ch_info)) { |
5699 | IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n", | 5677 | IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n", |
@@ -5702,7 +5680,7 @@ static int iwl4965_get_channels_for_scan(struct iwl4965_priv *priv, int phymode, | |||
5702 | } | 5680 | } |
5703 | 5681 | ||
5704 | if (!is_active || is_channel_passive(ch_info) || | 5682 | if (!is_active || is_channel_passive(ch_info) || |
5705 | !(channels[i].flag & IEEE80211_CHAN_W_ACTIVE_SCAN)) | 5683 | (channels[i].flags & IEEE80211_CHAN_PASSIVE_SCAN)) |
5706 | scan_ch->type = 0; /* passive */ | 5684 | scan_ch->type = 0; /* passive */ |
5707 | else | 5685 | else |
5708 | scan_ch->type = 1; /* active */ | 5686 | scan_ch->type = 1; /* active */ |
@@ -5721,7 +5699,7 @@ static int iwl4965_get_channels_for_scan(struct iwl4965_priv *priv, int phymode, | |||
5721 | /* scan_pwr_info->tpc.dsp_atten; */ | 5699 | /* scan_pwr_info->tpc.dsp_atten; */ |
5722 | 5700 | ||
5723 | /*scan_pwr_info->tpc.tx_gain; */ | 5701 | /*scan_pwr_info->tpc.tx_gain; */ |
5724 | if (phymode == MODE_IEEE80211A) | 5702 | if (band == IEEE80211_BAND_5GHZ) |
5725 | scan_ch->tpc.tx_gain = ((1 << 5) | (3 << 3)) | 3; | 5703 | scan_ch->tpc.tx_gain = ((1 << 5) | (3 << 3)) | 3; |
5726 | else { | 5704 | else { |
5727 | scan_ch->tpc.tx_gain = ((1 << 5) | (5 << 3)); | 5705 | scan_ch->tpc.tx_gain = ((1 << 5) | (5 << 3)); |
@@ -5745,41 +5723,23 @@ static int iwl4965_get_channels_for_scan(struct iwl4965_priv *priv, int phymode, | |||
5745 | return added; | 5723 | return added; |
5746 | } | 5724 | } |
5747 | 5725 | ||
5748 | static void iwl4965_reset_channel_flag(struct iwl4965_priv *priv) | ||
5749 | { | ||
5750 | int i, j; | ||
5751 | for (i = 0; i < 3; i++) { | ||
5752 | struct ieee80211_hw_mode *hw_mode = (void *)&priv->modes[i]; | ||
5753 | for (j = 0; j < hw_mode->num_channels; j++) | ||
5754 | hw_mode->channels[j].flag = hw_mode->channels[j].val; | ||
5755 | } | ||
5756 | } | ||
5757 | |||
5758 | static void iwl4965_init_hw_rates(struct iwl4965_priv *priv, | 5726 | static void iwl4965_init_hw_rates(struct iwl4965_priv *priv, |
5759 | struct ieee80211_rate *rates) | 5727 | struct ieee80211_rate *rates) |
5760 | { | 5728 | { |
5761 | int i; | 5729 | int i; |
5762 | 5730 | ||
5763 | for (i = 0; i < IWL_RATE_COUNT; i++) { | 5731 | for (i = 0; i < IWL_RATE_COUNT; i++) { |
5764 | rates[i].rate = iwl4965_rates[i].ieee * 5; | 5732 | rates[i].bitrate = iwl4965_rates[i].ieee * 5; |
5765 | rates[i].val = i; /* Rate scaling will work on indexes */ | 5733 | rates[i].hw_value = i; /* Rate scaling will work on indexes */ |
5766 | rates[i].val2 = i; | 5734 | rates[i].hw_value_short = i; |
5767 | rates[i].flags = IEEE80211_RATE_SUPPORTED; | 5735 | rates[i].flags = 0; |
5768 | /* Only OFDM have the bits-per-symbol set */ | 5736 | if ((i > IWL_LAST_OFDM_RATE) || (i < IWL_FIRST_OFDM_RATE)) { |
5769 | if ((i <= IWL_LAST_OFDM_RATE) && (i >= IWL_FIRST_OFDM_RATE)) | ||
5770 | rates[i].flags |= IEEE80211_RATE_OFDM; | ||
5771 | else { | ||
5772 | /* | 5737 | /* |
5773 | * If CCK 1M then set rate flag to CCK else CCK_2 | 5738 | * If CCK != 1M then set short preamble rate flag. |
5774 | * which is CCK | PREAMBLE2 | ||
5775 | */ | 5739 | */ |
5776 | rates[i].flags |= (iwl4965_rates[i].plcp == 10) ? | 5740 | rates[i].flags |= (iwl4965_rates[i].plcp == 10) ? |
5777 | IEEE80211_RATE_CCK : IEEE80211_RATE_CCK_2; | 5741 | 0 : IEEE80211_RATE_SHORT_PREAMBLE; |
5778 | } | 5742 | } |
5779 | |||
5780 | /* Set up which ones are basic rates... */ | ||
5781 | if (IWL_BASIC_RATES_MASK & (1 << i)) | ||
5782 | rates[i].flags |= IEEE80211_RATE_BASIC; | ||
5783 | } | 5743 | } |
5784 | } | 5744 | } |
5785 | 5745 | ||
@@ -5789,74 +5749,47 @@ static void iwl4965_init_hw_rates(struct iwl4965_priv *priv, | |||
5789 | static int iwl4965_init_geos(struct iwl4965_priv *priv) | 5749 | static int iwl4965_init_geos(struct iwl4965_priv *priv) |
5790 | { | 5750 | { |
5791 | struct iwl4965_channel_info *ch; | 5751 | struct iwl4965_channel_info *ch; |
5792 | struct ieee80211_hw_mode *modes; | 5752 | struct ieee80211_supported_band *band; |
5793 | struct ieee80211_channel *channels; | 5753 | struct ieee80211_channel *channels; |
5794 | struct ieee80211_channel *geo_ch; | 5754 | struct ieee80211_channel *geo_ch; |
5795 | struct ieee80211_rate *rates; | 5755 | struct ieee80211_rate *rates; |
5796 | int i = 0; | 5756 | int i = 0; |
5797 | enum { | ||
5798 | A = 0, | ||
5799 | B = 1, | ||
5800 | G = 2, | ||
5801 | }; | ||
5802 | int mode_count = 3; | ||
5803 | 5757 | ||
5804 | if (priv->modes) { | 5758 | if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates || |
5759 | priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) { | ||
5805 | IWL_DEBUG_INFO("Geography modes already initialized.\n"); | 5760 | IWL_DEBUG_INFO("Geography modes already initialized.\n"); |
5806 | set_bit(STATUS_GEO_CONFIGURED, &priv->status); | 5761 | set_bit(STATUS_GEO_CONFIGURED, &priv->status); |
5807 | return 0; | 5762 | return 0; |
5808 | } | 5763 | } |
5809 | 5764 | ||
5810 | modes = kzalloc(sizeof(struct ieee80211_hw_mode) * mode_count, | ||
5811 | GFP_KERNEL); | ||
5812 | if (!modes) | ||
5813 | return -ENOMEM; | ||
5814 | |||
5815 | channels = kzalloc(sizeof(struct ieee80211_channel) * | 5765 | channels = kzalloc(sizeof(struct ieee80211_channel) * |
5816 | priv->channel_count, GFP_KERNEL); | 5766 | priv->channel_count, GFP_KERNEL); |
5817 | if (!channels) { | 5767 | if (!channels) |
5818 | kfree(modes); | ||
5819 | return -ENOMEM; | 5768 | return -ENOMEM; |
5820 | } | ||
5821 | 5769 | ||
5822 | rates = kzalloc((sizeof(struct ieee80211_rate) * (IWL_MAX_RATES + 1)), | 5770 | rates = kzalloc((sizeof(struct ieee80211_rate) * (IWL_MAX_RATES + 1)), |
5823 | GFP_KERNEL); | 5771 | GFP_KERNEL); |
5824 | if (!rates) { | 5772 | if (!rates) { |
5825 | kfree(modes); | ||
5826 | kfree(channels); | 5773 | kfree(channels); |
5827 | return -ENOMEM; | 5774 | return -ENOMEM; |
5828 | } | 5775 | } |
5829 | 5776 | ||
5830 | /* 0 = 802.11a | ||
5831 | * 1 = 802.11b | ||
5832 | * 2 = 802.11g | ||
5833 | */ | ||
5834 | |||
5835 | /* 5.2GHz channels start after the 2.4GHz channels */ | 5777 | /* 5.2GHz channels start after the 2.4GHz channels */ |
5836 | modes[A].mode = MODE_IEEE80211A; | ||
5837 | modes[A].channels = &channels[ARRAY_SIZE(iwl4965_eeprom_band_1)]; | ||
5838 | modes[A].rates = rates; | ||
5839 | modes[A].num_rates = 8; /* just OFDM */ | ||
5840 | modes[A].rates = &rates[4]; | ||
5841 | modes[A].num_channels = 0; | ||
5842 | #ifdef CONFIG_IWL4965_HT | 5778 | #ifdef CONFIG_IWL4965_HT |
5843 | iwl4965_init_ht_hw_capab(&modes[A].ht_info, MODE_IEEE80211A); | 5779 | iwl4965_init_ht_hw_capab(&modes[A].ht_info, MODE_IEEE80211A); |
5844 | #endif | 5780 | #endif |
5845 | |||
5846 | modes[B].mode = MODE_IEEE80211B; | ||
5847 | modes[B].channels = channels; | ||
5848 | modes[B].rates = rates; | ||
5849 | modes[B].num_rates = 4; /* just CCK */ | ||
5850 | modes[B].num_channels = 0; | ||
5851 | |||
5852 | modes[G].mode = MODE_IEEE80211G; | ||
5853 | modes[G].channels = channels; | ||
5854 | modes[G].rates = rates; | ||
5855 | modes[G].num_rates = 12; /* OFDM & CCK */ | ||
5856 | modes[G].num_channels = 0; | ||
5857 | #ifdef CONFIG_IWL4965_HT | 5781 | #ifdef CONFIG_IWL4965_HT |
5858 | iwl4965_init_ht_hw_capab(&modes[G].ht_info, MODE_IEEE80211G); | 5782 | iwl4965_init_ht_hw_capab(&modes[G].ht_info, MODE_IEEE80211G); |
5859 | #endif | 5783 | #endif |
5784 | band = &priv->bands[IEEE80211_BAND_5GHZ]; | ||
5785 | band->channels = &channels[ARRAY_SIZE(iwl4965_eeprom_band_1)]; | ||
5786 | band->bitrates = &rates[4]; | ||
5787 | band->n_bitrates = 8; /* just OFDM */ | ||
5788 | |||
5789 | band = &priv->bands[IEEE80211_BAND_2GHZ]; | ||
5790 | band->channels = channels; | ||
5791 | band->bitrates = rates; | ||
5792 | band->n_bitrates = 12; /* OFDM & CCK */ | ||
5860 | 5793 | ||
5861 | priv->ieee_channels = channels; | 5794 | priv->ieee_channels = channels; |
5862 | priv->ieee_rates = rates; | 5795 | priv->ieee_rates = rates; |
@@ -5875,37 +5808,32 @@ static int iwl4965_init_geos(struct iwl4965_priv *priv) | |||
5875 | } | 5808 | } |
5876 | 5809 | ||
5877 | if (is_channel_a_band(ch)) { | 5810 | if (is_channel_a_band(ch)) { |
5878 | geo_ch = &modes[A].channels[modes[A].num_channels++]; | 5811 | geo_ch = &priv->bands[IEEE80211_BAND_5GHZ].channels[priv->bands[IEEE80211_BAND_5GHZ].n_channels++]; |
5879 | } else { | 5812 | } else |
5880 | geo_ch = &modes[B].channels[modes[B].num_channels++]; | 5813 | geo_ch = &priv->bands[IEEE80211_BAND_2GHZ].channels[priv->bands[IEEE80211_BAND_2GHZ].n_channels++]; |
5881 | modes[G].num_channels++; | ||
5882 | } | ||
5883 | 5814 | ||
5884 | geo_ch->freq = ieee80211chan2mhz(ch->channel); | 5815 | geo_ch->center_freq = ieee80211chan2mhz(ch->channel); |
5885 | geo_ch->chan = ch->channel; | 5816 | geo_ch->max_power = ch->max_power_avg; |
5886 | geo_ch->power_level = ch->max_power_avg; | 5817 | geo_ch->max_antenna_gain = 0xff; |
5887 | geo_ch->antenna_max = 0xff; | ||
5888 | 5818 | ||
5889 | if (is_channel_valid(ch)) { | 5819 | if (is_channel_valid(ch)) { |
5890 | geo_ch->flag = IEEE80211_CHAN_W_SCAN; | 5820 | if (!(ch->flags & EEPROM_CHANNEL_IBSS)) |
5891 | if (ch->flags & EEPROM_CHANNEL_IBSS) | 5821 | geo_ch->flags |= IEEE80211_CHAN_NO_IBSS; |
5892 | geo_ch->flag |= IEEE80211_CHAN_W_IBSS; | ||
5893 | 5822 | ||
5894 | if (ch->flags & EEPROM_CHANNEL_ACTIVE) | 5823 | if (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) |
5895 | geo_ch->flag |= IEEE80211_CHAN_W_ACTIVE_SCAN; | 5824 | geo_ch->flags |= IEEE80211_CHAN_PASSIVE_SCAN; |
5896 | 5825 | ||
5897 | if (ch->flags & EEPROM_CHANNEL_RADAR) | 5826 | if (ch->flags & EEPROM_CHANNEL_RADAR) |
5898 | geo_ch->flag |= IEEE80211_CHAN_W_RADAR_DETECT; | 5827 | geo_ch->flags |= IEEE80211_CHAN_RADAR; |
5899 | 5828 | ||
5900 | if (ch->max_power_avg > priv->max_channel_txpower_limit) | 5829 | if (ch->max_power_avg > priv->max_channel_txpower_limit) |
5901 | priv->max_channel_txpower_limit = | 5830 | priv->max_channel_txpower_limit = |
5902 | ch->max_power_avg; | 5831 | ch->max_power_avg; |
5903 | } | 5832 | } else |
5904 | 5833 | geo_ch->flags |= IEEE80211_CHAN_DISABLED; | |
5905 | geo_ch->val = geo_ch->flag; | ||
5906 | } | 5834 | } |
5907 | 5835 | ||
5908 | if ((modes[A].num_channels == 0) && priv->is_abg) { | 5836 | if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) && priv->is_abg) { |
5909 | printk(KERN_INFO DRV_NAME | 5837 | printk(KERN_INFO DRV_NAME |
5910 | ": Incorrectly detected BG card as ABG. Please send " | 5838 | ": Incorrectly detected BG card as ABG. Please send " |
5911 | "your PCI ID 0x%04X:0x%04X to maintainer.\n", | 5839 | "your PCI ID 0x%04X:0x%04X to maintainer.\n", |
@@ -5915,24 +5843,12 @@ static int iwl4965_init_geos(struct iwl4965_priv *priv) | |||
5915 | 5843 | ||
5916 | printk(KERN_INFO DRV_NAME | 5844 | printk(KERN_INFO DRV_NAME |
5917 | ": Tunable channels: %d 802.11bg, %d 802.11a channels\n", | 5845 | ": Tunable channels: %d 802.11bg, %d 802.11a channels\n", |
5918 | modes[G].num_channels, modes[A].num_channels); | 5846 | priv->bands[IEEE80211_BAND_2GHZ].n_channels, |
5919 | 5847 | priv->bands[IEEE80211_BAND_5GHZ].n_channels); | |
5920 | /* | ||
5921 | * NOTE: We register these in preference of order -- the | ||
5922 | * stack doesn't currently (as of 7.0.6 / Apr 24 '07) pick | ||
5923 | * a phymode based on rates or AP capabilities but seems to | ||
5924 | * configure it purely on if the channel being configured | ||
5925 | * is supported by a mode -- and the first match is taken | ||
5926 | */ | ||
5927 | 5848 | ||
5928 | if (modes[G].num_channels) | 5849 | priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->bands[IEEE80211_BAND_2GHZ]; |
5929 | ieee80211_register_hwmode(priv->hw, &modes[G]); | 5850 | priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &priv->bands[IEEE80211_BAND_5GHZ]; |
5930 | if (modes[B].num_channels) | ||
5931 | ieee80211_register_hwmode(priv->hw, &modes[B]); | ||
5932 | if (modes[A].num_channels) | ||
5933 | ieee80211_register_hwmode(priv->hw, &modes[A]); | ||
5934 | 5851 | ||
5935 | priv->modes = modes; | ||
5936 | set_bit(STATUS_GEO_CONFIGURED, &priv->status); | 5852 | set_bit(STATUS_GEO_CONFIGURED, &priv->status); |
5937 | 5853 | ||
5938 | return 0; | 5854 | return 0; |
@@ -5943,7 +5859,6 @@ static int iwl4965_init_geos(struct iwl4965_priv *priv) | |||
5943 | */ | 5859 | */ |
5944 | static void iwl4965_free_geos(struct iwl4965_priv *priv) | 5860 | static void iwl4965_free_geos(struct iwl4965_priv *priv) |
5945 | { | 5861 | { |
5946 | kfree(priv->modes); | ||
5947 | kfree(priv->ieee_channels); | 5862 | kfree(priv->ieee_channels); |
5948 | kfree(priv->ieee_rates); | 5863 | kfree(priv->ieee_rates); |
5949 | clear_bit(STATUS_GEO_CONFIGURED, &priv->status); | 5864 | clear_bit(STATUS_GEO_CONFIGURED, &priv->status); |
@@ -6945,7 +6860,7 @@ static void iwl4965_bg_request_scan(struct work_struct *data) | |||
6945 | struct iwl4965_scan_cmd *scan; | 6860 | struct iwl4965_scan_cmd *scan; |
6946 | struct ieee80211_conf *conf = NULL; | 6861 | struct ieee80211_conf *conf = NULL; |
6947 | u8 direct_mask; | 6862 | u8 direct_mask; |
6948 | int phymode; | 6863 | enum ieee80211_band band; |
6949 | 6864 | ||
6950 | conf = ieee80211_get_hw_conf(priv->hw); | 6865 | conf = ieee80211_get_hw_conf(priv->hw); |
6951 | 6866 | ||
@@ -7075,7 +6990,7 @@ static void iwl4965_bg_request_scan(struct work_struct *data) | |||
7075 | RATE_MCS_ANT_B_MSK|RATE_MCS_CCK_MSK); | 6990 | RATE_MCS_ANT_B_MSK|RATE_MCS_CCK_MSK); |
7076 | 6991 | ||
7077 | scan->good_CRC_th = 0; | 6992 | scan->good_CRC_th = 0; |
7078 | phymode = MODE_IEEE80211G; | 6993 | band = IEEE80211_BAND_2GHZ; |
7079 | break; | 6994 | break; |
7080 | 6995 | ||
7081 | case 1: | 6996 | case 1: |
@@ -7083,7 +6998,7 @@ static void iwl4965_bg_request_scan(struct work_struct *data) | |||
7083 | iwl4965_hw_set_rate_n_flags(IWL_RATE_6M_PLCP, | 6998 | iwl4965_hw_set_rate_n_flags(IWL_RATE_6M_PLCP, |
7084 | RATE_MCS_ANT_B_MSK); | 6999 | RATE_MCS_ANT_B_MSK); |
7085 | scan->good_CRC_th = IWL_GOOD_CRC_TH; | 7000 | scan->good_CRC_th = IWL_GOOD_CRC_TH; |
7086 | phymode = MODE_IEEE80211A; | 7001 | band = IEEE80211_BAND_5GHZ; |
7087 | break; | 7002 | break; |
7088 | 7003 | ||
7089 | default: | 7004 | default: |
@@ -7113,7 +7028,7 @@ static void iwl4965_bg_request_scan(struct work_struct *data) | |||
7113 | 7028 | ||
7114 | scan->channel_count = | 7029 | scan->channel_count = |
7115 | iwl4965_get_channels_for_scan( | 7030 | iwl4965_get_channels_for_scan( |
7116 | priv, phymode, 1, /* active */ | 7031 | priv, band, 1, /* active */ |
7117 | direct_mask, | 7032 | direct_mask, |
7118 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); | 7033 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); |
7119 | 7034 | ||
@@ -7463,7 +7378,7 @@ static int iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
7463 | } | 7378 | } |
7464 | 7379 | ||
7465 | IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, | 7380 | IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, |
7466 | ctl->tx_rate); | 7381 | ctl->tx_rate->bitrate); |
7467 | 7382 | ||
7468 | if (iwl4965_tx_skb(priv, skb, ctl)) | 7383 | if (iwl4965_tx_skb(priv, skb, ctl)) |
7469 | dev_kfree_skb_any(skb); | 7384 | dev_kfree_skb_any(skb); |
@@ -7522,7 +7437,7 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
7522 | int ret = 0; | 7437 | int ret = 0; |
7523 | 7438 | ||
7524 | mutex_lock(&priv->mutex); | 7439 | mutex_lock(&priv->mutex); |
7525 | IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel); | 7440 | IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel->hw_value); |
7526 | 7441 | ||
7527 | priv->add_radiotap = !!(conf->flags & IEEE80211_CONF_RADIOTAP); | 7442 | priv->add_radiotap = !!(conf->flags & IEEE80211_CONF_RADIOTAP); |
7528 | 7443 | ||
@@ -7542,10 +7457,9 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
7542 | 7457 | ||
7543 | spin_lock_irqsave(&priv->lock, flags); | 7458 | spin_lock_irqsave(&priv->lock, flags); |
7544 | 7459 | ||
7545 | ch_info = iwl4965_get_channel_info(priv, conf->phymode, conf->channel); | 7460 | ch_info = iwl4965_get_channel_info(priv, conf->channel->band, |
7461 | ieee80211_frequency_to_channel(conf->channel->center_freq)); | ||
7546 | if (!is_channel_valid(ch_info)) { | 7462 | if (!is_channel_valid(ch_info)) { |
7547 | IWL_DEBUG_SCAN("Channel %d [%d] is INVALID for this SKU.\n", | ||
7548 | conf->channel, conf->phymode); | ||
7549 | IWL_DEBUG_MAC80211("leave - invalid channel\n"); | 7463 | IWL_DEBUG_MAC80211("leave - invalid channel\n"); |
7550 | spin_unlock_irqrestore(&priv->lock, flags); | 7464 | spin_unlock_irqrestore(&priv->lock, flags); |
7551 | ret = -EINVAL; | 7465 | ret = -EINVAL; |
@@ -7564,12 +7478,13 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
7564 | priv->staging_rxon.flags = 0; | 7478 | priv->staging_rxon.flags = 0; |
7565 | #endif /* CONFIG_IWL4965_HT */ | 7479 | #endif /* CONFIG_IWL4965_HT */ |
7566 | 7480 | ||
7567 | iwl4965_set_rxon_channel(priv, conf->phymode, conf->channel); | 7481 | iwl4965_set_rxon_channel(priv, conf->channel->band, |
7482 | ieee80211_frequency_to_channel(conf->channel->center_freq)); | ||
7568 | 7483 | ||
7569 | iwl4965_set_flags_for_phymode(priv, conf->phymode); | 7484 | iwl4965_set_flags_for_phymode(priv, conf->channel->band); |
7570 | 7485 | ||
7571 | /* The list of supported rates and rate mask can be different | 7486 | /* The list of supported rates and rate mask can be different |
7572 | * for each phymode; since the phymode may have changed, reset | 7487 | * for each band; since the band may have changed, reset |
7573 | * the rate mask to what mac80211 lists */ | 7488 | * the rate mask to what mac80211 lists */ |
7574 | iwl4965_set_rate(priv); | 7489 | iwl4965_set_rate(priv); |
7575 | 7490 | ||
@@ -7839,7 +7754,7 @@ static void iwl4965_bss_info_changed(struct ieee80211_hw *hw, | |||
7839 | } | 7754 | } |
7840 | 7755 | ||
7841 | if (changes & BSS_CHANGED_ERP_CTS_PROT) { | 7756 | if (changes & BSS_CHANGED_ERP_CTS_PROT) { |
7842 | if (bss_conf->use_cts_prot && (priv->phymode != MODE_IEEE80211A)) | 7757 | if (bss_conf->use_cts_prot && (priv->band != IEEE80211_BAND_5GHZ)) |
7843 | priv->staging_rxon.flags |= RXON_FLG_TGG_PROTECT_MSK; | 7758 | priv->staging_rxon.flags |= RXON_FLG_TGG_PROTECT_MSK; |
7844 | else | 7759 | else |
7845 | priv->staging_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK; | 7760 | priv->staging_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK; |
@@ -8277,7 +8192,6 @@ static void iwl4965_set_ht_capab(struct ieee80211_hw *hw, | |||
8277 | u8 use_current_config) | 8192 | u8 use_current_config) |
8278 | { | 8193 | { |
8279 | struct ieee80211_conf *conf = &hw->conf; | 8194 | struct ieee80211_conf *conf = &hw->conf; |
8280 | struct ieee80211_hw_mode *mode = conf->mode; | ||
8281 | 8195 | ||
8282 | if (use_current_config) { | 8196 | if (use_current_config) { |
8283 | ht_cap->cap_info = cpu_to_le16(conf->ht_conf.cap); | 8197 | ht_cap->cap_info = cpu_to_le16(conf->ht_conf.cap); |
@@ -8488,65 +8402,6 @@ static ssize_t store_filter_flags(struct device *d, | |||
8488 | static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, show_filter_flags, | 8402 | static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, show_filter_flags, |
8489 | store_filter_flags); | 8403 | store_filter_flags); |
8490 | 8404 | ||
8491 | static ssize_t show_tune(struct device *d, | ||
8492 | struct device_attribute *attr, char *buf) | ||
8493 | { | ||
8494 | struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; | ||
8495 | |||
8496 | return sprintf(buf, "0x%04X\n", | ||
8497 | (priv->phymode << 8) | | ||
8498 | le16_to_cpu(priv->active_rxon.channel)); | ||
8499 | } | ||
8500 | |||
8501 | static void iwl4965_set_flags_for_phymode(struct iwl4965_priv *priv, u8 phymode); | ||
8502 | |||
8503 | static ssize_t store_tune(struct device *d, | ||
8504 | struct device_attribute *attr, | ||
8505 | const char *buf, size_t count) | ||
8506 | { | ||
8507 | struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; | ||
8508 | char *p = (char *)buf; | ||
8509 | u16 tune = simple_strtoul(p, &p, 0); | ||
8510 | u8 phymode = (tune >> 8) & 0xff; | ||
8511 | u16 channel = tune & 0xff; | ||
8512 | |||
8513 | IWL_DEBUG_INFO("Tune request to:%d channel:%d\n", phymode, channel); | ||
8514 | |||
8515 | mutex_lock(&priv->mutex); | ||
8516 | if ((le16_to_cpu(priv->staging_rxon.channel) != channel) || | ||
8517 | (priv->phymode != phymode)) { | ||
8518 | const struct iwl4965_channel_info *ch_info; | ||
8519 | |||
8520 | ch_info = iwl4965_get_channel_info(priv, phymode, channel); | ||
8521 | if (!ch_info) { | ||
8522 | IWL_WARNING("Requested invalid phymode/channel " | ||
8523 | "combination: %d %d\n", phymode, channel); | ||
8524 | mutex_unlock(&priv->mutex); | ||
8525 | return -EINVAL; | ||
8526 | } | ||
8527 | |||
8528 | /* Cancel any currently running scans... */ | ||
8529 | if (iwl4965_scan_cancel_timeout(priv, 100)) | ||
8530 | IWL_WARNING("Could not cancel scan.\n"); | ||
8531 | else { | ||
8532 | IWL_DEBUG_INFO("Committing phymode and " | ||
8533 | "rxon.channel = %d %d\n", | ||
8534 | phymode, channel); | ||
8535 | |||
8536 | iwl4965_set_rxon_channel(priv, phymode, channel); | ||
8537 | iwl4965_set_flags_for_phymode(priv, phymode); | ||
8538 | |||
8539 | iwl4965_set_rate(priv); | ||
8540 | iwl4965_commit_rxon(priv); | ||
8541 | } | ||
8542 | } | ||
8543 | mutex_unlock(&priv->mutex); | ||
8544 | |||
8545 | return count; | ||
8546 | } | ||
8547 | |||
8548 | static DEVICE_ATTR(tune, S_IWUSR | S_IRUGO, show_tune, store_tune); | ||
8549 | |||
8550 | #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT | 8405 | #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT |
8551 | 8406 | ||
8552 | static ssize_t show_measurement(struct device *d, | 8407 | static ssize_t show_measurement(struct device *d, |
@@ -8736,73 +8591,8 @@ static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level, | |||
8736 | static ssize_t show_channels(struct device *d, | 8591 | static ssize_t show_channels(struct device *d, |
8737 | struct device_attribute *attr, char *buf) | 8592 | struct device_attribute *attr, char *buf) |
8738 | { | 8593 | { |
8739 | struct iwl4965_priv *priv = dev_get_drvdata(d); | 8594 | /* all this shit doesn't belong into sysfs anyway */ |
8740 | int len = 0, i; | 8595 | return 0; |
8741 | struct ieee80211_channel *channels = NULL; | ||
8742 | const struct ieee80211_hw_mode *hw_mode = NULL; | ||
8743 | int count = 0; | ||
8744 | |||
8745 | if (!iwl4965_is_ready(priv)) | ||
8746 | return -EAGAIN; | ||
8747 | |||
8748 | hw_mode = iwl4965_get_hw_mode(priv, MODE_IEEE80211G); | ||
8749 | if (!hw_mode) | ||
8750 | hw_mode = iwl4965_get_hw_mode(priv, MODE_IEEE80211B); | ||
8751 | if (hw_mode) { | ||
8752 | channels = hw_mode->channels; | ||
8753 | count = hw_mode->num_channels; | ||
8754 | } | ||
8755 | |||
8756 | len += | ||
8757 | sprintf(&buf[len], | ||
8758 | "Displaying %d channels in 2.4GHz band " | ||
8759 | "(802.11bg):\n", count); | ||
8760 | |||
8761 | for (i = 0; i < count; i++) | ||
8762 | len += sprintf(&buf[len], "%d: %ddBm: BSS%s%s, %s.\n", | ||
8763 | channels[i].chan, | ||
8764 | channels[i].power_level, | ||
8765 | channels[i]. | ||
8766 | flag & IEEE80211_CHAN_W_RADAR_DETECT ? | ||
8767 | " (IEEE 802.11h required)" : "", | ||
8768 | (!(channels[i].flag & IEEE80211_CHAN_W_IBSS) | ||
8769 | || (channels[i]. | ||
8770 | flag & | ||
8771 | IEEE80211_CHAN_W_RADAR_DETECT)) ? "" : | ||
8772 | ", IBSS", | ||
8773 | channels[i]. | ||
8774 | flag & IEEE80211_CHAN_W_ACTIVE_SCAN ? | ||
8775 | "active/passive" : "passive only"); | ||
8776 | |||
8777 | hw_mode = iwl4965_get_hw_mode(priv, MODE_IEEE80211A); | ||
8778 | if (hw_mode) { | ||
8779 | channels = hw_mode->channels; | ||
8780 | count = hw_mode->num_channels; | ||
8781 | } else { | ||
8782 | channels = NULL; | ||
8783 | count = 0; | ||
8784 | } | ||
8785 | |||
8786 | len += sprintf(&buf[len], "Displaying %d channels in 5.2GHz band " | ||
8787 | "(802.11a):\n", count); | ||
8788 | |||
8789 | for (i = 0; i < count; i++) | ||
8790 | len += sprintf(&buf[len], "%d: %ddBm: BSS%s%s, %s.\n", | ||
8791 | channels[i].chan, | ||
8792 | channels[i].power_level, | ||
8793 | channels[i]. | ||
8794 | flag & IEEE80211_CHAN_W_RADAR_DETECT ? | ||
8795 | " (IEEE 802.11h required)" : "", | ||
8796 | (!(channels[i].flag & IEEE80211_CHAN_W_IBSS) | ||
8797 | || (channels[i]. | ||
8798 | flag & | ||
8799 | IEEE80211_CHAN_W_RADAR_DETECT)) ? "" : | ||
8800 | ", IBSS", | ||
8801 | channels[i]. | ||
8802 | flag & IEEE80211_CHAN_W_ACTIVE_SCAN ? | ||
8803 | "active/passive" : "passive only"); | ||
8804 | |||
8805 | return len; | ||
8806 | } | 8596 | } |
8807 | 8597 | ||
8808 | static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL); | 8598 | static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL); |
@@ -8981,7 +8771,6 @@ static struct attribute *iwl4965_sysfs_entries[] = { | |||
8981 | &dev_attr_statistics.attr, | 8771 | &dev_attr_statistics.attr, |
8982 | &dev_attr_status.attr, | 8772 | &dev_attr_status.attr, |
8983 | &dev_attr_temperature.attr, | 8773 | &dev_attr_temperature.attr, |
8984 | &dev_attr_tune.attr, | ||
8985 | &dev_attr_tx_power.attr, | 8774 | &dev_attr_tx_power.attr, |
8986 | 8775 | ||
8987 | NULL | 8776 | NULL |
@@ -9109,7 +8898,7 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
9109 | priv->data_retry_limit = -1; | 8898 | priv->data_retry_limit = -1; |
9110 | priv->ieee_channels = NULL; | 8899 | priv->ieee_channels = NULL; |
9111 | priv->ieee_rates = NULL; | 8900 | priv->ieee_rates = NULL; |
9112 | priv->phymode = -1; | 8901 | priv->band = IEEE80211_BAND_2GHZ; |
9113 | 8902 | ||
9114 | err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); | 8903 | err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); |
9115 | if (!err) | 8904 | if (!err) |
@@ -9175,7 +8964,7 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
9175 | priv->qos_data.qos_cap.val = 0; | 8964 | priv->qos_data.qos_cap.val = 0; |
9176 | #endif /* CONFIG_IWL4965_QOS */ | 8965 | #endif /* CONFIG_IWL4965_QOS */ |
9177 | 8966 | ||
9178 | iwl4965_set_rxon_channel(priv, MODE_IEEE80211G, 6); | 8967 | iwl4965_set_rxon_channel(priv, IEEE80211_BAND_2GHZ, 6); |
9179 | iwl4965_setup_deferred_work(priv); | 8968 | iwl4965_setup_deferred_work(priv); |
9180 | iwl4965_setup_rx_handlers(priv); | 8969 | iwl4965_setup_rx_handlers(priv); |
9181 | 8970 | ||
@@ -9226,7 +9015,6 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
9226 | IWL_ERROR("initializing geos failed: %d\n", err); | 9015 | IWL_ERROR("initializing geos failed: %d\n", err); |
9227 | goto out_free_channel_map; | 9016 | goto out_free_channel_map; |
9228 | } | 9017 | } |
9229 | iwl4965_reset_channel_flag(priv); | ||
9230 | 9018 | ||
9231 | iwl4965_rate_control_register(priv->hw); | 9019 | iwl4965_rate_control_register(priv->hw); |
9232 | err = ieee80211_register_hw(priv->hw); | 9020 | err = ieee80211_register_hw(priv->hw); |