diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 65 |
1 files changed, 60 insertions, 5 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 3e5bffb6034f..a27872de4106 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -1844,6 +1844,49 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv) | |||
1844 | #endif | 1844 | #endif |
1845 | } | 1845 | } |
1846 | 1846 | ||
1847 | static int iwl3945_get_single_channel_for_scan(struct iwl_priv *priv, | ||
1848 | struct ieee80211_vif *vif, | ||
1849 | enum ieee80211_band band, | ||
1850 | struct iwl3945_scan_channel *scan_ch) | ||
1851 | { | ||
1852 | const struct ieee80211_supported_band *sband; | ||
1853 | u16 passive_dwell = 0; | ||
1854 | u16 active_dwell = 0; | ||
1855 | int added = 0; | ||
1856 | u8 channel = 0; | ||
1857 | |||
1858 | sband = iwl_get_hw_mode(priv, band); | ||
1859 | if (!sband) { | ||
1860 | IWL_ERR(priv, "invalid band\n"); | ||
1861 | return added; | ||
1862 | } | ||
1863 | |||
1864 | active_dwell = iwl_get_active_dwell_time(priv, band, 0); | ||
1865 | passive_dwell = iwl_get_passive_dwell_time(priv, band, vif); | ||
1866 | |||
1867 | if (passive_dwell <= active_dwell) | ||
1868 | passive_dwell = active_dwell + 1; | ||
1869 | |||
1870 | |||
1871 | channel = iwl_get_single_channel_number(priv, band); | ||
1872 | |||
1873 | if (channel) { | ||
1874 | scan_ch->channel = channel; | ||
1875 | scan_ch->type = 0; /* passive */ | ||
1876 | scan_ch->active_dwell = cpu_to_le16(active_dwell); | ||
1877 | scan_ch->passive_dwell = cpu_to_le16(passive_dwell); | ||
1878 | /* Set txpower levels to defaults */ | ||
1879 | scan_ch->tpc.dsp_atten = 110; | ||
1880 | if (band == IEEE80211_BAND_5GHZ) | ||
1881 | scan_ch->tpc.tx_gain = ((1 << 5) | (3 << 3)) | 3; | ||
1882 | else | ||
1883 | scan_ch->tpc.tx_gain = ((1 << 5) | (5 << 3)); | ||
1884 | added++; | ||
1885 | } else | ||
1886 | IWL_ERR(priv, "no valid channel found\n"); | ||
1887 | return added; | ||
1888 | } | ||
1889 | |||
1847 | static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, | 1890 | static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, |
1848 | enum ieee80211_band band, | 1891 | enum ieee80211_band band, |
1849 | u8 is_active, u8 n_probes, | 1892 | u8 is_active, u8 n_probes, |
@@ -2992,9 +3035,16 @@ void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
2992 | /* select Rx antennas */ | 3035 | /* select Rx antennas */ |
2993 | scan->flags |= iwl3945_get_antenna_flags(priv); | 3036 | scan->flags |= iwl3945_get_antenna_flags(priv); |
2994 | 3037 | ||
2995 | scan->channel_count = | 3038 | if (priv->is_internal_short_scan) { |
2996 | iwl3945_get_channels_for_scan(priv, band, is_active, n_probes, | 3039 | scan->channel_count = |
2997 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)], vif); | 3040 | iwl3945_get_single_channel_for_scan(priv, vif, band, |
3041 | (void *)&scan->data[le16_to_cpu( | ||
3042 | scan->tx_cmd.len)]); | ||
3043 | } else { | ||
3044 | scan->channel_count = | ||
3045 | iwl3945_get_channels_for_scan(priv, band, is_active, n_probes, | ||
3046 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)], vif); | ||
3047 | } | ||
2998 | 3048 | ||
2999 | if (scan->channel_count == 0) { | 3049 | if (scan->channel_count == 0) { |
3000 | IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); | 3050 | IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); |
@@ -3387,10 +3437,13 @@ static int iwl3945_mac_sta_add(struct ieee80211_hw *hw, | |||
3387 | bool is_ap = vif->type == NL80211_IFTYPE_STATION; | 3437 | bool is_ap = vif->type == NL80211_IFTYPE_STATION; |
3388 | u8 sta_id; | 3438 | u8 sta_id; |
3389 | 3439 | ||
3390 | sta_priv->common.sta_id = IWL_INVALID_STATION; | ||
3391 | |||
3392 | IWL_DEBUG_INFO(priv, "received request to add station %pM\n", | 3440 | IWL_DEBUG_INFO(priv, "received request to add station %pM\n", |
3393 | sta->addr); | 3441 | sta->addr); |
3442 | mutex_lock(&priv->mutex); | ||
3443 | IWL_DEBUG_INFO(priv, "proceeding to add station %pM\n", | ||
3444 | sta->addr); | ||
3445 | sta_priv->common.sta_id = IWL_INVALID_STATION; | ||
3446 | |||
3394 | 3447 | ||
3395 | ret = iwl_add_station_common(priv, sta->addr, is_ap, &sta->ht_cap, | 3448 | ret = iwl_add_station_common(priv, sta->addr, is_ap, &sta->ht_cap, |
3396 | &sta_id); | 3449 | &sta_id); |
@@ -3398,6 +3451,7 @@ static int iwl3945_mac_sta_add(struct ieee80211_hw *hw, | |||
3398 | IWL_ERR(priv, "Unable to add station %pM (%d)\n", | 3451 | IWL_ERR(priv, "Unable to add station %pM (%d)\n", |
3399 | sta->addr, ret); | 3452 | sta->addr, ret); |
3400 | /* Should we return success if return code is EEXIST ? */ | 3453 | /* Should we return success if return code is EEXIST ? */ |
3454 | mutex_unlock(&priv->mutex); | ||
3401 | return ret; | 3455 | return ret; |
3402 | } | 3456 | } |
3403 | 3457 | ||
@@ -3407,6 +3461,7 @@ static int iwl3945_mac_sta_add(struct ieee80211_hw *hw, | |||
3407 | IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", | 3461 | IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", |
3408 | sta->addr); | 3462 | sta->addr); |
3409 | iwl3945_rs_rate_init(priv, sta, sta_id); | 3463 | iwl3945_rs_rate_init(priv, sta, sta_id); |
3464 | mutex_unlock(&priv->mutex); | ||
3410 | 3465 | ||
3411 | return 0; | 3466 | return 0; |
3412 | } | 3467 | } |