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
这个提交包含在:
Will Huang
2019-10-31 17:40:06 +08:00
提交者 nshrivas
父节点 9c82045c9b
当前提交 a6af7e1182
修改 4 个文件,包含 108 行新增84 行删除

查看文件

@@ -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; uint8_t buflen = WLAN_SVC_COUNTRY_CODE_LEN;
int i; int i;
uint32_t chan_id; uint32_t chan_id;
uint32_t *chan_freq_list, chan_freq_len;
struct svc_channel_info *chan_info; struct svc_channel_info *chan_info;
bool lpass_support; bool lpass_support;
QDF_STATUS status; QDF_STATUS status;
@@ -122,17 +123,30 @@ static int wlan_hdd_gen_wlan_status_pack(struct wlan_status_data *data,
data->lpss_support = 1; data->lpss_support = 1;
else else
data->lpss_support = 0; data->lpss_support = 0;
data->numChannels = WLAN_SVC_MAX_NUM_CHAN;
sme_get_cfg_valid_channels(data->channel_list, chan_freq_list =
&data->numChannels); 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++) { for (i = 0; i < data->numChannels; i++) {
chan_info = &data->channel_info[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_id = data->channel_list[i];
chan_info->chan_id = chan_id; 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); sme_get_country_code(hdd_ctx->mac_handle, data->country_code, &buflen);
data->is_on = is_on; data->is_on = is_on;
data->vdev_id = adapter->vdev_id; data->vdev_id = adapter->vdev_id;

查看文件

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

查看文件

@@ -772,8 +772,16 @@ uint16_t sme_check_concurrent_channel_overlap(mac_handle_t mac_handle,
eCsrPhyMode sapPhyMode, eCsrPhyMode sapPhyMode,
uint8_t cc_switch_mode); uint8_t cc_switch_mode);
#endif #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 #ifdef WLAN_FEATURE_PACKET_FILTERING
QDF_STATUS sme_8023_multicast_list(mac_handle_t mac_handle, uint8_t sessionId, QDF_STATUS sme_8023_multicast_list(mac_handle_t mac_handle, uint8_t sessionId,
tpSirRcvFltMcAddrList pMulticastAddrs); tpSirRcvFltMcAddrList pMulticastAddrs);
@@ -1346,10 +1354,21 @@ QDF_STATUS sme_update_dfs_scan_mode(mac_handle_t mac_handle,
uint8_t allowDFSChannelRoam); uint8_t allowDFSChannelRoam);
uint8_t sme_get_dfs_scan_mode(mac_handle_t mac_handle); 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, QDF_STATUS sme_get_valid_channels_by_band(mac_handle_t mac_handle,
uint8_t wifiBand, uint8_t wifi_band,
uint32_t *aValidChannels, uint32_t *valid_chan_list,
uint8_t *pNumChannels); uint8_t *valid_chan_len);
#ifdef FEATURE_WLAN_EXTSCAN #ifdef FEATURE_WLAN_EXTSCAN
/** /**

查看文件

@@ -5223,7 +5223,7 @@ QDF_STATUS sme_set_tsf_gpio(mac_handle_t mac_handle, uint32_t pinvalue)
} }
#endif #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; QDF_STATUS status = QDF_STATUS_E_FAILURE;
struct mac_context *mac_ctx = sme_get_mac_context(); 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++) for (i = 0; i < *len; i++)
valid_ch[i] = valid_ch_freq[i] = valid_ch_freq_list[i];
wlan_reg_freq_to_chan(mac_ctx->pdev, valid_ch_freq_list[i]);
qdf_mem_free(valid_ch_freq_list); 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; 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, QDF_STATUS sme_get_valid_channels_by_band(mac_handle_t mac_handle,
uint8_t wifiBand, uint8_t wifi_band,
uint32_t *aValidChannels, uint32_t *valid_chan_list,
uint8_t *pNumChannels) uint8_t *valid_chan_len)
{ {
QDF_STATUS status = QDF_STATUS_SUCCESS; QDF_STATUS status = QDF_STATUS_SUCCESS;
uint8_t chanList[CFG_VALID_CHANNEL_LIST_LEN] = { 0 }; uint32_t chan_freq_list[CFG_VALID_CHANNEL_LIST_LEN] = { 0 };
uint8_t numChannels = 0; uint8_t num_channels = 0;
uint8_t i = 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); 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"); sme_err("Output channel list/NumChannels is NULL");
return QDF_STATUS_E_INVAL; return QDF_STATUS_E_INVAL;
} }
if (wifiBand >= WIFI_BAND_MAX) { if (wifi_band >= WIFI_BAND_MAX) {
sme_err("Invalid wifiBand: %d", wifiBand); sme_err("Invalid wifi Band: %d", wifi_band);
return QDF_STATUS_E_INVAL; return QDF_STATUS_E_INVAL;
} }
status = sme_get_cfg_valid_channels(&chanList[0], status = sme_get_cfg_valid_channels(&chan_freq_list[0],
&totValidChannels); &valid_channels);
if (!QDF_IS_STATUS_SUCCESS(status)) { if (!QDF_IS_STATUS_SUCCESS(status)) {
sme_err("Fail to get valid channel list (err=%d)", status); sme_err("Fail to get valid channel list (err=%d)", status);
return status; return status;
} }
switch (wifiBand) { switch (wifi_band) {
case WIFI_BAND_UNSPECIFIED: case WIFI_BAND_UNSPECIFIED:
sme_debug("Unspec Band, return all %d valid channels", sme_debug("Unspec Band, return all %d valid channels",
totValidChannels); valid_channels);
numChannels = totValidChannels; num_channels = valid_channels;
for (i = 0; i < totValidChannels; i++) for (i = 0; i < valid_channels; i++)
aValidChannels[i] = cds_chan_to_freq(chanList[i]); valid_chan_list[i] = chan_freq_list[i];
break; break;
case WIFI_BAND_BG: case WIFI_BAND_BG:
sme_debug("WIFI_BAND_BG (2.4 GHz)"); sme_debug("WIFI_BAND_BG (2.4 GHz)");
for (i = 0; i < totValidChannels; i++) { for (i = 0; i < valid_channels; i++) {
if (WLAN_REG_IS_24GHZ_CH(chanList[i])) if (WLAN_REG_IS_24GHZ_CH_FREQ(chan_freq_list[i]))
aValidChannels[numChannels++] = valid_chan_list[num_channels++] =
cds_chan_to_freq(chanList[i]); chan_freq_list[i];
} }
break; break;
case WIFI_BAND_A: case WIFI_BAND_A:
sme_debug("WIFI_BAND_A (5 GHz without DFS)"); sme_debug("WIFI_BAND_A (5 GHz without DFS)");
for (i = 0; i < totValidChannels; i++) { for (i = 0; i < valid_channels; i++) {
if (WLAN_REG_IS_5GHZ_CH(chanList[i]) && if (WLAN_REG_IS_5GHZ_CH_FREQ(chan_freq_list[i]) &&
!wlan_reg_is_dfs_ch(mac_ctx->pdev, chanList[i])) !wlan_reg_is_dfs_for_freq(mac_ctx->pdev,
aValidChannels[numChannels++] = chan_freq_list[i]))
cds_chan_to_freq(chanList[i]); valid_chan_list[num_channels++] =
chan_freq_list[i];
} }
break; break;
case WIFI_BAND_ABG: case WIFI_BAND_ABG:
sme_debug("WIFI_BAND_ABG (2.4 GHz + 5 GHz; no DFS)"); sme_debug("WIFI_BAND_ABG (2.4 GHz + 5 GHz; no DFS)");
for (i = 0; i < totValidChannels; i++) { for (i = 0; i < valid_channels; i++) {
if ((WLAN_REG_IS_24GHZ_CH(chanList[i]) || if ((WLAN_REG_IS_24GHZ_CH_FREQ(chan_freq_list[i]) ||
WLAN_REG_IS_5GHZ_CH(chanList[i])) && WLAN_REG_IS_5GHZ_CH_FREQ(chan_freq_list[i])) &&
!wlan_reg_is_dfs_ch(mac_ctx->pdev, chanList[i])) !wlan_reg_is_dfs_for_freq(mac_ctx->pdev,
aValidChannels[numChannels++] = chan_freq_list[i]))
cds_chan_to_freq(chanList[i]); valid_chan_list[num_channels++] =
chan_freq_list[i];
} }
break; break;
case WIFI_BAND_A_DFS_ONLY: case WIFI_BAND_A_DFS_ONLY:
sme_debug("WIFI_BAND_A_DFS (5 GHz DFS only)"); sme_debug("WIFI_BAND_A_DFS (5 GHz DFS only)");
for (i = 0; i < totValidChannels; i++) { for (i = 0; i < valid_channels; i++) {
if (WLAN_REG_IS_5GHZ_CH(chanList[i]) && if (WLAN_REG_IS_5GHZ_CH_FREQ(chan_freq_list[i]) &&
wlan_reg_is_dfs_ch(mac_ctx->pdev, chanList[i])) wlan_reg_is_dfs_for_freq(mac_ctx->pdev,
aValidChannels[numChannels++] = chan_freq_list[i]))
cds_chan_to_freq(chanList[i]); valid_chan_list[num_channels++] =
chan_freq_list[i];
} }
break; break;
case WIFI_BAND_A_WITH_DFS: case WIFI_BAND_A_WITH_DFS:
sme_debug("WIFI_BAND_A_WITH_DFS (5 GHz with DFS)"); sme_debug("WIFI_BAND_A_WITH_DFS (5 GHz with DFS)");
for (i = 0; i < totValidChannels; i++) { for (i = 0; i < valid_channels; i++) {
if (WLAN_REG_IS_5GHZ_CH(chanList[i])) if (WLAN_REG_IS_5GHZ_CH_FREQ(chan_freq_list[i]))
aValidChannels[numChannels++] = valid_chan_list[num_channels++] =
cds_chan_to_freq(chanList[i]); chan_freq_list[i];
} }
break; break;
case WIFI_BAND_ABG_WITH_DFS: case WIFI_BAND_ABG_WITH_DFS:
sme_debug("WIFI_BAND_ABG_WITH_DFS (2.4 GHz+5 GHz with DFS)"); sme_debug("WIFI_BAND_ABG_WITH_DFS (2.4 GHz+5 GHz with DFS)");
for (i = 0; i < totValidChannels; i++) { for (i = 0; i < valid_channels; i++) {
if (WLAN_REG_IS_24GHZ_CH(chanList[i]) || if (WLAN_REG_IS_24GHZ_CH_FREQ(chan_freq_list[i]) ||
WLAN_REG_IS_5GHZ_CH(chanList[i])) WLAN_REG_IS_5GHZ_CH_FREQ(chan_freq_list[i]))
aValidChannels[numChannels++] = valid_chan_list[num_channels++] =
cds_chan_to_freq(chanList[i]); chan_freq_list[i];
} }
break; break;
default: default:
sme_err("Unknown wifiBand: %d", wifiBand); sme_err("Unknown wifi Band: %d", wifi_band);
return QDF_STATUS_E_INVAL; return QDF_STATUS_E_INVAL;
} }
*pNumChannels = numChannels; *valid_chan_len = num_channels;
return status; return status;
} }