qcacld-3.0: Convert legacy chan ID usage to chan freq

Modify the following 3 APIs' code and parameters to make
sure they're using frequency instead of channel ID:
   sme_get_reg_info
   wlan_hdd_get_channel_info
   hdd_update_channel_bw_info

Change-Id: I87ad6fb9cd9fcd7fe4e41e62a32e4954e93f8ba1
CRs-Fixed: 2554710
This commit is contained in:
bings 2019-10-31 18:26:46 +08:00 • committed by nshrivas
commit e063e4f155
5 changed files with 54 additions and 54 deletions

View file

@ -209,8 +209,22 @@ int oem_activate_service(struct hdd_context *hdd_ctx);
int oem_deactivate_service(void);
void hdd_send_oem_data_rsp_msg(struct oem_data_rsp *oem_rsp);
/**
* update_channel_bw_info() - set bandwidth info for the chan
* @hdd_ctx: hdd context
* @chan_freq: channel freq for which info are required
* @chan_info: struct where the bandwidth info is filled
*
* This function finds the maximum bandwidth allowed, secondary
* channel offset and center freq for the channel as per regulatory
* domain and uses these info calculate the phy mode for the
* channel.
*
* Return: void
*/
void hdd_update_channel_bw_info(struct hdd_context *hdd_ctx,
uint16_t chan,
uint32_t chan_freq,
void *hdd_chan_info);
#else
static inline int oem_activate_service(struct hdd_context *hdd_ctx)
@ -226,7 +240,7 @@ static inline int oem_deactivate_service(void)
static inline void hdd_send_oem_data_rsp_msg(void *oem_rsp) {}
static inline void hdd_update_channel_bw_info(struct hdd_context *hdd_ctx,
uint16_t chan,
uint32_t chan_freq,
void *hdd_chan_info) {}
#endif /* FEATURE_OEM_DATA_SUPPORT */

View file

