qcacld-3.0: Add logic to check if channel is disabled

Currently, when the country code changes, there is no logic
to restart the SAP on a new channel. Add a case to check if
the channel is not allowed, then calculate a new safe channel
and update the SAP restart reason.

Change-Id: I679ce6f72228b431530953a631c8c8afa4597187
CRs-fixed: 2718324
This commit is contained in:
Lincoln Tran 2020-06-24 13:40:00 -07:00 • committed by snandini
commit eb083f3346
4 changed files with 25 additions and 6 deletions

View file

@ -75,6 +75,7 @@ typedef const enum policy_mgr_conc_next_action
* @CSA_REASON_CONCURRENT_NAN_EVENT: NAN concurrency.
* @CSA_REASON_BAND_RESTRICTED: band disabled or re-enabled
* @CSA_REASON_DCS: DCS
* @CSA_REASON_CHAN_DISABLED: channel is disabled
*
*/
enum sap_csa_reason_code {
@ -89,6 +90,7 @@ enum sap_csa_reason_code {
CSA_REASON_CONCURRENT_NAN_EVENT,
CSA_REASON_BAND_RESTRICTED,
CSA_REASON_DCS,
CSA_REASON_CHAN_DISABLED,
};
/**

View file

@ -3229,11 +3229,10 @@ QDF_STATUS wlan_hdd_get_channel_for_sap_restart(
return QDF_STATUS_E_FAILURE;
}
intf_ch_freq = wlansap_get_chan_band_restrict(sap_context);
if (intf_ch_freq) {
csa_reason = CSA_REASON_BAND_RESTRICTED;
intf_ch_freq = wlansap_get_chan_band_restrict(sap_context, &csa_reason);
if (intf_ch_freq)
goto sap_restart;
}
/*
* If STA+SAP sessions are on DFS channel and STA+SAP SCC is
* enabled on DFS channel then move the SAP out of DFS channel

View file

@ -1477,14 +1477,18 @@ wlansap_get_safe_channel_from_pcl_and_acs_range(struct sap_context *sap_ctx);
/**
* wlansap_get_chan_band_restrict() - get new chan for band change
* @sap_ctx: sap context pointer
* @csa_reason: channel switch reason to update
*
* Sap/p2p go channel switch from 5G to 2G by CSA when 5G band disabled to
* avoid conflict with modem N79.
* Sap/p2p go channel restore to 5G channel when 5G band enabled.
* Note: csa_reason is only updated when channel is disabled or band is
* restricted, so it must be initialized to a default value beforehand
*
* Return - restart channel in MHZ
*/
qdf_freq_t wlansap_get_chan_band_restrict(struct sap_context *sap_ctx);
qdf_freq_t wlansap_get_chan_band_restrict(struct sap_context *sap_ctx,
enum sap_csa_reason_code *csa_reason);
#ifdef DCS_INTERFERENCE_DETECTION
/**

View file

@ -2979,7 +2979,8 @@ err:
return freq;
}
qdf_freq_t wlansap_get_chan_band_restrict(struct sap_context *sap_ctx)
qdf_freq_t wlansap_get_chan_band_restrict(struct sap_context *sap_ctx,
enum sap_csa_reason_code *csa_reason)
{
uint32_t restart_freq;
enum phy_ch_width restart_ch_width;
@ -2995,6 +2996,12 @@ qdf_freq_t wlansap_get_chan_band_restrict(struct sap_context *sap_ctx)
sap_err("sap_ctx NULL parameter");
return 0;
}
if (!csa_reason) {
sap_err("csa_reason is NULL");
return 0;
}
if (cds_is_driver_recovering())
return 0;
@ -3004,6 +3011,12 @@ qdf_freq_t wlansap_get_chan_band_restrict(struct sap_context *sap_ctx)
return 0;
}
if (wlan_reg_is_disable_for_freq(mac->pdev, sap_ctx->chan_freq)) {
sap_debug("channel is disabled");
*csa_reason = CSA_REASON_CHAN_DISABLED;
return wlansap_get_safe_channel_from_pcl_and_acs_range(sap_ctx);
}
if (ucfg_reg_get_band(mac->pdev, &band) != QDF_STATUS_SUCCESS) {
sap_err("Failed to get current band config");
return 0;
@ -3034,6 +3047,7 @@ qdf_freq_t wlansap_get_chan_band_restrict(struct sap_context *sap_ctx)
restart_ch_width = sap_ctx->chan_width_before_switch_band;
sap_debug("Restore chan freq: %d, width: %d",
restart_freq, restart_ch_width);
*csa_reason = CSA_REASON_BAND_RESTRICTED;
} else {
sap_debug("No need switch SAP/Go channel");
return 0;