diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-01-24 13:38:38 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-02-29 15:19:32 -0500 |
commit | 8318d78a44d49ac1edf2bdec7299de3617c4232e (patch) | |
tree | d434634418edd7399737801615d247be06616fdd /drivers/net/wireless/iwlwifi/iwl-4965.c | |
parent | 10b6b80145cc93887dd8aab99bfffa375e9add31 (diff) |
cfg80211 API for channels/bitrates, mac80211 and driver conversion
This patch creates new cfg80211 wiphy API for channel and bitrate
registration and converts mac80211 and drivers to the new API. The
old mac80211 API is completely ripped out. All drivers (except ath5k)
are updated to the new API, in many cases I expect that optimisations
can be done.
Along with the regulatory code I've also ripped out the
IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED flag, I believe it to be
unnecessary if the hardware simply gives us whatever channels it wants
to support and we then enable/disable them as required, which is pretty
much required for travelling.
Additionally, the patch adds proper "basic" rate handling for STA
mode interface, AP mode interface will have to have new API added
to allow userspace to set the basic rate set, currently it'll be
empty... However, the basic rate handling will need to be moved to
the BSS conf stuff.
I do expect there to be bugs in this, especially wrt. transmit
power handling where I'm basically clueless about how it should work.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-4965.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 43 |
1 files changed, 21 insertions, 22 deletions
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 | ||