qcacld-3.0: Convert channel to freq in vdev start structure

Convert channel to freq in vdev start structure to
avoid duplicate channel numbers in 6ghz, and 2.4ghz
operation.

Change-Id: Ie78d93a34d1d558b9c94fc8a54aa95ee07bda55e
CRs-Fixed: 2508040
This commit is contained in:
gaurank kathpalia 2019-07-23 12:02:35 +05:30 • committed by nshrivas
commit c99859b8cb
8 changed files with 44 additions and 30 deletions

View file

@ -402,6 +402,7 @@ void hdd_update_channel_bw_info(struct hdd_context *hdd_ctx,
WLAN_PHY_MODE 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);
@ -413,9 +414,11 @@ void hdd_update_channel_bw_info(struct hdd_context *hdd_ctx,
hdd_chan_info->band_center_freq1 =
cds_chan_to_freq(ch_params.center_freq_seg0);
if (ch_params.ch_width < CH_WIDTH_INVALID)
phy_mode = wma_chan_phy_mode(chan, ch_params.ch_width,
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,
wni_dot11_mode);
}
else
/*
* If channel width is CH_WIDTH_INVALID, It mean channel is

View file

@ -1251,7 +1251,7 @@ struct wma_target_req {
* @chan_offset: channel offset
* @is_dfs: is dfs supported or not
* @vdev_id: vdev id
* @chan: channel
* @op_freq: operating frequency
* @oper_mode: operating mode
* @ssid: ssid
* @hidden_ssid: hidden ssid
@ -1278,7 +1278,7 @@ struct wma_vdev_start_req {
enum phy_ch_width chan_width;
bool is_dfs;
uint8_t vdev_id;
uint8_t chan;
uint32_t op_freq;
uint8_t oper_mode;
tSirMacSSid ssid;
uint8_t hidden_ssid;
@ -1865,7 +1865,7 @@ QDF_STATUS wma_get_cca_stats(tp_wma_handle wma_handle,
uint8_t vdev_id);
struct wma_ini_config *wma_get_ini_handle(tp_wma_handle wma_handle);
WLAN_PHY_MODE wma_chan_phy_mode(uint8_t chan, enum phy_ch_width chan_width,
WLAN_PHY_MODE wma_chan_phy_mode(uint32_t freq, enum phy_ch_width chan_width,
uint8_t dot11_mode);
#ifdef FEATURE_OEM_DATA_SUPPORT

View file

@ -2973,28 +2973,28 @@ QDF_STATUS wma_vdev_start(tp_wma_handle wma,
return QDF_STATUS_E_FAILURE;
}
if (req->chan == 0) {
WMA_LOGE("%s: invalid channel: %d", __func__, req->chan);
if (req->op_freq == 0) {
WMA_LOGE("invalid operating frequency");
QDF_ASSERT(0);
return QDF_STATUS_E_INVAL;
}
params.channel.cfreq1 = cds_chan_to_freq(req->chan);
params.channel.cfreq1 = req->op_freq;
ch_width = req->chan_width;
bw_val = wlan_reg_get_bw_value(req->chan_width);
if (20 < bw_val) {
if (bw_val > 20) {
if (req->ch_center_freq_seg0) {
params.channel.cfreq1 =
cds_chan_to_freq(req->ch_center_freq_seg0);
} else {
WMA_LOGE("%s: invalid cntr_freq for bw %d, drop to 20",
__func__, bw_val);
params.channel.cfreq1 = cds_chan_to_freq(req->chan);
params.channel.cfreq1 = req->op_freq;
ch_width = CH_WIDTH_20MHZ;
bw_val = 20;
}
}
if (80 < bw_val) {
if (bw_val > 80) {
if (req->ch_center_freq_seg1) {
params.channel.cfreq2 =
cds_chan_to_freq(req->ch_center_freq_seg1);
@ -3007,8 +3007,7 @@ QDF_STATUS wma_vdev_start(tp_wma_handle wma,
} else {
params.channel.cfreq2 = 0;
}
chan_mode = wma_chan_phy_mode(req->chan, ch_width,
req->dot11_mode);
chan_mode = wma_chan_phy_mode(req->op_freq, ch_width, req->dot11_mode);
if (chan_mode == MODE_UNKNOWN) {
WMA_LOGE("%s: invalid phy mode!", __func__);
@ -3026,7 +3025,7 @@ QDF_STATUS wma_vdev_start(tp_wma_handle wma,
return QDF_STATUS_E_FAILURE;
}
/* Fill channel info */
params.channel.mhz = cds_chan_to_freq(req->chan);
params.channel.mhz = req->op_freq;
params.channel.phy_mode = chan_mode;
/* For Rome, only supports LFR2, not LFR3, for reassoc, need send vdev
@ -3071,7 +3070,8 @@ QDF_STATUS wma_vdev_start(tp_wma_handle wma,
CFG_TGT_DEFAULT_GTX_BW_MASK;
intr[params.vdev_id].mhz = params.channel.mhz;
intr[params.vdev_id].chan_width = ch_width;
intr[params.vdev_id].channel = req->chan;
intr[params.vdev_id].channel = wlan_reg_freq_to_chan(wma->pdev,
req->op_freq);
temp_chan_info &= 0xffffffc0;
temp_chan_info |= params.channel.phy_mode;
@ -4087,7 +4087,8 @@ static void wma_add_bss_ap_mode(tp_wma_handle wma, struct bss_params *add_bss)
qdf_mem_zero(&req, sizeof(req));
req.vdev_id = vdev_id;
req.chan = add_bss->currentOperChannel;
req.op_freq = wlan_reg_chan_to_freq(wma->pdev,
add_bss->currentOperChannel);
req.chan_width = add_bss->ch_width;
req.dot11_mode = add_bss->dot11_mode;
@ -4245,7 +4246,8 @@ static void wma_add_bss_ibss_mode(tp_wma_handle wma, struct bss_params *add_bss)
qdf_mem_zero(&req, sizeof(req));
req.vdev_id = vdev_id;
req.chan = add_bss->currentOperChannel;
req.op_freq = wlan_reg_chan_to_freq(wma->pdev,
add_bss->currentOperChannel);
req.chan_width = add_bss->ch_width;
req.ch_center_freq_seg0 = add_bss->ch_center_freq_seg0;
req.ch_center_freq_seg1 = add_bss->ch_center_freq_seg1;
@ -4273,7 +4275,7 @@ static void wma_add_bss_ibss_mode(tp_wma_handle wma, struct bss_params *add_bss)
req.preferred_tx_streams = 1;
}
WMA_LOGD("%s: chan %d chan_width %d", __func__, req.chan,
WMA_LOGD("%s: op_freq %d chan_width %d", __func__, req.op_freq,
req.chan_width);
WMA_LOGD("%s: ssid = %s", __func__, req.ssid.ssId);
@ -4421,7 +4423,9 @@ static void wma_add_bss_sta_mode(tp_wma_handle wma, struct bss_params *add_bss)
qdf_mem_zero(&req, sizeof(req));
req.vdev_id = vdev_id;
req.chan = add_bss->currentOperChannel;
req.op_freq =
wlan_reg_chan_to_freq(wma->pdev,
add_bss->currentOperChannel);
req.chan_width = add_bss->ch_width;
if (add_bss->ch_width == CH_WIDTH_10MHZ)

View file

@ -531,18 +531,19 @@ QDF_STATUS wma_process_dhcp_ind(WMA_HANDLE handle,
/**
* wma_chan_phy__mode() - get WLAN_PHY_MODE for channel
* @chan: channel number
* @freq: operating frequency of connection
* @chan_width: maximum channel width possible
* @dot11_mode: maximum phy_mode possible
*
* Return: return WLAN_PHY_MODE
*/
WLAN_PHY_MODE wma_chan_phy_mode(uint8_t chan, enum phy_ch_width chan_width,
WLAN_PHY_MODE wma_chan_phy_mode(uint32_t freq, enum phy_ch_width chan_width,
uint8_t dot11_mode)
{
WLAN_PHY_MODE phymode = MODE_UNKNOWN;
uint16_t bw_val = wlan_reg_get_bw_value(chan_width);
t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
uint16_t chan;
if (!wma) {
WMA_LOGE("%s : wma_handle is NULL", __func__);
@ -554,7 +555,8 @@ WLAN_PHY_MODE wma_chan_phy_mode(uint8_t chan, enum phy_ch_width chan_width,
return MODE_UNKNOWN;
}
if (WLAN_REG_IS_24GHZ_CH(chan)) {
chan = wlan_reg_freq_to_chan(wma->pdev, freq);
if (wlan_reg_is_24ghz_ch_freq(freq)) {
if (((CH_WIDTH_5MHZ == chan_width) ||
(CH_WIDTH_10MHZ == chan_width)) &&
((MLME_DOT11_MODE_11B == dot11_mode) ||
@ -661,8 +663,8 @@ WLAN_PHY_MODE wma_chan_phy_mode(uint8_t chan, enum phy_ch_width chan_width,
}
}
WMA_LOGD("%s: phymode %d channel %d ch_width %d dot11_mode %d",
__func__, phymode, chan, chan_width, dot11_mode);
WMA_LOGD("%s: phymode %d freq %d ch_width %d dot11_mode %d",
__func__, phymode, freq, chan_width, dot11_mode);
QDF_ASSERT(MODE_UNKNOWN != phymode);
return phymode;

View file

@ -3077,6 +3077,7 @@ void wma_get_phy_mode_cb(uint8_t chan, uint32_t chan_width, uint32_t *phy_mode)
{
uint32_t dot11_mode;
struct mac_context *mac = cds_get_context(QDF_MODULE_ID_PE);
uint32_t freq;
if (!mac) {
wma_err("MAC context is NULL");
@ -3084,8 +3085,9 @@ void wma_get_phy_mode_cb(uint8_t chan, uint32_t chan_width, uint32_t *phy_mode)
return;
}
freq = wlan_reg_chan_to_freq(mac->pdev, chan);
dot11_mode = mac->mlme_cfg->dot11_mode.dot11_mode;
*phy_mode = wma_chan_phy_mode(chan, chan_width, dot11_mode);
*phy_mode = wma_chan_phy_mode(freq, chan_width, dot11_mode);
}
#ifdef WLAN_FEATURE_NAN

View file

@ -101,7 +101,8 @@ void wma_add_bss_ndi_mode(tp_wma_handle wma, struct bss_params *add_bss)
*/
qdf_mem_zero(&req, sizeof(req));
req.vdev_id = vdev_id;
req.chan = add_bss->currentOperChannel;
req.op_freq = wlan_reg_chan_to_freq(wma->pdev,
add_bss->currentOperChannel);
req.ch_center_freq_seg0 = add_bss->ch_center_freq_seg0;
req.ch_center_freq_seg1 = add_bss->ch_center_freq_seg1;
req.vht_capable = add_bss->vhtCapable;

View file

@ -50,9 +50,9 @@ static QDF_STATUS wma_start_ocb_vdev(struct ocb_config *config)
return QDF_STATUS_E_NOMEM;
}
req.chan = cds_freq_to_chan(config->channels[0].chan_freq);
req.op_freq = config->channels[0].chan_freq;
req.vdev_id = msg->vdev_id;
if (cds_chan_to_band(req.chan) == CDS_BAND_2GHZ)
if (wlan_reg_is_24ghz_ch_freq(req.op_freq))
req.dot11_mode = MLME_DOT11_MODE_11G;
else
req.dot11_mode = MLME_DOT11_MODE_11A;

View file

@ -3533,7 +3533,7 @@ void wma_set_channel(tp_wma_handle wma, tpSwitchChannelParams params)
qdf_mem_zero(&req, sizeof(req));
req.vdev_id = vdev_id;
req.chan = params->channelNumber;
req.op_freq = wlan_reg_chan_to_freq(wma->pdev, params->channelNumber);
req.chan_width = params->ch_width;
if (params->ch_width == CH_WIDTH_10MHZ)
@ -3631,7 +3631,9 @@ void wma_set_channel(tp_wma_handle wma, tpSwitchChannelParams params)
* indicate RX PPDU TLV with invalid channel number.
*/
if (intr[vdev_id].type == WMI_VDEV_TYPE_MONITOR)
cdp_record_monitor_chan_num(soc, pdev, req.chan);
cdp_record_monitor_chan_num(soc, pdev,
wlan_reg_freq_to_chan(wma->pdev,
req.op_freq));
return;
send_resp: