qcacld-3.0: Add cac duration and dfs region in vdev start

Add support to fill cac duration and dfs region in  vdev
start command, these values are used in firmware on phyerror
processing and cac timer offload cases.

Change-Id: I8bfbd4a3f59002f92ee2e5e321c15da849fce9ec
CRs-Fixed: 2021357
This commit is contained in:
Arif Hussain 2017-03-17 09:08:32 -07:00 • committed by Sandeep Puligilla
commit 671a190aa9
17 changed files with 167 additions and 71 deletions

View file

@ -693,6 +693,8 @@ typedef struct sSirSmeStartBssReq {
uint8_t sap_dot11mc;
uint8_t beacon_tx_rate;
bool vendor_vht_sap;
uint32_t cac_duration_ms;
uint32_t dfs_regdomain;
} tSirSmeStartBssReq, *tpSirSmeStartBssReq;
@ -3952,6 +3954,8 @@ typedef struct sSirChanChangeRequest {
uint32_t dot11mode;
tSirMacRateSet operational_rateset;
tSirMacRateSet extended_rateset;
uint32_t cac_duration_ms;
uint32_t dfs_regdomain;
} tSirChanChangeRequest, *tpSirChanChangeRequest;
typedef struct sSirChanChangeResponse {

View file

@ -157,7 +157,7 @@ void lim_process_mlm_reassoc_req(tpAniSirGlobal mac_ctx, uint32_t *msg)
session->ch_center_freq_seg1,
session->ch_width,
session->maxTxPower,
session->peSessionId);
session->peSessionId, 0, 0);
return;
end:

View file

@ -201,7 +201,7 @@ lim_change_channel_with_callback(tpAniSirGlobal mac_ctx, uint8_t new_chan,
lim_send_switch_chnl_params(mac_ctx, new_chan, 0, 0,
CH_WIDTH_20MHZ, session_entry->maxTxPower,
session_entry->peSessionId, false);
session_entry->peSessionId, false, 0, 0);
return;
}
@ -603,6 +603,8 @@ lim_mlm_add_bss(tpAniSirGlobal mac_ctx,
addbss_param->dot11_mode = session->dot11mode;
addbss_param->nss = session->nss;
addbss_param->cac_duration_ms = mlm_start_req->cac_duration_ms;
addbss_param->dfs_regdomain = mlm_start_req->dfs_regdomain;
if (QDF_IBSS_MODE == addbss_param->halPersona) {
addbss_param->nss_2g = mac_ctx->vdev_type_nss_2g.ibss;
addbss_param->nss_5g = mac_ctx->vdev_type_nss_5g.ibss;
@ -764,7 +766,7 @@ static void lim_post_join_set_link_state_callback(tpAniSirGlobal mac,
session_entry->ch_center_freq_seg1,
session_entry->ch_width,
session_entry->maxTxPower,
session_entry->peSessionId);
session_entry->peSessionId, 0, 0);
return;
failure:
@ -2698,7 +2700,8 @@ void lim_complete_mlm_scan(tpAniSirGlobal mac_ctx, tSirResultCodes ret_code)
void lim_set_channel(tpAniSirGlobal mac_ctx, uint8_t channel,
uint8_t ch_center_freq_seg0, uint8_t ch_center_freq_seg1,
enum phy_ch_width ch_width, int8_t max_tx_power,
uint8_t pe_session_id)
uint8_t pe_session_id, uint32_t cac_duration_ms,
uint32_t dfs_regdomain)
{
tpPESession pe_session;
pe_session = pe_find_session_by_session_id(mac_ctx, pe_session_id);
@ -2710,5 +2713,6 @@ void lim_set_channel(tpAniSirGlobal mac_ctx, uint8_t channel,
}
lim_send_switch_chnl_params(mac_ctx, channel, ch_center_freq_seg0,
ch_center_freq_seg1, ch_width,
max_tx_power, pe_session_id, false);
max_tx_power, pe_session_id, false,
cac_duration_ms, dfs_regdomain);
}