@ -34,33 +34,32 @@
* wlan_hdd_get_channel_info() - Get channel info
* @hdd_ctx: HDD context
* @chan_info: Pointer to the structure that stores channel info
* @chan_id: Channel ID
* @chan_freq: Channel freq
*
* Fill in the channel info to chan_info structure.
*/
static void wlan_hdd_get_channel_info(struct hdd_context *hdd_ctx,
struct svc_channel_info *chan_info,
uint32_t chan_id)
uint32_t chan_freq)
{
uint32_t reg_info_1;
uint32_t reg_info_2;
QDF_STATUS status = QDF_STATUS_E_FAILURE;
status = sme_get_reg_info(hdd_ctx->mac_handle, chan_id,
status = sme_get_reg_info(hdd_ctx->mac_handle, chan_freq,
&reg_info_1, &reg_info_2);
if (status != QDF_STATUS_SUCCESS)
return;
chan_info->mhz = cds_chan_to_freq(chan_id);
chan_info->mhz = chan_freq;
chan_info->band_center_freq1 = chan_info->mhz;
chan_info->band_center_freq2 = 0;
chan_info->info = 0;
if (CHANNEL_STATE_DFS ==
wlan_reg_get_channel_state(hdd_ctx->pdev,
chan_id))
wlan_reg_get_channel_state_for_freq(hdd_ctx->pdev, chan_freq))
WMI_SET_CHANNEL_FLAG(chan_info,
WMI_CHAN_FLAG_DFS);
hdd_update_channel_bw_info(hdd_ctx, chan_id,
hdd_update_channel_bw_info(hdd_ctx, chan_freq,
chan_info);
chan_info->reg_info_1 = reg_info_1;
chan_info->reg_info_2 = reg_info_2;

View file

@ -381,43 +381,28 @@ static QDF_STATUS oem_process_data_req_msg(int oem_data_len, char *oem_data)
return status;
}
/**
* update_channel_bw_info() - set bandwidth info for the chan
* @hdd_ctx: hdd context
* @chan: channel for which info are required
* @chan_info: struct where the bandwidth info is filled
*
* This function find the maximum bandwidth allowed, secondary
* channel offset and center freq for the channel as per regulatory
* domain and using these info calculate the phy mode for the
* channel.
*
* Return: void
*/
void hdd_update_channel_bw_info(struct hdd_context *hdd_ctx,
uint16_t chan, void *chan_info)
uint32_t chan_freq, void *chan_info)
{
struct ch_params ch_params = {0};
uint16_t sec_ch_2g = 0;
enum wlan_phymode phy_mode;
uint16_t fw_phy_mode;
uint32_t wni_dot11_mode;
struct hdd_channel_info *hdd_chan_info = chan_info;
uint32_t freq;
wni_dot11_mode = sme_get_wni_dot11_mode(hdd_ctx->mac_handle);
/* Passing CH_WIDTH_MAX will give the max bandwidth supported */
ch_params.ch_width = CH_WIDTH_MAX;
wlan_reg_set_channel_params(hdd_ctx->pdev, chan, sec_ch_2g, &ch_params);
wlan_reg_set_channel_params_for_freq(
hdd_ctx->pdev, chan_freq, 0, &ch_params);
if (ch_params.center_freq_seg0)
hdd_chan_info->band_center_freq1 =
cds_chan_to_freq(ch_params.center_freq_seg0);
if (ch_params.ch_width < CH_WIDTH_INVALID) {
freq = wlan_reg_chan_to_freq(hdd_ctx->pdev, chan);
phy_mode = wma_chan_phy_mode(freq, ch_params.ch_width,
phy_mode = wma_chan_phy_mode(chan_freq, ch_params.ch_width,
wni_dot11_mode);
}
else
@ -431,9 +416,9 @@ void hdd_update_channel_bw_info(struct hdd_context *hdd_ctx,
fw_phy_mode = wma_host_to_fw_phymode(phy_mode);
hdd_debug("chan %d dot11_mode %d ch_width %d sec offset %d freq_seg0 %d phy_mode %d fw_phy_mode %d",
chan, wni_dot11_mode, ch_params.ch_width,
ch_params.sec_ch_offset,
hdd_chan_info->band_center_freq1, phy_mode, fw_phy_mode);
chan_freq, wni_dot11_mode, ch_params.ch_width,
ch_params.sec_ch_offset,
hdd_chan_info->band_center_freq1, phy_mode, fw_phy_mode);
WMI_SET_CHANNEL_MODE(hdd_chan_info, fw_phy_mode);
}
@ -454,12 +439,12 @@ static int oem_process_channel_info_req_msg(int numOfChannels, char *chanList)
tAniMsgHdr *ani_hdr;
struct hdd_channel_info *pHddChanInfo;
struct hdd_channel_info hddChanInfo;
uint8_t chanId;
uint32_t reg_info_1;
uint32_t reg_info_2;
QDF_STATUS status = QDF_STATUS_E_FAILURE;
int i;
uint8_t *buf;
uint32_t chan_freq;
/* OEM msg is always to a specific process and cannot be a broadcast */
if (p_hdd_ctx->oem_pid == 0) {
@ -498,24 +483,26 @@ static int oem_process_channel_info_req_msg(int numOfChannels, char *chanList)
i *
sizeof(*pHddChanInfo));
chanId = chanList[i];
status = sme_get_reg_info(p_hdd_ctx->mac_handle, chanId,
chan_freq = wlan_reg_legacy_chan_to_freq(
p_hdd_ctx->pdev, chanList[i]);
status = sme_get_reg_info(p_hdd_ctx->mac_handle, chan_freq,
&reg_info_1, &reg_info_2);
if (QDF_STATUS_SUCCESS == status) {
/* copy into hdd chan info struct */
hddChanInfo.reserved0 = 0;
hddChanInfo.mhz = wlan_reg_chan_to_freq(p_hdd_ctx->pdev, chanId);
hddChanInfo.mhz = chan_freq;
hddChanInfo.band_center_freq1 = hddChanInfo.mhz;
hddChanInfo.band_center_freq2 = 0;
hddChanInfo.info = 0;
if (CHANNEL_STATE_DFS ==
wlan_reg_get_channel_state(p_hdd_ctx->pdev, chanId))
wlan_reg_get_channel_state_for_freq(
p_hdd_ctx->pdev, chan_freq))
WMI_SET_CHANNEL_FLAG(&hddChanInfo,
WMI_CHAN_FLAG_DFS);
hdd_update_channel_bw_info(p_hdd_ctx,
chanId, &hddChanInfo);
chan_freq, &hddChanInfo);
hddChanInfo.reg_info_1 = reg_info_1;
hddChanInfo.reg_info_2 = reg_info_2;
} else {
@ -523,9 +510,9 @@ static int oem_process_channel_info_req_msg(int numOfChannels, char *chanList)
* channel info struct
*/
hdd_debug("sme_get_reg_info failed for chan: %d, fill 0s",
chanId);
chan_freq);
hddChanInfo.reserved0 = 0;
hddChanInfo.mhz = wlan_reg_chan_to_freq(p_hdd_ctx->pdev, chanId);
hddChanInfo.mhz = chan_freq;
hddChanInfo.band_center_freq1 = 0;
hddChanInfo.band_center_freq2 = 0;
hddChanInfo.info = 0;

View file

@ -1177,7 +1177,19 @@ QDF_STATUS sme_notify_ht2040_mode(mac_handle_t mac_handle,
QDF_STATUS sme_set_ht2040_mode(mac_handle_t mac_handle, uint8_t sessionId,
uint8_t channel_type, bool obssEnabled);
#endif
QDF_STATUS sme_get_reg_info(mac_handle_t mac_handle, uint8_t chanId,
/**
* sme_get_reg_info() - To get tx power information
* @mac_handle: Opaque handle to the global MAC context
* @chan_freq: channel freq
* @regInfo1: first reg info to fill
* @regInfo2: second reg info to fill
*
* This routine will give you tx power information
*
* Return: QDF_STATUS
*/
QDF_STATUS sme_get_reg_info(mac_handle_t mac_handle, uint32_t chan_freq,
uint32_t *regInfo1, uint32_t *regInfo2);
#ifdef FEATURE_WLAN_CH_AVOID

View file

@ -8764,18 +8764,7 @@ QDF_STATUS sme_update_sta_inactivity_timeout(mac_handle_t mac_handle,
return QDF_STATUS_SUCCESS;
}
/**
* sme_get_reg_info() - To get registration info
* @mac_handle: Opaque handle to the global MAC context
* @chanId: channel id
* @regInfo1: first reg info to fill
* @regInfo2: second reg info to fill
*
* This routine will give you reg info
*
* Return: QDF_STATUS
*/
QDF_STATUS sme_get_reg_info(mac_handle_t mac_handle, uint8_t chanId,
QDF_STATUS sme_get_reg_info(mac_handle_t mac_handle, uint32_t chan_freq,
uint32_t *regInfo1, uint32_t *regInfo2)
{
struct mac_context *mac = MAC_CONTEXT(mac_handle);
@ -8790,8 +8779,7 @@ QDF_STATUS sme_get_reg_info(mac_handle_t mac_handle, uint8_t chanId,
return status;
for (i = 0; i < CFG_VALID_CHANNEL_LIST_LEN; i++) {
if (mac->scan.defaultPowerTable[i].center_freq ==
wlan_reg_chan_to_freq(mac->pdev, chanId)) {
if (mac->scan.defaultPowerTable[i].center_freq == chan_freq) {
SME_SET_CHANNEL_REG_POWER(*regInfo1,
mac->scan.defaultPowerTable[i].tx_power);