qcacld-3.0: Allow Setting Channel&Bandwidth in STA mode

Add one new ini configuration item to disable/enable
setMonChan in STA mode with disconnected state for
spectral scan test at CV2X platform.

Change-Id: Ie9ffc701d93ed1c050375dd56151b7a0da69cdce
CRs-Fixed: 2279013
This commit is contained in:
Chaoli Zhou 2018-06-11 12:36:54 +08:00 • committed by nshrivas
commit 75b062f194
8 changed files with 115 additions and 4 deletions

View file

@ -14299,6 +14299,30 @@ enum hdd_external_acs_policy {
#define CFG_NUM_VDEV_ENABLE_MAX (0x4)
#define CFG_NUM_VDEV_ENABLE_DEFAULT (CFG_TGT_NUM_VDEV)
/*
* <ini>
* gEnableChangeChannelBandWidth - Enable/Disable change
* channel&bandwidth in the mission mode
* @Min: 0
* @Max: 1
* @Default: 0
*
* 0 - not allow change channel&bandwidth by setMonChan
* 1 - allow change channel&bandwidth by setMonChan
*
* Related: None
*
* Supported Feature: STA
*
* Usage: External
*
* </ini>
*/
#define CFG_CHANGE_CHANNEL_BANDWIDTH_NAME "gEnableChangeChannelBandWidth"
#define CFG_CHANGE_CHANNEL_BANDWIDTH_MIN (0)
#define CFG_CHANGE_CHANNEL_BANDWIDTH_MAX (1)
#define CFG_CHANGE_CHANNEL_BANDWIDTH_DEFAULT (0)
/*
* Type declarations
*/
@ -15195,6 +15219,7 @@ struct hdd_config {
bool enable_ftopen;
bool enable_rtt_mac_randomization;
bool roam_force_rssi_trigger;
bool enable_change_channel_bandwidth;
};
#define VAR_OFFSET(_Struct, _Var) (offsetof(_Struct, _Var))

View file

@ -5466,6 +5466,14 @@ struct reg_table_entry g_registry_table[] = {
CFG_NUM_VDEV_ENABLE_DEFAULT,
CFG_NUM_VDEV_ENABLE_MIN,
CFG_NUM_VDEV_ENABLE_MAX),
REG_VARIABLE(CFG_CHANGE_CHANNEL_BANDWIDTH_NAME,
WLAN_PARAM_Integer,
struct hdd_config, enable_change_channel_bandwidth,
VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
CFG_CHANGE_CHANNEL_BANDWIDTH_DEFAULT,
CFG_CHANGE_CHANNEL_BANDWIDTH_MIN,
CFG_CHANGE_CHANNEL_BANDWIDTH_MAX),
};
@ -7350,6 +7358,10 @@ void hdd_cfg_print(struct hdd_context *hdd_ctx)
hdd_debug("Name = [%s] value = [%d]",
CFG_DTIM_SELECTION_DIVERSITY_NAME,
hdd_ctx->config->enable_dtim_selection_diversity);
hdd_debug("Name = [%s] value = [%d]",
CFG_CHANGE_CHANNEL_BANDWIDTH_NAME,
hdd_ctx->config->enable_change_channel_bandwidth);
hdd_debug("Name = [%s] value = [%d]",
CFG_TX_SCH_DELAY_NAME,
hdd_ctx->config->enable_tx_sch_delay);

View file

