qcacld-3.0: SAP CSA from 5G to 2G for modem N79
For SAP/P2P GO on 5G, when receive cmd to disable 5G band when modem n79 band used, will move to 2G band via CSA. 1. If no active connection on 2G, select ch by safe list, or channel 6. 2. If there is STA on 2G, force scc with it. 3. If there is SAP/GO on 2G, force scc with it. 4. Handle one race condition that if candidate is already selected & FW has gone ahead with roaming or about to go ahead when set_band comes, it will be complicated for FW to stop the current roaming. Instead, host will check roam sync to make sure the new AP is on 2G, or disconnect the AP. 5. If 2 SAP on 5G, move both to 2G and keep scc. When Set band to enable 5G band again, restored all 5G SAP/Go.. Change-Id: I9b2b1ead3b4502022aeefc08359037457bb051f9 CRs-Fixed: 2580204
This commit is contained in:

committed by
Nitesh Shrivastav

父節點
17a78b1f04
當前提交
61d502d966
@@ -1459,6 +1459,21 @@ QDF_STATUS wlansap_filter_ch_based_acs(struct sap_context *sap_ctx,
|
||||
*/
|
||||
uint32_t
|
||||
wlansap_get_safe_channel_from_pcl_and_acs_range(struct sap_context *sap_ctx);
|
||||
|
||||
/**
|
||||
* wlansap_set_band_csa() - sap channel switch for band change
|
||||
* @sap_ctx: sap context pointer
|
||||
* @sap_config: sap config pointer
|
||||
*
|
||||
* 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 when 5G band enabled.
|
||||
*
|
||||
* Return - none
|
||||
*/
|
||||
void wlansap_set_band_csa(struct sap_context *sap_ctx,
|
||||
struct sap_config *sap_config,
|
||||
enum band_info band);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -171,7 +171,8 @@ struct sap_context {
|
||||
uint8_t num_of_channel;
|
||||
uint16_t ch_width_orig;
|
||||
struct ch_params ch_params;
|
||||
|
||||
uint32_t chan_freq_before_switch_band;
|
||||
enum phy_ch_width chan_width_before_switch_band;
|
||||
uint32_t auto_channel_select_weight;
|
||||
bool enableOverLapCh;
|
||||
struct sap_acs_cfg *acs_cfg;
|
||||
|
@@ -1358,6 +1358,8 @@ static char *sap_get_csa_reason_str(enum sap_csa_reason_code reason)
|
||||
return "LTE_COEX";
|
||||
case CSA_REASON_CONCURRENT_NAN_EVENT:
|
||||
return "CONCURRENT_NAN_EVENT";
|
||||
case CSA_REASON_BAND_RESTRICTED:
|
||||
return "BAND_RESTRICTED";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
@@ -3090,3 +3092,119 @@ wlansap_get_safe_channel_from_pcl_and_acs_range(struct sap_context *sap_ctx)
|
||||
*/
|
||||
return wlansap_get_safe_channel(sap_ctx);
|
||||
}
|
||||
|
||||
static uint32_t wlansap_get_2g_first_safe_chan_freq(struct sap_context *sap_ctx)
|
||||
{
|
||||
uint32_t i;
|
||||
uint32_t freq;
|
||||
enum channel_state state;
|
||||
struct regulatory_channel *cur_chan_list;
|
||||
struct wlan_objmgr_pdev *pdev;
|
||||
struct wlan_objmgr_psoc *psoc;
|
||||
uint32_t *acs_freq_list;
|
||||
uint8_t acs_list_count;
|
||||
|
||||
pdev = sap_ctx->vdev->vdev_objmgr.wlan_pdev;
|
||||
psoc = pdev->pdev_objmgr.wlan_psoc;
|
||||
|
||||
cur_chan_list = qdf_mem_malloc(NUM_CHANNELS *
|
||||
sizeof(struct regulatory_channel));
|
||||
if (!cur_chan_list)
|
||||
return TWOG_CHAN_6_IN_MHZ;
|
||||
|
||||
if (wlan_reg_get_current_chan_list(pdev, cur_chan_list) !=
|
||||
QDF_STATUS_SUCCESS) {
|
||||
freq = TWOG_CHAN_6_IN_MHZ;
|
||||
goto err;
|
||||
}
|
||||
|
||||
acs_freq_list = sap_ctx->acs_cfg->master_freq_list;
|
||||
acs_list_count = sap_ctx->acs_cfg->master_ch_list_count;
|
||||
for (i = 0; i < NUM_CHANNELS; i++) {
|
||||
freq = cur_chan_list[i].center_freq;
|
||||
state = wlan_reg_get_channel_state_for_freq(pdev, freq);
|
||||
if (state != CHANNEL_STATE_DISABLE &&
|
||||
state != CHANNEL_STATE_INVALID &&
|
||||
wlan_reg_is_24ghz_ch_freq(freq) &&
|
||||
policy_mgr_is_safe_channel(psoc, freq) &&
|
||||
wlansap_is_channel_present_in_acs_list(freq,
|
||||
acs_freq_list,
|
||||
acs_list_count)) {
|
||||
sap_debug("find a 2g channel: %d", freq);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
freq = TWOG_CHAN_6_IN_MHZ;
|
||||
err:
|
||||
qdf_mem_free(cur_chan_list);
|
||||
return freq;
|
||||
}
|
||||
|
||||
void wlansap_set_band_csa(struct sap_context *sap_ctx,
|
||||
struct sap_config *sap_config,
|
||||
enum band_info band)
|
||||
{
|
||||
uint8_t restart_chan;
|
||||
uint32_t restart_freq;
|
||||
enum phy_ch_width restart_ch_width;
|
||||
uint8_t intf_ch;
|
||||
uint32_t phy_mode;
|
||||
struct mac_context *mac;
|
||||
uint8_t cc_mode;
|
||||
uint8_t vdev_id;
|
||||
enum reg_wifi_band sap_band;
|
||||
|
||||
sap_band = wlan_reg_freq_to_band(sap_ctx->chan_freq);
|
||||
sap_debug("SAP/Go current band: %d, pdev band capability: %d",
|
||||
sap_band, band);
|
||||
if (sap_band == REG_BAND_5G && band == BAND_2G) {
|
||||
if (sap_ctx->chan_freq_before_switch_band ==
|
||||
sap_ctx->chan_freq)
|
||||
return;
|
||||
sap_ctx->chan_freq_before_switch_band = sap_ctx->chan_freq;
|
||||
sap_ctx->chan_width_before_switch_band =
|
||||
sap_ctx->ch_params.ch_width;
|
||||
sap_debug("Save chan info before switch: %d, width: %d",
|
||||
sap_ctx->chan_freq, sap_ctx->ch_params.ch_width);
|
||||
restart_freq = wlansap_get_2g_first_safe_chan_freq(sap_ctx);
|
||||
restart_ch_width = sap_ctx->ch_params.ch_width;
|
||||
if (restart_ch_width > CH_WIDTH_40MHZ) {
|
||||
sap_debug("set 40M when switch SAP to 2G");
|
||||
restart_ch_width = CH_WIDTH_40MHZ;
|
||||
}
|
||||
} else if (sap_band == REG_BAND_2G &&
|
||||
(band == BAND_ALL || band == BAND_5G)) {
|
||||
if (sap_ctx->chan_freq_before_switch_band == 0)
|
||||
return;
|
||||
restart_freq = sap_ctx->chan_freq_before_switch_band;
|
||||
restart_ch_width = sap_ctx->chan_width_before_switch_band;
|
||||
sap_debug("Restore chan freq: %d, width: %d",
|
||||
restart_freq, restart_ch_width);
|
||||
sap_ctx->chan_freq_before_switch_band = 0;
|
||||
sap_ctx->chan_width_before_switch_band = CH_WIDTH_INVALID;
|
||||
|
||||
} else {
|
||||
sap_debug("No need switch SAP/Go channel");
|
||||
return;
|
||||
}
|
||||
|
||||
mac = cds_get_context(QDF_MODULE_ID_PE);
|
||||
restart_chan = wlan_reg_freq_to_chan(mac->pdev, restart_freq);
|
||||
cc_mode = sap_ctx->cc_switch_mode;
|
||||
phy_mode = sap_ctx->csr_roamProfile.phyMode;
|
||||
intf_ch = sme_check_concurrent_channel_overlap(MAC_HANDLE(mac),
|
||||
restart_freq,
|
||||
phy_mode,
|
||||
cc_mode);
|
||||
if (intf_ch)
|
||||
restart_chan = intf_ch;
|
||||
sap_ctx->csa_reason = CSA_REASON_BAND_RESTRICTED;
|
||||
vdev_id = sap_ctx->vdev->vdev_objmgr.vdev_id;
|
||||
restart_freq = wlan_chan_to_freq(restart_chan);
|
||||
sap_debug("vdev: %d, CSA target channel: %d, width: %d",
|
||||
vdev_id, restart_freq, restart_ch_width);
|
||||
policy_mgr_change_sap_channel_with_csa(mac->psoc, vdev_id,
|
||||
restart_freq,
|
||||
restart_ch_width, true);
|
||||
}
|
||||
|
Reference in New Issue
Block a user