qcacmn: Enhance SAP concurrency check to cover AP channel switch case

SAP(Go) concurrency check is mainly used for two purposes:

1) When new GO/SAP session is coming up and needs to check if
this session's channel can co-exist with existing GO/SAP
sessions. For example, in case of single radio platform, MCC for
SAP/GO+SAP/GO is not supported, in such case this API should
prevent bringing the second connection.

2) There is already existing SAP+GO combination but due to upper
layer notifying LTE-COEX event or sending command to move one of
the connections to different channel. In such cases before moving
existing connection to new channel, check if new channel can
co-exist with the other existing connection. For example, one
SAP1 is on channel-6 and second SAP2 is on channel-36 and lets
say they are doing DBS, and lets say upper layer sends LTE-COEX
to move SAP1 from channel-6 to channel-149. In this case, SAP1
and SAP2 will end up doing MCC which may not be desirable result.
such cases will be prevented with this API.

Add vdev_id check while checking for 2nd case. If connection with
given vdev_id exist then it is confirmed that it's a case of
channel switch rather than a new connection case.

Optimize the performance and readability of
policy_mgr_allow_sap_go_concurrency() API by re-organizing the
code blocks.

Change-Id: Idce5d2df7d21e36d2311946115a19482e4b81a8e
CRs-Fixed: 2299105
This commit is contained in:
Jianmin Zhu 2018-08-21 19:20:28 +08:00 • committed by nshrivas
commit e1ebfd058d
2 changed files with 54 additions and 55 deletions

View file

