@@ -5808,7 +5808,7 @@ static int ath11k_mac_op_start(struct ieee80211_hw *hw)
/* TODO: Do we need to enable ANI? */
- ath11k_reg_update_chan_list(ar);
+ ath11k_reg_update_chan_list(ar, NULL);
ar->num_started_vdevs = 0;
ar->num_created_vdevs = 0;
@@ -102,18 +102,19 @@ ath11k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request)
ar->regdom_set_by_user = true;
}
-int ath11k_reg_update_chan_list(struct ath11k *ar)
+int ath11k_reg_update_chan_list(struct ath11k *ar, const struct scan_req_params *arg)
{
struct ieee80211_supported_band **bands;
struct scan_chan_list_params *params;
- struct ieee80211_channel *channel;
- struct ieee80211_hw *hw = ar->hw;
struct channel_param *ch;
+ struct cfg80211_chan_def *chandef;
+ struct ieee80211_channel *channel, *req_channel;
enum nl80211_band band;
int num_channels = 0;
- int i, ret;
+ int params_len, i, ret;
+ bool found = false;
- bands = hw->wiphy->bands;
+ bands = ar->hw->wiphy->bands;
for (band = 0; band < NUM_NL80211_BANDS; band++) {
if (!bands[band])
continue;
@@ -130,8 +131,10 @@ int ath11k_reg_update_chan_list(struct ath11k *ar)
if (WARN_ON(!num_channels))
return -EINVAL;
- params = kzalloc(struct_size(params, ch_param, num_channels),
- GFP_KERNEL);
+ params_len = sizeof(struct scan_chan_list_params) +
+ num_channels * sizeof(struct channel_param);
+
+ params = kzalloc(params_len, GFP_KERNEL);
if (!params)
return -ENOMEM;
@@ -139,6 +142,8 @@ int ath11k_reg_update_chan_list(struct ath11k *ar)
params->nallchans = num_channels;
ch = params->ch_param;
+ chandef = arg ? arg->chandef : NULL;
+ req_channel = chandef ? chandef->chan : NULL;
for (band = 0; band < NUM_NL80211_BANDS; band++) {
if (!bands[band])
@@ -150,6 +155,22 @@ int ath11k_reg_update_chan_list(struct ath11k *ar)
if (channel->flags & IEEE80211_CHAN_DISABLED)
continue;
+ if (req_channel && !found &&
+ req_channel->center_freq == channel->center_freq) {
+ ch->mhz = chandef->chan->center_freq;
+ ch->cfreq1 = chandef->center_freq1;
+ ch->cfreq2 = chandef->center_freq2;
+
+ ch->phy_mode = arg->phymode;
+ channel = req_channel;
+ found = true;
+ } else {
+ ch->mhz = channel->center_freq;
+ ch->cfreq1 = channel->center_freq;
+ ch->phy_mode = (channel->band == NL80211_BAND_2GHZ) ?
+ MODE_11G : MODE_11A;
+ }
+
/* TODO: Set to true/false based on some condition? */
ch->allow_ht = true;
ch->allow_vht = true;
@@ -163,15 +184,9 @@ int ath11k_reg_update_chan_list(struct ath11k *ar)
ch->mhz = channel->center_freq;
ch->cfreq1 = channel->center_freq;
ch->minpower = 0;
- ch->maxpower = channel->max_power * 2;
- ch->maxregpower = channel->max_reg_power * 2;
- ch->antennamax = channel->max_antenna_gain * 2;
-
- /* TODO: Use appropriate phymodes */
- if (channel->band == NL80211_BAND_2GHZ)
- ch->phy_mode = MODE_11G;
- else
- ch->phy_mode = MODE_11A;
+ ch->maxpower = channel->max_power;
+ ch->maxregpower = channel->max_reg_power;
+ ch->antennamax = channel->max_antenna_gain;
if (channel->band == NL80211_BAND_6GHZ &&
cfg80211_channel_is_psc(channel))
@@ -282,7 +297,7 @@ int ath11k_regd_update(struct ath11k *ar)
goto err;
if (ar->state == ATH11K_STATE_ON) {
- ret = ath11k_reg_update_chan_list(ar);
+ ret = ath11k_reg_update_chan_list(ar, NULL);
if (ret)
goto err;
}
@@ -32,5 +32,5 @@ struct ieee80211_regdomain *
ath11k_reg_build_regd(struct ath11k_base *ab,
struct cur_regulatory_info *reg_info, bool intersect);
int ath11k_regd_update(struct ath11k *ar);
-int ath11k_reg_update_chan_list(struct ath11k *ar);
+int ath11k_reg_update_chan_list(struct ath11k *ar, const struct scan_req_params *arg);
#endif
@@ -3323,6 +3323,8 @@ struct scan_req_params {
struct hint_bssid hint_bssid[WLAN_SCAN_MAX_HINT_BSSID];
struct wmi_mac_addr mac_addr;
struct wmi_mac_addr mac_mask;
+ u32 phymode;
+ struct cfg80211_chan_def *chandef;
};
struct wmi_ssid_arg {