diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index a978e835d7cc..396be5e93408 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -10674,6 +10674,26 @@ enum l1ss_sleep_allowed { #define CFG_ENABLE_REG_OFFLOAD_MAX (1) #define CFG_ENABLE_REG_OFFLOAD_DEFAULT (1) +/* + * + * g_sap_chanswitch_beacon_cnt - channel switch beacon count + * @Min: 1 + * @Max: 5 + * @Default: 5 + * + * This ini is used to configure channel switch beacon count + * + * Related: none + * + * Usage: External + * + * + */ +#define CFG_SAP_CH_SWITCH_BEACON_CNT "g_sap_chanswitch_beacon_cnt" +#define CFG_SAP_CH_SWITCH_BEACON_CNT_MIN (1) +#define CFG_SAP_CH_SWITCH_BEACON_CNT_MAX (5) +#define CFG_SAP_CH_SWITCH_BEACON_CNT_DEFAULT (5) + /* * * g_fils_max_chan_guard_time - Set maximum channel guard time(ms) @@ -11789,6 +11809,8 @@ struct hdd_config { bool sta_prefer_80MHz_over_160MHz; uint8_t sap_max_inactivity_override; bool fw_timeout_crash; + /* beacon count before channel switch */ + uint8_t sap_chanswitch_beacon_cnt; uint32_t rx_wakelock_timeout; uint32_t max_sched_scan_plan_interval; uint32_t max_sched_scan_plan_iterations; diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index 4fcfb1dd3bc8..9e8e2606af70 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -4227,6 +4227,12 @@ struct reg_table_entry g_registry_table[] = { CFG_RX_WAKELOCK_TIMEOUT_DEFAULT, CFG_RX_WAKELOCK_TIMEOUT_MIN, CFG_RX_WAKELOCK_TIMEOUT_MAX), + REG_VARIABLE(CFG_SAP_CH_SWITCH_BEACON_CNT, WLAN_PARAM_Integer, + struct hdd_config, sap_chanswitch_beacon_cnt, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_SAP_CH_SWITCH_BEACON_CNT_DEFAULT, + CFG_SAP_CH_SWITCH_BEACON_CNT_MIN, + CFG_SAP_CH_SWITCH_BEACON_CNT_MAX), REG_VARIABLE(CFG_MAX_SCHED_SCAN_PLAN_INT_NAME, WLAN_PARAM_Integer, struct hdd_config, max_sched_scan_plan_interval, VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 36405cd9ae72..227747eb3a8b 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -7521,6 +7521,8 @@ int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, pConfig->dfs_cac_offload = pHddCtx->dfs_cac_offload; pConfig->disableDFSChSwitch = iniConfig->disableDFSChSwitch; + pConfig->sap_chanswitch_beacon_cnt = + iniConfig->sap_chanswitch_beacon_cnt; /* channel is already set in the set_channel Call back */ /* pConfig->channel = pCommitConfig->channel; */ diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index 3f5be7a76a60..07f63a0d4220 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -3984,6 +3984,7 @@ typedef struct sSirDfsCsaIeRequest { uint8_t csaIeRequired; uint8_t bssid[QDF_MAC_ADDR_SIZE]; struct ch_params ch_params; + uint8_t ch_switch_beacon_cnt; } tSirDfsCsaIeRequest, *tpSirDfsCsaIeRequest; /* Indication from lower layer indicating the completion of first beacon send diff --git a/core/mac/src/pe/include/lim_global.h b/core/mac/src/pe/include/lim_global.h index 8cb627c7213f..2958b583f1a5 100644 --- a/core/mac/src/pe/include/lim_global.h +++ b/core/mac/src/pe/include/lim_global.h @@ -67,7 +67,6 @@ ((LIntrvl * LIM_TIM_WAIT_COUNT_FACTOR) > LIM_MIN_TIM_WAIT_COUNT ? \ (LIntrvl * LIM_TIM_WAIT_COUNT_FACTOR) : LIM_MIN_TIM_WAIT_COUNT) -#define LIM_MAX_CSA_IE_UPDATES (5) /* enums exported by LIM are as follows */ diff --git a/core/mac/src/pe/lim/lim_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c index 23e2cfe8771a..1d7cd4f880b0 100644 --- a/core/mac/src/pe/lim/lim_process_sme_req_messages.c +++ b/core/mac/src/pe/lim/lim_process_sme_req_messages.c @@ -5804,7 +5804,7 @@ static void send_extended_chan_switch_action_frame(tpAniSirGlobal mac_ctx, uint16_t op_class; uint8_t switch_mode = 0, i; tpDphHashNode psta; - + uint8_t switch_count; op_class = wlan_reg_dmn_get_opclass_from_channel( mac_ctx->scan.countryCodeCurrent, @@ -5815,6 +5815,8 @@ static void send_extended_chan_switch_action_frame(tpAniSirGlobal mac_ctx, (mac_ctx->sap.SapDfsInfo.disable_dfs_ch_switch == false)) switch_mode = 1; + switch_count = session_entry->gLimChannelSwitch.switchCount; + if (LIM_IS_AP_ROLE(session_entry)) { for (i = 0; i <= mac_ctx->lim.maxStation; i++) { psta = @@ -5824,13 +5826,13 @@ static void send_extended_chan_switch_action_frame(tpAniSirGlobal mac_ctx, mac_ctx, psta->staAddr, switch_mode, op_class, new_channel, - LIM_MAX_CSA_IE_UPDATES, session_entry); + switch_count, session_entry); } } else if (LIM_IS_STA_ROLE(session_entry)) { lim_send_extended_chan_switch_action_frame(mac_ctx, session_entry->bssId, switch_mode, op_class, new_channel, - LIM_MAX_CSA_IE_UPDATES, session_entry); + switch_count, session_entry); } } @@ -5881,7 +5883,8 @@ static void lim_process_sme_dfs_csa_ie_request(tpAniSirGlobal mac_ctx, /* Channel switch announcement needs to be included in beacon */ session_entry->dfsIncludeChanSwIe = true; - session_entry->gLimChannelSwitch.switchCount = LIM_MAX_CSA_IE_UPDATES; + session_entry->gLimChannelSwitch.switchCount = + dfs_csa_ie_req->ch_switch_beacon_cnt; session_entry->gLimChannelSwitch.ch_width = dfs_csa_ie_req->ch_params.ch_width; session_entry->gLimChannelSwitch.sec_ch_offset = diff --git a/core/sap/inc/sap_api.h b/core/sap/inc/sap_api.h index 09191bf0ba1a..9e93f1854036 100644 --- a/core/sap/inc/sap_api.h +++ b/core/sap/inc/sap_api.h @@ -628,6 +628,8 @@ typedef struct sap_Config { struct hdd_channel_info *channel_info; uint32_t channel_info_count; bool dfs_cac_offload; + /* beacon count before channel switch */ + uint8_t sap_chanswitch_beacon_cnt; } tsap_Config_t; #ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE @@ -734,6 +736,8 @@ typedef struct sSapDfsInfo { */ uint8_t disable_dfs_ch_switch; uint16_t tx_leakage_threshold; + /* beacon count before channel switch */ + uint8_t sap_ch_switch_beacon_cnt; } tSapDfsInfo; typedef struct tagSapCtxList { diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index 552940078b12..84baa76ddcbe 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -947,6 +947,9 @@ QDF_STATUS wlansap_start_bss(void *pCtx, /* pwextCtx */ */ pmac->sap.SapDfsInfo.disable_dfs_ch_switch = pConfig->disableDFSChSwitch; + pmac->sap.SapDfsInfo.sap_ch_switch_beacon_cnt = + pConfig->sap_chanswitch_beacon_cnt; + pmac->sap.sapCtxList[pSapCtx->sessionId].pSapContext = pSapCtx; pmac->sap.sapCtxList[pSapCtx->sessionId].sapPersona = pSapCtx->csr_roamProfile.csrPersona; diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index e6a2cc05a73e..79dd733c4d84 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -19162,6 +19162,8 @@ QDF_STATUS csr_roam_send_chan_sw_ie_request(tpAniSirGlobal mac_ctx, msg->targetChannel = target_channel; msg->csaIeRequired = csa_ie_reqd; + msg->ch_switch_beacon_cnt = + mac_ctx->sap.SapDfsInfo.sap_ch_switch_beacon_cnt; qdf_mem_copy(msg->bssid, bssid.bytes, QDF_MAC_ADDR_SIZE); qdf_mem_copy(&msg->ch_params, ch_params, sizeof(struct ch_params));