diff --git a/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h b/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h index 301cd0c7c1..7e514d265f 100644 --- a/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h +++ b/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h @@ -680,6 +680,8 @@ enum policy_mgr_con_mode policy_mgr_convert_device_mode_to_qdf_type( * @dfs: HW Agile DFS capability * @sbs: HW SBS capability * @reason: Reason for connection update + * @next_action: next action to happen at policy mgr after + * HW mode change * * Sends the set hw mode request to FW * @@ -710,7 +712,34 @@ QDF_STATUS policy_mgr_pdev_set_hw_mode(struct wlan_objmgr_psoc *psoc, enum hw_mode_dbs_capab dbs, enum hw_mode_agile_dfs_capab dfs, enum hw_mode_sbs_capab sbs, - enum policy_mgr_conn_update_reason reason); + enum policy_mgr_conn_update_reason reason, + uint8_t next_action); + +/** + * policy_mgr_pdev_set_hw_mode_cback() - callback invoked by + * other component to provide set HW mode request status + * @status: status of the request + * @cfgd_hw_mode_index: new HW mode index + * @num_vdev_mac_entries: Number of mac entries + * @vdev_mac_map: The table of vdev to mac mapping + * @next_action: next action to happen at policy mgr after + * beacon update + * @reason: Reason for set HW mode + * @session_id: vdev id on which the request was made + * @context: PSOC object information + * + * This function is the callback registered with SME at set HW + * mode request time + * + * Return: None + */ +typedef void (*policy_mgr_pdev_set_hw_mode_cback)(uint32_t status, + uint32_t cfgd_hw_mode_index, + uint32_t num_vdev_mac_entries, + struct policy_mgr_vdev_mac_map *vdev_mac_map, + uint8_t next_action, + enum policy_mgr_conn_update_reason reason, + uint32_t session_id, void *context); /** * policy_mgr_nss_update_cback() - callback invoked by other diff --git a/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h b/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h index 4d4f9ad53f..18d16254ef 100644 --- a/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h +++ b/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h @@ -668,6 +668,8 @@ enum policy_mgr_two_connection_mode { * @PM_SINGLE_MAC_UPGRADE: switch to MCC/SCC mode & upgrade to 2x2 * @PM_SBS: switch to SBS mode * @PM_SBS_DOWNGRADE: switch to SBS mode & downgrade to 1x1 + * @PM_DOWNGRADE: downgrade to 1x1 + * @PM_UPGRADE: upgrade to 2x2 * @PM_MAX_CONC_PRIORITY_MODE: Max place holder * * These are generic IDs that identify the various roles @@ -682,6 +684,8 @@ enum policy_mgr_conc_next_action { PM_SINGLE_MAC_UPGRADE, PM_SBS, PM_SBS_DOWNGRADE, + PM_DOWNGRADE, + PM_UPGRADE, PM_MAX_CONC_NEXT_ACTION }; @@ -889,6 +893,7 @@ struct policy_mgr_dual_mac_config { * @set_hw_mode_cb: HDD set HW mode callback * @reason: Reason for HW mode change * @session_id: Session id + * @next_action: next action to happen at policy mgr * @context: psoc context */ struct policy_mgr_hw_mode { @@ -896,7 +901,7 @@ struct policy_mgr_hw_mode { void *set_hw_mode_cb; enum policy_mgr_conn_update_reason reason; uint32_t session_id; - struct wlan_objmgr_vdev *vdev; + uint8_t next_action; struct wlan_objmgr_psoc *context; }; diff --git a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c index 48ab89322b..a4e0886a1b 100644 --- a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c +++ b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c @@ -98,7 +98,8 @@ QDF_STATUS policy_mgr_pdev_set_hw_mode(struct wlan_objmgr_psoc *psoc, enum hw_mode_dbs_capab dbs, enum hw_mode_agile_dfs_capab dfs, enum hw_mode_sbs_capab sbs, - enum policy_mgr_conn_update_reason reason) + enum policy_mgr_conn_update_reason reason, + uint8_t next_action) { int8_t hw_mode_index; struct policy_mgr_hw_mode msg; @@ -135,6 +136,7 @@ QDF_STATUS policy_mgr_pdev_set_hw_mode(struct wlan_objmgr_psoc *psoc, msg.set_hw_mode_cb = (void *)policy_mgr_pdev_set_hw_mode_cb; msg.reason = reason; msg.session_id = session_id; + msg.next_action = next_action; msg.context = psoc; policy_mgr_debug("set hw mode to sme: hw_mode_index: %d session:%d reason:%d", @@ -488,7 +490,7 @@ QDF_STATUS policy_mgr_next_actions(struct wlan_objmgr_psoc *psoc, HW_MODE_DBS, HW_MODE_AGILE_DFS_NONE, HW_MODE_SBS_NONE, - reason); + reason, PM_NOP); break; case PM_SINGLE_MAC_UPGRADE: /* @@ -501,14 +503,7 @@ QDF_STATUS policy_mgr_next_actions(struct wlan_objmgr_psoc *psoc, HW_MODE_DBS_NONE, HW_MODE_AGILE_DFS_NONE, HW_MODE_SBS_NONE, - reason); - /* - * check if we have a beaconing entity that advertised 2x2 - * intially. If yes, update the beacon template & notify FW. - * Once FW confirms beacon updated, send the HW mode change req - */ - status = policy_mgr_complete_action(psoc, POLICY_MGR_RX_NSS_2, - PM_SINGLE_MAC, reason, session_id); + reason, PM_UPGRADE); break; case PM_SINGLE_MAC: status = policy_mgr_pdev_set_hw_mode(psoc, session_id, @@ -518,7 +513,7 @@ QDF_STATUS policy_mgr_next_actions(struct wlan_objmgr_psoc *psoc, HW_MODE_DBS_NONE, HW_MODE_AGILE_DFS_NONE, HW_MODE_SBS_NONE, - reason); + reason, PM_NOP); break; case PM_DBS_UPGRADE: status = policy_mgr_pdev_set_hw_mode(psoc, session_id, @@ -528,10 +523,7 @@ QDF_STATUS policy_mgr_next_actions(struct wlan_objmgr_psoc *psoc, HW_MODE_DBS, HW_MODE_AGILE_DFS_NONE, HW_MODE_SBS_NONE, - reason); - - status = policy_mgr_complete_action(psoc, POLICY_MGR_RX_NSS_2, - PM_DBS, reason, session_id); + reason, PM_UPGRADE); break; case PM_SBS_DOWNGRADE: status = policy_mgr_complete_action(psoc, POLICY_MGR_RX_NSS_1, @@ -545,7 +537,23 @@ QDF_STATUS policy_mgr_next_actions(struct wlan_objmgr_psoc *psoc, HW_MODE_DBS, HW_MODE_AGILE_DFS_NONE, HW_MODE_SBS, - reason); + reason, PM_NOP); + break; + case PM_DOWNGRADE: + /* + * check if we have a beaconing entity that advertised 2x2 + * intially. If yes, update the beacon template & notify FW. + */ + status = policy_mgr_nss_update(psoc, POLICY_MGR_RX_NSS_1, + PM_NOP, reason); + break; + case PM_UPGRADE: + /* + * check if we have a beaconing entity that advertised 2x2 + * intially. If yes, update the beacon template & notify FW. + */ + status = policy_mgr_nss_update(psoc, POLICY_MGR_RX_NSS_2, + PM_NOP, reason); break; default: policy_mgr_err("unexpected action value %d", action); diff --git a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c index 037ad11aa8..c707cdac8a 100644 --- a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c +++ b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c @@ -753,24 +753,13 @@ void policy_mgr_update_hw_mode_conn_info(struct wlan_objmgr_psoc *psoc, policy_mgr_dump_connection_status_info(psoc); } -/** - * policy_mgr_pdev_set_hw_mode_cb() - Callback for set hw mode - * @status: Status - * @cfgd_hw_mode_index: Configured HW mode index - * @num_vdev_mac_entries: Number of vdev-mac id mapping that follows - * @vdev_mac_map: vdev-mac id map. This memory will be freed by the caller. - * So, make local copy if needed. - * - * Provides the status and configured hw mode index set - * by the FW - * - * Return: None - */ void policy_mgr_pdev_set_hw_mode_cb(uint32_t status, uint32_t cfgd_hw_mode_index, uint32_t num_vdev_mac_entries, struct policy_mgr_vdev_mac_map *vdev_mac_map, - void *context) + uint8_t next_action, + enum policy_mgr_conn_update_reason reason, + uint32_t session_id, void *context) { QDF_STATUS ret; struct policy_mgr_hw_mode_params hw_mode; @@ -819,6 +808,12 @@ void policy_mgr_pdev_set_hw_mode_cb(uint32_t status, if (!QDF_IS_STATUS_SUCCESS(ret)) policy_mgr_err("ERROR: set connection_update_done event failed"); + if (PM_NOP != next_action) + policy_mgr_next_actions(context, session_id, + next_action, reason); + else + policy_mgr_debug("No action needed right now"); + return; } @@ -2404,26 +2399,9 @@ static void policy_mgr_nss_update_cb(struct wlan_objmgr_psoc *psoc, return; } -/** - * policy_mgr_complete_action() - initiates actions needed on - * current connections once channel has been decided for the new - * connection - * @new_nss: the new nss value - * @next_action: next action to happen at policy mgr after - * beacon update - * @reason: Reason for connection update - * @session_id: Session id - * - * This function initiates initiates actions - * needed on current connections once channel has been decided - * for the new connection. Notifies UMAC & FW as well - * - * Return: QDF_STATUS enum - */ -QDF_STATUS policy_mgr_complete_action(struct wlan_objmgr_psoc *psoc, - uint8_t new_nss, uint8_t next_action, - enum policy_mgr_conn_update_reason reason, - uint32_t session_id) +QDF_STATUS policy_mgr_nss_update(struct wlan_objmgr_psoc *psoc, + uint8_t new_nss, uint8_t next_action, + enum policy_mgr_conn_update_reason reason) { QDF_STATUS status = QDF_STATUS_E_FAILURE; uint32_t index, count; @@ -2439,16 +2417,6 @@ QDF_STATUS policy_mgr_complete_action(struct wlan_objmgr_psoc *psoc, return status; } - if (policy_mgr_is_hw_dbs_capable(psoc) == false) { - policy_mgr_err("driver isn't dbs capable, no further action needed"); - return QDF_STATUS_E_NOSUPPORT; - } - - /* policy_mgr_complete_action() is called by policy_mgr_next_actions(). - * All other callers of policy_mgr_next_actions() have taken mutex - * protection. So, not taking any lock inside - * policy_mgr_complete_action() during pm_conc_connection_list access. - */ count = policy_mgr_mode_specific_connection_count(psoc, PM_P2P_GO_MODE, list); for (index = 0; index < count; index++) { @@ -2503,6 +2471,44 @@ QDF_STATUS policy_mgr_complete_action(struct wlan_objmgr_psoc *psoc, } } } + + return status; +} + +/** + * policy_mgr_complete_action() - initiates actions needed on + * current connections once channel has been decided for the new + * connection + * @new_nss: the new nss value + * @next_action: next action to happen at policy mgr after + * beacon update + * @reason: Reason for connection update + * @session_id: Session id + * + * This function initiates initiates actions + * needed on current connections once channel has been decided + * for the new connection. Notifies UMAC & FW as well + * + * Return: QDF_STATUS enum + */ +QDF_STATUS policy_mgr_complete_action(struct wlan_objmgr_psoc *psoc, + uint8_t new_nss, uint8_t next_action, + enum policy_mgr_conn_update_reason reason, + uint32_t session_id) +{ + QDF_STATUS status = QDF_STATUS_E_FAILURE; + + if (policy_mgr_is_hw_dbs_capable(psoc) == false) { + policy_mgr_err("driver isn't dbs capable, no further action needed"); + return QDF_STATUS_E_NOSUPPORT; + } + + /* policy_mgr_complete_action() is called by policy_mgr_next_actions(). + * All other callers of policy_mgr_next_actions() have taken mutex + * protection. So, not taking any lock inside + * policy_mgr_complete_action() during pm_conc_connection_list access. + */ + status = policy_mgr_nss_update(psoc, new_nss, next_action, reason); if (!QDF_IS_STATUS_SUCCESS(status)) status = policy_mgr_next_actions(psoc, session_id, next_action, reason); diff --git a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h index 17c83b4210..c05716131b 100644 --- a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h +++ b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h @@ -369,7 +369,9 @@ void policy_mgr_pdev_set_hw_mode_cb(uint32_t status, uint32_t cfgd_hw_mode_index, uint32_t num_vdev_mac_entries, struct policy_mgr_vdev_mac_map *vdev_mac_map, - void *context); + uint8_t next_action, + enum policy_mgr_conn_update_reason reason, + uint32_t session_id, void *context); void policy_mgr_dump_current_concurrency(struct wlan_objmgr_psoc *psoc); void policy_mgr_pdev_set_pcl(struct wlan_objmgr_psoc *psoc, enum QDF_OPMODE mode); @@ -441,4 +443,8 @@ void policy_mgr_reg_chan_change_callback(struct wlan_objmgr_psoc *psoc, struct regulatory_channel *chan_list, struct avoid_freq_ind_data *avoid_freq_ind, void *arg); + +QDF_STATUS policy_mgr_nss_update(struct wlan_objmgr_psoc *psoc, + uint8_t new_nss, uint8_t next_action, + enum policy_mgr_conn_update_reason reason); #endif