View file

@ -1047,7 +1047,10 @@ __lim_handle_sme_start_bss_request(tpAniSirGlobal mac_ctx, uint32_t *msg_buf)
mlm_start_req->cbMode = sme_start_bss_req->cbMode;
mlm_start_req->beaconPeriod =
session->beaconParams.beaconInterval;
mlm_start_req->cac_duration_ms =
sme_start_bss_req->cac_duration_ms;
mlm_start_req->dfs_regdomain =
sme_start_bss_req->dfs_regdomain;
if (LIM_IS_AP_ROLE(session)) {
mlm_start_req->dtimPeriod = session->dtimPeriod;
mlm_start_req->wps_state = session->wps_state;
@ -5574,7 +5577,9 @@ static void lim_process_sme_channel_change_request(tpAniSirGlobal mac_ctx,
session_entry->ch_center_freq_seg0,
session_entry->ch_center_freq_seg1,
session_entry->ch_width,
max_tx_pwr, session_entry->peSessionId);
max_tx_pwr, session_entry->peSessionId,
ch_change_req->cac_duration_ms,
ch_change_req->dfs_regdomain);
}
/******************************************************************************

View file

@ -517,7 +517,8 @@ lim_restore_pre_reassoc_state(tpAniSirGlobal pMac,
psessionEntry->ch_center_freq_seg1,
psessionEntry->ch_width,
psessionEntry->maxTxPower,
psessionEntry->peSessionId);
psessionEntry->peSessionId,
0, 0);
/* @ToDo:Need to Integrate the STOP the Dataxfer to AP from 11H code */

View file

@ -209,7 +209,9 @@ tSirRetStatus lim_send_switch_chnl_params(tpAniSirGlobal pMac,
enum phy_ch_width ch_width,
int8_t maxTxPower,
uint8_t peSessionId,
uint8_t is_restart)
uint8_t is_restart,
uint32_t cac_duration_ms,
uint32_t dfs_regdomain)
{
tpSwitchChannelParams pChnlParams = NULL;
struct scheduler_msg msgQ;
@ -264,6 +266,8 @@ tSirRetStatus lim_send_switch_chnl_params(tpAniSirGlobal pMac,
}
pChnlParams->restart_on_chan_switch = is_restart;
pChnlParams->cac_duration_ms = cac_duration_ms;
pChnlParams->dfs_regdomain = dfs_regdomain;
if (cds_is_5_mhz_enabled())
pChnlParams->ch_width = CH_WIDTH_5MHZ;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
* Copyright (c) 2011-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@ -70,7 +70,9 @@ tSirRetStatus lim_send_switch_chnl_params(tpAniSirGlobal pMac,
enum phy_ch_width ch_width,
int8_t maxTxPower,
uint8_t peSessionId,
uint8_t is_restart);
uint8_t is_restart,
uint32_t cac_duration_ms,
uint32_t dfs_regdomain);
tSirRetStatus lim_send_edca_params(tpAniSirGlobal pMac,
tSirMacEdcaParamRecord *pUpdatedEdcaParams,

View file

@ -199,6 +199,8 @@ typedef struct sLimMlmStartReq {
uint8_t wps_state;
uint8_t obssProtEnabled;
uint8_t beacon_tx_rate;
uint32_t cac_duration_ms;
uint32_t dfs_regdomain;
} tLimMlmStartReq, *tpLimMlmStartReq;
typedef struct sLimMlmStartCnf {
@ -586,7 +588,8 @@ uint32_t lim_defer_msg(tpAniSirGlobal, struct scheduler_msg *);
void lim_set_channel(tpAniSirGlobal pMac, uint8_t channel,
uint8_t ch_center_freq_seg0, uint8_t ch_center_freq_seg1,
enum phy_ch_width ch_width, int8_t maxTxPower,
uint8_t peSessionId);
uint8_t peSessionId, uint32_t cac_duration_ms,
uint32_t dfs_regdomain);
/* / Function that completes channel scan */

View file

@ -2714,7 +2714,7 @@ void lim_switch_primary_channel(tpAniSirGlobal pMac, uint8_t newChannel,
lim_send_switch_chnl_params(pMac, newChannel, 0, 0, CH_WIDTH_20MHZ,
psessionEntry->maxTxPower,
psessionEntry->peSessionId, false);
psessionEntry->peSessionId, false, 0, 0);
return;
}
@ -2757,7 +2757,7 @@ void lim_switch_primary_secondary_channel(tpAniSirGlobal pMac,
ch_center_freq_seg1, ch_width,
psessionEntry->maxTxPower,
psessionEntry->peSessionId,
false);
false, 0, 0);
/* Store the new primary and secondary channel in session entries if different */
if (psessionEntry->currentOperChannel != newChannel) {
@ -4559,7 +4559,7 @@ void lim_update_sta_run_time_ht_switch_chnl_params(tpAniSirGlobal pMac,
psessionEntry->htRecommendedTxWidthSet,
psessionEntry->maxTxPower,
psessionEntry->peSessionId,
true);
true, 0, 0);
/* In case of IBSS, if STA should update HT Info IE in its beacons. */
if (LIM_IS_IBSS_ROLE(psessionEntry)) {

View file

@ -1088,6 +1088,71 @@ sap_mark_leaking_ch(ptSapContext sap_ctx,
}
#endif /* end of WLAN_ENABLE_CHNL_MATRIX_RESTRICTION */
/**
* sap_is_channel_bonding_etsi_weather_channel() - check weather chan bonding.
* @sap_ctx: sap context
*
* Check if the current SAP operating channel is bonded to weather radar
* channel in ETSI domain.
*
* Return: True if bonded to weather channel in ETSI
*/
static bool sap_is_channel_bonding_etsi_weather_channel(ptSapContext sap_ctx)
{
if (IS_CH_BONDING_WITH_WEATHER_CH(sap_ctx->channel) &&
(sap_ctx->ch_params.ch_width != CH_WIDTH_20MHZ))
return true;
return false;
}
/**
* sap_get_cac_dur_dfs_region() - get cac duration and dfs region.
* @sap_ctxt: sap context
* @cac_duration_ms: pointer to cac duration
* @dfs_region: pointer to dfs region
*
* Get cac duration and dfs region.
*
* Return: None
*/
static void sap_get_cac_dur_dfs_region(ptSapContext sap_ctx,
uint32_t *cac_duration_ms,
uint32_t *dfs_region)
{
tHalHandle hal = NULL;
tpAniSirGlobal mac = NULL;
cds_get_dfs_region(dfs_region);
if (!sap_ctx) {
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
"%s: null sap_ctx", __func__);
return;
}
hal = CDS_GET_HAL_CB(sap_ctx->p_cds_gctx);
if (!hal) {
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
"%s: null hal", __func__);
return;
}
mac = PMAC_STRUCT(hal);
if (mac->sap.SapDfsInfo.ignore_cac) {
*cac_duration_ms = 0;
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_DEBUG,
"%s: ignore_cac is set", __func__);
return;
}
if ((*dfs_region == DFS_ETSI_REGION) &&
((IS_ETSI_WEATHER_CH(sap_ctx->channel)) ||
(sap_is_channel_bonding_etsi_weather_channel(sap_ctx))))
*cac_duration_ms = ETSI_WEATHER_CH_CAC_TIMEOUT;
else
*cac_duration_ms = DEFAULT_CAC_TIMEOUT;
}
/*
* This function adds availabe channel to bitmap
*
@ -3796,6 +3861,9 @@ static QDF_STATUS sap_fsm_state_ch_select(ptSapContext sap_ctx,
sap_ctx->ch_params.center_freq_seg1;
sap_ctx->csr_roamProfile.ch_params.sec_ch_offset =
sap_ctx->ch_params.sec_ch_offset;
sap_get_cac_dur_dfs_region(sap_ctx,
&sap_ctx->csr_roamProfile.cac_duration_ms,
&sap_ctx->csr_roamProfile.dfs_regdomain);
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
FL("notify hostapd about channel selection: %d"),
sap_ctx->channel);
@ -4175,6 +4243,10 @@ static QDF_STATUS sap_fsm_state_disconnecting(ptSapContext sap_ctx,
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_MED,
FL("sapdfs: Send channel change request on sapctx[%p]"),
sap_ctx);
sap_get_cac_dur_dfs_region(sap_ctx,
&sap_ctx->csr_roamProfile.cac_duration_ms,
&sap_ctx->csr_roamProfile.dfs_regdomain);
/*
* Most likely, radar has been detected and SAP wants to
* change the channel
@ -5095,87 +5167,58 @@ static int sap_stop_dfs_cac_timer(ptSapContext sapContext)
}
/**
* sap_is_channel_bonding_etsi_weather_channel() - check weather chan bonding.
* @sap_context: SAP context
*
* Check if the current SAP operating channel is bonded to weather radar
* channel in ETSI domain.
*
* Return: True if bonded to weather channel in ETSI
*/
static bool
sap_is_channel_bonding_etsi_weather_channel(ptSapContext sap_context)
{
if (IS_CH_BONDING_WITH_WEATHER_CH(sap_context->channel) &&
(sap_context->ch_params.ch_width != CH_WIDTH_20MHZ))
return true;
return false;
}
/*
* Function to start the DFS CAC Timer
* when SAP is started on a DFS channel
*/
int sap_start_dfs_cac_timer(ptSapContext sapContext)
int sap_start_dfs_cac_timer(ptSapContext sap_ctx)
{
QDF_STATUS status;
uint32_t cacTimeOut;
tHalHandle hHal = NULL;
tpAniSirGlobal pMac = NULL;
uint32_t cac_dur;
tHalHandle hal = NULL;
tpAniSirGlobal mac = NULL;
enum dfs_region dfs_region;
if (sapContext == NULL) {
return 0;
}
hHal = CDS_GET_HAL_CB(sapContext->p_cds_gctx);
if (NULL == hHal) {
if (!sap_ctx) {
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
"In %s invalid hHal", __func__);
"%s: null sap_ctx", __func__);
return 0;
}
pMac = PMAC_STRUCT(hHal);
if (pMac->sap.SapDfsInfo.ignore_cac) {
/*
* If User has set to ignore the CAC
* so, continue without CAC Timer.
*/
return 2;
hal = CDS_GET_HAL_CB(sap_ctx->p_cds_gctx);
if (!hal) {
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
"%s: null hal", __func__);
return 0;
}
cacTimeOut = DEFAULT_CAC_TIMEOUT;
cds_get_dfs_region(&dfs_region);
if ((dfs_region == DFS_ETSI_REGION)
&& ((IS_ETSI_WEATHER_CH(sapContext->channel)) ||
(sap_is_channel_bonding_etsi_weather_channel(sapContext)))) {
cacTimeOut = ETSI_WEATHER_CH_CAC_TIMEOUT;
}
mac = PMAC_STRUCT(hal);
sap_get_cac_dur_dfs_region(sap_ctx, &cac_dur, &dfs_region);
if (0 == cac_dur)
return 0;
#ifdef QCA_WIFI_NAPIER_EMULATION
cacTimeOut = cacTimeOut / 100;
cac_dur = cac_dur / 100;
#endif
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_MED,
"sapdfs: SAP_DFS_CHANNEL_CAC_START on CH - %d, CAC TIMEOUT - %d sec",
sapContext->channel, cacTimeOut / 1000);
"sapdfs: SAP_DFS_CHANNEL_CAC_START on CH-%d, CAC_DUR-%d sec",
sap_ctx->channel, cac_dur / 1000);
qdf_mc_timer_init(&pMac->sap.SapDfsInfo.sap_dfs_cac_timer,
qdf_mc_timer_init(&mac->sap.SapDfsInfo.sap_dfs_cac_timer,
QDF_TIMER_TYPE_SW,
sap_dfs_cac_timer_callback, (void *) hHal);
sap_dfs_cac_timer_callback, (void *)hal);
/*Start the CAC timer */
status =
qdf_mc_timer_start(&pMac->sap.SapDfsInfo.sap_dfs_cac_timer,
cacTimeOut);
/* Start the CAC timer */
status = qdf_mc_timer_start(&mac->sap.SapDfsInfo.sap_dfs_cac_timer,
cac_dur);
if (status == QDF_STATUS_SUCCESS) {
pMac->sap.SapDfsInfo.is_dfs_cac_timer_running = true;
mac->sap.SapDfsInfo.is_dfs_cac_timer_running = true;
return 1;
} else {
pMac->sap.SapDfsInfo.is_dfs_cac_timer_running = false;
qdf_mc_timer_destroy(&pMac->sap.SapDfsInfo.sap_dfs_cac_timer);
mac->sap.SapDfsInfo.is_dfs_cac_timer_running = false;
qdf_mc_timer_destroy(&mac->sap.SapDfsInfo.sap_dfs_cac_timer);
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
"%s: failed to start cac timer", __func__);
return 0;
}
}