@ -17477,6 +17477,10 @@ void hdd_select_cbmode(struct hdd_adapter *adapter, uint8_t operationChannel,
{
uint8_t sec_ch = 0;
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
struct hdd_station_ctx *station_ctx =
WLAN_HDD_GET_STATION_CTX_PTR(adapter);
eConnectionState connstate;
bool cbmode_select = false;
/*
* CDS api expects secondary channel for calculating
@ -17494,7 +17498,16 @@ void hdd_select_cbmode(struct hdd_adapter *adapter, uint8_t operationChannel,
wlan_reg_set_channel_params(hdd_ctx->hdd_pdev, operationChannel,
sec_ch, ch_params);
if (cds_get_conparam() == QDF_GLOBAL_MONITOR_MODE)
if (adapter->device_mode == QDF_STA_MODE &&
hdd_ctx->config->enable_change_channel_bandwidth) {
connstate = station_ctx->conn_info.connState;
if (!(eConnectionState_Associated == connstate ||
eConnectionState_Connecting == connstate)) {
cbmode_select = true;
}
}
if (cds_get_conparam() == QDF_GLOBAL_MONITOR_MODE || cbmode_select)
hdd_mon_select_cbmode(adapter, operationChannel, ch_params);
}

View file

@ -6046,14 +6046,25 @@ int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan,
struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
struct hdd_mon_set_ch_info *ch_info = &sta_ctx->ch_info;
QDF_STATUS status;
tHalHandle hal_hdl = hdd_ctx->mac_handle;
struct qdf_mac_addr bssid;
struct csr_roam_profile roam_profile;
struct ch_params ch_params;
eConnectionState connstate;
if (QDF_GLOBAL_MONITOR_MODE != hdd_get_conparam()) {
hdd_err("Not supported, device is not in monitor mode");
if (hdd_get_conparam() != QDF_GLOBAL_MONITOR_MODE &&
adapter->device_mode != QDF_STA_MODE) {
hdd_err("Not supported, device is not in monitor mode or sta mission mode");
return -EINVAL;
}
if (adapter->device_mode == QDF_STA_MODE &&
hdd_ctx->config->enable_change_channel_bandwidth) {
connstate = sta_ctx->conn_info.connState;
if (eConnectionState_Associated == connstate ||
eConnectionState_Connecting == connstate) {
return -EINVAL;
}
}
/* Validate Channel */
if (!WLAN_REG_IS_24GHZ_CH(chan) && !WLAN_REG_IS_5GHZ_CH(chan)) {
@ -6088,7 +6099,16 @@ int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan,
roam_profile.phyMode = ch_info->phy_mode;
roam_profile.ch_params.ch_width = bandwidth;
hdd_select_cbmode(adapter, chan, &roam_profile.ch_params);
if (hdd_ctx->config->enable_change_channel_bandwidth &&
(!sme_find_session_by_bssid(hal_hdl, adapter->mac_addr.bytes))) {
status = sme_create_mon_session(hal_hdl,
adapter->mac_addr.bytes);
if (status != QDF_STATUS_SUCCESS) {
hdd_err("Status: %d Failed to create session.",
status);
return qdf_status_to_os_return(status);
}
}
qdf_mem_copy(bssid.bytes, adapter->mac_addr.bytes,
QDF_MAC_ADDR_SIZE);

View file

@ -1348,6 +1348,7 @@ bool csr_store_joinreq_param(tpAniSirGlobal mac_ctx,
tScanResultHandle scan_cache,
uint32_t *roam_id,
uint32_t session_id);
bool csr_find_session_by_bssid(tpAniSirGlobal mac_ctx, uint8_t *bssid);
bool csr_clear_joinreq_param(tpAniSirGlobal mac_ctx,
uint32_t session_id);
QDF_STATUS csr_issue_stored_joinreq(tpAniSirGlobal mac_ctx,

View file

@ -2591,4 +2591,13 @@ QDF_STATUS sme_deregister_twt_disable_complete_cb(mac_handle_t mac_handle)
}
#endif
/**
* sme_find_session_by_bssid() - checks whether has session
* with given bssid
* @hal: global hal handle
* @bssid: bssid
* Return: true - if has the session
* false - if not has the session
*/
bool sme_find_session_by_bssid(tHalHandle hal, uint8_t *bssid);
#endif /* #if !defined( __SME_API_H ) */

View file

@ -16059,3 +16059,13 @@ uint8_t sme_get_mcs_idx(uint16_t max_rate, uint8_t rate_flags,
{
return wma_get_mcs_idx(max_rate, rate_flags, nss, mcs_rate_flags);
}
bool sme_find_session_by_bssid(tHalHandle hal, uint8_t *bssid)
{
tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
bool ret;
ret = csr_find_session_by_bssid(mac_ctx, bssid);
return ret;
}

View file

@ -21039,6 +21039,27 @@ csr_find_session_by_type(tpAniSirGlobal mac_ctx, enum QDF_OPMODE type)
}
return session_id;
}
/**
* csr_find_session_by_bssid() - This function will find given bssid from
* all sessions.
* @mac_ctx: pointer to mac context.
* @bssid: session bssid
* Return: false or true.
**/
bool
csr_find_session_by_bssid(tpAniSirGlobal mac_ctx, uint8_t *bssid)
{
tpPESession session_entry;
uint8_t session_id; /* PE session_id */
session_entry = pe_find_session_by_bssid(mac_ctx,
bssid, &session_id);
if (session_entry)
return true;
else
return false;
}
/**
* csr_is_conn_allow_2g_band() - This function will check if station's conn
* is allowed in 2.4Ghz band.