qcacld-3.0: Use channel frequency in sme_get_cfg_valid_channels()

Use channel frequency in API sme_get_cfg_valid_channels(), and modify
all places which call this API.

Change-Id: Iab15d03b6e9070c68711f06ec7300bb29d986185
CRs-Fixed: 2559274
This commit is contained in:
Will Huang 2019-10-31 17:40:06 +08:00 • committed by nshrivas
commit a6af7e1182
4 changed files with 108 additions and 84 deletions

View file

@ -88,6 +88,7 @@ static int wlan_hdd_gen_wlan_status_pack(struct wlan_status_data *data,
uint8_t buflen = WLAN_SVC_COUNTRY_CODE_LEN;
int i;
uint32_t chan_id;
uint32_t *chan_freq_list, chan_freq_len;
struct svc_channel_info *chan_info;
bool lpass_support;
QDF_STATUS status;
@ -122,17 +123,30 @@ static int wlan_hdd_gen_wlan_status_pack(struct wlan_status_data *data,
data->lpss_support = 1;
else
data->lpss_support = 0;
data->numChannels = WLAN_SVC_MAX_NUM_CHAN;
sme_get_cfg_valid_channels(data->channel_list,
&data->numChannels);
chan_freq_list =
qdf_mem_malloc(sizeof(uint32_t) * WLAN_SVC_MAX_NUM_CHAN);
if (!chan_freq_list)
return -ENOMEM;
chan_freq_len = WLAN_SVC_MAX_NUM_CHAN;
sme_get_cfg_valid_channels(chan_freq_list, &chan_freq_len);
data->numChannels = chan_freq_len;
for (i = 0; i < data->numChannels; i++) {
chan_info = &data->channel_info[i];
data->channel_list[i] =
wlan_reg_freq_to_chan(hdd_ctx->pdev, chan_freq_list[i]);
chan_id = data->channel_list[i];
chan_info->chan_id = chan_id;
wlan_hdd_get_channel_info(hdd_ctx, chan_info, chan_id);
wlan_hdd_get_channel_info(hdd_ctx,
chan_info,
chan_freq_list[i]);
}
qdf_mem_free(chan_freq_list);
sme_get_country_code(hdd_ctx->mac_handle, data->country_code, &buflen);
data->is_on = is_on;
data->vdev_id = adapter->vdev_id;

View file

@ -58,8 +58,8 @@ static int populate_oem_data_cap(struct hdd_adapter *adapter,
{
QDF_STATUS status;
struct hdd_config *config;
uint32_t num_chan;
uint8_t *chan_list;
uint32_t num_chan, i;
uint32_t *chan_freq_list;
uint8_t band_capability;
uint16_t neighbor_scan_min_chan_time;
uint16_t neighbor_scan_max_chan_time;
@ -77,11 +77,10 @@ static int populate_oem_data_cap(struct hdd_adapter *adapter,
return -EIO;
}
chan_list = qdf_mem_malloc(sizeof(uint8_t) * OEM_CAP_MAX_NUM_CHANNELS);
if (!chan_list) {
hdd_err("Memory allocation failed");
chan_freq_list =
qdf_mem_malloc(sizeof(uint32_t) * OEM_CAP_MAX_NUM_CHANNELS);
if (!chan_freq_list)
return -ENOMEM;
}
strlcpy(data_cap->oem_target_signature, OEM_TARGET_SIGNATURE,
OEM_TARGET_SIGNATURE_LEN);
@ -107,27 +106,28 @@ static int populate_oem_data_cap(struct hdd_adapter *adapter,
/* request for max num of channels */
num_chan = OEM_CAP_MAX_NUM_CHANNELS;
status = sme_get_cfg_valid_channels(
&chan_list[0], &num_chan);
status = sme_get_cfg_valid_channels(&chan_freq_list[0], &num_chan);
if (QDF_STATUS_SUCCESS != status) {
hdd_err("failed to get valid channel list, status: %d", status);
qdf_mem_free(chan_list);
qdf_mem_free(chan_freq_list);
return -EINVAL;
}
/* make sure num channels is not more than chan list array */
if (num_chan > OEM_CAP_MAX_NUM_CHANNELS) {
hdd_err("Num of channels-%d > length-%d of chan_list",
hdd_err("Num of channels-%d > length-%d of chan_freq_list",
num_chan, OEM_CAP_MAX_NUM_CHANNELS);
qdf_mem_free(chan_list);
qdf_mem_free(chan_freq_list);
return -ENOMEM;
}
data_cap->num_channels = num_chan;
qdf_mem_copy(data_cap->channel_list, chan_list,
sizeof(uint8_t) * num_chan);
for (i = 0; i < num_chan; i++) {
data_cap->channel_list[i] =
wlan_reg_freq_to_chan(hdd_ctx->pdev, chan_freq_list[i]);
}
qdf_mem_free(chan_list);
qdf_mem_free(chan_freq_list);
return 0;
}

View file

@ -772,8 +772,16 @@ uint16_t sme_check_concurrent_channel_overlap(mac_handle_t mac_handle,
eCsrPhyMode sapPhyMode,
uint8_t cc_switch_mode);
#endif
QDF_STATUS sme_get_cfg_valid_channels(uint8_t *aValidChannels,
uint32_t *len);
/**
* sme_get_cfg_valid_channels() - To get valid channel list
* @valid_ch_freq: pointer to array which save the valid channel list
* @len: the length of the valid channel list
*
* Return: QDF status
*/
QDF_STATUS sme_get_cfg_valid_channels(uint32_t *valid_ch_freq, uint32_t *len);
#ifdef WLAN_FEATURE_PACKET_FILTERING
QDF_STATUS sme_8023_multicast_list(mac_handle_t mac_handle, uint8_t sessionId,
tpSirRcvFltMcAddrList pMulticastAddrs);
@ -1346,10 +1354,21 @@ QDF_STATUS sme_update_dfs_scan_mode(mac_handle_t mac_handle,
uint8_t allowDFSChannelRoam);
uint8_t sme_get_dfs_scan_mode(mac_handle_t mac_handle);
/**
* sme_get_valid_channels_by_band() - to fetch valid channels filtered by band
* @mac_handle: Opaque handle to the global MAC context
* @wifi_band: RF band information
* @valid_chan_list: output array to store channel info
* @valid_chan_len: output number of channels
*
* SME API to fetch all valid channels filtered by band
*
* Return: QDF_STATUS
*/
QDF_STATUS sme_get_valid_channels_by_band(mac_handle_t mac_handle,
uint8_t wifiBand,
uint32_t *aValidChannels,
uint8_t *pNumChannels);
uint8_t wifi_band,
uint32_t *valid_chan_list,
uint8_t *valid_chan_len);
#ifdef FEATURE_WLAN_EXTSCAN
/**

View file

@ -5223,7 +5223,7 @@ QDF_STATUS sme_set_tsf_gpio(mac_handle_t mac_handle, uint32_t pinvalue)
}
#endif
QDF_STATUS sme_get_cfg_valid_channels(uint8_t *valid_ch, uint32_t *len)
QDF_STATUS sme_get_cfg_valid_channels(uint32_t *valid_ch_freq, uint32_t *len)
{
QDF_STATUS status = QDF_STATUS_E_FAILURE;
struct mac_context *mac_ctx = sme_get_mac_context();
@ -5249,8 +5249,7 @@ QDF_STATUS sme_get_cfg_valid_channels(uint8_t *valid_ch, uint32_t *len)
}
for (i = 0; i < *len; i++)
valid_ch[i] =
wlan_reg_freq_to_chan(mac_ctx->pdev, valid_ch_freq_list[i]);
valid_ch_freq[i] = valid_ch_freq_list[i];
qdf_mem_free(valid_ch_freq_list);
@ -9753,119 +9752,111 @@ QDF_STATUS sme_abort_roam_scan(mac_handle_t mac_handle, uint8_t sessionId)
return status;
}
/**
* sme_get_valid_channels_by_band() - to fetch valid channels filtered by band
* @mac_handle: Opaque handle to the global MAC context
* @wifiBand: RF band information
* @aValidChannels: output array to store channel info
* @pNumChannels: output number of channels
*
* SME API to fetch all valid channels filtered by band
*
* Return: QDF_STATUS
*/
QDF_STATUS sme_get_valid_channels_by_band(mac_handle_t mac_handle,
uint8_t wifiBand,
uint32_t *aValidChannels,
uint8_t *pNumChannels)
uint8_t wifi_band,
uint32_t *valid_chan_list,
uint8_t *valid_chan_len)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
uint8_t chanList[CFG_VALID_CHANNEL_LIST_LEN] = { 0 };
uint8_t numChannels = 0;
uint32_t chan_freq_list[CFG_VALID_CHANNEL_LIST_LEN] = { 0 };
uint8_t num_channels = 0;
uint8_t i = 0;
uint32_t totValidChannels = CFG_VALID_CHANNEL_LIST_LEN;
uint32_t valid_channels = CFG_VALID_CHANNEL_LIST_LEN;
struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle);
if (!aValidChannels || !pNumChannels) {
if (!valid_chan_list || !valid_chan_len) {
sme_err("Output channel list/NumChannels is NULL");
return QDF_STATUS_E_INVAL;
}
if (wifiBand >= WIFI_BAND_MAX) {
sme_err("Invalid wifiBand: %d", wifiBand);
if (wifi_band >= WIFI_BAND_MAX) {
sme_err("Invalid wifi Band: %d", wifi_band);
return QDF_STATUS_E_INVAL;
}
status = sme_get_cfg_valid_channels(&chanList[0],
&totValidChannels);
status = sme_get_cfg_valid_channels(&chan_freq_list[0],
&valid_channels);
if (!QDF_IS_STATUS_SUCCESS(status)) {
sme_err("Fail to get valid channel list (err=%d)", status);
return status;
}
switch (wifiBand) {
switch (wifi_band) {
case WIFI_BAND_UNSPECIFIED:
sme_debug("Unspec Band, return all %d valid channels",
totValidChannels);
numChannels = totValidChannels;
for (i = 0; i < totValidChannels; i++)
aValidChannels[i] = cds_chan_to_freq(chanList[i]);
valid_channels);
num_channels = valid_channels;
for (i = 0; i < valid_channels; i++)
valid_chan_list[i] = chan_freq_list[i];
break;
case WIFI_BAND_BG:
sme_debug("WIFI_BAND_BG (2.4 GHz)");
for (i = 0; i < totValidChannels; i++) {
if (WLAN_REG_IS_24GHZ_CH(chanList[i]))
aValidChannels[numChannels++] =
cds_chan_to_freq(chanList[i]);
for (i = 0; i < valid_channels; i++) {
if (WLAN_REG_IS_24GHZ_CH_FREQ(chan_freq_list[i]))
valid_chan_list[num_channels++] =
chan_freq_list[i];
}
break;
case WIFI_BAND_A:
sme_debug("WIFI_BAND_A (5 GHz without DFS)");
for (i = 0; i < totValidChannels; i++) {
if (WLAN_REG_IS_5GHZ_CH(chanList[i]) &&
!wlan_reg_is_dfs_ch(mac_ctx->pdev, chanList[i]))
aValidChannels[numChannels++] =
cds_chan_to_freq(chanList[i]);
for (i = 0; i < valid_channels; i++) {
if (WLAN_REG_IS_5GHZ_CH_FREQ(chan_freq_list[i]) &&
!wlan_reg_is_dfs_for_freq(mac_ctx->pdev,
chan_freq_list[i]))
valid_chan_list[num_channels++] =
chan_freq_list[i];
}
break;
case WIFI_BAND_ABG:
sme_debug("WIFI_BAND_ABG (2.4 GHz + 5 GHz; no DFS)");
for (i = 0; i < totValidChannels; i++) {
if ((WLAN_REG_IS_24GHZ_CH(chanList[i]) ||
WLAN_REG_IS_5GHZ_CH(chanList[i])) &&
!wlan_reg_is_dfs_ch(mac_ctx->pdev, chanList[i]))
aValidChannels[numChannels++] =
cds_chan_to_freq(chanList[i]);
for (i = 0; i < valid_channels; i++) {
if ((WLAN_REG_IS_24GHZ_CH_FREQ(chan_freq_list[i]) ||
WLAN_REG_IS_5GHZ_CH_FREQ(chan_freq_list[i])) &&
!wlan_reg_is_dfs_for_freq(mac_ctx->pdev,
chan_freq_list[i]))
valid_chan_list[num_channels++] =
chan_freq_list[i];
}
break;
case WIFI_BAND_A_DFS_ONLY:
sme_debug("WIFI_BAND_A_DFS (5 GHz DFS only)");
for (i = 0; i < totValidChannels; i++) {
if (WLAN_REG_IS_5GHZ_CH(chanList[i]) &&
wlan_reg_is_dfs_ch(mac_ctx->pdev, chanList[i]))
aValidChannels[numChannels++] =
cds_chan_to_freq(chanList[i]);
for (i = 0; i < valid_channels; i++) {
if (WLAN_REG_IS_5GHZ_CH_FREQ(chan_freq_list[i]) &&
wlan_reg_is_dfs_for_freq(mac_ctx->pdev,
chan_freq_list[i]))
valid_chan_list[num_channels++] =
chan_freq_list[i];
}
break;
case WIFI_BAND_A_WITH_DFS:
sme_debug("WIFI_BAND_A_WITH_DFS (5 GHz with DFS)");
for (i = 0; i < totValidChannels; i++) {
if (WLAN_REG_IS_5GHZ_CH(chanList[i]))
aValidChannels[numChannels++] =
cds_chan_to_freq(chanList[i]);
for (i = 0; i < valid_channels; i++) {
if (WLAN_REG_IS_5GHZ_CH_FREQ(chan_freq_list[i]))
valid_chan_list[num_channels++] =
chan_freq_list[i];
}
break;
case WIFI_BAND_ABG_WITH_DFS:
sme_debug("WIFI_BAND_ABG_WITH_DFS (2.4 GHz+5 GHz with DFS)");
for (i = 0; i < totValidChannels; i++) {
if (WLAN_REG_IS_24GHZ_CH(chanList[i]) ||
WLAN_REG_IS_5GHZ_CH(chanList[i]))
aValidChannels[numChannels++] =
cds_chan_to_freq(chanList[i]);
for (i = 0; i < valid_channels; i++) {
if (WLAN_REG_IS_24GHZ_CH_FREQ(chan_freq_list[i]) ||
WLAN_REG_IS_5GHZ_CH_FREQ(chan_freq_list[i]))
valid_chan_list[num_channels++] =
chan_freq_list[i];
}
break;
default:
sme_err("Unknown wifiBand: %d", wifiBand);
sme_err("Unknown wifi Band: %d", wifi_band);
return QDF_STATUS_E_INVAL;
}
*pNumChannels = numChannels;
*valid_chan_len = num_channels;
return status;
}