@ -2444,19 +2444,37 @@ QDF_STATUS policy_mgr_register_mode_change_cb(struct wlan_objmgr_psoc *psoc,
QDF_STATUS policy_mgr_deregister_mode_change_cb(struct wlan_objmgr_psoc *psoc);
/**
* policy_mgr_allow_sap_go_concurrency() - check whether multiple SAP/GO
* interfaces are allowed
* policy_mgr_allow_sap_go_concurrency() - check whether SAP/GO concurrency is
* allowed.
* @psoc: pointer to soc
* @policy_mgr_con_mode: operating mode of the new interface
* @channel: operating channel of the new interface
* This function checks whether second SAP/GO interface is allowed on the same
* MAC.
* @policy_mgr_con_mode: operating mode of interface to be checked
* @channel: new operating channel of the interface to be checked
* @vdev_id: vdev id of the connection to be checked, 0xff for new connection
*
* Checks whether new channel SAP/GO can co-exist with the channel of existing
* SAP/GO connection. This API mainly used for two purposes:
*
* 1) When new GO/SAP session is coming up and needs to check if this session's
* channel can co-exist with existing existing GO/SAP sessions. For example,
* when single radio platform comes, MCC for SAP/GO+SAP/GO is not supported, in
* such case this API should prevent bringing the second connection.
*
* 2) There is already existing SAP+GO combination but due to upper layer
* notifying LTE-COEX event or sending command to move one of the connections
* to different channel. In such cases before moving existing connection to new
* channel, check if new channel can co-exist with the other existing
* connection. For example, one SAP1 is on channel-6 and second SAP2 is on
* channel-36 and lets say they are doing DBS, and lets say upper layer sends
* LTE-COEX to move SAP1 from channel-6 to channel-149. In this case, SAP1 and
* SAP2 will end up doing MCC which may not be desirable result. such cases
* will be prevented with this API.
*
* Return: true or false
*/
bool policy_mgr_allow_sap_go_concurrency(struct wlan_objmgr_psoc *psoc,
enum policy_mgr_con_mode mode,
uint8_t channel);
uint8_t channel,
uint32_t vdev_id);
/**
* policy_mgr_dual_beacon_on_single_mac_scc_capable() - get capability that

View file

@ -1808,7 +1808,8 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc,
}
}
if (!policy_mgr_allow_sap_go_concurrency(psoc, mode, channel)) {
if (!policy_mgr_allow_sap_go_concurrency(psoc, mode, channel,
WLAN_INVALID_VDEV_ID)) {
policy_mgr_err("This concurrency combination is not allowed");
goto done;
}
@ -3117,62 +3118,42 @@ uint32_t policy_mgr_get_connection_info(struct wlan_objmgr_psoc *psoc,
bool policy_mgr_allow_sap_go_concurrency(struct wlan_objmgr_psoc *psoc,
enum policy_mgr_con_mode mode,
uint8_t channel)
uint8_t channel,
uint32_t vdev_id)
{
uint32_t sap_cnt;
uint32_t go_cnt;
enum policy_mgr_con_mode con_mode;
uint8_t con_chan;
int id;
uint32_t vdev;
bool dbs;
sap_cnt = policy_mgr_mode_specific_connection_count(psoc,
PM_SAP_MODE,
NULL);
go_cnt = policy_mgr_mode_specific_connection_count(psoc,
PM_P2P_GO_MODE,
NULL);
if ((mode == PM_SAP_MODE || mode == PM_P2P_GO_MODE) &&
(sap_cnt || go_cnt)) {
if (policy_mgr_dual_beacon_on_single_mac_mcc_capable(psoc))
if (mode != PM_SAP_MODE && mode != PM_P2P_GO_MODE)
return true;
if (policy_mgr_dual_beacon_on_single_mac_mcc_capable(psoc))
return true;
dbs = policy_mgr_is_hw_dbs_capable(psoc);
for (id = 0; id < MAX_NUMBER_OF_CONC_CONNECTIONS; id++) {
if (!pm_conc_connection_list[id].in_use)
continue;
vdev = pm_conc_connection_list[id].vdev_id;
if (vdev_id == vdev)
continue;
con_mode = pm_conc_connection_list[id].mode;
if (con_mode != PM_SAP_MODE && con_mode != PM_P2P_GO_MODE)
continue;
con_chan = pm_conc_connection_list[id].chan;
if (policy_mgr_dual_beacon_on_single_mac_scc_capable(psoc) &&
(channel == con_chan)) {
policy_mgr_debug("SCC enabled, 2 AP on same channel, allow 2nd AP");
return true;
if (policy_mgr_dual_beacon_on_single_mac_scc_capable(psoc)) {
for (id = 0; id < MAX_NUMBER_OF_CONC_CONNECTIONS;
id++) {
if (pm_conc_connection_list[id].in_use) {
con_mode =
pm_conc_connection_list[id].mode;
con_chan =
pm_conc_connection_list[id].chan;
if (((con_mode == PM_SAP_MODE) ||
(con_mode == PM_P2P_GO_MODE)) &&
(channel == con_chan)) {
policy_mgr_debug("Scc is supported, allow second SAP interface");
return true;
}
}
}
}
if (!policy_mgr_is_hw_dbs_capable(psoc)) {
policy_mgr_debug("DBS is not supported, mcc and scc are not supported too, don't allow second SAP interface");
if (!dbs) {
policy_mgr_debug("DBS unsupported, mcc and scc unsupported too, don't allow 2nd AP");
return false;
}
/* If DBS is supported then allow second SAP/GO session only if
* the freq band of the second SAP/GO interface is different
* than the first SAP/GO interface.
*/
for (id = 0; id < MAX_NUMBER_OF_CONC_CONNECTIONS; id++) {
if (pm_conc_connection_list[id].in_use) {
con_mode = pm_conc_connection_list[id].mode;
con_chan = pm_conc_connection_list[id].chan;
if (((con_mode == PM_SAP_MODE) ||
(con_mode == PM_P2P_GO_MODE)) &&
(WLAN_REG_IS_SAME_BAND_CHANNELS(channel,
con_chan))) {
policy_mgr_debug("DBS is supported, but first SAP and second SAP are on same band, So don't allow second SAP interface");
return false;
}
}
if (WLAN_REG_IS_SAME_BAND_CHANNELS(channel, con_chan)) {
policy_mgr_debug("DBS supported, 2 SAP on same band, reject 2nd AP");
return false;
}
}