View file

@ -974,6 +974,8 @@ typedef struct tagCsrRoamProfile {
tSirMacRateSet extended_rates;
struct qdf_mac_addr bssid_hint;
bool do_not_roam;
uint32_t cac_duration_ms;
uint32_t dfs_regdomain;
} tCsrRoamProfile;

View file

@ -348,6 +348,8 @@ typedef struct tagCsrRoamStartBssParams {
tSirAddIeParams addIeParams;
uint8_t sap_dot11mc;
uint8_t beacon_tx_rate;
uint32_t cac_duration_ms;
uint32_t dfs_regdomain;
} tCsrRoamStartBssParams;
typedef struct tagScanCmd {

View file

@ -7657,6 +7657,8 @@ QDF_STATUS csr_roam_copy_profile(tpAniSirGlobal pMac,
pDstProfile->extended_rates.numRates =
pSrcProfile->extended_rates.numRates;
}
pDstProfile->cac_duration_ms = pSrcProfile->cac_duration_ms;
pDstProfile->dfs_regdomain = pSrcProfile->dfs_regdomain;
end:
if (!QDF_IS_STATUS_SUCCESS(status)) {
csr_release_profile(pMac, pDstProfile);
@ -13343,6 +13345,8 @@ QDF_STATUS csr_roam_issue_start_bss(tpAniSirGlobal pMac, uint32_t sessionId,
pProfile->addIeParams.probeRespBCNData_buff;
}
pParam->sap_dot11mc = pProfile->sap_dot11mc;
pParam->cac_duration_ms = pProfile->cac_duration_ms;
pParam->dfs_regdomain = pProfile->dfs_regdomain;
/* When starting an IBSS, start on the channel from the Profile. */
status =
@ -15503,6 +15507,8 @@ QDF_STATUS csr_send_mb_start_bss_req_msg(tpAniSirGlobal pMac, uint32_t sessionId
pMsg->sap_dot11mc = pParam->sap_dot11mc;
pMsg->vendor_vht_sap =
pMac->roam.configParam.vendor_vht_sap;
pMsg->cac_duration_ms = pParam->cac_duration_ms;
pMsg->dfs_regdomain = pParam->dfs_regdomain;
return umac_send_mb_message_to_mac(pMsg);
}
@ -19231,6 +19237,8 @@ QDF_STATUS csr_roam_channel_change_req(tpAniSirGlobal pMac,
pMsg->center_freq_seg_0 = ch_params->center_freq_seg0;
pMsg->center_freq_seg_1 = ch_params->center_freq_seg1;
pMsg->cac_duration_ms = profile->cac_duration_ms;
pMsg->dfs_regdomain = profile->dfs_regdomain;
qdf_mem_copy(pMsg->bssid, bssid.bytes, QDF_MAC_ADDR_SIZE);
qdf_mem_copy(&pMsg->operational_rateset,
&param.operationalRateSet, sizeof(pMsg->operational_rateset));

View file

@ -1667,6 +1667,8 @@ struct wma_target_req {
* number of receive streams
* @he_capable: HE capability
* @he_ops: HE operation
* @cac_duration_ms: cac duration in milliseconds
* @dfs_regdomain: dfs region
*/
struct wma_vdev_start_req {
uint32_t beacon_intval;
@ -1695,6 +1697,8 @@ struct wma_vdev_start_req {
bool he_capable;
uint32_t he_ops;
#endif
uint32_t cac_duration_ms;
uint32_t dfs_regdomain;
};
/**

View file

@ -456,6 +456,8 @@ typedef struct sLimMlmSetKeysReq {
* @smpsMode: SMPS mode
* @dot11_mode: 802.11 mode
* @he_capable: HE Capability
* @cac_duration_ms: cac duration in milliseconds
* @dfs_regdomain: dfs region
*/
typedef struct {
tSirMacAddr bssId;
@ -527,6 +529,8 @@ typedef struct {
tDot11fIEvendor_he_cap he_config;
tDot11fIEvendor_he_op he_op;
#endif
uint32_t cac_duration_ms;
uint32_t dfs_regdomain;
} tAddBssParams, *tpAddBssParams;
/**
@ -891,6 +895,8 @@ typedef struct {
* @isDfsChannel: is DFS channel
* @vhtCapable: VHT capable
* @dot11_mode: 802.11 mode
* @cac_duration_ms: cac duration in milliseconds
* @dfs_regdomain: dfs region
*/
typedef struct {
uint8_t channelNumber;
@ -924,6 +930,8 @@ typedef struct {
#ifdef WLAN_FEATURE_11AX
bool he_capable;
#endif
uint32_t cac_duration_ms;
uint32_t dfs_regdomain;
} tSwitchChannelParams, *tpSwitchChannelParams;
typedef void (*tpSetLinkStateCallback)(tpAniSirGlobal pMac, void *msgParam,

View file

@ -1984,6 +1984,8 @@ QDF_STATUS wma_vdev_start(tp_wma_handle wma,
*/
params.is_dfs = req->is_dfs;
params.is_restart = isRestart;
params.cac_duration_ms = req->cac_duration_ms;
params.regdomain = req->dfs_regdomain;
if ((QDF_GLOBAL_MONITOR_MODE != cds_get_conparam()) && req->is_dfs) {
params.flag_dfs = WMI_CHAN_FLAG_DFS;
temp_chan_info |= (1 << WMI_CHAN_FLAG_DFS);
@ -2966,6 +2968,8 @@ static void wma_add_bss_ap_mode(tp_wma_handle wma, tpAddBssParams add_bss)
req.is_dfs = add_bss->bSpectrumMgtEnabled;
req.oper_mode = BSS_OPERATIONAL_MODE_AP;
req.ssid.length = add_bss->ssId.length;
req.cac_duration_ms = add_bss->cac_duration_ms;
req.dfs_regdomain = add_bss->dfs_regdomain;
if (req.ssid.length > 0)
qdf_mem_copy(req.ssid.ssId, add_bss->ssId.ssId,
add_bss->ssId.length);

View file

@ -2955,6 +2955,8 @@ void wma_set_channel(tp_wma_handle wma, tpSwitchChannelParams params)
req.beacon_intval = 100;
req.dtim_period = 1;
req.is_dfs = params->isDfsChannel;
req.cac_duration_ms = params->cac_duration_ms;
req.dfs_regdomain = params->dfs_regdomain;
/* In case of AP mode, once radar is detected, we need to
* issuse VDEV RESTART, so we making is_channel_switch as