diff --git a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h index 2c0af0e02787..eaa796e91e0b 100644 --- a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h +++ b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h @@ -30,6 +30,7 @@ #include "qdf_status.h" #include "wlan_objmgr_psoc_obj.h" #include "wlan_policy_mgr_public_struct.h" +#include "wlan_utility.h" struct target_psoc_info; @@ -396,9 +397,9 @@ uint32_t policy_mgr_get_concurrency_mode(struct wlan_objmgr_psoc *psoc); * Searches and gets the channel number from the scan results and checks if * concurrency is allowed for the given session ID * - * Non zero channel number if concurrency is allowed, zero otherwise + * Return: Non zero channel frequency value if concurrency is allowed else 0 */ -uint8_t policy_mgr_search_and_check_for_session_conc( +uint32_t policy_mgr_search_and_check_for_session_conc( struct wlan_objmgr_psoc *psoc, uint8_t session_id, void *roam_profile); @@ -406,34 +407,51 @@ uint8_t policy_mgr_search_and_check_for_session_conc( * policy_mgr_is_chnl_in_diff_band() - to check that given channel * is in diff band from existing channel or not * @psoc: pointer to psoc - * @channel: given channel + * @ch_freq: given channel frequency * * This API will check that if the passed channel is in diff band than the * already existing connections or not. * * Return: true if channel is in diff band */ +bool policy_mgr_is_chnl_in_diff_band_int(struct wlan_objmgr_psoc *psoc, + uint32_t ch_freq); + +static inline bool policy_mgr_is_chnl_in_diff_band(struct wlan_objmgr_psoc *psoc, - uint8_t channel); + uint8_t channel) +{ + return policy_mgr_is_chnl_in_diff_band_int(psoc, + wlan_chan_to_freq( + channel)); +} /** * policy_mgr_check_for_session_conc() - Check if concurrency is * allowed for a session * @psoc: PSOC object information * @session_id: Session ID - * @channel: Channel number + * @ch_freq: Channel frequency * * Checks if connection is allowed for a given session_id * * True if the concurrency is allowed, false otherwise */ -bool policy_mgr_check_for_session_conc( - struct wlan_objmgr_psoc *psoc, uint8_t session_id, uint8_t channel); - +bool policy_mgr_check_for_session_conc_int(struct wlan_objmgr_psoc *psoc, + uint8_t session_id, + uint32_t ch_freq); +static inline +bool policy_mgr_check_for_session_conc(struct wlan_objmgr_psoc *psoc, + uint8_t session_id, uint8_t channel) +{ + return policy_mgr_check_for_session_conc_int(psoc, session_id, + wlan_chan_to_freq( + channel)); +} /** * policy_mgr_handle_conc_multiport() - to handle multiport concurrency * @session_id: Session ID - * @channel: Channel number + * @ch_freq: Channel frequency * @reason: reason for connection update * * This routine will handle STA side concurrency when policy manager @@ -441,10 +459,21 @@ bool policy_mgr_check_for_session_conc( * * Return: QDF_STATUS */ -QDF_STATUS policy_mgr_handle_conc_multiport( - struct wlan_objmgr_psoc *psoc, uint8_t session_id, uint8_t channel, - enum policy_mgr_conn_update_reason reason); +QDF_STATUS policy_mgr_handle_conc_multiport_int(struct wlan_objmgr_psoc *psoc, + uint8_t session_id, + uint32_t ch_freq, + enum policy_mgr_conn_update_reason reason); +static inline +QDF_STATUS policy_mgr_handle_conc_multiport(struct wlan_objmgr_psoc *psoc, + uint8_t session_id, uint8_t channel, + enum policy_mgr_conn_update_reason + reason) +{ + return policy_mgr_handle_conc_multiport_int(psoc, session_id, + wlan_chan_to_freq(channel), + reason); +} #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH /** * policy_mgr_check_concurrent_intf_and_restart_sap() - Check @@ -498,7 +527,7 @@ QDF_STATUS policy_mgr_change_mcc_go_beacon_interval( * policy_mgr_change_sap_channel_with_csa() - Move SAP channel using (E)CSA * @psoc: PSOC object information * @vdev_id: Vdev id - * @channel: Channel to change + * @ch_freq: Channel frequency to change * @ch_width: channel width to change * @forced: Force to switch channel, ignore SCC/MCC check * @@ -506,15 +535,25 @@ QDF_STATUS policy_mgr_change_mcc_go_beacon_interval( * * Return: None */ -void policy_mgr_change_sap_channel_with_csa( - struct wlan_objmgr_psoc *psoc, - uint8_t vdev_id, uint32_t channel, - uint32_t ch_width, - bool forced); +void policy_mgr_change_sap_channel_with_csa_int(struct wlan_objmgr_psoc *psoc, + uint8_t vdev_id, + uint32_t ch_freq, + uint32_t ch_width, + bool forced); + +static inline +void policy_mgr_change_sap_channel_with_csa(struct wlan_objmgr_psoc *psoc, + uint8_t vdev_id, uint8_t channel, + uint32_t ch_width, bool forced) +{ + policy_mgr_change_sap_channel_with_csa_int(psoc, vdev_id, + wlan_chan_to_freq(channel), + ch_width, forced); +} #else static inline void policy_mgr_change_sap_channel_with_csa( struct wlan_objmgr_psoc *psoc, - uint8_t vdev_id, uint32_t channel, + uint8_t vdev_id, uint32_t ch_freq, uint32_t ch_width, bool forced) { @@ -581,21 +620,30 @@ void policy_mgr_decr_session_set_pcl(struct wlan_objmgr_psoc *psoc, * @mode: given mode * @vdev_id: pointer to vdev_id * - * This API will provide channel number of matching mode and vdevid. + * This API will provide channel frequency value of matching mode and vdevid. * If vdev_id is NULL then it will match only mode * If vdev_id is not NULL the it will match both mode and vdev_id * - * Return: channel number + * Return: channel frequency value */ -uint8_t policy_mgr_get_channel(struct wlan_objmgr_psoc *psoc, - enum policy_mgr_con_mode mode, uint32_t *vdev_id); +uint32_t policy_mgr_get_channel_int(struct wlan_objmgr_psoc *psoc, + enum policy_mgr_con_mode mode, + uint32_t *vdev_id); + +static inline uint8_t policy_mgr_get_channel(struct wlan_objmgr_psoc *psoc, + enum policy_mgr_con_mode mode, + uint32_t *vdev_id) +{ + return wlan_freq_to_chan(policy_mgr_get_channel_int(psoc, mode, + vdev_id)); +} /** * policy_mgr_get_pcl() - provides the preferred channel list for * new connection * @psoc: PSOC object information - * @mode: Device mode - * @pcl_channels: PCL channels + * @mode: Device mode + * @pcl_channels: Preferred channel freq list * @len: length of the PCL * @pcl_weight: Weights of the PCL * @weight_len: Max length of the weights list @@ -607,16 +655,20 @@ uint8_t policy_mgr_get_channel(struct wlan_objmgr_psoc *psoc, * * Return: QDF_STATUS */ +QDF_STATUS policy_mgr_get_pcl_int(struct wlan_objmgr_psoc *psoc, + enum policy_mgr_con_mode mode, + uint32_t *pcl_channels, uint32_t *len, + uint8_t *pcl_weight, uint32_t weight_len); QDF_STATUS policy_mgr_get_pcl(struct wlan_objmgr_psoc *psoc, - enum policy_mgr_con_mode mode, - uint8_t *pcl_channels, uint32_t *len, - uint8_t *pcl_weight, uint32_t weight_len); + enum policy_mgr_con_mode mode, + uint8_t *pcl_channels, uint32_t *len, + uint8_t *pcl_weight, uint32_t weight_len); /** * policy_mgr_update_with_safe_channel_list() - provides the safe * channel list * @psoc: PSOC object information - * @pcl_channels: channel list + * @pcl_channels: channel freq list * @len: length of the list * @weight_list: Weights of the PCL * @weight_len: Max length of the weights list @@ -626,9 +678,17 @@ QDF_STATUS policy_mgr_get_pcl(struct wlan_objmgr_psoc *psoc, * * Return: None */ +void policy_mgr_update_with_safe_channel_list_int(struct wlan_objmgr_psoc *psoc, + uint32_t *pcl_channels, + uint32_t *len, + uint8_t *weight_list, + uint32_t weight_len); + void policy_mgr_update_with_safe_channel_list(struct wlan_objmgr_psoc *psoc, - uint8_t *pcl_channels, uint32_t *len, - uint8_t *weight_list, uint32_t weight_len); + uint8_t *pcl_channels, + uint32_t *len, + uint8_t *weight_list, + uint32_t weight_len); /** * policy_mgr_get_nondfs_preferred_channel() - to get non-dfs preferred channel @@ -646,16 +706,27 @@ void policy_mgr_update_with_safe_channel_list(struct wlan_objmgr_psoc *psoc, * to give preferred channel list. once we get preferred channel list, loop * through list to find first non-dfs channel from ascending order. * - * Return: uint8_t non-dfs channel + * Return: uint32_t non-dfs channel frequency */ +uint32_t +policy_mgr_get_nondfs_preferred_channel_int(struct wlan_objmgr_psoc *psoc, + enum policy_mgr_con_mode mode, + bool for_existing_conn); + +static inline uint8_t policy_mgr_get_nondfs_preferred_channel(struct wlan_objmgr_psoc *psoc, - enum policy_mgr_con_mode mode, bool for_existing_conn); + enum policy_mgr_con_mode mode, + bool for_existing_conn) +{ + return wlan_freq_to_chan(policy_mgr_get_nondfs_preferred_channel_int( + psoc, mode, for_existing_conn)); +} /** * policy_mgr_is_any_nondfs_chnl_present() - Find any non-dfs * channel from conc table * @psoc: PSOC object information - * @channel: pointer to channel which needs to be filled + * @ch_freq: pointer to channel frequency which needs to be filled * * In-case if any connection is already present whose channel is none dfs then * return that channel @@ -663,7 +734,7 @@ uint8_t policy_mgr_get_nondfs_preferred_channel(struct wlan_objmgr_psoc *psoc, * Return: true up-on finding non-dfs channel else false */ bool policy_mgr_is_any_nondfs_chnl_present(struct wlan_objmgr_psoc *psoc, - uint8_t *channel); + uint32_t *ch_freq); /** * policy_mgr_get_dfs_beaconing_session_id() - to find the @@ -681,7 +752,7 @@ uint32_t policy_mgr_get_dfs_beaconing_session_id( * policy_mgr_is_any_dfs_beaconing_session_present() - to find * if any DFS session * @psoc: PSOC object information - * @channel: pointer to channel number that needs to filled + * @ch_freq: pointer to channel frequency that needs to filled * * If any beaconing session such as SAP or GO present and it is on DFS channel * then this function will return true @@ -689,14 +760,13 @@ uint32_t policy_mgr_get_dfs_beaconing_session_id( * Return: true if session is on DFS or false if session is on non-dfs channel */ bool policy_mgr_is_any_dfs_beaconing_session_present( - struct wlan_objmgr_psoc *psoc, uint8_t *channel); - + struct wlan_objmgr_psoc *psoc, uint32_t *ch_freq); /** * policy_mgr_allow_concurrency() - Check for allowed concurrency * combination consulting the PCL * @psoc: PSOC object information * @mode: new connection mode - * @channel: channel on which new connection is coming up + * @ch_freq: channel frequency on which new connection is coming up * @bw: Bandwidth requested by the connection (optional) * * When a new connection is about to come up check if current @@ -705,30 +775,49 @@ bool policy_mgr_is_any_dfs_beaconing_session_present( * * Return: True/False */ +bool policy_mgr_allow_concurrency_int(struct wlan_objmgr_psoc *psoc, + enum policy_mgr_con_mode mode, + uint32_t ch_freq, + enum hw_mode_bandwidth bw); + +static inline bool policy_mgr_allow_concurrency(struct wlan_objmgr_psoc *psoc, - enum policy_mgr_con_mode mode, - uint8_t channel, enum hw_mode_bandwidth bw); + enum policy_mgr_con_mode mode, + uint8_t channel, enum hw_mode_bandwidth bw) +{ + return policy_mgr_allow_concurrency_int(psoc, mode, + wlan_chan_to_freq(channel), bw); +} /** * policy_mgr_nan_sap_pre_enable_conc_check() - Check if NAN+SAP SCC is * allowed in given ch * @psoc: PSOC object information * @mode: Connection mode - * @ch: channel to check + * @ch_freq: channel frequency to check * * Return: True if allowed else false */ bool +policy_mgr_nan_sap_pre_enable_conc_check_int(struct wlan_objmgr_psoc *psoc, + enum policy_mgr_con_mode mode, + uint32_t ch_freq); +static inline bool policy_mgr_nan_sap_pre_enable_conc_check(struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode, - uint8_t ch); + uint8_t ch) +{ + return policy_mgr_nan_sap_pre_enable_conc_check_int(psoc, mode, + wlan_chan_to_freq( + ch)); +} /** * policy_mgr_allow_concurrency_csa() - Check for allowed concurrency * combination when channel switch * @psoc: PSOC object information * @mode: connection mode - * @channel: target channel to switch + * @ch_freq: target channel frequency to switch * @vdev_id: vdev id of channel switch interface * @forced: forced to chan switch. * @reason: request reason of CSA @@ -745,12 +834,25 @@ policy_mgr_nan_sap_pre_enable_conc_check(struct wlan_objmgr_psoc *psoc, * * Return: True/False */ -bool policy_mgr_allow_concurrency_csa(struct wlan_objmgr_psoc *psoc, - enum policy_mgr_con_mode mode, - uint8_t channel, - uint32_t vdev_id, - bool forced, - enum sap_csa_reason_code reason); +bool policy_mgr_allow_concurrency_csa_int(struct wlan_objmgr_psoc *psoc, + enum policy_mgr_con_mode mode, + uint32_t ch_freq, + uint32_t vdev_id, + bool forced, + enum sap_csa_reason_code reason); + +static inline +bool policy_mgr_allow_concurrency_csa(struct wlan_objmgr_psoc *psoc, + enum policy_mgr_con_mode mode, + uint8_t channel, + uint32_t vdev_id, + bool forced, + enum sap_csa_reason_code reason) +{ + return policy_mgr_allow_concurrency_csa_int(psoc, mode, + wlan_chan_to_freq(channel), + vdev_id, forced, reason); +} /** * policy_mgr_get_first_connection_pcl_table_index() - provides the @@ -871,7 +973,7 @@ QDF_STATUS policy_mgr_decr_connection_count(struct wlan_objmgr_psoc *psoc, * for the new connection * @psoc: PSOC object information * @session_id: Session id - * @channel: Channel on which new connection will be + * @ch_freq: Channel frequency on which new connection will be * @reason: Reason for which connection update is required * * This function initiates initiates actions @@ -880,10 +982,21 @@ QDF_STATUS policy_mgr_decr_connection_count(struct wlan_objmgr_psoc *psoc, * * Return: QDF_STATUS enum */ -QDF_STATUS policy_mgr_current_connections_update(struct wlan_objmgr_psoc *psoc, - uint32_t session_id, uint8_t channel, - enum policy_mgr_conn_update_reason); +QDF_STATUS +policy_mgr_current_connections_update_int(struct wlan_objmgr_psoc *psoc, + uint32_t session_id, + uint32_t ch_freq, + enum policy_mgr_conn_update_reason); +static inline QDF_STATUS +policy_mgr_current_connections_update(struct wlan_objmgr_psoc *psoc, + uint32_t session_id, uint8_t channel, + enum policy_mgr_conn_update_reason reason) +{ + return policy_mgr_current_connections_update_int(psoc, session_id, + wlan_chan_to_freq( + channel), reason); +} /** * policy_mgr_is_dbs_allowed_for_concurrency() - If dbs is allowed for current * concurreny @@ -901,7 +1014,7 @@ bool policy_mgr_is_dbs_allowed_for_concurrency( * policy_mgr_get_preferred_dbs_action_table() - get dbs action table type * @psoc: Pointer to psoc * @vdev_id: vdev Id - * @channel: channel of vdev. + * @ch_freq: channel frequency of vdev. * @reason: reason of request * * 1. Based on band preferred and vdev priority setting to choose the preferred @@ -921,13 +1034,13 @@ enum policy_mgr_conc_next_action policy_mgr_get_preferred_dbs_action_table( struct wlan_objmgr_psoc *psoc, uint32_t vdev_id, - uint8_t channel, + uint32_t ch_freq, enum policy_mgr_conn_update_reason reason); /** * policy_mgr_is_ibss_conn_exist() - to check if IBSS connection already present * @psoc: PSOC object information - * @ibss_channel: pointer to ibss channel which needs to be filled + * @ibss_ch_freq: pointer to ibss channel which needs to be filled * * this routine will check if IBSS connection already exist or no. If it * exist then this routine will return true and fill the ibss_channel value. @@ -935,7 +1048,7 @@ policy_mgr_get_preferred_dbs_action_table( * Return: true if ibss connection exist else false */ bool policy_mgr_is_ibss_conn_exist(struct wlan_objmgr_psoc *psoc, - uint8_t *ibss_channel); + uint32_t *ibss_ch_freq); /** * policy_mgr_get_conn_info() - get the current connections list @@ -959,7 +1072,7 @@ struct policy_mgr_conc_connection_info *policy_mgr_get_conn_info( * @chain_mask: chain mask * @type: connection type * @sub_type: connection subtype - * @channelid: channel number + * @ch_freq: channel frequency value * @mac_id: mac id * * This function adds the new connection to the current @@ -967,11 +1080,28 @@ struct policy_mgr_conc_connection_info *policy_mgr_get_conn_info( * * Return: QDF_STATUS */ -QDF_STATUS policy_mgr_incr_connection_count_utfw(struct wlan_objmgr_psoc *psoc, - uint32_t vdev_id, uint32_t tx_streams, uint32_t rx_streams, - uint32_t chain_mask, uint32_t type, uint32_t sub_type, - uint32_t channelid, uint32_t mac_id); +QDF_STATUS +policy_mgr_incr_connection_count_utfw_int(struct wlan_objmgr_psoc *psoc, + uint32_t vdev_id, uint32_t tx_streams, + uint32_t rx_streams, + uint32_t chain_mask, uint32_t type, + uint32_t sub_type, + uint32_t ch_freq, uint32_t mac_id); +static inline QDF_STATUS +policy_mgr_incr_connection_count_utfw(struct wlan_objmgr_psoc *psoc, + uint32_t vdev_id, uint32_t tx_streams, + uint32_t rx_streams, uint32_t chain_mask, + uint32_t type, uint32_t sub_type, + uint32_t channelid, uint32_t mac_id) +{ + return policy_mgr_incr_connection_count_utfw_int(psoc, vdev_id, + tx_streams, rx_streams, + chain_mask, type, + sub_type, + wlan_chan_to_freq( + channelid), mac_id); +} /** * policy_mgr_update_connection_info_utfw() - updates the * existing connection in the current connections list @@ -982,7 +1112,7 @@ QDF_STATUS policy_mgr_incr_connection_count_utfw(struct wlan_objmgr_psoc *psoc, * @chain_mask: chain mask * @type: connection type * @sub_type: connection subtype - * @channelid: channel number + * @ch_freq: channel frequency value * @mac_id: mac id * * This function updates the connection to the current @@ -990,10 +1120,31 @@ QDF_STATUS policy_mgr_incr_connection_count_utfw(struct wlan_objmgr_psoc *psoc, * * Return: QDF_STATUS */ -QDF_STATUS policy_mgr_update_connection_info_utfw(struct wlan_objmgr_psoc *psoc, - uint32_t vdev_id, uint32_t tx_streams, uint32_t rx_streams, - uint32_t chain_mask, uint32_t type, uint32_t sub_type, - uint32_t channelid, uint32_t mac_id); +QDF_STATUS +policy_mgr_update_connection_info_utfw_int(struct wlan_objmgr_psoc *psoc, + uint32_t vdev_id, + uint32_t tx_streams, + uint32_t rx_streams, + uint32_t chain_mask, uint32_t type, + uint32_t sub_type, + uint32_t ch_freq, uint32_t mac_id); + +static inline QDF_STATUS +policy_mgr_update_connection_info_utfw(struct wlan_objmgr_psoc *psoc, + uint32_t vdev_id, uint32_t tx_streams, + uint32_t rx_streams, + uint32_t chain_mask, uint32_t type, + uint32_t sub_type, + uint32_t channelid, uint32_t mac_id) +{ + return policy_mgr_update_connection_info_utfw_int(psoc, vdev_id, + tx_streams, + rx_streams, + chain_mask, type, + sub_type, + wlan_chan_to_freq( + channelid), mac_id); +} /** * policy_mgr_decr_connection_count_utfw() - remove the old @@ -1060,7 +1211,7 @@ static inline QDF_STATUS policy_mgr_incr_connection_count_utfw( struct wlan_objmgr_psoc *psoc, uint32_t vdev_id, uint32_t tx_streams, uint32_t rx_streams, uint32_t chain_mask, uint32_t type, uint32_t sub_type, - uint32_t channelid, uint32_t mac_id) + uint32_t ch_freq, uint32_t mac_id) { return QDF_STATUS_SUCCESS; } @@ -1068,7 +1219,7 @@ static inline QDF_STATUS policy_mgr_update_connection_info_utfw( struct wlan_objmgr_psoc *psoc, uint32_t vdev_id, uint32_t tx_streams, uint32_t rx_streams, uint32_t chain_mask, uint32_t type, uint32_t sub_type, - uint32_t channelid, uint32_t mac_id) + uint32_t ch_freq, uint32_t mac_id) { return QDF_STATUS_SUCCESS; } @@ -1247,7 +1398,7 @@ typedef void (*policy_mgr_nss_update_cback)(struct wlan_objmgr_psoc *psoc, * @sme_change_mcc_beacon_interval: Set MCC beacon interval to FW */ struct policy_mgr_sme_cbacks { - QDF_STATUS (*sme_get_valid_channels)(uint8_t *chan_list, + QDF_STATUS (*sme_get_valid_channels)(uint32_t *ch_freq_list, uint32_t *list_len); void (*sme_get_nss_for_vdev)(enum QDF_OPMODE, uint8_t *nss_2g, uint8_t *nss_5g); @@ -1264,7 +1415,7 @@ struct policy_mgr_sme_cbacks { QDF_STATUS (*sme_get_ap_channel_from_scan)( void *roam_profile, void **scan_cache, - uint8_t *channel); + uint32_t *ch_freq); QDF_STATUS (*sme_scan_result_purge)( void *scan_result); }; @@ -1287,12 +1438,12 @@ struct policy_mgr_sme_cbacks { */ struct policy_mgr_hdd_cbacks { void (*sap_restart_chan_switch_cb)(struct wlan_objmgr_psoc *psoc, - uint8_t vdev_id, uint32_t channel, + uint8_t vdev_id, uint32_t ch_freq, uint32_t channel_bw, bool forced); QDF_STATUS (*wlan_hdd_get_channel_for_sap_restart)( struct wlan_objmgr_psoc *psoc, - uint8_t vdev_id, uint8_t *channel); + uint8_t vdev_id, uint32_t *ch_freq); enum policy_mgr_con_mode (*get_mode_for_non_connected_vdev)( struct wlan_objmgr_psoc *psoc, uint8_t vdev_id); @@ -1460,17 +1611,30 @@ bool policy_mgr_map_concurrency_mode(enum QDF_OPMODE *old_mode, * policy_mgr_get_channel_from_scan_result() - to get channel from scan result * @psoc: PSOC object information * @roam_profile: pointer to roam profile - * @channel: channel to be filled + * @ch_freq: channel frequency to be filled * * This routine gets channel which most likely a candidate to which STA * will make connection. * * Return: QDF_STATUS */ -QDF_STATUS policy_mgr_get_channel_from_scan_result( - struct wlan_objmgr_psoc *psoc, - void *roam_profile, uint8_t *channel); +QDF_STATUS +policy_mgr_get_channel_from_scan_result_int(struct wlan_objmgr_psoc *psoc, + void *roam_profile, + uint32_t *ch_freq); +static inline QDF_STATUS +policy_mgr_get_channel_from_scan_result(struct wlan_objmgr_psoc *psoc, + void *roam_profile, uint8_t *channel) +{ + uint32_t ch_freq; + QDF_STATUS status; + + status = policy_mgr_get_channel_from_scan_result_int(psoc, roam_profile, + &ch_freq); + *channel = wlan_freq_to_chan(ch_freq); + return status; +} /** * policy_mgr_mode_specific_num_open_sessions() - to get number of open sessions * for a specific mode @@ -1665,7 +1829,7 @@ QDF_STATUS policy_mgr_restart_opportunistic_timer( * policy_mgr_modify_sap_pcl_based_on_mandatory_channel() - * Modify SAPs PCL based on mandatory channel list * @psoc: PSOC object information - * @pcl_list_org: Pointer to the preferred channel list to be trimmed + * @pcl_list_org: Pointer to the preferred channel freq list to be trimmed * @weight_list_org: Pointer to the weights of the preferred channel list * @pcl_len_org: Pointer to the length of the preferred chanel list * @@ -1674,7 +1838,7 @@ QDF_STATUS policy_mgr_restart_opportunistic_timer( * Return: QDF_STATUS */ QDF_STATUS policy_mgr_modify_sap_pcl_based_on_mandatory_channel( - struct wlan_objmgr_psoc *psoc, uint8_t *pcl_list_org, + struct wlan_objmgr_psoc *psoc, uint32_t *pcl_list_org, uint8_t *weight_list_org, uint32_t *pcl_len_org); /** @@ -1682,7 +1846,7 @@ QDF_STATUS policy_mgr_modify_sap_pcl_based_on_mandatory_channel( * connection update * @psoc: PSOC object information * @session_id: Session id - * @channel: Channel number + * @ch_freq: Channel frequency * @reason: Reason for connection update * * Update the connection to either single MAC or dual MAC and wait for the @@ -1690,9 +1854,19 @@ QDF_STATUS policy_mgr_modify_sap_pcl_based_on_mandatory_channel( * * Return: QDF_STATUS */ -QDF_STATUS policy_mgr_update_and_wait_for_connection_update( +QDF_STATUS policy_mgr_update_and_wait_for_connection_update_int( struct wlan_objmgr_psoc *psoc, uint8_t session_id, - uint8_t channel, enum policy_mgr_conn_update_reason reason); + uint32_t ch_freq, enum policy_mgr_conn_update_reason reason); + +static inline QDF_STATUS policy_mgr_update_and_wait_for_connection_update( + struct wlan_objmgr_psoc *psoc, uint8_t session_id, + uint8_t channel, enum policy_mgr_conn_update_reason reason) +{ + return + policy_mgr_update_and_wait_for_connection_update_int(psoc, session_id, + wlan_chan_to_freq( + channel), reason); +} /** * policy_mgr_is_sap_mandatory_channel_set() - Checks if SAP @@ -1706,42 +1880,49 @@ bool policy_mgr_is_sap_mandatory_channel_set(struct wlan_objmgr_psoc *psoc); /** * policy_mgr_list_has_24GHz_channel() - Check if list contains 2.4GHz channels - * @channel_list: Channel list + * @channel_list: Channel frequency list * @list_len: Length of the channel list * * Checks if the channel list contains atleast one 2.4GHz channel * * Return: True if 2.4GHz channel is present, false otherwise */ -bool policy_mgr_list_has_24GHz_channel(uint8_t *channel_list, - uint32_t list_len); +bool policy_mgr_list_has_24GHz_channel(uint32_t *ch_freq_list, + uint32_t list_len); /** * policy_mgr_get_valid_chans_from_range() - get valid channel from given range * @psoc: PSOC object information - * @ch_list: Pointer to the channel list + * @ch_freq_list: Pointer to the channel frequency list * @ch_cnt: Pointer to the length of the channel list * @mode: Device mode * * Return: QDF_STATUS */ +QDF_STATUS policy_mgr_get_valid_chans_from_range_int( + struct wlan_objmgr_psoc *psoc, + uint32_t *ch_freq_list, + uint32_t *ch_cnt, + enum policy_mgr_con_mode mode); QDF_STATUS policy_mgr_get_valid_chans_from_range(struct wlan_objmgr_psoc *psoc, uint8_t *ch_list, uint32_t *ch_cnt, enum policy_mgr_con_mode mode); - /** * policy_mgr_get_valid_chans() - Get the valid channel list * @psoc: PSOC object information - * @chan_list: Pointer to the valid channel list + * @ch_freq_list: Pointer to the valid channel frequency list * @list_len: Pointer to the length of the valid channel list * * Gets the valid channel list filtered by band * * Return: QDF_STATUS */ +QDF_STATUS policy_mgr_get_valid_chans_int(struct wlan_objmgr_psoc *psoc, + uint32_t *ch_freq_list, + uint32_t *list_len); QDF_STATUS policy_mgr_get_valid_chans(struct wlan_objmgr_psoc *psoc, - uint8_t *chan_list, uint32_t *list_len); + uint8_t *chan_list, uint32_t *list_len); /** * policy_mgr_get_nss_for_vdev() - Get the allowed nss value for the @@ -1762,19 +1943,32 @@ QDF_STATUS policy_mgr_get_nss_for_vdev(struct wlan_objmgr_psoc *psoc, /** * policy_mgr_get_sap_mandatory_channel() - Get the mandatory channel for SAP * @psoc: PSOC object information - * @chan: Pointer to the SAP mandatory channel + * @ch_freq: Pointer to the SAP mandatory channel frequency * * Gets the mandatory channel for SAP operation * * Return: QDF_STATUS */ -QDF_STATUS policy_mgr_get_sap_mandatory_channel(struct wlan_objmgr_psoc *psoc, - uint16_t *chan); +QDF_STATUS +policy_mgr_get_sap_mandatory_channel_int(struct wlan_objmgr_psoc *psoc, + uint32_t *ch_freq); +static inline QDF_STATUS +policy_mgr_get_sap_mandatory_channel(struct wlan_objmgr_psoc *psoc, + uint16_t *chan) +{ + uint32_t ch_freq; + QDF_STATUS status; + + status = policy_mgr_get_sap_mandatory_channel_int(psoc, &ch_freq); + *chan = wlan_freq_to_chan(ch_freq); + + return status; +} /** * policy_mgr_set_sap_mandatory_channels() - Set the mandatory channel for SAP * @psoc: PSOC object information - * @channels: Channel list to be set + * @ch_freq_list: Channel frequency list to be set * @len: Length of the channel list * * Sets the channels for the mandatory channel list along with the length of @@ -1782,8 +1976,13 @@ QDF_STATUS policy_mgr_get_sap_mandatory_channel(struct wlan_objmgr_psoc *psoc, * * Return: QDF_STATUS */ +QDF_STATUS policy_mgr_set_sap_mandatory_channels_int( + struct wlan_objmgr_psoc *psoc, + uint32_t *ch_freq_list, + uint32_t len); QDF_STATUS policy_mgr_set_sap_mandatory_channels(struct wlan_objmgr_psoc *psoc, - uint8_t *channels, uint32_t len); + uint8_t *ch_list, + uint32_t len); /** * policy_mgr_is_any_mode_active_on_band_along_with_session() - @@ -1807,14 +2006,27 @@ bool policy_mgr_is_any_mode_active_on_band_along_with_session( * policy_mgr_get_chan_by_session_id() - Get channel for a given session ID * @psoc: PSOC object information * @session_id: Session ID - * @chan: Pointer to the channel + * @ch_freq: Pointer to the channel frequency * * Gets the channel for a given session ID * * Return: QDF_STATUS */ -QDF_STATUS policy_mgr_get_chan_by_session_id(struct wlan_objmgr_psoc *psoc, - uint8_t session_id, uint8_t *chan); +QDF_STATUS policy_mgr_get_chan_by_session_id_int(struct wlan_objmgr_psoc *psoc, + uint8_t session_id, + uint32_t *ch_freq); +static inline QDF_STATUS +policy_mgr_get_chan_by_session_id(struct wlan_objmgr_psoc *psoc, + uint8_t session_id, uint8_t *chan) +{ + uint32_t ch_freq; + QDF_STATUS status; + + status = policy_mgr_get_chan_by_session_id_int(psoc, + session_id, &ch_freq); + *chan = wlan_freq_to_chan(ch_freq); + return status; +} /** * policy_mgr_get_mac_id_by_session_id() - Get MAC ID for a given session ID @@ -1851,11 +2063,17 @@ QDF_STATUS policy_mgr_get_mcc_session_id_on_mac(struct wlan_objmgr_psoc *psoc, * * Gets the MCC channel for a given session ID. * - * Return: '0' (INVALID_CHANNEL_ID) or valid channel number + * Return: '0' (INVALID_CHANNEL_ID) or valid channel frequency */ -uint8_t policy_mgr_get_mcc_operating_channel(struct wlan_objmgr_psoc *psoc, - uint8_t session_id); - +uint32_t policy_mgr_get_mcc_operating_channel_int(struct wlan_objmgr_psoc *psoc, + uint8_t session_id); +static inline uint8_t +policy_mgr_get_mcc_operating_channel(struct wlan_objmgr_psoc *psoc, + uint8_t session_id) +{ + return wlan_freq_to_chan(policy_mgr_get_mcc_operating_channel_int(psoc, + session_id)); +} /** * policy_mgr_get_pcl_for_existing_conn() - Get PCL for existing connection * @psoc: PSOC object information @@ -1870,12 +2088,18 @@ uint8_t policy_mgr_get_mcc_operating_channel(struct wlan_objmgr_psoc *psoc, * * Return: None */ +QDF_STATUS policy_mgr_get_pcl_for_existing_conn_int( + struct wlan_objmgr_psoc *psoc, + enum policy_mgr_con_mode mode, + uint32_t *pcl_ch, uint32_t *len, + uint8_t *pcl_weight, uint32_t weight_len, + bool all_matching_cxn_to_del); + QDF_STATUS policy_mgr_get_pcl_for_existing_conn(struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode, uint8_t *pcl_ch, uint32_t *len, uint8_t *weight_list, uint32_t weight_len, bool all_matching_cxn_to_del); - /** * policy_mgr_get_valid_chan_weights() - Get the weightage for * all valid channels @@ -1911,14 +2135,23 @@ QDF_STATUS policy_mgr_set_hw_mode_on_channel_switch( * this is required if DBS mode is 2x2 * @psoc: PSOC object information * @vdev_id: vdev id on which channel switch is required - * @chan: New channel to which channel switch is requested + * @ch_freq: New channel frequency to which channel switch is requested * @reason: reason for hw mode change * * Return: QDF_STATUS, success if HW mode change is required else Failure */ +QDF_STATUS policy_mgr_check_and_set_hw_mode_for_channel_switch_int( + struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, + uint32_t ch_freq, enum policy_mgr_conn_update_reason reason); + +static inline QDF_STATUS policy_mgr_check_and_set_hw_mode_for_channel_switch( struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, uint8_t chan, - enum policy_mgr_conn_update_reason reason); + enum policy_mgr_conn_update_reason reason) +{ + return policy_mgr_check_and_set_hw_mode_for_channel_switch_int( + psoc, vdev_id, wlan_chan_to_freq(chan), reason); +} /** * policy_mgr_set_do_hw_mode_change_flag() - Set flag to indicate hw mode change @@ -1949,7 +2182,7 @@ bool policy_mgr_is_hw_mode_change_after_vdev_up(struct wlan_objmgr_psoc *psoc); * policy_mgr_checkn_update_hw_mode_single_mac_mode() - Set hw_mode to SMM * if required * @psoc: PSOC object information - * @channel: channel number for the new STA connection + * @ch_freq: channel frequency for the new STA connection * * After the STA disconnection, if the hw_mode is in DBS and the new STA * connection is coming in the band in which existing connections are @@ -1958,8 +2191,15 @@ bool policy_mgr_is_hw_mode_change_after_vdev_up(struct wlan_objmgr_psoc *psoc); * * Return: None */ +void policy_mgr_checkn_update_hw_mode_single_mac_mode_int( + struct wlan_objmgr_psoc *psoc, uint32_t ch_freq); +static inline void policy_mgr_checkn_update_hw_mode_single_mac_mode( - struct wlan_objmgr_psoc *psoc, uint8_t channel); + struct wlan_objmgr_psoc *psoc, uint8_t channel) +{ + policy_mgr_checkn_update_hw_mode_single_mac_mode_int( + psoc, wlan_chan_to_freq(channel)); +} /** * policy_mgr_dump_connection_status_info() - Dump the concurrency information @@ -2599,14 +2839,22 @@ void policy_mgr_update_new_hw_mode_index(struct wlan_objmgr_psoc *psoc, * policy_mgr_is_chan_ok_for_dnbs() - Function to check if a channel * is OK for "Do Not Break Stream" * @psoc: PSOC object information - * @channel: Channel to check. + * @ch_freq: Channel frequency to check. * @ok: Pointer to flag in which status will be stored * This function checks if a channel is OK for * "Do Not Break Stream" * Return: SUCCESS or FAILURE */ -QDF_STATUS policy_mgr_is_chan_ok_for_dnbs(struct wlan_objmgr_psoc *psoc, - uint8_t channel, bool *ok); +QDF_STATUS policy_mgr_is_chan_ok_for_dnbs_int(struct wlan_objmgr_psoc *psoc, + uint32_t ch_freq, bool *ok); +static inline QDF_STATUS +policy_mgr_is_chan_ok_for_dnbs(struct wlan_objmgr_psoc *psoc, + uint8_t channel, bool *ok) +{ + return policy_mgr_is_chan_ok_for_dnbs_int(psoc, + wlan_chan_to_freq(channel), + ok); +} /** * policy_mgr_get_hw_dbs_nss() - Computes DBS NSS @@ -2650,15 +2898,19 @@ QDF_STATUS policy_mgr_get_updated_scan_and_fw_mode_config( * policy_mgr_is_safe_channel - Check if the channel is in LTE * coex channel avoidance list * @psoc: PSOC object information - * @channel: channel to be checked + * @ch_freq: channel frequency to be checked * * Check if the channel is in LTE coex channel avoidance list. * * Return: true for success, else false */ -bool policy_mgr_is_safe_channel(struct wlan_objmgr_psoc *psoc, - uint8_t channel); - +bool policy_mgr_is_safe_channel_int(struct wlan_objmgr_psoc *psoc, + uint32_t ch_freq); +static inline bool policy_mgr_is_safe_channel(struct wlan_objmgr_psoc *psoc, + uint8_t channel) +{ + return policy_mgr_is_safe_channel_int(psoc, wlan_chan_to_freq(channel)); +} /** * policy_mgr_is_force_scc() - checks if SCC needs to be * mandated @@ -2684,37 +2936,52 @@ bool policy_mgr_go_scc_enforced(struct wlan_objmgr_psoc *psoc); * policy_mgr_valid_sap_conc_channel_check() - checks & updates * the channel SAP to come up on in case of STA+SAP concurrency * @psoc: PSOC object information - * @con_ch: pointer to the channel on which sap will come up - * @sap_ch: initial channel for SAP + * @con_ch_freq: pointer to the chan freq on which sap will come up + * @sap_ch_freq: initial channel frequency for SAP * @sap_vdev_id: sap vdev id. * * This function checks & updates the channel SAP to come up on in * case of STA+SAP concurrency * Return: Success if SAP can come up on a channel */ -QDF_STATUS policy_mgr_valid_sap_conc_channel_check( +QDF_STATUS policy_mgr_valid_sap_conc_channel_check_int( + struct wlan_objmgr_psoc *psoc, uint32_t *con_ch_freq, + uint32_t sap_ch_freq, uint8_t sap_vdev_id); + +static inline QDF_STATUS policy_mgr_valid_sap_conc_channel_check( struct wlan_objmgr_psoc *psoc, uint8_t *con_ch, uint8_t sap_ch, - uint8_t sap_vdev_id); + uint8_t sap_vdev_id) +{ + uint32_t con_ch_freq; + QDF_STATUS status; + + con_ch_freq = wlan_chan_to_freq(*con_ch); + status = policy_mgr_valid_sap_conc_channel_check_int( + psoc, &con_ch_freq, + wlan_chan_to_freq(sap_ch), sap_vdev_id); + *con_ch = wlan_freq_to_chan(con_ch_freq); + return status; +} /** * policy_mgr_get_alternate_channel_for_sap() - Get an alternate * channel to move the SAP to * @psoc: PSOC object information * @sap_vdev_id: sap vdev id. - * @sap_channel: sap channel. + * @sap_ch_freq: sap channel frequency. * * This function returns an alternate channel for SAP to move to * Return: The new channel for SAP */ -uint8_t policy_mgr_get_alternate_channel_for_sap( +uint32_t policy_mgr_get_alternate_channel_for_sap( struct wlan_objmgr_psoc *psoc, uint8_t sap_vdev_id, - uint8_t sap_channel); + uint32_t sap_ch_freq); /** * policy_mgr_disallow_mcc() - Check for mcc * * @psoc: PSOC object information - * @channel: channel on which new connection is coming up + * @ch_freq: channel frequency on which new connection is coming up * * When a new connection is about to come up check if current * concurrency combination including the new connection is @@ -2722,8 +2989,13 @@ uint8_t policy_mgr_get_alternate_channel_for_sap( * * Return: True if it is causing MCC */ -bool policy_mgr_disallow_mcc(struct wlan_objmgr_psoc *psoc, - uint8_t channel); +bool policy_mgr_disallow_mcc_int(struct wlan_objmgr_psoc *psoc, + uint32_t ch_freq); +static inline bool policy_mgr_disallow_mcc(struct wlan_objmgr_psoc *psoc, + uint8_t channel) +{ + return policy_mgr_disallow_mcc_int(psoc, wlan_chan_to_freq(channel)); +} /** * policy_mgr_mode_specific_get_channel() - Get channel for a @@ -2731,26 +3003,31 @@ bool policy_mgr_disallow_mcc(struct wlan_objmgr_psoc *psoc, * @psoc: PSOC object information * @chan_list: Connection type * - * Get channel for a connection type + * Get channel frequency for a connection type * - * Return: channel number + * Return: channel frequency */ -uint8_t policy_mgr_mode_specific_get_channel( - struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode); +uint32_t policy_mgr_mode_specific_get_channel(struct wlan_objmgr_psoc *psoc, + enum policy_mgr_con_mode mode); /** * policy_mgr_add_sap_mandatory_chan() - Add chan to SAP mandatory channel * list * @psoc: Pointer to soc - * @chan: Channel to be added + * @ch_freq: Channel frequency to be added * * Add chan to SAP mandatory channel list * * Return: None */ +void policy_mgr_add_sap_mandatory_chan_int(struct wlan_objmgr_psoc *psoc, + uint32_t ch_freq); +static inline void policy_mgr_add_sap_mandatory_chan(struct wlan_objmgr_psoc *psoc, - uint8_t chan); - + uint8_t chan) +{ + policy_mgr_add_sap_mandatory_chan_int(psoc, wlan_chan_to_freq(chan)); +} /** * policy_mgr_get_sap_mandatory_chan_list_len() - Return the SAP mandatory * channel list len @@ -2778,14 +3055,21 @@ void policy_mgr_init_sap_mandatory_2g_chan(struct wlan_objmgr_psoc *psoc); * policy_mgr_remove_sap_mandatory_chan() - Remove channel from SAP mandatory * channel list * @psoc: Pointer to soc - * @chan: channel to be removed from mandatory channel list + * @ch_freq: channel frequency to be removed from mandatory list * * Remove channel from SAP mandatory channel list * * Return: None */ -void policy_mgr_remove_sap_mandatory_chan(struct wlan_objmgr_psoc *psoc, - uint8_t chan); +void policy_mgr_remove_sap_mandatory_chan_int(struct wlan_objmgr_psoc *psoc, + uint32_t ch_freq); +static inline void +policy_mgr_remove_sap_mandatory_chan(struct wlan_objmgr_psoc *psoc, + uint8_t chan) +{ + policy_mgr_remove_sap_mandatory_chan_int(psoc, wlan_chan_to_freq(chan)); +} + /* * policy_set_cur_conc_system_pref - set current conc_system_pref * @psoc: soc pointer @@ -2824,7 +3108,7 @@ void policy_mgr_check_and_stop_opportunistic_timer( * policy_mgr_set_weight_of_dfs_passive_channels_to_zero() - set weight of dfs * and passive channels to 0 * @psoc: pointer to soc - * @pcl_channels: preferred channel list + * @pcl: preferred channel freq list * @len: length of preferred channel list * @weight_list: preferred channel weight list * @weight_len: length of weight list @@ -2833,7 +3117,7 @@ void policy_mgr_check_and_stop_opportunistic_timer( * Return: None */ void policy_mgr_set_weight_of_dfs_passive_channels_to_zero( - struct wlan_objmgr_psoc *psoc, uint8_t *pcl_channels, + struct wlan_objmgr_psoc *psoc, uint32_t *pcl, uint32_t *len, uint8_t *weight_list, uint32_t weight_len); /** @@ -2854,20 +3138,6 @@ bool policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan( */ bool policy_mgr_is_sta_connected_2g(struct wlan_objmgr_psoc *psoc); -/** - * policy_mgr_trim_acs_channel_list() - Trims ACS channel list with - * intersection of PCL - * @pcl: preferred channel list - * @pcl_count: Preferred channel list count - * @org_ch_list: ACS channel list from user space - * @org_ch_list_count: ACS channel count from user space - * - * Return: None - */ -void policy_mgr_trim_acs_channel_list(uint8_t *pcl, uint8_t pcl_count, - uint8_t *org_ch_list, - uint8_t *org_ch_list_count); - /** * policy_mgr_scan_trim_5g_chnls_for_dfs_ap() - check if sta scan should skip * 5g channel when dfs ap is present. @@ -2882,7 +3152,7 @@ bool policy_mgr_scan_trim_5g_chnls_for_dfs_ap(struct wlan_objmgr_psoc *psoc); * policy_mgr_is_hwmode_set_for_given_chnl() - to check for given channel * if the hw mode is properly set. * @psoc: pointer to psoc - * @channel: given channel + * @ch_freq: given channel frequency * * If HW mode is properly set for given channel then it returns true else * it returns false. @@ -2893,9 +3163,18 @@ bool policy_mgr_scan_trim_5g_chnls_for_dfs_ap(struct wlan_objmgr_psoc *psoc); * * Return: true if HW mode is set properly else false */ -bool policy_mgr_is_hwmode_set_for_given_chnl(struct wlan_objmgr_psoc *psoc, - uint8_t channel); -/* +bool policy_mgr_is_hwmode_set_for_given_chnl_int(struct wlan_objmgr_psoc *psoc, + uint32_t ch_freq); + +static inline bool +policy_mgr_is_hwmode_set_for_given_chnl(struct wlan_objmgr_psoc *psoc, + uint8_t channel) +{ + return policy_mgr_is_hwmode_set_for_given_chnl_int( + psoc, wlan_chan_to_freq(channel)); +} + +/** * policy_mgr_get_connection_info() - Get info of all active connections * @info: Pointer to connection info * @@ -2926,7 +3205,7 @@ QDF_STATUS policy_mgr_deregister_mode_change_cb(struct wlan_objmgr_psoc *psoc); * allowed. * @psoc: pointer to soc * @policy_mgr_con_mode: operating mode of interface to be checked - * @channel: new operating channel of the interface to be checked + * @ch_freq: 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 @@ -2951,22 +3230,9 @@ QDF_STATUS policy_mgr_deregister_mode_change_cb(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, + uint32_t ch_freq, uint32_t vdev_id); -/** - * policy_mgr_allow_multiple_sta_connections() - check whether multiple STA - * concurrency is allowed and F/W supported - * @psoc: Pointer to soc - * @second_sta_chan: 2nd STA channel - * @first_sta_chan: 2nd STA channel - * - * Return: true if supports else false. - */ -bool policy_mgr_allow_multiple_sta_connections(struct wlan_objmgr_psoc *psoc, - uint8_t second_sta_chan, - uint8_t first_sta_chan); - /** * policy_mgr_dual_beacon_on_single_mac_scc_capable() - get capability that * whether support dual beacon on same channel on single MAC @@ -3001,25 +3267,38 @@ bool policy_mgr_sta_sap_scc_on_lte_coex_chan( * policy_mgr_valid_channel_for_channel_switch() - check for valid channel for * channel switch. * @psoc: poniter to psoc - * @channel: channel to be validated. + * @ch_freq: channel frequency to be validated. * This function validates whether the given channel is valid for channel * switch. * * Return: true or false */ +bool policy_mgr_is_valid_for_channel_switch_int(struct wlan_objmgr_psoc *psoc, + uint32_t ch_freq); +static inline bool policy_mgr_is_valid_for_channel_switch(struct wlan_objmgr_psoc *psoc, - uint8_t channel); - + uint8_t channel) +{ + return policy_mgr_is_valid_for_channel_switch_int(psoc, + wlan_chan_to_freq( + channel)); +} /** * policy_mgr_update_user_config_sap_chan() - Update user configured channel * @psoc: poniter to psoc - * @channel: channel to be upated + * @ch_freq: channel frequency to be upated * * Return: void **/ -void policy_mgr_update_user_config_sap_chan( - struct wlan_objmgr_psoc *psoc, uint32_t channel); - +void policy_mgr_update_user_config_sap_chan_int(struct wlan_objmgr_psoc *psoc, + uint32_t ch_freq); +static inline +void policy_mgr_update_user_config_sap_chan(struct wlan_objmgr_psoc *psoc, + uint32_t channel) +{ + policy_mgr_update_user_config_sap_chan_int(psoc, + wlan_chan_to_freq(channel)); +} /** * policy_mgr_nan_sap_post_enable_conc_check() - Do concurrency operations * post nan/sap enable @@ -3044,7 +3323,7 @@ void policy_mgr_nan_sap_post_disable_conc_check(struct wlan_objmgr_psoc *psoc); * after sta disconnection * @psoc: psoc object data * @sap_vdev_id: sap vdev id - * @intf_ch: sap channel + * @intf_ch_freq: sap channel frequency * * Check if SAP should be moved to a non dfs channel after STA disconnection. * This API applicable only for STA+SAP SCC and ini 'sta_sap_scc_on_dfs_chan' @@ -3052,32 +3331,57 @@ void policy_mgr_nan_sap_post_disable_conc_check(struct wlan_objmgr_psoc *psoc); * * Return: true if sap restart is required, otherwise false */ -bool policy_mgr_is_sap_restart_required_after_sta_disconnect( - struct wlan_objmgr_psoc *psoc, - uint32_t sap_vdev_id, uint8_t *intf_ch); +bool policy_mgr_is_sap_restart_required_after_sta_disconnect_int( + struct wlan_objmgr_psoc *psoc, uint32_t sap_vdev_id, + uint32_t *intf_ch_freq); +static inline bool policy_mgr_is_sap_restart_required_after_sta_disconnect( + struct wlan_objmgr_psoc *psoc, + uint32_t sap_vdev_id, uint8_t *intf_ch) +{ + uint32_t intf_ch_freq; + bool ret; + + ret = policy_mgr_is_sap_restart_required_after_sta_disconnect_int( + psoc, sap_vdev_id, &intf_ch_freq); + *intf_ch = wlan_freq_to_chan(intf_ch_freq); + return ret; +} /** * policy_mgr_is_sta_sap_scc() - check whether SAP is doing SCC with * STA * @psoc: poniter to psoc - * @sap_ch: operating channel of SAP interface + * @sap_ch_freq: operating channel frequency of SAP interface * This function checks whether SAP is doing SCC with STA * * Return: true or false */ -bool policy_mgr_is_sta_sap_scc(struct wlan_objmgr_psoc *psoc, uint8_t sap_ch); +bool policy_mgr_is_sta_sap_scc_int(struct wlan_objmgr_psoc *psoc, + uint32_t sap_ch_freq); +static inline bool policy_mgr_is_sta_sap_scc(struct wlan_objmgr_psoc *psoc, + uint8_t sap_ch) +{ + return policy_mgr_is_sta_sap_scc_int(psoc, wlan_chan_to_freq(sap_ch)); +} /** * policy_mgr_nan_sap_scc_on_unsafe_ch_chk() - check whether SAP is doing SCC * with NAN * @psoc: poniter to psoc - * @sap_ch: operating channel of SAP interface + * @sap_freq: operating channel frequency of SAP interface * * Return: true or false */ +bool policy_mgr_nan_sap_scc_on_unsafe_ch_chk_int(struct wlan_objmgr_psoc *psoc, + uint32_t sap_freq); +static inline bool policy_mgr_nan_sap_scc_on_unsafe_ch_chk(struct wlan_objmgr_psoc *psoc, - uint8_t sap_ch); - + uint8_t sap_ch) +{ + return policy_mgr_nan_sap_scc_on_unsafe_ch_chk_int(psoc, + wlan_chan_to_freq( + sap_ch)); +} /** * policy_mgr_get_hw_mode_from_idx() - Get HW mode based on index * @psoc: psoc object @@ -3112,7 +3416,7 @@ QDF_STATUS policy_mgr_update_nan_vdev_mac_info(struct wlan_objmgr_psoc *psoc, * policy_mgr_get_mode_specific_conn_info() - Get active mode specific * channel and vdev id * @psoc: PSOC object information - * @channel: Mode specific channel (list) + * @ch_freq_list: Mode specific channel freq list * @vdev_id: Mode specific vdev id (list) * @mode: Connection Mode * @@ -3120,8 +3424,12 @@ QDF_STATUS policy_mgr_update_nan_vdev_mac_info(struct wlan_objmgr_psoc *psoc, * * Return: number of connection found as per given mode */ +uint32_t policy_mgr_get_mode_specific_conn_info_int( + struct wlan_objmgr_psoc *psoc, + uint32_t *ch_freq_list, uint8_t *vdev_id, + enum policy_mgr_con_mode mode); uint32_t policy_mgr_get_mode_specific_conn_info(struct wlan_objmgr_psoc *psoc, - uint8_t *channel, + uint8_t *ch_list, uint8_t *vdev_id, enum policy_mgr_con_mode mode); #endif /* __WLAN_POLICY_MGR_API_H */ diff --git a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h index 614ecc9f5662..c5ad6f3749a7 100644 --- a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h +++ b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h @@ -981,7 +981,7 @@ enum dbs_support { * connections in the wlan system * * @mode: connection type - * @chan: channel of the connection + * @freq: Channel frequency * @bw: channel bandwidth used for the connection * @mac: The HW mac it is running * @chain_mask: The original capability advertised by HW @@ -991,7 +991,7 @@ enum dbs_support { */ struct policy_mgr_conc_connection_info { enum policy_mgr_con_mode mode; - uint8_t chan; + uint32_t freq; enum hw_mode_bandwidth bw; uint8_t mac; enum policy_mgr_chain_mode chain_mask; @@ -1075,7 +1075,7 @@ struct policy_mgr_hw_mode { * @pcl_len: Number of channels in the PCL */ struct policy_mgr_pcl_list { - uint8_t pcl_list[POLICY_MGR_MAX_CHANNEL_LIST]; + uint32_t pcl_list[POLICY_MGR_MAX_CHANNEL_LIST]; uint8_t weight_list[POLICY_MGR_MAX_CHANNEL_LIST]; uint32_t pcl_len; }; @@ -1093,9 +1093,9 @@ struct policy_mgr_pcl_list { * @weight_list: Weights assigned by policy manager */ struct policy_mgr_pcl_chan_weights { - uint8_t pcl_list[POLICY_MGR_MAX_CHANNEL_LIST]; + uint32_t pcl_list[POLICY_MGR_MAX_CHANNEL_LIST]; uint32_t pcl_len; - uint8_t saved_chan_list[POLICY_MGR_MAX_CHANNEL_LIST]; + uint32_t saved_chan_list[POLICY_MGR_MAX_CHANNEL_LIST]; uint32_t saved_num_chan; uint8_t weighed_valid_list[POLICY_MGR_MAX_CHANNEL_LIST]; uint8_t weight_list[POLICY_MGR_MAX_CHANNEL_LIST]; diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c index 19402589a4e1..7918f9059abf 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c @@ -225,7 +225,7 @@ enum policy_mgr_conc_next_action policy_mgr_need_opportunistic_upgrade( conn_index, pm_conc_connection_list[conn_index].mac, pm_conc_connection_list[conn_index].in_use, - pm_conc_connection_list[conn_index].chan, + pm_conc_connection_list[conn_index].freq, pm_conc_connection_list[conn_index].original_nss); if ((pm_conc_connection_list[conn_index].mac == 0) && pm_conc_connection_list[conn_index].in_use) { @@ -238,8 +238,8 @@ enum policy_mgr_conc_next_action policy_mgr_need_opportunistic_upgrade( pm_conc_connection_list[conn_index].in_use) { mac |= POLICY_MGR_MAC1; if (policy_mgr_is_hw_dbs_2x2_capable(psoc) && - WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[conn_index].chan) + WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[conn_index].freq) ) { qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); policy_mgr_debug("2X2 DBS capable with 2.4 GHZ connection"); @@ -295,13 +295,12 @@ QDF_STATUS policy_mgr_update_connection_info(struct wlan_objmgr_psoc *psoc, uint32_t vdev_id) { QDF_STATUS status = QDF_STATUS_E_FAILURE; - uint32_t conn_index = 0; + uint32_t conn_index = 0, ch_freq; bool found = false; struct policy_mgr_vdev_entry_info conn_table_entry; enum policy_mgr_chain_mode chain_mask = POLICY_MGR_ONE_ONE; uint8_t nss_2g, nss_5g; enum policy_mgr_con_mode mode; - uint8_t chan; uint32_t nss = 0; struct policy_mgr_psoc_priv_obj *pm_ctx; @@ -342,15 +341,15 @@ QDF_STATUS policy_mgr_update_connection_info(struct wlan_objmgr_psoc *psoc, mode = policy_mgr_get_mode(conn_table_entry.type, conn_table_entry.sub_type); - chan = wlan_reg_freq_to_chan(pm_ctx->pdev, conn_table_entry.mhz); + ch_freq = conn_table_entry.mhz; status = policy_mgr_get_nss_for_vdev(psoc, mode, &nss_2g, &nss_5g); if (QDF_IS_STATUS_SUCCESS(status)) { - if ((WLAN_REG_IS_24GHZ_CH(chan) && (nss_2g > 1)) || - (WLAN_REG_IS_5GHZ_CH(chan) && (nss_5g > 1))) + if ((WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq) && nss_2g > 1) || + (WLAN_REG_IS_5GHZ_CH_FREQ(ch_freq) && nss_5g > 1)) chain_mask = POLICY_MGR_TWO_TWO; else chain_mask = POLICY_MGR_ONE_ONE; - nss = (WLAN_REG_IS_24GHZ_CH(chan)) ? nss_2g : nss_5g; + nss = (WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq)) ? nss_2g : nss_5g; } else { policy_mgr_err("Error in getting nss"); } @@ -358,12 +357,10 @@ QDF_STATUS policy_mgr_update_connection_info(struct wlan_objmgr_psoc *psoc, policy_mgr_debug("update PM connection table for vdev:%d", vdev_id); /* add the entry */ - policy_mgr_update_conc_list(psoc, conn_index, - mode, - chan, + policy_mgr_update_conc_list( + psoc, conn_index, mode, ch_freq, policy_mgr_get_bw(conn_table_entry.chan_width), - conn_table_entry.mac_id, - chain_mask, + conn_table_entry.mac_id, chain_mask, nss, vdev_id, true, true); /* do we need to change the HW mode */ @@ -372,23 +369,23 @@ QDF_STATUS policy_mgr_update_connection_info(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_SUCCESS; } -QDF_STATUS policy_mgr_update_and_wait_for_connection_update( +QDF_STATUS policy_mgr_update_and_wait_for_connection_update_int( struct wlan_objmgr_psoc *psoc, uint8_t session_id, - uint8_t channel, + uint32_t ch_freq, enum policy_mgr_conn_update_reason reason) { QDF_STATUS status; - policy_mgr_debug("session:%d channel:%d reason:%d", - session_id, channel, reason); + policy_mgr_debug("session:%d ch_freq:%d reason:%d", + session_id, ch_freq, reason); status = policy_mgr_reset_connection_update(psoc); if (QDF_IS_STATUS_ERROR(status)) policy_mgr_err("clearing event failed"); - status = policy_mgr_current_connections_update(psoc, - session_id, channel, reason); + status = policy_mgr_current_connections_update_int( + psoc, session_id, ch_freq, reason); if (QDF_STATUS_E_FAILURE == status) { policy_mgr_err("connections update failed"); return QDF_STATUS_E_FAILURE; @@ -484,10 +481,10 @@ bool policy_mgr_is_dbs_allowed_for_concurrency( return ret; } -bool policy_mgr_is_chnl_in_diff_band(struct wlan_objmgr_psoc *psoc, - uint8_t channel) +bool policy_mgr_is_chnl_in_diff_band_int(struct wlan_objmgr_psoc *psoc, + uint32_t ch_freq) { - uint8_t i, pm_chnl; + uint8_t i; struct policy_mgr_psoc_priv_obj *pm_ctx; pm_ctx = policy_mgr_get_context(psoc); @@ -497,14 +494,14 @@ bool policy_mgr_is_chnl_in_diff_band(struct wlan_objmgr_psoc *psoc, } /* - * check given channel against already existing connections' - * channels. if they differ then channels are in different bands + * check given channel freq against already existing connections' + * channel freqs. if they differ then channels are in different bands */ qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); for (i = 0; i < MAX_NUMBER_OF_CONC_CONNECTIONS; i++) { - pm_chnl = pm_conc_connection_list[i].chan; if (pm_conc_connection_list[i].in_use) - if (!WLAN_REG_IS_SAME_BAND_CHANNELS(channel, pm_chnl)) { + if (!WLAN_REG_IS_SAME_BAND_FREQS( + ch_freq, pm_conc_connection_list[i].freq)) { qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); policy_mgr_debug("channel is in diff band"); return true; @@ -515,8 +512,8 @@ bool policy_mgr_is_chnl_in_diff_band(struct wlan_objmgr_psoc *psoc, return false; } -bool policy_mgr_is_hwmode_set_for_given_chnl(struct wlan_objmgr_psoc *psoc, - uint8_t channel) +bool policy_mgr_is_hwmode_set_for_given_chnl_int(struct wlan_objmgr_psoc *psoc, + uint32_t ch_freq) { enum policy_mgr_band band; bool is_hwmode_dbs, is_2x2_dbs; @@ -524,7 +521,7 @@ bool policy_mgr_is_hwmode_set_for_given_chnl(struct wlan_objmgr_psoc *psoc, if (policy_mgr_is_hw_dbs_capable(psoc) == false) return true; - if (WLAN_REG_IS_24GHZ_CH(channel)) + if (WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq)) band = POLICY_MGR_BAND_24; else band = POLICY_MGR_BAND_5; @@ -575,7 +572,7 @@ enum policy_mgr_conc_next_action policy_mgr_get_preferred_dbs_action_table( struct wlan_objmgr_psoc *psoc, uint32_t vdev_id, - uint8_t channel, + uint32_t ch_freq, enum policy_mgr_conn_update_reason reason) { struct policy_mgr_psoc_priv_obj *pm_ctx; @@ -587,7 +584,7 @@ policy_mgr_get_preferred_dbs_action_table( bool dbs_2x2_5g_1x1_2g_supported; bool dbs_2x2_2g_1x1_5g_supported; uint32_t vdev_pri_list, vdev_pri_id; - uint8_t chan_list[MAX_NUMBER_OF_CONC_CONNECTIONS + 1]; + uint32_t ch_freq_list[MAX_NUMBER_OF_CONC_CONNECTIONS + 1]; uint8_t vdev_list[MAX_NUMBER_OF_CONC_CONNECTIONS + 1]; uint32_t vdev_count = 0; uint32_t i; @@ -632,7 +629,7 @@ policy_mgr_get_preferred_dbs_action_table( if (!vdev_priority_enabled) goto DONE; - if (vdev_id != INVALID_VDEV_ID && channel) { + if (vdev_id != INVALID_VDEV_ID && ch_freq) { if (pm_ctx->hdd_cbacks.hdd_get_device_mode) new_conn_op_mode = pm_ctx->hdd_cbacks. hdd_get_device_mode(vdev_id); @@ -640,12 +637,12 @@ policy_mgr_get_preferred_dbs_action_table( new_conn_mode = policy_mgr_convert_device_mode_to_qdf_type( new_conn_op_mode); if (new_conn_mode == PM_MAX_NUM_OF_MODE) - policy_mgr_debug("new vdev %d op_mode %d chan %d reason %d: not prioritized", + policy_mgr_debug("new vdev %d op_mode %d freq %d reason %d: not prioritized", vdev_id, new_conn_op_mode, - channel, reason); + ch_freq, reason); else - policy_mgr_debug("new vdev %d op_mode %d chan %d : reason %d", - vdev_id, new_conn_op_mode, channel, + policy_mgr_debug("new vdev %d op_mode %d freq %d : reason %d", + vdev_id, new_conn_op_mode, ch_freq, reason); } vdev_pri_list = pm_ctx->cfg.vdev_priority_list; @@ -657,8 +654,8 @@ policy_mgr_get_preferred_dbs_action_table( vdev_pri_id); goto NEXT; } - vdev_count = policy_mgr_get_mode_specific_conn_info( - psoc, chan_list, vdev_list, pri_conn_mode); + vdev_count = policy_mgr_get_mode_specific_conn_info_int( + psoc, ch_freq_list, vdev_list, pri_conn_mode); /** * Take care of duplication case, the vdev id may * exist in the conn list already with old chan. @@ -667,12 +664,12 @@ policy_mgr_get_preferred_dbs_action_table( found = false; for (i = 0; i < vdev_count; i++) { policy_mgr_debug("[%d] vdev %d chan %d conn_mode %d", - i, vdev_list[i], chan_list[i], + i, vdev_list[i], ch_freq_list[i], pri_conn_mode); if (new_conn_mode == pri_conn_mode && vdev_list[i] == vdev_id) { - chan_list[i] = channel; + ch_freq_list[i] = ch_freq; found = true; } } @@ -681,7 +678,7 @@ policy_mgr_get_preferred_dbs_action_table( * make decision if it is prioritized. */ if (!found && new_conn_mode == pri_conn_mode) { - chan_list[vdev_count] = channel; + ch_freq_list[vdev_count] = ch_freq; vdev_list[vdev_count++] = vdev_id; } /** @@ -695,7 +692,8 @@ policy_mgr_get_preferred_dbs_action_table( * preferred band. */ if (vdev_count > 0) { - band_pref_5g = WLAN_REG_IS_5GHZ_CH(chan_list[0]); + band_pref_5g = + WLAN_REG_IS_5GHZ_CH_FREQ(ch_freq_list[0]); break; } NEXT: @@ -713,7 +711,7 @@ DONE: * policy_mgr_get_second_conn_action_table() - get second conn action table * @psoc: Pointer to psoc * @vdev_id: vdev Id - * @channel: channel of vdev. + * @ch_freq: channel frequency of vdev. * @reason: reason of request * * Get the action table based on current HW Caps and INI user preference. @@ -726,7 +724,7 @@ static policy_mgr_next_action_two_connection_table_type * policy_mgr_get_second_conn_action_table( struct wlan_objmgr_psoc *psoc, uint32_t vdev_id, - uint8_t channel, + uint32_t ch_freq, enum policy_mgr_conn_update_reason reason) { enum policy_mgr_conc_next_action preferred_action; @@ -735,7 +733,7 @@ policy_mgr_get_second_conn_action_table( return next_action_two_connection_table; preferred_action = policy_mgr_get_preferred_dbs_action_table( - psoc, vdev_id, channel, reason); + psoc, vdev_id, ch_freq, reason); switch (preferred_action) { case PM_DBS2: return next_action_two_connection_2x2_2g_1x1_5g_table; @@ -748,7 +746,7 @@ policy_mgr_get_second_conn_action_table( * policy_mgr_get_third_conn_action_table() - get third connection action table * @psoc: Pointer to psoc * @vdev_id: vdev Id - * @channel: channel of vdev. + * @ch_freq: channel frequency of vdev. * @reason: reason of request * * Get the action table based on current HW Caps and INI user preference. @@ -761,7 +759,7 @@ static policy_mgr_next_action_three_connection_table_type * policy_mgr_get_third_conn_action_table( struct wlan_objmgr_psoc *psoc, uint32_t vdev_id, - uint8_t channel, + uint32_t ch_freq, enum policy_mgr_conn_update_reason reason) { enum policy_mgr_conc_next_action preferred_action; @@ -770,7 +768,7 @@ policy_mgr_get_third_conn_action_table( return next_action_three_connection_table; preferred_action = policy_mgr_get_preferred_dbs_action_table( - psoc, vdev_id, channel, reason); + psoc, vdev_id, ch_freq, reason); switch (preferred_action) { case PM_DBS2: return next_action_three_connection_2x2_2g_1x1_5g_table; @@ -782,7 +780,7 @@ policy_mgr_get_third_conn_action_table( static QDF_STATUS policy_mgr_get_next_action(struct wlan_objmgr_psoc *psoc, uint32_t session_id, - uint8_t channel, + uint32_t ch_freq, enum policy_mgr_conn_update_reason reason, enum policy_mgr_conc_next_action *next_action) { @@ -806,15 +804,15 @@ policy_mgr_get_next_action(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_E_FAILURE; } - if (WLAN_REG_IS_24GHZ_CH(channel)) + if (WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq)) band = POLICY_MGR_BAND_24; else band = POLICY_MGR_BAND_5; num_connections = policy_mgr_get_connection_count(psoc); - policy_mgr_debug("num_connections=%d channel=%d", - num_connections, channel); + policy_mgr_debug("num_connections=%d freq=%d", + num_connections, ch_freq); switch (num_connections) { case 0: @@ -835,7 +833,7 @@ policy_mgr_get_next_action(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_E_FAILURE; } second_conn_table = policy_mgr_get_second_conn_action_table( - psoc, session_id, channel, reason); + psoc, session_id, ch_freq, reason); *next_action = (*second_conn_table)[second_index][band]; break; case 2: @@ -847,7 +845,7 @@ policy_mgr_get_next_action(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_E_FAILURE; } third_conn_table = policy_mgr_get_third_conn_action_table( - psoc, session_id, channel, reason); + psoc, session_id, ch_freq, reason); *next_action = (*third_conn_table)[third_index][band]; break; default: @@ -889,11 +887,12 @@ policy_mgr_get_next_action(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_SUCCESS; } - -QDF_STATUS policy_mgr_current_connections_update(struct wlan_objmgr_psoc *psoc, - uint32_t session_id, - uint8_t channel, - enum policy_mgr_conn_update_reason reason) +QDF_STATUS +policy_mgr_current_connections_update_int(struct wlan_objmgr_psoc *psoc, + uint32_t session_id, + uint32_t ch_freq, + enum policy_mgr_conn_update_reason + reason) { enum policy_mgr_conc_next_action next_action = PM_NOP; QDF_STATUS status; @@ -903,7 +902,7 @@ QDF_STATUS policy_mgr_current_connections_update(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_E_NOSUPPORT; } - status = policy_mgr_get_next_action(psoc, session_id, channel, reason, + status = policy_mgr_get_next_action(psoc, session_id, ch_freq, reason, &next_action); if (QDF_IS_STATUS_ERROR(status)) return status; @@ -1211,13 +1210,14 @@ QDF_STATUS policy_mgr_next_actions( return status; } -QDF_STATUS policy_mgr_handle_conc_multiport(struct wlan_objmgr_psoc *psoc, - uint8_t session_id, uint8_t channel, - enum policy_mgr_conn_update_reason reason) +QDF_STATUS +policy_mgr_handle_conc_multiport_int(struct wlan_objmgr_psoc *psoc, + uint8_t session_id, uint32_t ch_freq, + enum policy_mgr_conn_update_reason reason) { QDF_STATUS status; - if (!policy_mgr_check_for_session_conc(psoc, session_id, channel)) { + if (!policy_mgr_check_for_session_conc_int(psoc, session_id, ch_freq)) { policy_mgr_err("Conc not allowed for the session %d", session_id); return QDF_STATUS_E_FAILURE; @@ -1227,8 +1227,8 @@ QDF_STATUS policy_mgr_handle_conc_multiport(struct wlan_objmgr_psoc *psoc, if (!QDF_IS_STATUS_SUCCESS(status)) policy_mgr_err("clearing event failed"); - status = policy_mgr_current_connections_update(psoc, session_id, - channel, reason); + status = policy_mgr_current_connections_update_int(psoc, session_id, + ch_freq, reason); if (QDF_STATUS_E_FAILURE == status) { policy_mgr_err("connections update failed"); return status; @@ -1238,8 +1238,8 @@ QDF_STATUS policy_mgr_handle_conc_multiport(struct wlan_objmgr_psoc *psoc, } #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH -void policy_mgr_update_user_config_sap_chan( - struct wlan_objmgr_psoc *psoc, uint32_t channel) +void policy_mgr_update_user_config_sap_chan_int( + struct wlan_objmgr_psoc *psoc, uint32_t ch_freq) { struct policy_mgr_psoc_priv_obj *pm_ctx; @@ -1248,7 +1248,7 @@ void policy_mgr_update_user_config_sap_chan( policy_mgr_err("Invalid pm context and failed to update the user config sap channel"); return; } - pm_ctx->user_config_sap_channel = channel; + pm_ctx->user_config_sap_ch_freq = ch_freq; } /** @@ -1293,8 +1293,8 @@ static bool policy_mgr_is_restart_sap_allowed( return false; } -bool policy_mgr_is_safe_channel(struct wlan_objmgr_psoc *psoc, - uint8_t channel) +bool policy_mgr_is_safe_channel_int(struct wlan_objmgr_psoc *psoc, + uint32_t ch_freq) { struct policy_mgr_psoc_priv_obj *pm_ctx; bool is_safe = true; @@ -1313,9 +1313,9 @@ bool policy_mgr_is_safe_channel(struct wlan_objmgr_psoc *psoc, } for (j = 0; j < pm_ctx->unsafe_channel_count; j++) { - if (channel == pm_ctx->unsafe_channel_list[j]) { + if (ch_freq == pm_ctx->unsafe_channel_list[j]) { is_safe = false; - policy_mgr_warn("CH %d is not safe", channel); + policy_mgr_warn("Freq %d is not safe", ch_freq); break; } } @@ -1323,26 +1323,27 @@ bool policy_mgr_is_safe_channel(struct wlan_objmgr_psoc *psoc, return is_safe; } -bool policy_mgr_is_sap_restart_required_after_sta_disconnect( +bool policy_mgr_is_sap_restart_required_after_sta_disconnect_int( struct wlan_objmgr_psoc *psoc, - uint32_t sap_vdev_id, uint8_t *intf_ch) + uint32_t sap_vdev_id, uint32_t *intf_ch_freq) { struct policy_mgr_psoc_priv_obj *pm_ctx; - uint8_t curr_sap_chan = 0, new_sap_ch = 0; + uint32_t curr_sap_freq = 0, new_sap_freq = 0; bool sta_sap_scc_on_dfs_chan = policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan(psoc); bool sta_sap_scc_on_lte_coex_chan = policy_mgr_sta_sap_scc_on_lte_coex_chan(psoc); uint32_t cc_count, i, go_index_start, pcl_len = 0; - uint8_t op_ch[MAX_NUMBER_OF_CONC_CONNECTIONS]; + uint32_t op_ch_freq_list[MAX_NUMBER_OF_CONC_CONNECTIONS]; uint8_t vdev_id[MAX_NUMBER_OF_CONC_CONNECTIONS]; enum policy_mgr_con_mode mode; - uint8_t pcl_channels[QDF_MAX_NUM_CHAN + 1]; + uint32_t pcl_channels[QDF_MAX_NUM_CHAN + 1]; uint8_t pcl_weight[QDF_MAX_NUM_CHAN + 1]; struct policy_mgr_conc_connection_info info = {0}; uint8_t num_cxn_del = 0; QDF_STATUS status; + *intf_ch_freq = 0; pm_ctx = policy_mgr_get_context(psoc); if (!pm_ctx) { policy_mgr_err("Invalid pm context"); @@ -1357,15 +1358,15 @@ bool policy_mgr_is_sap_restart_required_after_sta_disconnect( if (policy_mgr_get_connection_count(psoc) > 1) return false; - cc_count = policy_mgr_get_mode_specific_conn_info( + cc_count = policy_mgr_get_mode_specific_conn_info_int( psoc, - &op_ch[0], + &op_ch_freq_list[0], &vdev_id[0], PM_SAP_MODE); go_index_start = cc_count; if (cc_count < MAX_NUMBER_OF_CONC_CONNECTIONS) - cc_count += policy_mgr_get_mode_specific_conn_info(psoc, - &op_ch[cc_count], + cc_count += policy_mgr_get_mode_specific_conn_info_int(psoc, + &op_ch_freq_list[cc_count], &vdev_id[cc_count], PM_P2P_GO_MODE); @@ -1375,55 +1376,56 @@ bool policy_mgr_is_sap_restart_required_after_sta_disconnect( continue; if (policy_mgr_is_any_mode_active_on_band_along_with_session( psoc, vdev_id[i], - WLAN_REG_IS_24GHZ_CH(op_ch[i]) ? + WLAN_REG_IS_24GHZ_CH_FREQ(op_ch_freq_list[i]) ? POLICY_MGR_BAND_24 : POLICY_MGR_BAND_5)) continue; if (sta_sap_scc_on_dfs_chan && - wlan_reg_is_dfs_ch(pm_ctx->pdev, op_ch[i])) { + wlan_reg_is_dfs_for_freq(pm_ctx->pdev, + op_ch_freq_list[i])) { sap_vdev_id = vdev_id[i]; - curr_sap_chan = op_ch[i]; - policy_mgr_debug("sta_sap_scc_on_dfs_chan %u, dfs sap_chan %u", + curr_sap_freq = op_ch_freq_list[i]; + policy_mgr_debug("sta_sap_scc_on_dfs_chan %u, dfs sap_ch_freq %u", sta_sap_scc_on_dfs_chan, - curr_sap_chan); + curr_sap_freq); break; } if (sta_sap_scc_on_lte_coex_chan && - !policy_mgr_is_safe_channel(psoc, op_ch[i])) { + !policy_mgr_is_safe_channel_int(psoc, op_ch_freq_list[i])) { sap_vdev_id = vdev_id[i]; - curr_sap_chan = op_ch[i]; - policy_mgr_debug("sta_sap_scc_on_lte_coex_chan %u unsafe sap_chan %u", + curr_sap_freq = op_ch_freq_list[i]; + policy_mgr_debug("sta_sap_scc_on_lte_coex_chan %u unsafe sap_ch_freq %u", sta_sap_scc_on_lte_coex_chan, - curr_sap_chan); + curr_sap_freq); break; } } - if (!curr_sap_chan) + if (!curr_sap_freq) return false; mode = i >= go_index_start ? PM_P2P_GO_MODE : PM_SAP_MODE; qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); policy_mgr_store_and_del_conn_info_by_vdev_id(psoc, sap_vdev_id, &info, &num_cxn_del); /* Add the user config ch as first condidate */ - pcl_channels[0] = pm_ctx->user_config_sap_channel; + pcl_channels[0] = pm_ctx->user_config_sap_ch_freq; pcl_weight[0] = 0; - status = policy_mgr_get_pcl(psoc, mode, &pcl_channels[1], &pcl_len, - &pcl_weight[1], - QDF_ARRAY_SIZE(pcl_weight) - 1); + status = policy_mgr_get_pcl_int(psoc, mode, &pcl_channels[1], &pcl_len, + &pcl_weight[1], + QDF_ARRAY_SIZE(pcl_weight) - 1); if (status == QDF_STATUS_SUCCESS) pcl_len++; else pcl_len = 1; for (i = 0; i < pcl_len; i++) { - if (pcl_channels[i] == curr_sap_chan) + if (pcl_channels[i] == curr_sap_freq) continue; - if (!wlan_reg_is_same_band_channels( - curr_sap_chan, pcl_channels[i])) + if (!wlan_reg_is_same_band_freqs( + curr_sap_freq, pcl_channels[i])) continue; - if (!policy_mgr_is_safe_channel(psoc, pcl_channels[i]) || - wlan_reg_is_dfs_ch(pm_ctx->pdev, pcl_channels[i])) + if (!policy_mgr_is_safe_channel_int(psoc, pcl_channels[i]) || + wlan_reg_is_dfs_for_freq(pm_ctx->pdev, pcl_channels[i])) continue; - new_sap_ch = pcl_channels[i]; + new_sap_freq = pcl_channels[i]; break; } /* Restore the connection entry */ @@ -1431,14 +1433,14 @@ bool policy_mgr_is_sap_restart_required_after_sta_disconnect( policy_mgr_restore_deleted_conn_info(psoc, &info, num_cxn_del); qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); - if (new_sap_ch == 0 || curr_sap_chan == new_sap_ch) + if (new_sap_freq == 0 || curr_sap_freq == new_sap_freq) return false; - if (!intf_ch) + if (!intf_ch_freq) return true; - *intf_ch = new_sap_ch; + *intf_ch_freq = new_sap_freq; policy_mgr_debug("Standalone SAP(vdev_id %d) is not allowed on DFS/Unsafe channel, Move it to channel %u", - sap_vdev_id, *intf_ch); + sap_vdev_id, *intf_ch_freq); return true; } @@ -1447,15 +1449,15 @@ bool policy_mgr_is_sap_restart_required_after_sta_disconnect( * policy_mgr_is_nan_sap_unsafe_ch_scc_allowed() - Check if NAN+SAP SCC is * allowed in LTE COEX unsafe ch * @pm_ctx: policy_mgr_psoc_priv_obj policy mgr context - * @ch: Channel to check + * @ch_freq: Channel frequency to check * * Return: True if allowed else false */ static bool policy_mgr_is_nan_sap_unsafe_ch_scc_allowed(struct policy_mgr_psoc_priv_obj - *pm_ctx, uint8_t ch) + *pm_ctx, uint32_t ch_freq) { - if (policy_mgr_is_safe_channel(pm_ctx->psoc, ch) || + if (policy_mgr_is_safe_channel_int(pm_ctx->psoc, ch_freq) || pm_ctx->cfg.nan_sap_scc_on_lte_coex_chnl) return true; @@ -1475,10 +1477,10 @@ static void policy_mgr_nan_disable_work(void *data) ucfg_nan_disable_concurrency(psoc); } -bool policy_mgr_nan_sap_scc_on_unsafe_ch_chk(struct wlan_objmgr_psoc *psoc, - uint8_t sap_ch) +bool policy_mgr_nan_sap_scc_on_unsafe_ch_chk_int(struct wlan_objmgr_psoc *psoc, + uint32_t sap_freq) { - uint8_t nan_ch_2g, nan_ch_5g; + uint32_t nan_2g_freq, nan_5g_freq; struct policy_mgr_psoc_priv_obj *pm_ctx; pm_ctx = policy_mgr_get_context(psoc); @@ -1487,25 +1489,25 @@ bool policy_mgr_nan_sap_scc_on_unsafe_ch_chk(struct wlan_objmgr_psoc *psoc, return false; } - nan_ch_2g = policy_mgr_mode_specific_get_channel(psoc, - PM_NAN_DISC_MODE); - if (nan_ch_2g == 0) { + nan_2g_freq = policy_mgr_mode_specific_get_channel(psoc, + PM_NAN_DISC_MODE); + if (nan_2g_freq == 0) { policy_mgr_debug("No NAN+SAP SCC"); return false; } - nan_ch_5g = wlan_nan_get_disc_5g_ch(psoc); + nan_5g_freq = wlan_chan_to_freq(wlan_nan_get_disc_5g_ch(psoc)); - policy_mgr_debug("SAP Ch: %d NAN Ch: %d %d", sap_ch, - nan_ch_2g, nan_ch_5g); - if (WLAN_REG_IS_SAME_BAND_CHANNELS(nan_ch_2g, sap_ch)) { + policy_mgr_debug("Freq SAP: %d NAN: %d %d", sap_freq, + nan_2g_freq, nan_5g_freq); + if (WLAN_REG_IS_SAME_BAND_FREQS(nan_2g_freq, sap_freq)) { if (policy_mgr_is_force_scc(pm_ctx->psoc) && policy_mgr_is_nan_sap_unsafe_ch_scc_allowed(pm_ctx, - nan_ch_2g)) + nan_2g_freq)) return true; - } else if (WLAN_REG_IS_SAME_BAND_CHANNELS(nan_ch_5g, sap_ch)) { + } else if (WLAN_REG_IS_SAME_BAND_FREQS(nan_5g_freq, sap_freq)) { if (policy_mgr_is_force_scc(pm_ctx->psoc) && policy_mgr_is_nan_sap_unsafe_ch_scc_allowed(pm_ctx, - nan_ch_5g)) + nan_5g_freq)) return true; } else { /* @@ -1524,12 +1526,12 @@ bool policy_mgr_nan_sap_scc_on_unsafe_ch_chk(struct wlan_objmgr_psoc *psoc, } bool -policy_mgr_nan_sap_pre_enable_conc_check(struct wlan_objmgr_psoc *psoc, - enum policy_mgr_con_mode mode, - uint8_t ch) +policy_mgr_nan_sap_pre_enable_conc_check_int(struct wlan_objmgr_psoc *psoc, + enum policy_mgr_con_mode mode, + uint32_t ch_freq) { struct policy_mgr_psoc_priv_obj *pm_ctx; - uint8_t sap_ch, nan_ch_2g, nan_ch_5g; + uint32_t sap_freq, nan_2g_freq, nan_5g_freq; pm_ctx = policy_mgr_get_context(psoc); if (!pm_ctx) { @@ -1542,7 +1544,7 @@ policy_mgr_nan_sap_pre_enable_conc_check(struct wlan_objmgr_psoc *psoc, return true; } - if (!ch) { + if (!ch_freq) { policy_mgr_err("Invalid channel"); return false; } @@ -1555,11 +1557,11 @@ policy_mgr_nan_sap_pre_enable_conc_check(struct wlan_objmgr_psoc *psoc, ucfg_nan_disable_concurrency(pm_ctx->psoc); } if (mode == PM_NAN_DISC_MODE) { - sap_ch = policy_mgr_mode_specific_get_channel(pm_ctx->psoc, - PM_SAP_MODE); - policy_mgr_debug("SAP CH: %d NAN Ch: %d", sap_ch, ch); - if (WLAN_REG_IS_SAME_BAND_CHANNELS(sap_ch, ch)) { - if (sap_ch == ch) { + sap_freq = policy_mgr_mode_specific_get_channel(pm_ctx->psoc, + PM_SAP_MODE); + policy_mgr_debug("FREQ SAP: %d NAN: %d", sap_freq, ch_freq); + if (WLAN_REG_IS_SAME_BAND_FREQS(sap_freq, ch_freq)) { + if (sap_freq == ch_freq) { policy_mgr_debug("NAN+SAP SCC"); return true; } @@ -1568,22 +1570,23 @@ policy_mgr_nan_sap_pre_enable_conc_check(struct wlan_objmgr_psoc *psoc, policy_mgr_debug("SAP force SCC disabled"); return false; } - if (!policy_mgr_is_nan_sap_unsafe_ch_scc_allowed(pm_ctx, - ch)) { + if (!policy_mgr_is_nan_sap_unsafe_ch_scc_allowed( + pm_ctx, ch_freq)) { policy_mgr_debug("NAN+SAP unsafe ch SCC disabled"); return false; } } } else if (mode == PM_SAP_MODE) { - nan_ch_2g = + nan_2g_freq = policy_mgr_mode_specific_get_channel(pm_ctx->psoc, PM_NAN_DISC_MODE); - nan_ch_5g = wlan_nan_get_disc_5g_ch(pm_ctx->psoc); - policy_mgr_debug("SAP CH: %d NAN Ch: %d %d", ch, nan_ch_2g, - nan_ch_5g); - if (WLAN_REG_IS_SAME_BAND_CHANNELS(nan_ch_2g, ch) || - WLAN_REG_IS_SAME_BAND_CHANNELS(nan_ch_5g, ch)) { - if (ch == nan_ch_2g || ch == nan_ch_5g) { + nan_5g_freq = wlan_chan_to_freq(wlan_nan_get_disc_5g_ch( + pm_ctx->psoc)); + policy_mgr_debug("SAP CH: %d NAN Ch: %d %d", ch_freq, + nan_2g_freq, nan_5g_freq); + if (WLAN_REG_IS_SAME_BAND_FREQS(nan_2g_freq, ch_freq) || + WLAN_REG_IS_SAME_BAND_FREQS(nan_5g_freq, ch_freq)) { + if (ch_freq == nan_2g_freq || ch_freq == nan_5g_freq) { policy_mgr_debug("NAN+SAP SCC"); return true; } @@ -1592,12 +1595,12 @@ policy_mgr_nan_sap_pre_enable_conc_check(struct wlan_objmgr_psoc *psoc, ucfg_nan_disable_concurrency(pm_ctx->psoc); return false; } - if ((WLAN_REG_IS_5GHZ_CH(ch) && + if ((WLAN_REG_IS_5GHZ_CH_FREQ(ch_freq) && !policy_mgr_is_nan_sap_unsafe_ch_scc_allowed( - pm_ctx, nan_ch_5g)) || - (WLAN_REG_IS_24GHZ_CH(ch) && + pm_ctx, nan_5g_freq)) || + (WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq) && !policy_mgr_is_nan_sap_unsafe_ch_scc_allowed( - pm_ctx, nan_ch_2g))) { + pm_ctx, nan_2g_freq))) { policy_mgr_debug("NAN+SAP unsafe ch SCC disabled"); ucfg_nan_disable_concurrency(pm_ctx->psoc); return false; @@ -1611,7 +1614,7 @@ void policy_mgr_nan_sap_post_enable_conc_check(struct wlan_objmgr_psoc *psoc) { struct policy_mgr_psoc_priv_obj *pm_ctx; struct policy_mgr_conc_connection_info *sap_info = NULL; - uint8_t sap_ch = 0, nan_ch_2g, nan_ch_5g, i; + uint8_t nan_freq_2g, nan_freq_5g, i; QDF_STATUS status; pm_ctx = policy_mgr_get_context(psoc); @@ -1624,20 +1627,21 @@ void policy_mgr_nan_sap_post_enable_conc_check(struct wlan_objmgr_psoc *psoc) if (pm_conc_connection_list[i].mode == PM_SAP_MODE && pm_conc_connection_list[i].in_use) { sap_info = &pm_conc_connection_list[i]; - sap_ch = sap_info->chan; break; } } - if (sap_ch == 0) + if (!sap_info) return; - nan_ch_2g = policy_mgr_mode_specific_get_channel(psoc, - PM_NAN_DISC_MODE); - nan_ch_5g = wlan_nan_get_disc_5g_ch(psoc); - if (sap_ch == nan_ch_2g || sap_ch == nan_ch_5g) { + if (sap_info->freq == 0) + return; + nan_freq_2g = policy_mgr_mode_specific_get_channel(psoc, + PM_NAN_DISC_MODE); + nan_freq_5g = wlan_chan_to_freq(wlan_nan_get_disc_5g_ch(psoc)); + if (sap_info->freq == nan_freq_2g || sap_info->freq == nan_freq_5g) { policy_mgr_debug("NAN and SAP already in SCC"); return; } - if (nan_ch_2g == 0) + if (nan_freq_2g == 0) return; if (pm_ctx->hdd_cbacks.hdd_is_chan_switch_in_progress && @@ -1650,22 +1654,25 @@ void policy_mgr_nan_sap_post_enable_conc_check(struct wlan_objmgr_psoc *psoc) policy_mgr_err("wait for event failed, still continue with channel switch"); } - policy_mgr_debug("Force SCC for NAN+SAP Ch: %d", - WLAN_REG_IS_5GHZ_CH(sap_ch) ? nan_ch_5g : nan_ch_2g); + policy_mgr_debug("Force SCC for NAN+SAP Ch freq: %d", + WLAN_REG_IS_5GHZ_CH_FREQ(sap_info->freq) ? + nan_freq_5g : nan_freq_2g); if (pm_ctx->hdd_cbacks.wlan_hdd_set_sap_csa_reason) pm_ctx->hdd_cbacks.wlan_hdd_set_sap_csa_reason(psoc, sap_info->vdev_id, CSA_REASON_CONCURRENT_NAN_EVENT); - if (WLAN_REG_IS_5GHZ_CH(sap_ch)) { - policy_mgr_change_sap_channel_with_csa(psoc, sap_info->vdev_id, - nan_ch_5g, + if (WLAN_REG_IS_5GHZ_CH_FREQ(sap_info->freq)) { + policy_mgr_change_sap_channel_with_csa_int( + psoc, sap_info->vdev_id, + nan_freq_5g, policy_mgr_get_ch_width( sap_info->bw), true); } else { - policy_mgr_change_sap_channel_with_csa(psoc, sap_info->vdev_id, - nan_ch_2g, + policy_mgr_change_sap_channel_with_csa_int( + psoc, sap_info->vdev_id, + nan_freq_2g, policy_mgr_get_ch_width( sap_info->bw), true); @@ -1676,7 +1683,7 @@ void policy_mgr_nan_sap_post_disable_conc_check(struct wlan_objmgr_psoc *psoc) { struct policy_mgr_psoc_priv_obj *pm_ctx; struct policy_mgr_conc_connection_info *sap_info = NULL; - uint8_t sap_ch = 0, i; + uint32_t sap_freq = 0, i; QDF_STATUS status; pm_ctx = policy_mgr_get_context(psoc); @@ -1689,17 +1696,18 @@ void policy_mgr_nan_sap_post_disable_conc_check(struct wlan_objmgr_psoc *psoc) if (pm_conc_connection_list[i].mode == PM_SAP_MODE && pm_conc_connection_list[i].in_use) { sap_info = &pm_conc_connection_list[i]; - sap_ch = sap_info->chan; + sap_freq = sap_info->freq; break; } } - if (sap_ch == 0 || policy_mgr_is_safe_channel(psoc, sap_ch)) + if (sap_freq == 0 || policy_mgr_is_safe_channel_int(psoc, sap_freq)) return; - sap_ch = policy_mgr_get_nondfs_preferred_channel(psoc, PM_SAP_MODE, - false); - policy_mgr_debug("User/ACS orig ch: %d New SAP ch: %d", - pm_ctx->user_config_sap_channel, sap_ch); + sap_freq = policy_mgr_get_nondfs_preferred_channel_int(psoc, + PM_SAP_MODE, + false); + policy_mgr_debug("User/ACS orig Freq: %d New SAP Freq: %d", + pm_ctx->user_config_sap_ch_freq, sap_freq); if (pm_ctx->hdd_cbacks.hdd_is_chan_switch_in_progress && pm_ctx->hdd_cbacks.hdd_is_chan_switch_in_progress()) { policy_mgr_debug("wait as channel switch is already in progress"); @@ -1711,14 +1719,14 @@ void policy_mgr_nan_sap_post_disable_conc_check(struct wlan_objmgr_psoc *psoc) } if (pm_ctx->hdd_cbacks.wlan_hdd_set_sap_csa_reason) - pm_ctx->hdd_cbacks.wlan_hdd_set_sap_csa_reason(psoc, - sap_info->vdev_id, - CSA_REASON_CONCURRENT_NAN_EVENT); + pm_ctx->hdd_cbacks.wlan_hdd_set_sap_csa_reason( + psoc, sap_info->vdev_id, + CSA_REASON_CONCURRENT_NAN_EVENT); - policy_mgr_change_sap_channel_with_csa(psoc, sap_info->vdev_id, - sap_ch, - policy_mgr_get_ch_width( - sap_info->bw), true); + policy_mgr_change_sap_channel_with_csa_int(psoc, sap_info->vdev_id, + sap_freq, + policy_mgr_get_ch_width( + sap_info->bw), true); } static void __policy_mgr_check_sta_ap_concurrent_ch_intf(void *data) @@ -1728,8 +1736,8 @@ static void __policy_mgr_check_sta_ap_concurrent_ch_intf(void *data) struct sta_ap_intf_check_work_ctx *work_info = NULL; uint32_t mcc_to_scc_switch, cc_count = 0, i, go_index_start; QDF_STATUS status; - uint8_t channel; - uint8_t operating_channel[MAX_NUMBER_OF_CONC_CONNECTIONS]; + uint32_t ch_freq; + uint32_t op_ch_freq_list[MAX_NUMBER_OF_CONC_CONNECTIONS]; uint8_t vdev_id[MAX_NUMBER_OF_CONC_CONNECTIONS]; work_info = data; @@ -1758,19 +1766,16 @@ static void __policy_mgr_check_sta_ap_concurrent_ch_intf(void *data) if (!policy_mgr_is_restart_sap_allowed(psoc, mcc_to_scc_switch)) goto end; - cc_count = policy_mgr_get_mode_specific_conn_info(psoc, - &operating_channel[cc_count], - &vdev_id[cc_count], - PM_SAP_MODE); + cc_count = policy_mgr_get_mode_specific_conn_info_int( + psoc, &op_ch_freq_list[cc_count], + &vdev_id[cc_count], PM_SAP_MODE); policy_mgr_debug("Number of concurrent SAP: %d", cc_count); go_index_start = cc_count; if (cc_count < MAX_NUMBER_OF_CONC_CONNECTIONS) cc_count = cc_count + - policy_mgr_get_mode_specific_conn_info - (psoc, - &operating_channel[cc_count], - &vdev_id[cc_count], - PM_P2P_GO_MODE); + policy_mgr_get_mode_specific_conn_info_int( + psoc, &op_ch_freq_list[cc_count], + &vdev_id[cc_count], PM_P2P_GO_MODE); policy_mgr_debug("Number of beaconing entities (SAP + GO):%d", cc_count); if (!cc_count) { @@ -1799,10 +1804,10 @@ static void __policy_mgr_check_sta_ap_concurrent_ch_intf(void *data) continue; status = pm_ctx->hdd_cbacks. wlan_hdd_get_channel_for_sap_restart - (psoc, vdev_id[i], &channel); + (psoc, vdev_id[i], &ch_freq); if (status == QDF_STATUS_SUCCESS) { - policy_mgr_info("SAP restarts due to MCC->SCC switch, old chan :%d new chan: %d" - , operating_channel[i], channel); + policy_mgr_info("SAP restarts due to MCC->SCC switch, old ch freq :%d new ch freq: %d", + op_ch_freq_list[i], ch_freq); break; } } @@ -1829,7 +1834,7 @@ void policy_mgr_check_sta_ap_concurrent_ch_intf(void *data) } static bool policy_mgr_valid_sta_channel_check(struct wlan_objmgr_psoc *psoc, - uint8_t sta_channel) + uint32_t sta_ch_freq) { struct policy_mgr_psoc_priv_obj *pm_ctx; bool sta_sap_scc_on_dfs_chan; @@ -1842,16 +1847,17 @@ static bool policy_mgr_valid_sta_channel_check(struct wlan_objmgr_psoc *psoc, sta_sap_scc_on_dfs_chan = policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan(psoc); - if (wlan_reg_is_dfs_ch(pm_ctx->pdev, sta_channel) && + if (wlan_reg_is_dfs_for_freq(pm_ctx->pdev, sta_ch_freq) && sta_sap_scc_on_dfs_chan) { policy_mgr_debug("STA, SAP SCC is allowed on DFS chan %u", - sta_channel); + sta_ch_freq); return true; } - if ((wlan_reg_is_dfs_ch(pm_ctx->pdev, sta_channel) && - !sta_sap_scc_on_dfs_chan) || - wlan_reg_is_passive_or_disable_ch(pm_ctx->pdev, sta_channel) || - !policy_mgr_is_safe_channel(psoc, sta_channel)) { + if ((wlan_reg_is_dfs_for_freq(pm_ctx->pdev, sta_ch_freq) && + !sta_sap_scc_on_dfs_chan) || + wlan_reg_is_passive_or_disable_for_freq( + pm_ctx->pdev, sta_ch_freq) || + !policy_mgr_is_safe_channel_int(psoc, sta_ch_freq)) { if (policy_mgr_is_hw_dbs_capable(psoc)) return true; else @@ -1861,12 +1867,12 @@ static bool policy_mgr_valid_sta_channel_check(struct wlan_objmgr_psoc *psoc, return true; } -QDF_STATUS policy_mgr_valid_sap_conc_channel_check( - struct wlan_objmgr_psoc *psoc, uint8_t *con_ch, uint8_t sap_ch, - uint8_t sap_vdev_id) +QDF_STATUS policy_mgr_valid_sap_conc_channel_check_int( + struct wlan_objmgr_psoc *psoc, uint32_t *con_ch_freq, + uint32_t sap_ch_freq, uint8_t sap_vdev_id) { - uint8_t channel = *con_ch; - uint8_t temp_channel = 0; + uint32_t ch_freq = *con_ch_freq; + uint32_t temp_ch_freq = 0; struct policy_mgr_psoc_priv_obj *pm_ctx; bool sta_sap_scc_on_dfs_chan; @@ -1890,63 +1896,63 @@ QDF_STATUS policy_mgr_valid_sap_conc_channel_check( * return from here. If SCC, check further if SAP can move to * STA's channel. */ - if (!channel && - (sap_ch != policy_mgr_mode_specific_get_channel( - psoc, PM_STA_MODE))) + if (!ch_freq && + sap_ch_freq != policy_mgr_mode_specific_get_channel(psoc, + PM_STA_MODE)) return QDF_STATUS_SUCCESS; - else if (!channel) - channel = sap_ch; + else if (!ch_freq) + ch_freq = sap_ch_freq; sta_sap_scc_on_dfs_chan = policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan(psoc); - if (policy_mgr_valid_sta_channel_check(psoc, channel)) { - if (wlan_reg_is_dfs_ch(pm_ctx->pdev, channel) || - wlan_reg_is_passive_or_disable_ch(pm_ctx->pdev, channel) || + if (policy_mgr_valid_sta_channel_check(psoc, ch_freq)) { + if (wlan_reg_is_dfs_for_freq(pm_ctx->pdev, ch_freq) || + wlan_reg_is_passive_or_disable_for_freq(pm_ctx->pdev, + ch_freq) || !(policy_mgr_sta_sap_scc_on_lte_coex_chan(psoc) || - policy_mgr_is_safe_channel(psoc, channel)) || + policy_mgr_is_safe_channel_int(psoc, ch_freq)) || (!wlan_reg_is_etsi13_srd_chan_allowed_master_mode( pm_ctx->pdev) && - wlan_reg_is_etsi13_srd_chan(pm_ctx->pdev, channel))) { - if (wlan_reg_is_dfs_ch(pm_ctx->pdev, channel) && + wlan_reg_is_etsi13_srd_chan_for_freq(pm_ctx->pdev, + ch_freq))) { + if (wlan_reg_is_dfs_for_freq(pm_ctx->pdev, ch_freq) && sta_sap_scc_on_dfs_chan) { policy_mgr_debug("STA SAP SCC is allowed on DFS channel"); goto update_chan; } if (policy_mgr_is_hw_dbs_capable(psoc)) { - temp_channel = - policy_mgr_get_alternate_channel_for_sap(psoc, - sap_vdev_id, - sap_ch); - policy_mgr_debug("temp_channel is %d", - temp_channel); - if (temp_channel) { - channel = temp_channel; + temp_ch_freq = + policy_mgr_get_alternate_channel_for_sap( + psoc, sap_vdev_id, sap_ch_freq); + policy_mgr_debug("temp ch freq is %d", + temp_ch_freq); + if (temp_ch_freq) { + ch_freq = temp_ch_freq; } else { - if (WLAN_REG_IS_5GHZ_CH(channel)) - channel = PM_24_GHZ_CHANNEL_6; + if (WLAN_REG_IS_5GHZ_CH_FREQ(ch_freq)) + ch_freq = PM_24_GHZ_CH_FREQ_6; else - channel = PM_5_GHZ_CHANNEL_36; + ch_freq = PM_5_GHZ_CH_FREQ_36; } - if (!policy_mgr_is_safe_channel( - psoc, channel)) { - policy_mgr_warn( - "Can't have concurrency on %d as it is not safe", - channel); + if (!policy_mgr_is_safe_channel_int( + psoc, ch_freq)) { + policy_mgr_warn("Can't have concurrency on %d as it is not safe", + *con_ch_freq); return QDF_STATUS_E_FAILURE; } } else { policy_mgr_warn("Can't have concurrency on %d", - channel); + ch_freq); return QDF_STATUS_E_FAILURE; } } } update_chan: - if (channel != sap_ch) - *con_ch = channel; + if (ch_freq != sap_ch_freq) + *con_ch_freq = ch_freq; return QDF_STATUS_SUCCESS; } @@ -1967,11 +1973,11 @@ void policy_mgr_check_concurrent_intf_and_restart_sap( { struct policy_mgr_psoc_priv_obj *pm_ctx; uint32_t mcc_to_scc_switch; - uint8_t operating_channel[MAX_NUMBER_OF_CONC_CONNECTIONS] = {0}; + uint32_t op_ch_freq_list[MAX_NUMBER_OF_CONC_CONNECTIONS] = {0}; uint8_t vdev_id[MAX_NUMBER_OF_CONC_CONNECTIONS] = {0}; uint32_t cc_count = 0; bool restart_sap = false; - uint8_t sap_ch; + uint32_t sap_freq; pm_ctx = policy_mgr_get_context(psoc); if (!pm_ctx) { @@ -1986,10 +1992,10 @@ void policy_mgr_check_concurrent_intf_and_restart_sap( * enabled on unsafe channel then move the SAP to safe channel * as soon as STA disconnected. */ - if (policy_mgr_is_sap_restart_required_after_sta_disconnect( - psoc, INVALID_VDEV_ID, &sap_ch)) { + if (policy_mgr_is_sap_restart_required_after_sta_disconnect_int( + psoc, INVALID_VDEV_ID, &sap_freq)) { policy_mgr_debug("move the SAP to configured channel %u", - sap_ch); + sap_freq); restart_sap = true; goto sap_restart; } @@ -1997,9 +2003,9 @@ void policy_mgr_check_concurrent_intf_and_restart_sap( /* * force SCC with STA+STA+SAP will need some additional logic */ - cc_count = policy_mgr_get_mode_specific_conn_info(psoc, - &operating_channel[cc_count], - &vdev_id[cc_count], PM_STA_MODE); + cc_count = policy_mgr_get_mode_specific_conn_info_int( + psoc, &op_ch_freq_list[cc_count], + &vdev_id[cc_count], PM_STA_MODE); if (!cc_count) { policy_mgr_debug("Could not get STA operating channel&vdevid"); return; @@ -2008,7 +2014,7 @@ void policy_mgr_check_concurrent_intf_and_restart_sap( mcc_to_scc_switch = policy_mgr_get_mcc_to_scc_switch_mode(psoc); policy_mgr_info("MCC to SCC switch: %d chan: %d", - mcc_to_scc_switch, operating_channel[0]); + mcc_to_scc_switch, op_ch_freq_list[0]); if (!policy_mgr_is_restart_sap_allowed(psoc, mcc_to_scc_switch)) { policy_mgr_debug( @@ -2028,7 +2034,7 @@ sap_restart: */ if (restart_sap || ((mcc_to_scc_switch != QDF_MCC_TO_SCC_SWITCH_DISABLE) && - policy_mgr_valid_sta_channel_check(psoc, operating_channel[0]) && + policy_mgr_valid_sta_channel_check(psoc, op_ch_freq_list[0]) && !pm_ctx->sta_ap_intf_check_work_info)) { struct sta_ap_intf_check_work_ctx *work_info; work_info = qdf_mem_malloc( @@ -2052,7 +2058,7 @@ sap_restart: * policy_mgr_change_sap_channel_with_csa() - Move SAP channel using (E)CSA * @psoc: PSOC object information * @vdev_id: Vdev id - * @channel: Channel to change + * @ch_freq: Channel to change * @ch_width: channel width to change * @forced: Force to switch channel, ignore SCC/MCC check * @@ -2060,10 +2066,11 @@ sap_restart: * * Return: None */ -void policy_mgr_change_sap_channel_with_csa(struct wlan_objmgr_psoc *psoc, - uint8_t vdev_id, uint32_t channel, - uint32_t ch_width, - bool forced) +void policy_mgr_change_sap_channel_with_csa_int(struct wlan_objmgr_psoc *psoc, + uint8_t vdev_id, + uint32_t ch_freq, + uint32_t ch_width, + bool forced) { struct policy_mgr_psoc_priv_obj *pm_ctx; @@ -2076,7 +2083,7 @@ void policy_mgr_change_sap_channel_with_csa(struct wlan_objmgr_psoc *psoc, if (pm_ctx->hdd_cbacks.sap_restart_chan_switch_cb) { policy_mgr_info("SAP change change without restart"); pm_ctx->hdd_cbacks.sap_restart_chan_switch_cb(psoc, - vdev_id, channel, ch_width, forced); + vdev_id, ch_freq, ch_width, forced); } } #endif @@ -2322,9 +2329,9 @@ done: return status; } -QDF_STATUS policy_mgr_check_and_set_hw_mode_for_channel_switch( - struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, uint8_t chan, - enum policy_mgr_conn_update_reason reason) +QDF_STATUS policy_mgr_check_and_set_hw_mode_for_channel_switch_int( + struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, + uint32_t ch_freq, enum policy_mgr_conn_update_reason reason) { QDF_STATUS status; struct policy_mgr_conc_connection_info info; @@ -2356,7 +2363,7 @@ QDF_STATUS policy_mgr_check_and_set_hw_mode_for_channel_switch( return QDF_STATUS_E_ALREADY; } - if (!WLAN_CHAN_IS_2GHZ(chan)) { + if (wlan_reg_freq_to_band(ch_freq) != REG_BAND_2G) { policy_mgr_err("DBS is not required for 5Ghz chan"); return QDF_STATUS_E_NOSUPPORT; } @@ -2371,7 +2378,7 @@ QDF_STATUS policy_mgr_check_and_set_hw_mode_for_channel_switch( policy_mgr_store_and_del_conn_info_by_vdev_id(psoc, vdev_id, &info, &num_cxn_del); - status = policy_mgr_get_next_action(psoc, vdev_id, chan, + status = policy_mgr_get_next_action(psoc, vdev_id, ch_freq, reason, &next_action); /* Restore the connection entry */ if (num_cxn_del) @@ -2400,8 +2407,8 @@ chk_opportunistic_timer: return status; } -void policy_mgr_checkn_update_hw_mode_single_mac_mode( - struct wlan_objmgr_psoc *psoc, uint8_t channel) +void policy_mgr_checkn_update_hw_mode_single_mac_mode_int( + struct wlan_objmgr_psoc *psoc, uint32_t ch_freq) { uint8_t i; struct policy_mgr_psoc_priv_obj *pm_ctx; @@ -2419,16 +2426,16 @@ void policy_mgr_checkn_update_hw_mode_single_mac_mode( qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); for (i = 0; i < MAX_NUMBER_OF_CONC_CONNECTIONS; i++) { if (pm_conc_connection_list[i].in_use) { - if (!WLAN_REG_IS_SAME_BAND_CHANNELS(channel, - pm_conc_connection_list[i].chan)) { + if (!WLAN_REG_IS_SAME_BAND_FREQS( + ch_freq, pm_conc_connection_list[i].freq)) { qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); policy_mgr_debug("DBS required"); return; } if (policy_mgr_is_hw_dbs_2x2_capable(psoc) && - (WLAN_REG_IS_24GHZ_CH(channel) || - WLAN_REG_IS_24GHZ_CH - (pm_conc_connection_list[i].chan))) { + (WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq) || + WLAN_REG_IS_24GHZ_CH_FREQ + (pm_conc_connection_list[i].freq))) { qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); policy_mgr_debug("DBS required"); return; @@ -2557,11 +2564,11 @@ ret_value: } #ifdef MPC_UT_FRAMEWORK -QDF_STATUS policy_mgr_update_connection_info_utfw( +QDF_STATUS policy_mgr_update_connection_info_utfw_int( struct wlan_objmgr_psoc *psoc, uint32_t vdev_id, uint32_t tx_streams, uint32_t rx_streams, uint32_t chain_mask, uint32_t type, uint32_t sub_type, - uint32_t channelid, uint32_t mac_id) + uint32_t ch_freq, uint32_t mac_id) { QDF_STATUS status = QDF_STATUS_E_FAILURE; uint32_t conn_index = 0, found = 0; @@ -2593,16 +2600,17 @@ QDF_STATUS policy_mgr_update_connection_info_utfw( policy_mgr_update_conc_list(psoc, conn_index, policy_mgr_get_mode(type, sub_type), - channelid, HW_MODE_20_MHZ, + ch_freq, HW_MODE_20_MHZ, mac_id, chain_mask, 0, vdev_id, true, true); return QDF_STATUS_SUCCESS; } -QDF_STATUS policy_mgr_incr_connection_count_utfw(struct wlan_objmgr_psoc *psoc, +QDF_STATUS policy_mgr_incr_connection_count_utfw_int( + struct wlan_objmgr_psoc *psoc, uint32_t vdev_id, uint32_t tx_streams, uint32_t rx_streams, uint32_t chain_mask, uint32_t type, uint32_t sub_type, - uint32_t channelid, uint32_t mac_id) + uint32_t ch_freq, uint32_t mac_id) { QDF_STATUS status = QDF_STATUS_E_FAILURE; uint32_t conn_index = 0; @@ -2624,7 +2632,7 @@ QDF_STATUS policy_mgr_incr_connection_count_utfw(struct wlan_objmgr_psoc *psoc, policy_mgr_update_conc_list(psoc, conn_index, mode, - channelid, HW_MODE_20_MHZ, + ch_freq, HW_MODE_20_MHZ, mac_id, chain_mask, 0, vdev_id, true, update_conn); diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c index a3a0545bdd86..6ab461d43a2e 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c @@ -570,7 +570,7 @@ QDF_STATUS policy_mgr_get_old_and_new_hw_index( * policy_mgr_update_conc_list() - Update the concurrent connection list * @conn_index: Connection index * @mode: Mode - * @chan: Channel + * @ch_freq: channel frequency * @bw: Bandwidth * @mac: Mac id * @chain_mask: Chain mask @@ -586,7 +586,7 @@ QDF_STATUS policy_mgr_get_old_and_new_hw_index( void policy_mgr_update_conc_list(struct wlan_objmgr_psoc *psoc, uint32_t conn_index, enum policy_mgr_con_mode mode, - uint8_t chan, + uint32_t ch_freq, enum hw_mode_bandwidth bw, uint8_t mac, enum policy_mgr_chain_mode chain_mask, @@ -612,7 +612,7 @@ void policy_mgr_update_conc_list(struct wlan_objmgr_psoc *psoc, qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); pm_conc_connection_list[conn_index].mode = mode; - pm_conc_connection_list[conn_index].chan = chan; + pm_conc_connection_list[conn_index].freq = ch_freq; pm_conc_connection_list[conn_index].bw = bw; pm_conc_connection_list[conn_index].mac = mac; pm_conc_connection_list[conn_index].chain_mask = chain_mask; @@ -767,7 +767,7 @@ void policy_mgr_store_and_del_conn_info_by_vdev_id( void policy_mgr_store_and_del_conn_info_by_chan_and_mode( struct wlan_objmgr_psoc *psoc, - uint32_t chan, + uint32_t ch_freq, enum policy_mgr_con_mode mode, struct policy_mgr_conc_connection_info *info, uint8_t *num_cxn_del) @@ -789,7 +789,7 @@ void policy_mgr_store_and_del_conn_info_by_chan_and_mode( } qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); while (PM_CONC_CONNECTION_LIST_VALID_INDEX(conn_index)) { - if (chan != pm_conc_connection_list[conn_index].chan || + if (ch_freq != pm_conc_connection_list[conn_index].freq || mode != pm_conc_connection_list[conn_index].mode) { conn_index++; continue; @@ -799,7 +799,7 @@ void policy_mgr_store_and_del_conn_info_by_chan_and_mode( info[found_index].vdev_id, info[found_index].mode, info[found_index].vdev_id, conn_index, - chan); + ch_freq); found_index++; conn_index++; } @@ -1211,8 +1211,8 @@ static void policy_mgr_dump_dbs_concurrency(struct wlan_objmgr_psoc *psoc, qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); if (pm_conc_connection_list[0].mac == pm_conc_connection_list[1].mac) { - if (pm_conc_connection_list[0].chan == - pm_conc_connection_list[1].chan) + if (pm_conc_connection_list[0].freq == + pm_conc_connection_list[1].freq) strlcat(cc_mode, " with SCC for 1st two connections on mac ", length); @@ -1223,8 +1223,8 @@ static void policy_mgr_dump_dbs_concurrency(struct wlan_objmgr_psoc *psoc, mac = pm_conc_connection_list[0].mac; } if (pm_conc_connection_list[0].mac == pm_conc_connection_list[2].mac) { - if (pm_conc_connection_list[0].chan == - pm_conc_connection_list[2].chan) + if (pm_conc_connection_list[0].freq == + pm_conc_connection_list[2].freq) strlcat(cc_mode, " with SCC for 1st & 3rd connections on mac ", length); @@ -1235,8 +1235,8 @@ static void policy_mgr_dump_dbs_concurrency(struct wlan_objmgr_psoc *psoc, mac = pm_conc_connection_list[0].mac; } if (pm_conc_connection_list[1].mac == pm_conc_connection_list[2].mac) { - if (pm_conc_connection_list[1].chan == - pm_conc_connection_list[2].chan) + if (pm_conc_connection_list[1].freq == + pm_conc_connection_list[2].freq) strlcat(cc_mode, " with SCC for 2nd & 3rd connections on mac ", length); @@ -1284,8 +1284,8 @@ void policy_mgr_dump_current_concurrency(struct wlan_objmgr_psoc *psoc) count = policy_mgr_dump_current_concurrency_two_connection( cc_mode, sizeof(cc_mode)); qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); - if (pm_conc_connection_list[0].chan == - pm_conc_connection_list[1].chan) { + if (pm_conc_connection_list[0].freq == + pm_conc_connection_list[1].freq) { strlcat(cc_mode, " SCC", sizeof(cc_mode)); } else if (pm_conc_connection_list[0].mac == pm_conc_connection_list[1].mac) { @@ -1299,10 +1299,10 @@ void policy_mgr_dump_current_concurrency(struct wlan_objmgr_psoc *psoc) count = policy_mgr_dump_current_concurrency_three_connection( cc_mode, sizeof(cc_mode)); qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); - if ((pm_conc_connection_list[0].chan == - pm_conc_connection_list[1].chan) && - (pm_conc_connection_list[0].chan == - pm_conc_connection_list[2].chan)){ + if (pm_conc_connection_list[0].freq == + pm_conc_connection_list[1].freq && + pm_conc_connection_list[0].freq == + pm_conc_connection_list[2].freq){ qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); strlcat(cc_mode, " SCC", sizeof(cc_mode)); @@ -1361,9 +1361,10 @@ QDF_STATUS policy_mgr_pdev_get_pcl(struct wlan_objmgr_psoc *psoc, policy_mgr_debug("get pcl to set it to the FW"); - status = policy_mgr_get_pcl(psoc, con_mode, - pcl->pcl_list, &pcl->pcl_len, - pcl->weight_list, QDF_ARRAY_SIZE(pcl->weight_list)); + status = policy_mgr_get_pcl_int(psoc, con_mode, + pcl->pcl_list, &pcl->pcl_len, + pcl->weight_list, + QDF_ARRAY_SIZE(pcl->weight_list)); if (status != QDF_STATUS_SUCCESS) policy_mgr_err("Unable to set PCL to FW, Get PCL failed"); @@ -1662,21 +1663,22 @@ enum phy_ch_width policy_mgr_get_ch_width(enum hw_mode_bandwidth bw) * Return: QDF_STATUS */ -static QDF_STATUS policy_mgr_get_sbs_channels(uint8_t *channels, +static QDF_STATUS policy_mgr_get_sbs_channels( + uint32_t *ch_freq_list, uint32_t *len, uint8_t *pcl_weight, uint32_t weight_len, uint32_t *index, enum policy_mgr_pcl_group_id group_id, - uint8_t *available_5g_channels, + uint32_t *available_5g_ch_freqs, uint32_t available_5g_channels_len, bool add_5g_channels) { QDF_STATUS status = QDF_STATUS_SUCCESS; uint32_t conn_index = 0, num_channels = 0; - uint32_t num_5g_channels = 0, cur_5g_channel = 0; - uint8_t remaining_5g_Channels[QDF_MAX_NUM_CHAN] = {}; + uint32_t num_5g_channels = 0, cur_5g_ch_freq = 0; + uint32_t remaining_5g_ch_freqs[QDF_MAX_NUM_CHAN] = {}; uint32_t remaining_channel_index = 0; uint32_t j = 0, i = 0, weight1, weight2; - if ((!channels) || (!len)) { + if (!ch_freq_list || !len) { policy_mgr_err("channels or len is NULL"); status = QDF_STATUS_E_FAILURE; return status; @@ -1697,12 +1699,12 @@ static QDF_STATUS policy_mgr_get_sbs_channels(uint8_t *channels, weight1, weight2, *index); while (PM_CONC_CONNECTION_LIST_VALID_INDEX(conn_index)) { - if ((WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[conn_index].chan)) - && (pm_conc_connection_list[conn_index].in_use)) { + if (WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[conn_index].freq) && + pm_conc_connection_list[conn_index].in_use) { num_5g_channels++; - cur_5g_channel = - pm_conc_connection_list[conn_index].chan; + cur_5g_ch_freq = + pm_conc_connection_list[conn_index].freq; } conn_index++; } @@ -1711,8 +1713,8 @@ static QDF_STATUS policy_mgr_get_sbs_channels(uint8_t *channels, if (num_5g_channels > 1) { /* This case we are already in SBS so return the channels */ while (PM_CONC_CONNECTION_LIST_VALID_INDEX(conn_index)) { - channels[num_channels++] = - pm_conc_connection_list[conn_index++].chan; + ch_freq_list[num_channels++] = + pm_conc_connection_list[conn_index++].freq; if (*index < weight_len) pcl_weight[(*index)++] = weight1; } @@ -1720,22 +1722,22 @@ static QDF_STATUS policy_mgr_get_sbs_channels(uint8_t *channels, /* fix duplicate issue later */ if (add_5g_channels) for (j = 0; j < available_5g_channels_len; j++) - remaining_5g_Channels[ + remaining_5g_ch_freqs[ remaining_channel_index++] = - available_5g_channels[j]; + available_5g_ch_freqs[j]; } else { /* Get list of valid sbs channels for the current * connected channel */ for (j = 0; j < available_5g_channels_len; j++) { - if (WLAN_REG_IS_CHANNEL_VALID_5G_SBS( - cur_5g_channel, available_5g_channels[j])) { - channels[num_channels++] = - available_5g_channels[j]; + if (WLAN_REG_IS_FREQUENCY_VALID_5G_SBS( + cur_5g_ch_freq, available_5g_ch_freqs[j])) { + ch_freq_list[num_channels++] = + available_5g_ch_freqs[j]; } else { - remaining_5g_Channels[ - remaining_channel_index++] = - available_5g_channels[j]; + remaining_5g_ch_freqs[ + remaining_channel_index++] = + available_5g_ch_freqs[j]; continue; } if (*index < weight_len) @@ -1745,8 +1747,8 @@ static QDF_STATUS policy_mgr_get_sbs_channels(uint8_t *channels, } if (add_5g_channels) { - qdf_mem_copy(channels+num_channels, remaining_5g_Channels, - remaining_channel_index); + qdf_mem_copy(ch_freq_list + num_channels, remaining_5g_ch_freqs, + remaining_channel_index * sizeof(*ch_freq_list)); *len += remaining_channel_index; for (i = 0; ((i < remaining_channel_index) && (i < weight_len)); i++) @@ -1756,11 +1758,10 @@ static QDF_STATUS policy_mgr_get_sbs_channels(uint8_t *channels, return status; } - /** * policy_mgr_get_connection_channels() - provides the channel(s) * on which current connection(s) is - * @channels: the channel(s) on which current connection(s) is + * @ch_freq_list: the channel(s) on which current connection(s) is * @len: Number of channels * @order: no order OR 2.4 Ghz channel followed by 5 Ghz * channel OR 5 Ghz channel followed by 2.4 Ghz channel @@ -1778,7 +1779,7 @@ static QDF_STATUS policy_mgr_get_sbs_channels(uint8_t *channels, */ static QDF_STATUS policy_mgr_get_connection_channels(struct wlan_objmgr_psoc *psoc, - uint8_t *channels, + uint32_t *ch_freq_list, uint32_t *len, enum policy_mgr_pcl_channel_order order, bool skip_dfs_channel, uint8_t *pcl_weight, uint32_t weight_len, @@ -1795,7 +1796,7 @@ QDF_STATUS policy_mgr_get_connection_channels(struct wlan_objmgr_psoc *psoc, return status; } - if ((!channels) || (!len)) { + if (!ch_freq_list || !len) { policy_mgr_err("channels or len is NULL"); status = QDF_STATUS_E_FAILURE; return status; @@ -1814,9 +1815,9 @@ QDF_STATUS policy_mgr_get_connection_channels(struct wlan_objmgr_psoc *psoc, * assignments. * * e.g., when order is POLICY_MGR_PCL_ORDER_24G_THEN_5G and group id is - * POLICY_MGR_PCL_GROUP_ID2_ID3, WEIGHT_OF_GROUP2_PCL_CHANNELS is - * assigned to 2.4GHz channels and the weight - * WEIGHT_OF_GROUP3_PCL_CHANNELS is assigned to the 5GHz channels. + * POLICY_MGR_PCL_GROUP_ID2_ID3, WEIGHT_OF_GROUP2_PCL_CHANNELS is + * assigned to 2.4GHz channels and the weight + * WEIGHT_OF_GROUP3_PCL_CHANNELS is assigned to the 5GHz channels. */ if (group_id == POLICY_MGR_PCL_GROUP_ID1_ID2) { weight1 = WEIGHT_OF_GROUP1_PCL_CHANNELS; @@ -1829,12 +1830,14 @@ QDF_STATUS policy_mgr_get_connection_channels(struct wlan_objmgr_psoc *psoc, qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); if (POLICY_MGR_PCL_ORDER_NONE == order) { while (PM_CONC_CONNECTION_LIST_VALID_INDEX(conn_index)) { - if (skip_dfs_channel && wlan_reg_is_dfs_ch(pm_ctx->pdev, - pm_conc_connection_list[conn_index].chan)) { + if (skip_dfs_channel && wlan_reg_is_dfs_for_freq( + pm_ctx->pdev, + pm_conc_connection_list[conn_index].freq)) { conn_index++; } else if (*index < weight_len) { - channels[num_channels++] = - pm_conc_connection_list[conn_index++].chan; + ch_freq_list[num_channels++] = + pm_conc_connection_list[ + conn_index++].freq; pcl_weight[(*index)++] = weight1; } else { conn_index++; @@ -1843,11 +1846,12 @@ QDF_STATUS policy_mgr_get_connection_channels(struct wlan_objmgr_psoc *psoc, *len = num_channels; } else if (POLICY_MGR_PCL_ORDER_24G_THEN_5G == order) { while (PM_CONC_CONNECTION_LIST_VALID_INDEX(conn_index)) { - if (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[conn_index].chan) + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[conn_index].freq) && (*index < weight_len)) { - channels[num_channels++] = - pm_conc_connection_list[conn_index++].chan; + ch_freq_list[num_channels++] = + pm_conc_connection_list[ + conn_index++].freq; pcl_weight[(*index)++] = weight1; } else { conn_index++; @@ -1855,14 +1859,17 @@ QDF_STATUS policy_mgr_get_connection_channels(struct wlan_objmgr_psoc *psoc, } conn_index = 0; while (PM_CONC_CONNECTION_LIST_VALID_INDEX(conn_index)) { - if (skip_dfs_channel && wlan_reg_is_dfs_ch(pm_ctx->pdev, - pm_conc_connection_list[conn_index].chan)) { + if (skip_dfs_channel && + wlan_reg_is_dfs_for_freq( + pm_ctx->pdev, + pm_conc_connection_list[conn_index].freq)) { conn_index++; - } else if (WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[conn_index].chan) - && (*index < weight_len)) { - channels[num_channels++] = - pm_conc_connection_list[conn_index++].chan; + } else if (WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[conn_index].freq) && + (*index < weight_len)) { + ch_freq_list[num_channels++] = + pm_conc_connection_list[ + conn_index++].freq; pcl_weight[(*index)++] = weight2; } else { conn_index++; @@ -1871,14 +1878,17 @@ QDF_STATUS policy_mgr_get_connection_channels(struct wlan_objmgr_psoc *psoc, *len = num_channels; } else if (POLICY_MGR_PCL_ORDER_5G_THEN_2G == order) { while (PM_CONC_CONNECTION_LIST_VALID_INDEX(conn_index)) { - if (skip_dfs_channel && wlan_reg_is_dfs_ch(pm_ctx->pdev, - pm_conc_connection_list[conn_index].chan)) { + if (skip_dfs_channel && + wlan_reg_is_dfs_for_freq( + pm_ctx->pdev, + pm_conc_connection_list[conn_index].freq)) { conn_index++; - } else if (WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[conn_index].chan) - && (*index < weight_len)) { - channels[num_channels++] = - pm_conc_connection_list[conn_index++].chan; + } else if (WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[conn_index].freq) && + (*index < weight_len)) { + ch_freq_list[num_channels++] = + pm_conc_connection_list[ + conn_index++].freq; pcl_weight[(*index)++] = weight1; } else { conn_index++; @@ -1886,11 +1896,12 @@ QDF_STATUS policy_mgr_get_connection_channels(struct wlan_objmgr_psoc *psoc, } conn_index = 0; while (PM_CONC_CONNECTION_LIST_VALID_INDEX(conn_index)) { - if (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[conn_index].chan) - && (*index < weight_len)) { - channels[num_channels++] = - pm_conc_connection_list[conn_index++].chan; + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[conn_index].freq) && + (*index < weight_len)) { + ch_freq_list[num_channels++] = + pm_conc_connection_list[ + conn_index++].freq; pcl_weight[(*index)++] = weight2; } else { @@ -1920,7 +1931,7 @@ QDF_STATUS policy_mgr_get_connection_channels(struct wlan_objmgr_psoc *psoc, * Return: None */ void policy_mgr_set_weight_of_dfs_passive_channels_to_zero( - struct wlan_objmgr_psoc *psoc, uint8_t *pcl_channels, + struct wlan_objmgr_psoc *psoc, uint32_t *pcl_channels, uint32_t *len, uint8_t *weight_list, uint32_t weight_len) { uint8_t i; @@ -1956,15 +1967,15 @@ void policy_mgr_set_weight_of_dfs_passive_channels_to_zero( policy_mgr_debug("Set weight of DFS/passive channels to 0"); for (i = 0; i < orig_channel_count; i++) { - channel_state = wlan_reg_get_channel_state(pm_ctx->pdev, - pcl_channels[i]); + channel_state = wlan_reg_get_channel_state_for_freq( + pm_ctx->pdev, pcl_channels[i]); if ((channel_state == CHANNEL_STATE_DISABLE) || (channel_state == CHANNEL_STATE_INVALID)) /* Set weight of inactive channels to 0 */ weight_list[i] = 0; - policy_mgr_debug("chan[%d] - %d, weight[%d] - %d", - i, pcl_channels[i], i, weight_list[i]); + policy_mgr_debug("ch freq: [%d] - %d, weight[%d] - %d", + i, pcl_channels[i], i, weight_list[i]); } return; @@ -1988,7 +1999,7 @@ void policy_mgr_set_weight_of_dfs_passive_channels_to_zero( */ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, enum policy_mgr_pcl_type pcl, - uint8_t *pcl_channels, uint32_t *len, + uint32_t *pcl_channels, uint32_t *len, enum policy_mgr_con_mode mode, uint8_t *pcl_weights, uint32_t weight_len) { @@ -1996,15 +2007,13 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, uint32_t num_channels = 0; uint32_t sbs_num_channels = 0; uint32_t chan_index = 0, chan_index_24 = 0, chan_index_5 = 0; - uint8_t channel_list[QDF_MAX_NUM_CHAN] = {0}; - uint8_t channel_list_24[QDF_MAX_NUM_CHAN] = {0}; - uint8_t channel_list_5[QDF_MAX_NUM_CHAN] = {0}; - uint8_t sbs_channel_list[QDF_MAX_NUM_CHAN] = {0}; bool skip_dfs_channel = false; bool is_etsi13_srd_chan_allowed_in_mas_mode = true; uint32_t i = 0, j = 0; struct policy_mgr_psoc_priv_obj *pm_ctx; bool sta_sap_scc_on_dfs_chan; + uint32_t *channel_list, *channel_list_24, *channel_list_5, + *sbs_channel_list; pm_ctx = policy_mgr_get_context(psoc); if (!pm_ctx) { @@ -2029,11 +2038,23 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, policy_mgr_debug("pcl is 0"); return QDF_STATUS_SUCCESS; } + + channel_list = qdf_mem_malloc(QDF_MAX_NUM_CHAN * sizeof(uint32_t)); + channel_list_24 = qdf_mem_malloc(QDF_MAX_NUM_CHAN * sizeof(uint32_t)); + channel_list_5 = qdf_mem_malloc(QDF_MAX_NUM_CHAN * sizeof(uint32_t)); + sbs_channel_list = qdf_mem_malloc(QDF_MAX_NUM_CHAN * sizeof(uint32_t)); + if (!channel_list || !channel_list_24 || !channel_list_5 || + !sbs_channel_list) { + status = QDF_STATUS_E_NOMEM; + goto end; + } + /* get the channel list for current domain */ - status = policy_mgr_get_valid_chans(psoc, channel_list, &num_channels); + status = policy_mgr_get_valid_chans_int(psoc, channel_list, + &num_channels); if (QDF_IS_STATUS_ERROR(status)) { policy_mgr_err("Error in getting valid channels"); - return status; + goto end; } /* @@ -2057,39 +2078,42 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, } /* Let's divide the list in 2.4 & 5 Ghz lists */ - while ((chan_index < QDF_MAX_NUM_CHAN) && - (channel_list[chan_index] <= 11) && - (chan_index_24 < QDF_MAX_NUM_CHAN)) + while ((chan_index < QDF_MAX_NUM_CHAN) && (channel_list[chan_index] <= + wlan_reg_chan_to_freq(pm_ctx->pdev, 11)) && + (chan_index_24 < QDF_MAX_NUM_CHAN)) channel_list_24[chan_index_24++] = channel_list[chan_index++]; - if ((chan_index < QDF_MAX_NUM_CHAN) && - (channel_list[chan_index] == 12) && - (chan_index_24 < QDF_MAX_NUM_CHAN)) { + + if (chan_index < QDF_MAX_NUM_CHAN && channel_list[chan_index] == + wlan_reg_chan_to_freq(pm_ctx->pdev, 12) && + chan_index_24 < QDF_MAX_NUM_CHAN) { channel_list_24[chan_index_24++] = channel_list[chan_index++]; if ((chan_index < QDF_MAX_NUM_CHAN) && - (channel_list[chan_index] == 13) && + (channel_list[chan_index] == + wlan_reg_chan_to_freq(pm_ctx->pdev, 13)) && (chan_index_24 < QDF_MAX_NUM_CHAN)) { channel_list_24[chan_index_24++] = channel_list[chan_index++]; if ((chan_index < QDF_MAX_NUM_CHAN) && - (channel_list[chan_index] == 14) && + (channel_list[chan_index] == + wlan_reg_chan_to_freq(pm_ctx->pdev, 14)) && (chan_index_24 < QDF_MAX_NUM_CHAN)) channel_list_24[chan_index_24++] = channel_list[chan_index++]; } } - while ((chan_index < num_channels) && - (chan_index < QDF_MAX_NUM_CHAN) && - (chan_index_5 < QDF_MAX_NUM_CHAN)) { + while (chan_index < num_channels && + chan_index < QDF_MAX_NUM_CHAN && + chan_index_5 < QDF_MAX_NUM_CHAN) { if ((true == skip_dfs_channel) && - wlan_reg_is_dfs_ch(pm_ctx->pdev, - channel_list[chan_index])) { + wlan_reg_is_dfs_for_freq(pm_ctx->pdev, + channel_list[chan_index])) { chan_index++; continue; } if (!is_etsi13_srd_chan_allowed_in_mas_mode && - wlan_reg_is_etsi13_srd_chan(pm_ctx->pdev, - channel_list[chan_index])) { + wlan_reg_is_etsi13_srd_chan_for_freq( + pm_ctx->pdev, channel_list[chan_index])) { chan_index++; continue; } @@ -2137,7 +2161,7 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, case PM_24G: chan_index_24 = QDF_MIN(chan_index_24, weight_len); qdf_mem_copy(pcl_channels, channel_list_24, - chan_index_24); + chan_index_24 * sizeof(*pcl_channels)); *len = chan_index_24; for (i = 0; i < *len; i++) pcl_weights[i] = WEIGHT_OF_GROUP1_PCL_CHANNELS; @@ -2146,7 +2170,7 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, case PM_5G: chan_index_5 = QDF_MIN(chan_index_5, weight_len); qdf_mem_copy(pcl_channels, channel_list_5, - chan_index_5); + chan_index_5 * sizeof(*pcl_channels)); *len = chan_index_5; for (i = 0; i < *len; i++) pcl_weights[i] = WEIGHT_OF_GROUP1_PCL_CHANNELS; @@ -2158,7 +2182,8 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, channel_list, &num_channels, POLICY_MGR_PCL_ORDER_NONE, skip_dfs_channel, pcl_weights, weight_len, &i, POLICY_MGR_PCL_GROUP_ID1_ID2); - qdf_mem_copy(pcl_channels, channel_list, num_channels); + qdf_mem_copy(pcl_channels, channel_list, + num_channels * sizeof(*pcl_channels)); *len = num_channels; status = QDF_STATUS_SUCCESS; break; @@ -2168,12 +2193,13 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, channel_list, &num_channels, POLICY_MGR_PCL_ORDER_NONE, skip_dfs_channel, pcl_weights, weight_len, &i, POLICY_MGR_PCL_GROUP_ID1_ID2); - qdf_mem_copy(pcl_channels, channel_list, num_channels); + qdf_mem_copy(pcl_channels, channel_list, + num_channels * sizeof(*pcl_channels)); *len = num_channels; chan_index_24 = QDF_MIN((num_channels + chan_index_24), weight_len) - num_channels; - qdf_mem_copy(&pcl_channels[num_channels], - channel_list_24, chan_index_24); + qdf_mem_copy(&pcl_channels[num_channels], channel_list_24, + chan_index_24 * sizeof(*pcl_channels)); *len += chan_index_24; for (j = 0; j < chan_index_24; i++, j++) pcl_weights[i] = WEIGHT_OF_GROUP2_PCL_CHANNELS; @@ -2187,12 +2213,12 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, skip_dfs_channel, pcl_weights, weight_len, &i, POLICY_MGR_PCL_GROUP_ID1_ID2); qdf_mem_copy(pcl_channels, channel_list, - num_channels); + num_channels * sizeof(*pcl_channels)); *len = num_channels; chan_index_5 = QDF_MIN((num_channels + chan_index_5), weight_len) - num_channels; - qdf_mem_copy(&pcl_channels[num_channels], - channel_list_5, chan_index_5); + qdf_mem_copy(&pcl_channels[num_channels], channel_list_5, + chan_index_5 * sizeof(*pcl_channels)); *len += chan_index_5; for (j = 0; j < chan_index_5; i++, j++) pcl_weights[i] = WEIGHT_OF_GROUP2_PCL_CHANNELS; @@ -2202,7 +2228,7 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, case PM_24G_MCC_CH: chan_index_24 = QDF_MIN(chan_index_24, weight_len); qdf_mem_copy(pcl_channels, channel_list_24, - chan_index_24); + chan_index_24 * sizeof(*pcl_channels)); *len = chan_index_24; for (i = 0; i < chan_index_24; i++) pcl_weights[i] = WEIGHT_OF_GROUP1_PCL_CHANNELS; @@ -2210,8 +2236,8 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, channel_list, &num_channels, POLICY_MGR_PCL_ORDER_NONE, skip_dfs_channel, pcl_weights, weight_len, &i, POLICY_MGR_PCL_GROUP_ID2_ID3); - qdf_mem_copy(&pcl_channels[chan_index_24], - channel_list, num_channels); + qdf_mem_copy(&pcl_channels[chan_index_24], channel_list, + num_channels * sizeof(*pcl_channels)); *len += num_channels; status = QDF_STATUS_SUCCESS; break; @@ -2219,7 +2245,7 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, case PM_5G_MCC_CH: chan_index_5 = QDF_MIN(chan_index_5, weight_len); qdf_mem_copy(pcl_channels, channel_list_5, - chan_index_5); + chan_index_5 * sizeof(*pcl_channels)); *len = chan_index_5; for (i = 0; i < chan_index_5; i++) pcl_weights[i] = WEIGHT_OF_GROUP1_PCL_CHANNELS; @@ -2227,8 +2253,8 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, channel_list, &num_channels, POLICY_MGR_PCL_ORDER_NONE, skip_dfs_channel, pcl_weights, weight_len, &i, POLICY_MGR_PCL_GROUP_ID2_ID3); - qdf_mem_copy(&pcl_channels[chan_index_5], - channel_list, num_channels); + qdf_mem_copy(&pcl_channels[chan_index_5], channel_list, + num_channels * sizeof(*pcl_channels)); *len += num_channels; status = QDF_STATUS_SUCCESS; break; @@ -2239,7 +2265,7 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, skip_dfs_channel, pcl_weights, weight_len, &i, POLICY_MGR_PCL_GROUP_ID1_ID2); qdf_mem_copy(pcl_channels, channel_list, - num_channels); + num_channels * sizeof(*pcl_channels)); *len = num_channels; status = QDF_STATUS_SUCCESS; break; @@ -2249,7 +2275,8 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, POLICY_MGR_PCL_ORDER_5G_THEN_2G, skip_dfs_channel, pcl_weights, weight_len, &i, POLICY_MGR_PCL_GROUP_ID1_ID2); - qdf_mem_copy(pcl_channels, channel_list, num_channels); + qdf_mem_copy(pcl_channels, channel_list, + num_channels * sizeof(*pcl_channels)); *len = num_channels; status = QDF_STATUS_SUCCESS; break; @@ -2259,12 +2286,13 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, POLICY_MGR_PCL_ORDER_24G_THEN_5G, skip_dfs_channel, pcl_weights, weight_len, &i, POLICY_MGR_PCL_GROUP_ID1_ID2); - qdf_mem_copy(pcl_channels, channel_list, num_channels); + qdf_mem_copy(pcl_channels, channel_list, + num_channels * sizeof(*pcl_channels)); *len = num_channels; chan_index_24 = QDF_MIN((num_channels + chan_index_24), weight_len) - num_channels; - qdf_mem_copy(&pcl_channels[num_channels], - channel_list_24, chan_index_24); + qdf_mem_copy(&pcl_channels[num_channels], channel_list_24, + chan_index_24 * sizeof(*pcl_channels)); *len += chan_index_24; for (j = 0; j < chan_index_24; i++, j++) pcl_weights[i] = WEIGHT_OF_GROUP3_PCL_CHANNELS; @@ -2276,12 +2304,13 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, POLICY_MGR_PCL_ORDER_24G_THEN_5G, skip_dfs_channel, pcl_weights, weight_len, &i, POLICY_MGR_PCL_GROUP_ID1_ID2); - qdf_mem_copy(pcl_channels, channel_list, num_channels); + qdf_mem_copy(pcl_channels, channel_list, + num_channels * sizeof(*pcl_channels)); *len = num_channels; chan_index_5 = QDF_MIN((num_channels + chan_index_5), weight_len) - num_channels; - qdf_mem_copy(&pcl_channels[num_channels], - channel_list_5, chan_index_5); + qdf_mem_copy(&pcl_channels[num_channels], channel_list_5, + chan_index_5 * sizeof(*pcl_channels)); *len += chan_index_5; for (j = 0; j < chan_index_5; i++, j++) pcl_weights[i] = WEIGHT_OF_GROUP3_PCL_CHANNELS; @@ -2293,12 +2322,13 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, POLICY_MGR_PCL_ORDER_5G_THEN_2G, skip_dfs_channel, pcl_weights, weight_len, &i, POLICY_MGR_PCL_GROUP_ID1_ID2); - qdf_mem_copy(pcl_channels, channel_list, num_channels); + qdf_mem_copy(pcl_channels, channel_list, + num_channels * sizeof(*pcl_channels)); *len = num_channels; chan_index_24 = QDF_MIN((num_channels + chan_index_24), weight_len) - num_channels; - qdf_mem_copy(&pcl_channels[num_channels], - channel_list_24, chan_index_24); + qdf_mem_copy(&pcl_channels[num_channels], channel_list_24, + chan_index_24 * sizeof(*pcl_channels)); *len += chan_index_24; for (j = 0; j < chan_index_24; i++, j++) pcl_weights[i] = WEIGHT_OF_GROUP3_PCL_CHANNELS; @@ -2310,12 +2340,13 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, POLICY_MGR_PCL_ORDER_5G_THEN_2G, skip_dfs_channel, pcl_weights, weight_len, &i, POLICY_MGR_PCL_GROUP_ID1_ID2); - qdf_mem_copy(pcl_channels, channel_list, num_channels); + qdf_mem_copy(pcl_channels, channel_list, + num_channels * sizeof(*pcl_channels)); *len = num_channels; chan_index_5 = QDF_MIN((num_channels + chan_index_5), weight_len) - num_channels; - qdf_mem_copy(&pcl_channels[num_channels], - channel_list_5, chan_index_5); + qdf_mem_copy(&pcl_channels[num_channels], channel_list_5, + chan_index_5 * sizeof(*pcl_channels)); *len += chan_index_5; for (j = 0; j < chan_index_5; i++, j++) pcl_weights[i] = WEIGHT_OF_GROUP3_PCL_CHANNELS; @@ -2323,7 +2354,7 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, break; case PM_24G_SCC_CH_SBS_CH: qdf_mem_copy(pcl_channels, channel_list_24, - chan_index_24); + chan_index_24 * sizeof(*pcl_channels)); *len = chan_index_24; for (i = 0; ((i < chan_index_24) && (i < weight_len)); i++) pcl_weights[i] = WEIGHT_OF_GROUP1_PCL_CHANNELS; @@ -2331,8 +2362,8 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, channel_list, &num_channels, POLICY_MGR_PCL_ORDER_NONE, skip_dfs_channel, pcl_weights, weight_len, &i, POLICY_MGR_PCL_GROUP_ID2_ID3); - qdf_mem_copy(&pcl_channels[chan_index_24], - channel_list, num_channels); + qdf_mem_copy(&pcl_channels[chan_index_24], channel_list, + num_channels * sizeof(*pcl_channels)); *len += num_channels; if (policy_mgr_is_hw_sbs_capable(psoc)) { policy_mgr_get_sbs_channels( @@ -2341,14 +2372,15 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, channel_list_5, chan_index_5, false); qdf_mem_copy( &pcl_channels[chan_index_24 + num_channels], - sbs_channel_list, sbs_num_channels); + sbs_channel_list, + sbs_num_channels * sizeof(*pcl_channels)); *len += sbs_num_channels; } status = QDF_STATUS_SUCCESS; break; case PM_24G_SCC_CH_SBS_CH_5G: qdf_mem_copy(pcl_channels, channel_list_24, - chan_index_24); + chan_index_24 * sizeof(*pcl_channels)); *len = chan_index_24; for (i = 0; ((i < chan_index_24) && (i < weight_len)); i++) pcl_weights[i] = WEIGHT_OF_GROUP1_PCL_CHANNELS; @@ -2356,8 +2388,8 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, channel_list, &num_channels, POLICY_MGR_PCL_ORDER_NONE, skip_dfs_channel, pcl_weights, weight_len, &i, POLICY_MGR_PCL_GROUP_ID2_ID3); - qdf_mem_copy(&pcl_channels[chan_index_24], - channel_list, num_channels); + qdf_mem_copy(&pcl_channels[chan_index_24], channel_list, + num_channels * sizeof(*pcl_channels)); *len += num_channels; if (policy_mgr_is_hw_sbs_capable(psoc)) { policy_mgr_get_sbs_channels( @@ -2366,12 +2398,14 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, channel_list_5, chan_index_5, true); qdf_mem_copy( &pcl_channels[chan_index_24 + num_channels], - sbs_channel_list, sbs_num_channels); + sbs_channel_list, + sbs_num_channels * sizeof(*pcl_channels)); *len += sbs_num_channels; } else { qdf_mem_copy( &pcl_channels[chan_index_24 + num_channels], - channel_list_5, chan_index_5); + channel_list_5, + chan_index_5 * sizeof(*pcl_channels)); *len += chan_index_5; for (i = chan_index_24 + num_channels; ((i < *len) && (i < weight_len)); i++) @@ -2381,7 +2415,7 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, break; case PM_24G_SBS_CH_MCC_CH: qdf_mem_copy(pcl_channels, channel_list_24, - chan_index_24); + chan_index_24 * sizeof(*pcl_channels)); *len = chan_index_24; for (i = 0; ((i < chan_index_24) && (i < weight_len)); i++) pcl_weights[i] = WEIGHT_OF_GROUP1_PCL_CHANNELS; @@ -2391,15 +2425,16 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, weight_len, &i, POLICY_MGR_PCL_GROUP_ID2_ID3, channel_list_5, chan_index_5, false); qdf_mem_copy(&pcl_channels[num_channels], - sbs_channel_list, sbs_num_channels); + sbs_channel_list, + sbs_num_channels * sizeof(*pcl_channels)); *len += sbs_num_channels; } policy_mgr_get_connection_channels(psoc, channel_list, &num_channels, POLICY_MGR_PCL_ORDER_NONE, skip_dfs_channel, pcl_weights, weight_len, &i, POLICY_MGR_PCL_GROUP_ID2_ID3); - qdf_mem_copy(&pcl_channels[chan_index_24], - channel_list, num_channels); + qdf_mem_copy(&pcl_channels[chan_index_24], channel_list, + num_channels * sizeof(*pcl_channels)); *len += num_channels; status = QDF_STATUS_SUCCESS; break; @@ -2410,11 +2445,12 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, weight_len, &i, POLICY_MGR_PCL_GROUP_ID1_ID2, channel_list_5, chan_index_5, true); qdf_mem_copy(&pcl_channels[num_channels], - sbs_channel_list, sbs_num_channels); + sbs_channel_list, + sbs_num_channels * sizeof(*pcl_channels)); *len += sbs_num_channels; } else { qdf_mem_copy(pcl_channels, channel_list_5, - chan_index_5); + chan_index_5 * sizeof(*pcl_channels)); *len = chan_index_5; for (i = 0; ((i < *len) && (i < weight_len)); i++) pcl_weights[i] = WEIGHT_OF_GROUP1_PCL_CHANNELS; @@ -2428,32 +2464,26 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, if ((*len != 0) && (*len != i)) policy_mgr_debug("pcl len (%d) and weight list len mismatch (%d)", - *len, i); + *len, i); /* check the channel avoidance list for beaconing entities */ if ((mode == PM_SAP_MODE) || (mode == PM_P2P_GO_MODE)) - policy_mgr_update_with_safe_channel_list(psoc, pcl_channels, - len, pcl_weights, - weight_len); + policy_mgr_update_with_safe_channel_list_int(psoc, pcl_channels, + len, pcl_weights, + weight_len); policy_mgr_set_weight_of_dfs_passive_channels_to_zero(psoc, pcl_channels, len, pcl_weights, weight_len); +end: + qdf_mem_free(channel_list); + qdf_mem_free(channel_list_24); + qdf_mem_free(channel_list_5); + qdf_mem_free(sbs_channel_list); return status; } -/** - * policy_mgr_disallow_mcc() - Check for mcc - * - * @channel: channel on which new connection is coming up - * - * When a new connection is about to come up check if current - * concurrency combination including the new connection is - * causing MCC - * - * Return: True/False - */ -bool policy_mgr_disallow_mcc(struct wlan_objmgr_psoc *psoc, - uint8_t channel) +bool policy_mgr_disallow_mcc_int(struct wlan_objmgr_psoc *psoc, + uint32_t ch_freq) { uint32_t index = 0; bool match = false; @@ -2467,14 +2497,13 @@ bool policy_mgr_disallow_mcc(struct wlan_objmgr_psoc *psoc, qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); while (PM_CONC_CONNECTION_LIST_VALID_INDEX(index)) { if (policy_mgr_is_hw_dbs_capable(psoc) == false) { - if (pm_conc_connection_list[index].chan != - channel) { + if (pm_conc_connection_list[index].freq != ch_freq) { match = true; break; } - } else if (WLAN_REG_IS_5GHZ_CH - (pm_conc_connection_list[index].chan)) { - if (pm_conc_connection_list[index].chan != channel) { + } else if (WLAN_REG_IS_5GHZ_CH_FREQ + (pm_conc_connection_list[index].freq)) { + if (pm_conc_connection_list[index].freq != ch_freq) { match = true; break; } @@ -2533,7 +2562,7 @@ static bool policy_mgr_is_multi_ap_plus_sta_3vif_conc( */ bool policy_mgr_allow_new_home_channel( struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode, - uint8_t channel, uint32_t num_connections) + uint32_t ch_freq, uint32_t num_connections) { bool status = true; struct policy_mgr_psoc_priv_obj *pm_ctx; @@ -2551,27 +2580,26 @@ bool policy_mgr_allow_new_home_channel( if (num_connections == 2) { /* No SCC or MCC combination is allowed with / on DFS channel */ if ((mcc_to_scc_switch == - QDF_MCC_TO_SCC_SWITCH_FORCE_PREFERRED_WITHOUT_DISCONNECTION) - && wlan_reg_is_dfs_ch(pm_ctx->pdev, channel) && - (wlan_reg_is_dfs_ch(pm_ctx->pdev, - pm_conc_connection_list[0].chan) || - wlan_reg_is_dfs_ch(pm_ctx->pdev, - pm_conc_connection_list[1].chan))) { - + QDF_MCC_TO_SCC_SWITCH_FORCE_PREFERRED_WITHOUT_DISCONNECTION) && + wlan_reg_is_dfs_for_freq(pm_ctx->pdev, ch_freq) && + (wlan_reg_is_dfs_for_freq(pm_ctx->pdev, + pm_conc_connection_list[0].freq) || + wlan_reg_is_dfs_for_freq(pm_ctx->pdev, + pm_conc_connection_list[1].freq))) { policy_mgr_err("Existing DFS connection, new 3-port DFS connection is not allowed"); status = false; - } else if (((pm_conc_connection_list[0].chan != - pm_conc_connection_list[1].chan) + } else if (((pm_conc_connection_list[0].freq != + pm_conc_connection_list[1].freq) || (mcc_to_scc_switch == QDF_MCC_TO_SCC_SWITCH_FORCE_PREFERRED_WITHOUT_DISCONNECTION) ) && (pm_conc_connection_list[0].mac == pm_conc_connection_list[1].mac)) { if (policy_mgr_is_hw_dbs_capable(psoc) == false) { - if ((channel != - pm_conc_connection_list[0].chan) && - (channel != - pm_conc_connection_list[1].chan)) { + if (ch_freq != + pm_conc_connection_list[0].freq && + ch_freq != + pm_conc_connection_list[1].freq) { policy_mgr_err("don't allow 3rd home channel on same MAC"); status = false; } @@ -2590,18 +2618,18 @@ bool policy_mgr_allow_new_home_channel( * same MAC is possible. */ status = true; - } else if (((WLAN_REG_IS_24GHZ_CH(channel)) && - (WLAN_REG_IS_24GHZ_CH - (pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_24GHZ_CH - (pm_conc_connection_list[1].chan))) || - ((WLAN_REG_IS_5GHZ_CH(channel)) && - (WLAN_REG_IS_5GHZ_CH - (pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_5GHZ_CH - (pm_conc_connection_list[1].chan)))) { - policy_mgr_err("don't allow 3rd home channel on same MAC"); - status = false; + } else if (((WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq)) && + (WLAN_REG_IS_24GHZ_CH_FREQ + (pm_conc_connection_list[0].freq)) && + (WLAN_REG_IS_24GHZ_CH_FREQ + (pm_conc_connection_list[1].freq))) || + ((WLAN_REG_IS_5GHZ_CH_FREQ(ch_freq)) && + (WLAN_REG_IS_5GHZ_CH_FREQ + (pm_conc_connection_list[0].freq)) && + (WLAN_REG_IS_5GHZ_CH_FREQ + (pm_conc_connection_list[1].freq)))) { + policy_mgr_err("don't allow 3rd home channel on same MAC"); + status = false; } } else if (pm_conc_connection_list[0].mac == pm_conc_connection_list[1].mac) { @@ -2609,7 +2637,7 @@ bool policy_mgr_allow_new_home_channel( if (policy_mgr_is_hw_dbs_capable(psoc) == false) { /* keep legacy chip "allow" as it is */ policy_mgr_debug("allow 2 intf SCC + new intf ch %d for legacy hw", - channel); + ch_freq); } else if ((pm_conc_connection_list[0].mode == PM_NAN_DISC_MODE && pm_conc_connection_list[1].mode == @@ -2625,7 +2653,7 @@ bool policy_mgr_allow_new_home_channel( * same MAC is possible. */ } else if (wlan_reg_is_same_band_channels( - channel, pm_conc_connection_list[0].chan) && + ch_freq, pm_conc_connection_list[0].freq) && policy_mgr_is_multi_ap_plus_sta_3vif_conc( pm_conc_connection_list[0].mode, pm_conc_connection_list[1].mode, @@ -2634,12 +2662,12 @@ bool policy_mgr_allow_new_home_channel( status = false; } } - } else if ((num_connections == 1) - && (mcc_to_scc_switch == - QDF_MCC_TO_SCC_SWITCH_FORCE_PREFERRED_WITHOUT_DISCONNECTION) - && wlan_reg_is_dfs_ch(pm_ctx->pdev, channel) - && wlan_reg_is_dfs_ch(pm_ctx->pdev, - pm_conc_connection_list[0].chan)) { + } else if ((num_connections == 1) && + (mcc_to_scc_switch == + QDF_MCC_TO_SCC_SWITCH_FORCE_PREFERRED_WITHOUT_DISCONNECTION) && + wlan_reg_is_dfs_for_freq(pm_ctx->pdev, ch_freq) && + wlan_reg_is_dfs_for_freq(pm_ctx->pdev, + pm_conc_connection_list[0].freq)) { policy_mgr_err("Existing DFS connection, new 2-port DFS connection is not allowed"); status = false; @@ -2649,22 +2677,8 @@ bool policy_mgr_allow_new_home_channel( return status; } -/** - * policy_mgr_is_5g_channel_allowed() - check if 5g channel is allowed - * @channel: channel number which needs to be validated - * @list: list of existing connections. - * @mode: mode against which channel needs to be validated - * - * This API takes the channel as input and compares with existing - * connection channels. If existing connection's channel is DFS channel - * and provided channel is 5G channel then don't allow concurrency to - * happen as MCC with DFS channel is not yet supported - * - * Return: true if 5G channel is allowed, false if not allowed - * - */ bool policy_mgr_is_5g_channel_allowed(struct wlan_objmgr_psoc *psoc, - uint8_t channel, uint32_t *list, + uint32_t ch_freq, uint32_t *list, enum policy_mgr_con_mode mode) { uint32_t index = 0, count = 0; @@ -2679,11 +2693,11 @@ bool policy_mgr_is_5g_channel_allowed(struct wlan_objmgr_psoc *psoc, count = policy_mgr_mode_specific_connection_count(psoc, mode, list); qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); while (index < count) { - if (wlan_reg_is_dfs_ch( + if (wlan_reg_is_dfs_for_freq( pm_ctx->pdev, - pm_conc_connection_list[list[index]].chan) && - WLAN_REG_IS_5GHZ_CH(channel) && - (channel != pm_conc_connection_list[list[index]].chan)) { + pm_conc_connection_list[list[index]].freq) && + WLAN_REG_IS_5GHZ_CH_FREQ(ch_freq) && + (ch_freq != pm_conc_connection_list[list[index]].freq)) { qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); policy_mgr_err("don't allow MCC if SAP/GO on DFS channel"); return false; @@ -2761,9 +2775,8 @@ QDF_STATUS policy_mgr_nss_update(struct wlan_objmgr_psoc *psoc, uint32_t list[MAX_NUMBER_OF_CONC_CONNECTIONS]; uint32_t conn_index = 0; uint32_t vdev_id; - uint32_t original_nss; + uint32_t original_nss, ch_freq; struct policy_mgr_psoc_priv_obj *pm_ctx; - uint8_t chan; pm_ctx = policy_mgr_get_context(psoc); if (!pm_ctx) { @@ -2778,7 +2791,7 @@ QDF_STATUS policy_mgr_nss_update(struct wlan_objmgr_psoc *psoc, vdev_id = pm_conc_connection_list[list[index]].vdev_id; original_nss = pm_conc_connection_list[list[index]].original_nss; - chan = pm_conc_connection_list[list[index]].chan; + ch_freq = pm_conc_connection_list[list[index]].freq; qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); conn_index = policy_mgr_get_connection_for_vdev_id( psoc, vdev_id); @@ -2791,9 +2804,9 @@ QDF_STATUS policy_mgr_nss_update(struct wlan_objmgr_psoc *psoc, if (original_nss == 2 && (band == POLICY_MGR_ANY || (band == POLICY_MGR_BAND_24 && - WLAN_REG_IS_24GHZ_CH(chan)) || + WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq)) || (band == POLICY_MGR_BAND_5 && - WLAN_REG_IS_5GHZ_CH(chan)))) { + WLAN_REG_IS_5GHZ_CH_FREQ(ch_freq)))) { status = pm_ctx->sme_cbacks.sme_nss_update_request( vdev_id, new_nss, policy_mgr_nss_update_cb, @@ -2813,7 +2826,7 @@ QDF_STATUS policy_mgr_nss_update(struct wlan_objmgr_psoc *psoc, vdev_id = pm_conc_connection_list[list[index]].vdev_id; original_nss = pm_conc_connection_list[list[index]].original_nss; - chan = pm_conc_connection_list[list[index]].chan; + ch_freq = pm_conc_connection_list[list[index]].freq; qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); conn_index = policy_mgr_get_connection_for_vdev_id( psoc, vdev_id); @@ -2825,9 +2838,9 @@ QDF_STATUS policy_mgr_nss_update(struct wlan_objmgr_psoc *psoc, if (original_nss == 2 && (band == POLICY_MGR_ANY || (band == POLICY_MGR_BAND_24 && - WLAN_REG_IS_24GHZ_CH(chan)) || + WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq)) || (band == POLICY_MGR_BAND_5 && - WLAN_REG_IS_5GHZ_CH(chan)))) { + WLAN_REG_IS_5GHZ_CH_FREQ(ch_freq)))) { status = pm_ctx->sme_cbacks.sme_nss_update_request( vdev_id, new_nss, policy_mgr_nss_update_cb, @@ -2971,9 +2984,9 @@ enum policy_mgr_conc_next_action num_connections = policy_mgr_get_connection_count(psoc); policy_mgr_debug("chan[0]:%d chan[1]:%d chan[2]:%d num_connections:%d dbs:%d", - pm_conc_connection_list[0].chan, - pm_conc_connection_list[1].chan, - pm_conc_connection_list[2].chan, num_connections, + pm_conc_connection_list[0].freq, + pm_conc_connection_list[1].freq, + pm_conc_connection_list[2].freq, num_connections, hw_mode.dbs_cap); /* If the band of operation of both the MACs is the same, @@ -2981,25 +2994,23 @@ enum policy_mgr_conc_next_action */ switch (num_connections) { case 1: - band1 = wlan_reg_chan_to_band(pm_conc_connection_list[0].chan); - if (band1 == BAND_2G) + band1 = wlan_reg_freq_to_band(pm_conc_connection_list[0].freq); + if (band1 == REG_BAND_2G) return PM_DBS; else return PM_NOP; case 2: - band1 = wlan_reg_chan_to_band(pm_conc_connection_list[0].chan); - band2 = wlan_reg_chan_to_band(pm_conc_connection_list[1].chan); - if ((band1 == BAND_2G) || - (band2 == BAND_2G)) { + band1 = wlan_reg_freq_to_band(pm_conc_connection_list[0].freq); + band2 = wlan_reg_freq_to_band(pm_conc_connection_list[1].freq); + if (band1 == REG_BAND_2G || band2 == REG_BAND_2G) { if (!hw_mode.dbs_cap) return PM_DBS; else return PM_NOP; - } else if ((band1 == BAND_5G) && - (band2 == BAND_5G)) { - if (WLAN_REG_IS_CHANNEL_VALID_5G_SBS( - pm_conc_connection_list[0].chan, - pm_conc_connection_list[1].chan)) { + } else if (band1 == REG_BAND_5G && band2 == REG_BAND_5G) { + if (WLAN_REG_IS_FREQUENCY_VALID_5G_SBS( + pm_conc_connection_list[0].freq, + pm_conc_connection_list[1].freq)) { if (!hw_mode.sbs_cap) return PM_SBS; else @@ -3013,28 +3024,26 @@ enum policy_mgr_conc_next_action } else return PM_NOP; case 3: - band1 = wlan_reg_chan_to_band(pm_conc_connection_list[0].chan); - band2 = wlan_reg_chan_to_band(pm_conc_connection_list[1].chan); - band3 = wlan_reg_chan_to_band(pm_conc_connection_list[2].chan); - if ((band1 == BAND_2G) || - (band2 == BAND_2G) || - (band3 == BAND_2G)) { + band1 = wlan_reg_freq_to_band(pm_conc_connection_list[0].freq); + band2 = wlan_reg_freq_to_band(pm_conc_connection_list[1].freq); + band3 = wlan_reg_freq_to_band(pm_conc_connection_list[2].freq); + if (band1 == REG_BAND_2G || band2 == REG_BAND_2G || + band3 == REG_BAND_2G) { if (!hw_mode.dbs_cap) return PM_DBS; else return PM_NOP; - } else if ((band1 == BAND_5G) && - (band2 == BAND_5G) && - (band3 == BAND_5G)) { - if (WLAN_REG_IS_CHANNEL_VALID_5G_SBS( - pm_conc_connection_list[0].chan, - pm_conc_connection_list[2].chan) && - WLAN_REG_IS_CHANNEL_VALID_5G_SBS( - pm_conc_connection_list[1].chan, - pm_conc_connection_list[2].chan) && - WLAN_REG_IS_CHANNEL_VALID_5G_SBS( - pm_conc_connection_list[0].chan, - pm_conc_connection_list[1].chan)) { + } else if (band1 == REG_BAND_5G && band2 == REG_BAND_5G && + band3 == REG_BAND_5G) { + if (WLAN_REG_IS_FREQUENCY_VALID_5G_SBS( + pm_conc_connection_list[0].freq, + pm_conc_connection_list[2].freq) && + WLAN_REG_IS_FREQUENCY_VALID_5G_SBS( + pm_conc_connection_list[1].freq, + pm_conc_connection_list[2].freq) && + WLAN_REG_IS_FREQUENCY_VALID_5G_SBS( + pm_conc_connection_list[0].freq, + pm_conc_connection_list[1].freq)) { if (!hw_mode.sbs_cap) return PM_SBS; else @@ -3090,9 +3099,9 @@ enum policy_mgr_conc_next_action qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); policy_mgr_debug("chan[0]:%d chan[1]:%d chan[2]:%d num_connections:%d dbs:%d", - pm_conc_connection_list[0].chan, - pm_conc_connection_list[1].chan, - pm_conc_connection_list[2].chan, num_connections, + pm_conc_connection_list[0].freq, + pm_conc_connection_list[1].freq, + pm_conc_connection_list[2].freq, num_connections, hw_mode.dbs_cap); /* If the band of operation of both the MACs is the same, @@ -3104,8 +3113,8 @@ enum policy_mgr_conc_next_action next_action = PM_NOP; break; case 2: - band1 = wlan_reg_chan_to_band(pm_conc_connection_list[0].chan); - band2 = wlan_reg_chan_to_band(pm_conc_connection_list[1].chan); + band1 = wlan_reg_freq_to_band(pm_conc_connection_list[0].freq); + band2 = wlan_reg_freq_to_band(pm_conc_connection_list[1].freq); if ((band1 == band2) && (hw_mode.dbs_cap)) next_action = PM_SINGLE_MAC_UPGRADE; else if ((band1 != band2) && (!hw_mode.dbs_cap)) @@ -3116,9 +3125,9 @@ enum policy_mgr_conc_next_action break; case 3: - band1 = wlan_reg_chan_to_band(pm_conc_connection_list[0].chan); - band2 = wlan_reg_chan_to_band(pm_conc_connection_list[1].chan); - band3 = wlan_reg_chan_to_band(pm_conc_connection_list[2].chan); + band1 = wlan_reg_freq_to_band(pm_conc_connection_list[0].freq); + band2 = wlan_reg_freq_to_band(pm_conc_connection_list[1].freq); + band3 = wlan_reg_freq_to_band(pm_conc_connection_list[2].freq); if (((band1 == band2) && (band2 == band3)) && (hw_mode.dbs_cap)) { next_action = PM_SINGLE_MAC_UPGRADE; @@ -3187,13 +3196,14 @@ QDF_STATUS policy_mgr_reset_sap_mandatory_channels( { pm_ctx->sap_mandatory_channels_len = 0; qdf_mem_zero(pm_ctx->sap_mandatory_channels, - QDF_ARRAY_SIZE(pm_ctx->sap_mandatory_channels)); + QDF_ARRAY_SIZE(pm_ctx->sap_mandatory_channels) * + sizeof(*pm_ctx->sap_mandatory_channels)); return QDF_STATUS_SUCCESS; } -void policy_mgr_add_sap_mandatory_chan(struct wlan_objmgr_psoc *psoc, - uint8_t chan) +void policy_mgr_add_sap_mandatory_chan_int(struct wlan_objmgr_psoc *psoc, + uint32_t ch_freq) { int i; struct policy_mgr_psoc_priv_obj *pm_ctx; @@ -3205,13 +3215,13 @@ void policy_mgr_add_sap_mandatory_chan(struct wlan_objmgr_psoc *psoc, } for (i = 0; i < pm_ctx->sap_mandatory_channels_len; i++) { - if (chan == pm_ctx->sap_mandatory_channels[i]) + if (ch_freq == pm_ctx->sap_mandatory_channels[i]) return; } - policy_mgr_debug("chan %hu", chan); + policy_mgr_debug("Ch freq: %hu", ch_freq); pm_ctx->sap_mandatory_channels[pm_ctx->sap_mandatory_channels_len++] - = chan; + = ch_freq; } uint32_t policy_mgr_get_sap_mandatory_chan_list_len( @@ -3230,7 +3240,7 @@ uint32_t policy_mgr_get_sap_mandatory_chan_list_len( void policy_mgr_init_sap_mandatory_2g_chan(struct wlan_objmgr_psoc *psoc) { - uint8_t chan_list[QDF_MAX_NUM_CHAN] = {0}; + uint32_t ch_freq_list[QDF_MAX_NUM_CHAN] = {0}; uint32_t len = 0; int i; QDF_STATUS status; @@ -3242,7 +3252,7 @@ void policy_mgr_init_sap_mandatory_2g_chan(struct wlan_objmgr_psoc *psoc) return; } - status = policy_mgr_get_valid_chans(psoc, chan_list, &len); + status = policy_mgr_get_valid_chans_int(psoc, ch_freq_list, &len); if (QDF_IS_STATUS_ERROR(status)) { policy_mgr_err("Error in getting valid channels"); return; @@ -3250,20 +3260,20 @@ void policy_mgr_init_sap_mandatory_2g_chan(struct wlan_objmgr_psoc *psoc) pm_ctx->sap_mandatory_channels_len = 0; for (i = 0; (i < len) && (i < QDF_MAX_NUM_CHAN); i++) { - if (WLAN_REG_IS_24GHZ_CH(chan_list[i])) { + if (WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq_list[i])) { policy_mgr_debug("Add chan %hu to mandatory list", - chan_list[i]); + ch_freq_list[i]); pm_ctx->sap_mandatory_channels[ pm_ctx->sap_mandatory_channels_len++] = - chan_list[i]; + ch_freq_list[i]; } } } -void policy_mgr_remove_sap_mandatory_chan(struct wlan_objmgr_psoc *psoc, - uint8_t chan) +void policy_mgr_remove_sap_mandatory_chan_int(struct wlan_objmgr_psoc *psoc, + uint32_t ch_freq) { - uint8_t chan_list[QDF_MAX_NUM_CHAN] = {0}; + uint32_t ch_freq_list[QDF_MAX_NUM_CHAN] = {0}; uint32_t num_chan = 0; int i; struct policy_mgr_psoc_priv_obj *pm_ctx; @@ -3281,13 +3291,15 @@ void policy_mgr_remove_sap_mandatory_chan(struct wlan_objmgr_psoc *psoc, } for (i = 0; i < pm_ctx->sap_mandatory_channels_len; i++) { - if (chan == pm_ctx->sap_mandatory_channels[i]) + if (ch_freq == pm_ctx->sap_mandatory_channels[i]) continue; - chan_list[num_chan++] = pm_ctx->sap_mandatory_channels[i]; + ch_freq_list[num_chan++] = pm_ctx->sap_mandatory_channels[i]; } qdf_mem_zero(pm_ctx->sap_mandatory_channels, - pm_ctx->sap_mandatory_channels_len); - qdf_mem_copy(pm_ctx->sap_mandatory_channels, chan_list, num_chan); + pm_ctx->sap_mandatory_channels_len * + sizeof(*pm_ctx->sap_mandatory_channels)); + qdf_mem_copy(pm_ctx->sap_mandatory_channels, ch_freq_list, + num_chan * sizeof(*pm_ctx->sap_mandatory_channels)); pm_ctx->sap_mandatory_channels_len = num_chan; } diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c index 5e639f31f91e..5693c8d139bb 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c @@ -152,7 +152,7 @@ policy_mgr_get_dfs_master_dynamic_enabled( (pm_conc_connection_list[i].mode == PM_STA_MODE || pm_conc_connection_list[i].mode == PM_P2P_CLIENT_MODE))) continue; - if (WLAN_REG_IS_5GHZ_CH(pm_conc_connection_list[i].chan)) + if (WLAN_REG_IS_5GHZ_CH_FREQ(pm_conc_connection_list[i].freq)) sta_on_5g = true; else sta_on_2g = true; @@ -1430,21 +1430,21 @@ bool policy_mgr_current_concurrency_is_mcc(struct wlan_objmgr_psoc *psoc) case 1: break; case 2: - if ((pm_conc_connection_list[0].chan != - pm_conc_connection_list[1].chan) && - (pm_conc_connection_list[0].mac == - pm_conc_connection_list[1].mac)) { + if (pm_conc_connection_list[0].freq != + pm_conc_connection_list[1].freq && + pm_conc_connection_list[0].mac == + pm_conc_connection_list[1].mac) { is_mcc = true; } break; case 3: - if ((pm_conc_connection_list[0].chan != - pm_conc_connection_list[1].chan) || - (pm_conc_connection_list[0].chan != - pm_conc_connection_list[2].chan) || - (pm_conc_connection_list[1].chan != - pm_conc_connection_list[2].chan)){ - is_mcc = true; + if (pm_conc_connection_list[0].freq != + pm_conc_connection_list[1].freq || + pm_conc_connection_list[0].freq != + pm_conc_connection_list[2].freq || + pm_conc_connection_list[1].freq != + pm_conc_connection_list[2].freq){ + is_mcc = true; } break; default: @@ -1476,9 +1476,9 @@ bool policy_mgr_is_sap_p2pgo_on_dfs(struct wlan_objmgr_psoc *psoc) PM_SAP_MODE, list); while (index < count) { - if (wlan_reg_is_dfs_ch(pm_ctx->pdev, - pm_conc_connection_list - [list[index]].chan)){ + if (wlan_reg_is_dfs_for_freq( + pm_ctx->pdev, + pm_conc_connection_list[list[index]].freq)){ qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); return true; } @@ -1489,9 +1489,9 @@ bool policy_mgr_is_sap_p2pgo_on_dfs(struct wlan_objmgr_psoc *psoc) list); index = 0; while (index < count) { - if (wlan_reg_is_dfs_ch(pm_ctx->pdev, - pm_conc_connection_list - [list[index]].chan)){ + if (wlan_reg_is_dfs_for_freq( + pm_ctx->pdev, + pm_conc_connection_list[list[index]].freq)){ qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); return true; } @@ -1757,7 +1757,7 @@ QDF_STATUS policy_mgr_incr_connection_count( enum policy_mgr_chain_mode chain_mask = POLICY_MGR_ONE_ONE; uint8_t nss_2g = 0, nss_5g = 0; enum policy_mgr_con_mode mode; - uint8_t chan; + uint32_t ch_freq; uint32_t nss = 0; struct policy_mgr_psoc_priv_obj *pm_ctx; bool update_conn = true; @@ -1796,15 +1796,15 @@ QDF_STATUS policy_mgr_incr_connection_count( mode = policy_mgr_get_mode(conn_table_entry.type, conn_table_entry.sub_type); - chan = wlan_reg_freq_to_chan(pm_ctx->pdev, conn_table_entry.mhz); + ch_freq = conn_table_entry.mhz; status = policy_mgr_get_nss_for_vdev(psoc, mode, &nss_2g, &nss_5g); if (QDF_IS_STATUS_SUCCESS(status)) { - if ((WLAN_REG_IS_24GHZ_CH(chan) && (nss_2g > 1)) || - (WLAN_REG_IS_5GHZ_CH(chan) && (nss_5g > 1))) + if ((WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq) && nss_2g > 1) || + (WLAN_REG_IS_5GHZ_CH_FREQ(ch_freq) && nss_5g > 1)) chain_mask = POLICY_MGR_TWO_TWO; else chain_mask = POLICY_MGR_ONE_ONE; - nss = (WLAN_REG_IS_24GHZ_CH(chan)) ? nss_2g : nss_5g; + nss = (WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq)) ? nss_2g : nss_5g; } else { policy_mgr_err("Error in getting nss"); } @@ -1815,7 +1815,7 @@ QDF_STATUS policy_mgr_incr_connection_count( /* add the entry */ policy_mgr_update_conc_list(psoc, conn_index, mode, - chan, + ch_freq, policy_mgr_get_bw(conn_table_entry.chan_width), conn_table_entry.mac_id, chain_mask, @@ -1864,8 +1864,8 @@ QDF_STATUS policy_mgr_decr_connection_count(struct wlan_objmgr_psoc *psoc, pm_conc_connection_list[next_conn_index].mode; pm_conc_connection_list[conn_index].mac = pm_conc_connection_list[next_conn_index].mac; - pm_conc_connection_list[conn_index].chan = - pm_conc_connection_list[next_conn_index].chan; + pm_conc_connection_list[conn_index].freq = + pm_conc_connection_list[next_conn_index].freq; pm_conc_connection_list[conn_index].bw = pm_conc_connection_list[next_conn_index].bw; pm_conc_connection_list[conn_index].chain_mask = @@ -1924,7 +1924,7 @@ bool policy_mgr_map_concurrency_mode(enum QDF_OPMODE *old_mode, } bool policy_mgr_is_ibss_conn_exist(struct wlan_objmgr_psoc *psoc, - uint8_t *ibss_channel) + uint32_t *ibss_ch_freq) { uint32_t count = 0, index = 0; uint32_t list[MAX_NUMBER_OF_CONC_CONNECTIONS]; @@ -1936,7 +1936,7 @@ bool policy_mgr_is_ibss_conn_exist(struct wlan_objmgr_psoc *psoc, policy_mgr_err("Invalid Context"); return status; } - if (!ibss_channel) { + if (!ibss_ch_freq) { policy_mgr_err("Null pointer error"); return false; } @@ -1947,10 +1947,10 @@ bool policy_mgr_is_ibss_conn_exist(struct wlan_objmgr_psoc *psoc, /* No IBSS connection */ status = false; } else if (count == 1) { - *ibss_channel = pm_conc_connection_list[list[index]].chan; + *ibss_ch_freq = pm_conc_connection_list[list[index]].freq; status = true; } else { - *ibss_channel = pm_conc_connection_list[list[index]].chan; + *ibss_ch_freq = pm_conc_connection_list[list[index]].freq; policy_mgr_debug("Multiple IBSS connections, picking first one"); status = true; } @@ -1959,9 +1959,10 @@ bool policy_mgr_is_ibss_conn_exist(struct wlan_objmgr_psoc *psoc, return status; } -uint32_t policy_mgr_get_mode_specific_conn_info(struct wlan_objmgr_psoc *psoc, - uint8_t *channel, uint8_t *vdev_id, - enum policy_mgr_con_mode mode) +uint32_t policy_mgr_get_mode_specific_conn_info_int( + struct wlan_objmgr_psoc *psoc, + uint32_t *ch_freq_list, uint8_t *vdev_id, + enum policy_mgr_con_mode mode) { uint32_t count = 0, index = 0; @@ -1973,7 +1974,7 @@ uint32_t policy_mgr_get_mode_specific_conn_info(struct wlan_objmgr_psoc *psoc, policy_mgr_err("Invalid Context"); return count; } - if (!channel || !vdev_id) { + if (!ch_freq_list || !vdev_id) { policy_mgr_err("Null pointer error"); return count; } @@ -1984,13 +1985,13 @@ uint32_t policy_mgr_get_mode_specific_conn_info(struct wlan_objmgr_psoc *psoc, if (count == 0) { policy_mgr_debug("No mode:[%d] connection", mode); } else if (count == 1) { - *channel = pm_conc_connection_list[list[index]].chan; + *ch_freq_list = pm_conc_connection_list[list[index]].freq; *vdev_id = pm_conc_connection_list[list[index]].vdev_id; } else { for (index = 0; index < count; index++) { - channel[index] = - pm_conc_connection_list[list[index]].chan; + ch_freq_list[index] = pm_conc_connection_list[ + list[index]].freq; vdev_id[index] = pm_conc_connection_list[list[index]].vdev_id; @@ -2002,6 +2003,21 @@ uint32_t policy_mgr_get_mode_specific_conn_info(struct wlan_objmgr_psoc *psoc, return count; } +uint32_t +policy_mgr_get_mode_specific_conn_info(struct wlan_objmgr_psoc *psoc, + uint8_t *channels, uint8_t *vdev_id, + enum policy_mgr_con_mode mode) +{ + uint32_t count, i, ch_freq_list[MAX_NUMBER_OF_CONC_CONNECTIONS]; + + count = policy_mgr_get_mode_specific_conn_info_int(psoc, ch_freq_list, + vdev_id, mode); + for (i = 0; i < count; i++) + channels[i] = wlan_freq_to_chan(ch_freq_list[i]); + + return count; +} + bool policy_mgr_max_concurrent_connections_reached( struct wlan_objmgr_psoc *psoc) { @@ -2059,14 +2075,14 @@ static bool policy_mgr_check_privacy_for_new_conn( static bool policy_mgr_is_concurrency_allowed_4_port( struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode, - uint8_t channel, + uint32_t ch_freq, struct policy_mgr_pcl_list pcl) { uint32_t i; struct policy_mgr_psoc_priv_obj *pm_ctx; /* new STA may just have ssid, no channel until bssid assigned */ - if (channel == 0 && mode == PM_STA_MODE) + if (ch_freq == 0 && mode == PM_STA_MODE) return true; pm_ctx = policy_mgr_get_context(psoc); @@ -2089,11 +2105,11 @@ static bool policy_mgr_is_concurrency_allowed_4_port( } for (i = 0; i < pcl.pcl_len; i++) - if (channel == pcl.pcl_list[i]) + if (ch_freq == pcl.pcl_list[i]) return true; - policy_mgr_err("4th port failed on channel %d with mode %d", - channel, mode); + policy_mgr_err("4th port failed on ch freq %d with mode %d", + ch_freq, mode); return false; } @@ -2101,13 +2117,47 @@ static bool policy_mgr_is_concurrency_allowed_4_port( static inline bool policy_mgr_is_concurrency_allowed_4_port( struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode, - uint8_t channel, - struct policy_mgr_pcl_list pcl) {return false; } + uint32_t ch_freq, + struct policy_mgr_pcl_list pcl) +{return false; } #endif +/** + * policy_mgr_allow_multiple_sta_connections() - check whether multiple STA + * concurrency is allowed and F/W supported + * @psoc: Pointer to soc + * @second_sta_freq: 2nd STA channel frequency + * @first_sta_freq: 1st STA channel frequency + * + * Return: true if supports else false. + */ +static bool policy_mgr_allow_multiple_sta_connections(struct wlan_objmgr_psoc *psoc, + uint32_t second_sta_freq, + uint32_t first_sta_freq) +{ + struct wmi_unified *wmi_handle; + + wmi_handle = get_wmi_unified_hdl_from_psoc(psoc); + if (!wmi_handle) { + policy_mgr_debug("Invalid WMI handle"); + return false; + } + if (!wmi_service_enabled(wmi_handle, + wmi_service_sta_plus_sta_support)) + return false; + + if (second_sta_freq && second_sta_freq != first_sta_freq && + wlan_reg_is_same_band_freqs(second_sta_freq, first_sta_freq)) { + policy_mgr_err("STA+STA MCC isn't permitted"); + return false; + } + + return true; +} + bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode, - uint8_t channel, + uint32_t ch_freq, enum hw_mode_bandwidth bw) { uint32_t num_connections = 0, count = 0, index = 0; @@ -2115,7 +2165,7 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, uint32_t list[MAX_NUMBER_OF_CONC_CONNECTIONS]; struct policy_mgr_psoc_priv_obj *pm_ctx; bool sta_sap_scc_on_dfs_chan; - uint8_t chan; + uint32_t sta_freq; pm_ctx = policy_mgr_get_context(psoc); if (!pm_ctx) { @@ -2137,9 +2187,9 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, goto done; } - if (channel) { + if (ch_freq) { /* don't allow 3rd home channel on same MAC */ - if (!policy_mgr_allow_new_home_channel(psoc, mode, channel, + if (!policy_mgr_allow_new_home_channel(psoc, mode, ch_freq, num_connections)) goto done; @@ -2157,10 +2207,10 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, * in MCC which is not allowed. */ if (!policy_mgr_is_5g_channel_allowed(psoc, - channel, list, PM_P2P_GO_MODE)) + ch_freq, list, PM_P2P_GO_MODE)) goto done; if (!policy_mgr_is_5g_channel_allowed(psoc, - channel, list, PM_SAP_MODE)) + ch_freq, list, PM_SAP_MODE)) goto done; sta_sap_scc_on_dfs_chan = @@ -2170,8 +2220,9 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, if (!sta_sap_scc_on_dfs_chan && ((mode == PM_P2P_GO_MODE) || (mode == PM_SAP_MODE))) { - if (wlan_reg_is_dfs_ch(pm_ctx->pdev, channel)) - match = policy_mgr_disallow_mcc(psoc, channel); + if (wlan_reg_is_dfs_for_freq(pm_ctx->pdev, ch_freq)) + match = policy_mgr_disallow_mcc_int(psoc, + ch_freq); } if (true == match) { policy_mgr_err("No MCC, SAP/GO about to come up on DFS channel"); @@ -2179,7 +2230,7 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, } if ((policy_mgr_is_hw_dbs_capable(psoc) != true) && num_connections) { - if (WLAN_REG_IS_24GHZ_CH(channel)) { + if (WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq)) { if (policy_mgr_is_sap_p2pgo_on_dfs(psoc)) { policy_mgr_err("MCC not allowed: SAP/P2PGO on DFS"); goto done; @@ -2196,9 +2247,9 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, policy_mgr_err("3rd STA isn't permitted"); goto done; } - chan = pm_conc_connection_list[list[0]].chan; - if (!policy_mgr_allow_multiple_sta_connections(psoc, channel, - chan)) + sta_freq = pm_conc_connection_list[list[0]].freq; + if (!policy_mgr_allow_multiple_sta_connections(psoc, ch_freq, + sta_freq)) goto done; } @@ -2215,7 +2266,7 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, goto done; } if ((PM_IBSS_MODE == mode) && - (wlan_reg_is_dfs_ch(pm_ctx->pdev, channel)) && count) { + (wlan_reg_is_dfs_for_freq(pm_ctx->pdev, ch_freq)) && count) { policy_mgr_err("No IBSS + STA SCC/MCC, IBSS is on DFS channel"); goto done; } @@ -2236,10 +2287,10 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, * band. If requirement changes then this condition * needs to be removed */ - if (channel && - (pm_conc_connection_list[0].chan != channel) && - WLAN_REG_IS_SAME_BAND_CHANNELS( - pm_conc_connection_list[0].chan, channel)) { + if (ch_freq && + pm_conc_connection_list[0].freq != ch_freq && + WLAN_REG_IS_SAME_BAND_FREQS( + pm_conc_connection_list[0].freq, ch_freq)) { qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); policy_mgr_err("No IBSS + STA MCC"); goto done; @@ -2267,10 +2318,10 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, goto done; } qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); - if (channel && - (wlan_reg_is_dfs_ch(pm_ctx->pdev, - pm_conc_connection_list[0].chan)) - && (WLAN_REG_IS_5GHZ_CH(channel))) { + if (ch_freq && + (wlan_reg_is_dfs_for_freq(pm_ctx->pdev, + pm_conc_connection_list[0].freq)) && + (WLAN_REG_IS_5GHZ_CH_FREQ(ch_freq))) { qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); policy_mgr_err("No IBSS + STA SCC/MCC, IBSS is on DFS channel"); goto done; @@ -2280,9 +2331,9 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, * band. If requirement changes then this condition * needs to be removed */ - if ((pm_conc_connection_list[0].chan != channel) && - WLAN_REG_IS_SAME_BAND_CHANNELS( - pm_conc_connection_list[0].chan, channel)) { + if (pm_conc_connection_list[0].freq != ch_freq && + WLAN_REG_IS_SAME_BAND_FREQS( + pm_conc_connection_list[0].freq, ch_freq)) { policy_mgr_err("No IBSS + STA MCC"); qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); goto done; @@ -2294,20 +2345,21 @@ 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, ch_freq, WLAN_INVALID_VDEV_ID)) { policy_mgr_err("This concurrency combination is not allowed"); goto done; } /* don't allow two P2P GO on same band */ - if (channel && (mode == PM_P2P_GO_MODE) && num_connections) { + if (ch_freq && mode == PM_P2P_GO_MODE && num_connections) { index = 0; - count = policy_mgr_mode_specific_connection_count(psoc, - PM_P2P_GO_MODE, list); + count = policy_mgr_mode_specific_connection_count( + psoc, PM_P2P_GO_MODE, list); qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); while (index < count) { - if (WLAN_REG_IS_SAME_BAND_CHANNELS(channel, - pm_conc_connection_list[list[index]].chan)) { + if (WLAN_REG_IS_SAME_BAND_FREQS( + ch_freq, + pm_conc_connection_list[list[index]].freq)) { policy_mgr_err("Don't allow P2P GO on same band"); qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); goto done; @@ -2328,49 +2380,49 @@ done: return status; } -bool policy_mgr_allow_concurrency(struct wlan_objmgr_psoc *psoc, - enum policy_mgr_con_mode mode, - uint8_t channel, enum hw_mode_bandwidth bw) +bool policy_mgr_allow_concurrency_int(struct wlan_objmgr_psoc *psoc, + enum policy_mgr_con_mode mode, + uint32_t ch_freq, + enum hw_mode_bandwidth bw) { QDF_STATUS status; struct policy_mgr_pcl_list pcl; bool allowed; qdf_mem_zero(&pcl, sizeof(pcl)); - status = policy_mgr_get_pcl(psoc, mode, pcl.pcl_list, &pcl.pcl_len, - pcl.weight_list, - QDF_ARRAY_SIZE(pcl.weight_list)); + status = policy_mgr_get_pcl_int(psoc, mode, pcl.pcl_list, &pcl.pcl_len, + pcl.weight_list, + QDF_ARRAY_SIZE(pcl.weight_list)); if (QDF_IS_STATUS_ERROR(status)) { policy_mgr_err("disallow connection:%d", status); return false; } - allowed = policy_mgr_is_concurrency_allowed( - psoc, mode, channel, bw); + allowed = policy_mgr_is_concurrency_allowed(psoc, mode, ch_freq, bw); /* Fourth connection concurrency check */ if (allowed && policy_mgr_get_connection_count(psoc) == 3) allowed = policy_mgr_is_concurrency_allowed_4_port( psoc, mode, - channel, + ch_freq, pcl); return allowed; } -bool policy_mgr_allow_concurrency_csa(struct wlan_objmgr_psoc *psoc, - enum policy_mgr_con_mode mode, - uint8_t channel, - uint32_t vdev_id, - bool forced, - enum sap_csa_reason_code reason) +bool policy_mgr_allow_concurrency_csa_int(struct wlan_objmgr_psoc *psoc, + enum policy_mgr_con_mode mode, + uint32_t ch_freq, + uint32_t vdev_id, + bool forced, + enum sap_csa_reason_code reason) { bool allow = false; struct policy_mgr_conc_connection_info info[MAX_NUMBER_OF_CONC_CONNECTIONS]; uint8_t num_cxn_del = 0; struct policy_mgr_psoc_priv_obj *pm_ctx; - uint8_t old_chan; + uint32_t old_ch_freq; QDF_STATUS status; pm_ctx = policy_mgr_get_context(psoc); @@ -2379,9 +2431,10 @@ bool policy_mgr_allow_concurrency_csa(struct wlan_objmgr_psoc *psoc, return allow; } policy_mgr_debug("check concurrency_csa vdev:%d ch %d, forced %d, reason %d", - vdev_id, channel, forced, reason); + vdev_id, ch_freq, forced, reason); - status = policy_mgr_get_chan_by_session_id(psoc, vdev_id, &old_chan); + status = policy_mgr_get_chan_by_session_id_int(psoc, vdev_id, + &old_ch_freq); if (QDF_IS_STATUS_ERROR(status)) { policy_mgr_err("Failed to get channel for vdev:%d", vdev_id); @@ -2410,16 +2463,13 @@ bool policy_mgr_allow_concurrency_csa(struct wlan_objmgr_psoc *psoc, if (forced && reason == CSA_REASON_UNSAFE_CHANNEL) policy_mgr_store_and_del_conn_info_by_chan_and_mode( - psoc, old_chan, mode, info, &num_cxn_del); + psoc, old_ch_freq, mode, info, &num_cxn_del); else policy_mgr_store_and_del_conn_info_by_vdev_id( psoc, vdev_id, info, &num_cxn_del); - allow = policy_mgr_allow_concurrency( - psoc, - mode, - channel, - HW_MODE_20_MHZ); + allow = policy_mgr_allow_concurrency_int(psoc, mode, ch_freq, + HW_MODE_20_MHZ); /* Restore the connection entry */ if (num_cxn_del > 0) policy_mgr_restore_deleted_conn_info(psoc, info, num_cxn_del); @@ -2466,9 +2516,9 @@ uint32_t policy_mgr_get_concurrency_mode(struct wlan_objmgr_psoc *psoc) * * Return: QDF_STATUS */ -QDF_STATUS policy_mgr_get_channel_from_scan_result( +QDF_STATUS policy_mgr_get_channel_from_scan_result_int( struct wlan_objmgr_psoc *psoc, - void *roam_profile, uint8_t *channel) + void *roam_profile, uint32_t *ch_freq) { QDF_STATUS status = QDF_STATUS_E_FAILURE; void *scan_cache = NULL; @@ -2480,14 +2530,14 @@ QDF_STATUS policy_mgr_get_channel_from_scan_result( return QDF_STATUS_E_INVAL; } - if (!roam_profile || !channel) { + if (!roam_profile || !ch_freq) { policy_mgr_err("Invalid input parameters"); return QDF_STATUS_E_INVAL; } if (pm_ctx->sme_cbacks.sme_get_ap_channel_from_scan) { status = pm_ctx->sme_cbacks.sme_get_ap_channel_from_scan - (roam_profile, &scan_cache, channel); + (roam_profile, &scan_cache, ch_freq); if (status != QDF_STATUS_SUCCESS) { policy_mgr_err("Get AP channel failed"); return status; @@ -2531,12 +2581,12 @@ QDF_STATUS policy_mgr_set_user_cfg(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_SUCCESS; } -uint8_t policy_mgr_search_and_check_for_session_conc( +uint32_t policy_mgr_search_and_check_for_session_conc( struct wlan_objmgr_psoc *psoc, uint8_t session_id, void *roam_profile) { - uint8_t channel = 0; + uint32_t ch_freq = 0; QDF_STATUS status; enum policy_mgr_con_mode mode; bool ret; @@ -2545,7 +2595,7 @@ uint8_t policy_mgr_search_and_check_for_session_conc( pm_ctx = policy_mgr_get_context(psoc); if (!pm_ctx) { policy_mgr_err("Invalid Context"); - return channel; + return ch_freq; } if (pm_ctx->hdd_cbacks.get_mode_for_non_connected_vdev) { @@ -2553,27 +2603,28 @@ uint8_t policy_mgr_search_and_check_for_session_conc( psoc, session_id); if (PM_MAX_NUM_OF_MODE == mode) { policy_mgr_err("Invalid mode"); - return channel; + return ch_freq; } } else - return channel; + return ch_freq; - status = policy_mgr_get_channel_from_scan_result(psoc, - roam_profile, &channel); - if ((QDF_STATUS_SUCCESS != status) || (channel == 0)) { + status = policy_mgr_get_channel_from_scan_result_int( + psoc, roam_profile, &ch_freq); + if (QDF_STATUS_SUCCESS != status || ch_freq == 0) { policy_mgr_err("%s error %d %d", - __func__, status, channel); + __func__, status, ch_freq); return 0; } /* Take care of 160MHz and 80+80Mhz later */ - ret = policy_mgr_allow_concurrency(psoc, mode, channel, HW_MODE_20_MHZ); + ret = policy_mgr_allow_concurrency_int(psoc, mode, ch_freq, + HW_MODE_20_MHZ); if (false == ret) { policy_mgr_err("Connection failed due to conc check fail"); return 0; } - return channel; + return ch_freq; } /** @@ -2586,14 +2637,14 @@ uint8_t policy_mgr_search_and_check_for_session_conc( */ static bool policy_mgr_is_two_connection_mcc(void) { - return ((pm_conc_connection_list[0].chan != - pm_conc_connection_list[1].chan) && + return ((pm_conc_connection_list[0].freq != + pm_conc_connection_list[1].freq) && (pm_conc_connection_list[0].mac == pm_conc_connection_list[1].mac) && - (pm_conc_connection_list[0].chan <= - WLAN_REG_MAX_24GHZ_CH_NUM) && - (pm_conc_connection_list[1].chan <= - WLAN_REG_MAX_24GHZ_CH_NUM)) ? true : false; + (pm_conc_connection_list[0].freq <= + WLAN_REG_MAX_24GHZ_CHAN_FREQ) && + (pm_conc_connection_list[1].freq <= + WLAN_REG_MAX_24GHZ_CHAN_FREQ)) ? true : false; } /** @@ -2606,18 +2657,18 @@ static bool policy_mgr_is_two_connection_mcc(void) */ static bool policy_mgr_is_three_connection_mcc(void) { - return (((pm_conc_connection_list[0].chan != - pm_conc_connection_list[1].chan) || - (pm_conc_connection_list[0].chan != - pm_conc_connection_list[2].chan) || - (pm_conc_connection_list[1].chan != - pm_conc_connection_list[2].chan)) && - (pm_conc_connection_list[0].chan <= - WLAN_REG_MAX_24GHZ_CH_NUM) && - (pm_conc_connection_list[1].chan <= - WLAN_REG_MAX_24GHZ_CH_NUM) && - (pm_conc_connection_list[2].chan <= - WLAN_REG_MAX_24GHZ_CH_NUM)) ? true : false; + return (((pm_conc_connection_list[0].freq != + pm_conc_connection_list[1].freq) || + (pm_conc_connection_list[0].freq != + pm_conc_connection_list[2].freq) || + (pm_conc_connection_list[1].freq != + pm_conc_connection_list[2].freq)) && + (pm_conc_connection_list[0].freq <= + WLAN_REG_MAX_24GHZ_CHAN_FREQ) && + (pm_conc_connection_list[1].freq <= + WLAN_REG_MAX_24GHZ_CHAN_FREQ) && + (pm_conc_connection_list[2].freq <= + WLAN_REG_MAX_24GHZ_CHAN_FREQ)) ? true : false; } bool policy_mgr_is_mcc_in_24G(struct wlan_objmgr_psoc *psoc) @@ -2647,8 +2698,8 @@ bool policy_mgr_is_mcc_in_24G(struct wlan_objmgr_psoc *psoc) return is_24G_mcc; } -bool policy_mgr_check_for_session_conc(struct wlan_objmgr_psoc *psoc, - uint8_t session_id, uint8_t channel) +bool policy_mgr_check_for_session_conc_int(struct wlan_objmgr_psoc *psoc, + uint8_t session_id, uint32_t ch_freq) { enum policy_mgr_con_mode mode; bool ret; @@ -2670,13 +2721,14 @@ bool policy_mgr_check_for_session_conc(struct wlan_objmgr_psoc *psoc, } else return false; - if (channel == 0) { + if (ch_freq == 0) { policy_mgr_err("Invalid channel number 0"); return false; } /* Take care of 160MHz and 80+80Mhz later */ - ret = policy_mgr_allow_concurrency(psoc, mode, channel, HW_MODE_20_MHZ); + ret = policy_mgr_allow_concurrency_int(psoc, mode, ch_freq, + HW_MODE_20_MHZ); if (false == ret) { policy_mgr_err("Connection failed due to conc check fail"); return 0; @@ -2928,7 +2980,7 @@ bool policy_mgr_is_sta_active_connection_exists( } bool policy_mgr_is_any_nondfs_chnl_present(struct wlan_objmgr_psoc *psoc, - uint8_t *channel) + uint32_t *ch_freq) { bool status = false; uint32_t conn_index = 0; @@ -2943,9 +2995,9 @@ bool policy_mgr_is_any_nondfs_chnl_present(struct wlan_objmgr_psoc *psoc, for (conn_index = 0; conn_index < MAX_NUMBER_OF_CONC_CONNECTIONS; conn_index++) { if (pm_conc_connection_list[conn_index].in_use && - !wlan_reg_is_dfs_ch(pm_ctx->pdev, - pm_conc_connection_list[conn_index].chan)) { - *channel = pm_conc_connection_list[conn_index].chan; + !wlan_reg_is_dfs_for_freq(pm_ctx->pdev, + pm_conc_connection_list[conn_index].freq)) { + *ch_freq = pm_conc_connection_list[conn_index].freq; status = true; } } @@ -2972,8 +3024,8 @@ uint32_t policy_mgr_get_dfs_beaconing_session_id( conn_index++) { conn_info = &pm_conc_connection_list[conn_index]; if (conn_info->in_use && - wlan_reg_chan_has_dfs_attribute(pm_ctx->pdev, - conn_info->chan) && + wlan_reg_chan_has_dfs_attribute_for_freq( + pm_ctx->pdev, conn_info->freq) && (conn_info->mode == PM_SAP_MODE || conn_info->mode == PM_P2P_GO_MODE)) { session_id = @@ -2987,7 +3039,7 @@ uint32_t policy_mgr_get_dfs_beaconing_session_id( } bool policy_mgr_is_any_dfs_beaconing_session_present( - struct wlan_objmgr_psoc *psoc, uint8_t *channel) + struct wlan_objmgr_psoc *psoc, uint32_t *ch_freq) { struct policy_mgr_conc_connection_info *conn_info; bool status = false; @@ -3004,10 +3056,10 @@ bool policy_mgr_is_any_dfs_beaconing_session_present( conn_index++) { conn_info = &pm_conc_connection_list[conn_index]; if (conn_info->in_use && - wlan_reg_is_dfs_ch(pm_ctx->pdev, conn_info->chan) && + wlan_reg_is_dfs_for_freq(pm_ctx->pdev, conn_info->freq) && (PM_SAP_MODE == conn_info->mode || PM_P2P_GO_MODE == conn_info->mode)) { - *channel = pm_conc_connection_list[conn_index].chan; + *ch_freq = pm_conc_connection_list[conn_index].freq; status = true; } } @@ -3019,7 +3071,7 @@ bool policy_mgr_is_any_dfs_beaconing_session_present( bool policy_mgr_scan_trim_5g_chnls_for_dfs_ap(struct wlan_objmgr_psoc *psoc) { struct policy_mgr_psoc_priv_obj *pm_ctx; - uint8_t ap_dfs_channel = 0; + uint32_t ap_dfs_ch_freq = 0; pm_ctx = policy_mgr_get_context(psoc); if (!pm_ctx) { @@ -3027,9 +3079,8 @@ bool policy_mgr_scan_trim_5g_chnls_for_dfs_ap(struct wlan_objmgr_psoc *psoc) return false; } - policy_mgr_is_any_dfs_beaconing_session_present( - psoc, &ap_dfs_channel); - if (!ap_dfs_channel) + policy_mgr_is_any_dfs_beaconing_session_present(psoc, &ap_dfs_ch_freq); + if (!ap_dfs_ch_freq) return false; /* * 1) if agile & DFS scans are supportet @@ -3045,7 +3096,7 @@ bool policy_mgr_scan_trim_5g_chnls_for_dfs_ap(struct wlan_objmgr_psoc *psoc) return false; policy_mgr_err("scan skip 5g chan due to dfs ap(ch %d) present", - ap_dfs_channel); + ap_dfs_ch_freq); return true; } @@ -3091,15 +3142,15 @@ void policy_mgr_dump_connection_status_info(struct wlan_objmgr_psoc *psoc) qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); for (i = 0; i < MAX_NUMBER_OF_CONC_CONNECTIONS; i++) { - policy_mgr_debug("%d: use:%d vdev:%d mode:%d mac:%d chan:%d orig chainmask:%d orig nss:%d bw:%d", - i, pm_conc_connection_list[i].in_use, - pm_conc_connection_list[i].vdev_id, - pm_conc_connection_list[i].mode, - pm_conc_connection_list[i].mac, - pm_conc_connection_list[i].chan, - pm_conc_connection_list[i].chain_mask, - pm_conc_connection_list[i].original_nss, - pm_conc_connection_list[i].bw); + policy_mgr_debug("%d: use:%d vdev:%d mode:%d mac:%d freq:%d orig chainmask:%d orig nss:%d bw:%d", + i, pm_conc_connection_list[i].in_use, + pm_conc_connection_list[i].vdev_id, + pm_conc_connection_list[i].mode, + pm_conc_connection_list[i].mac, + pm_conc_connection_list[i].freq, + pm_conc_connection_list[i].chain_mask, + pm_conc_connection_list[i].original_nss, + pm_conc_connection_list[i].bw); } qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); } @@ -3126,8 +3177,8 @@ bool policy_mgr_is_any_mode_active_on_band_along_with_session( case POLICY_MGR_BAND_24: if ((pm_conc_connection_list[i].vdev_id != session_id) && (pm_conc_connection_list[i].in_use) && - (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[i].chan))) { + (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[i].freq))) { status = true; goto release_mutex_and_send_status; } @@ -3135,8 +3186,8 @@ bool policy_mgr_is_any_mode_active_on_band_along_with_session( case POLICY_MGR_BAND_5: if ((pm_conc_connection_list[i].vdev_id != session_id) && (pm_conc_connection_list[i].in_use) && - (WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[i].chan))) { + (WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[i].freq))) { status = true; goto release_mutex_and_send_status; } @@ -3153,8 +3204,9 @@ send_status: return status; } -QDF_STATUS policy_mgr_get_chan_by_session_id(struct wlan_objmgr_psoc *psoc, - uint8_t session_id, uint8_t *chan) +QDF_STATUS policy_mgr_get_chan_by_session_id_int(struct wlan_objmgr_psoc *psoc, + uint8_t session_id, + uint32_t *ch_freq) { uint32_t i; struct policy_mgr_psoc_priv_obj *pm_ctx; @@ -3169,7 +3221,7 @@ QDF_STATUS policy_mgr_get_chan_by_session_id(struct wlan_objmgr_psoc *psoc, for (i = 0; i < MAX_NUMBER_OF_CONC_CONNECTIONS; i++) { if ((pm_conc_connection_list[i].vdev_id == session_id) && (pm_conc_connection_list[i].in_use)) { - *chan = pm_conc_connection_list[i].chan; + *ch_freq = pm_conc_connection_list[i].freq; qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); return QDF_STATUS_SUCCESS; } @@ -3180,7 +3232,8 @@ QDF_STATUS policy_mgr_get_chan_by_session_id(struct wlan_objmgr_psoc *psoc, } QDF_STATUS policy_mgr_get_mac_id_by_session_id(struct wlan_objmgr_psoc *psoc, - uint8_t session_id, uint8_t *mac_id) + uint8_t session_id, + uint8_t *mac_id) { uint32_t i; struct policy_mgr_psoc_priv_obj *pm_ctx; @@ -3209,9 +3262,8 @@ QDF_STATUS policy_mgr_get_mcc_session_id_on_mac(struct wlan_objmgr_psoc *psoc, uint8_t mac_id, uint8_t session_id, uint8_t *mcc_session_id) { - uint32_t i; + uint32_t i, ch_freq; QDF_STATUS status; - uint8_t chan; struct policy_mgr_psoc_priv_obj *pm_ctx; pm_ctx = policy_mgr_get_context(psoc); @@ -3220,7 +3272,8 @@ QDF_STATUS policy_mgr_get_mcc_session_id_on_mac(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_E_FAILURE; } - status = policy_mgr_get_chan_by_session_id(psoc, session_id, &chan); + status = policy_mgr_get_chan_by_session_id_int(psoc, session_id, + &ch_freq); if (QDF_IS_STATUS_ERROR(status)) { policy_mgr_err("Failed to get channel for session id:%d", session_id); @@ -3234,8 +3287,8 @@ QDF_STATUS policy_mgr_get_mcc_session_id_on_mac(struct wlan_objmgr_psoc *psoc, if (pm_conc_connection_list[i].vdev_id == session_id) continue; /* Inter band or intra band MCC */ - if ((pm_conc_connection_list[i].chan != chan) && - (pm_conc_connection_list[i].in_use)) { + if (pm_conc_connection_list[i].freq != ch_freq && + pm_conc_connection_list[i].in_use) { *mcc_session_id = pm_conc_connection_list[i].vdev_id; qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); return QDF_STATUS_SUCCESS; @@ -3246,12 +3299,12 @@ QDF_STATUS policy_mgr_get_mcc_session_id_on_mac(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_E_FAILURE; } -uint8_t policy_mgr_get_mcc_operating_channel(struct wlan_objmgr_psoc *psoc, - uint8_t session_id) +uint32_t policy_mgr_get_mcc_operating_channel_int(struct wlan_objmgr_psoc *psoc, + uint8_t session_id) { uint8_t mac_id, mcc_session_id; QDF_STATUS status; - uint8_t chan; + uint32_t ch_freq; struct policy_mgr_psoc_priv_obj *pm_ctx; pm_ctx = policy_mgr_get_context(psoc); @@ -3273,15 +3326,15 @@ uint8_t policy_mgr_get_mcc_operating_channel(struct wlan_objmgr_psoc *psoc, return INVALID_CHANNEL_ID; } - status = policy_mgr_get_chan_by_session_id(psoc, mcc_session_id, - &chan); + status = policy_mgr_get_chan_by_session_id_int(psoc, mcc_session_id, + &ch_freq); if (QDF_IS_STATUS_ERROR(status)) { policy_mgr_err("Failed to get channel for MCC session ID:%d", mcc_session_id); return INVALID_CHANNEL_ID; } - return chan; + return ch_freq; } void policy_mgr_set_do_hw_mode_change_flag(struct wlan_objmgr_psoc *psoc, @@ -3337,11 +3390,11 @@ bool policy_mgr_is_dnsc_set(struct wlan_objmgr_vdev *vdev) return roffchan; } -QDF_STATUS policy_mgr_is_chan_ok_for_dnbs(struct wlan_objmgr_psoc *psoc, - uint8_t channel, bool *ok) +QDF_STATUS policy_mgr_is_chan_ok_for_dnbs_int(struct wlan_objmgr_psoc *psoc, + uint32_t ch_freq, bool *ok) { uint32_t cc_count = 0, i; - uint8_t operating_channel[MAX_NUMBER_OF_CONC_CONNECTIONS]; + uint32_t op_ch_freq_list[MAX_NUMBER_OF_CONC_CONNECTIONS]; uint8_t vdev_id[MAX_NUMBER_OF_CONC_CONNECTIONS]; struct wlan_objmgr_vdev *vdev; @@ -3350,18 +3403,16 @@ QDF_STATUS policy_mgr_is_chan_ok_for_dnbs(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_E_INVAL; } - cc_count = policy_mgr_get_mode_specific_conn_info(psoc, - &operating_channel[cc_count], - &vdev_id[cc_count], - PM_SAP_MODE); + cc_count = policy_mgr_get_mode_specific_conn_info_int( + psoc, &op_ch_freq_list[cc_count], + &vdev_id[cc_count], PM_SAP_MODE); policy_mgr_debug("Number of SAP modes: %d", cc_count); if (cc_count < MAX_NUMBER_OF_CONC_CONNECTIONS) - cc_count = cc_count + policy_mgr_get_mode_specific_conn_info( - psoc, - &operating_channel[cc_count], - &vdev_id[cc_count], - PM_P2P_GO_MODE); + cc_count = cc_count + + policy_mgr_get_mode_specific_conn_info_int( + psoc, &op_ch_freq_list[cc_count], + &vdev_id[cc_count], PM_P2P_GO_MODE); policy_mgr_debug("Number of beaconing entities (SAP + GO):%d", cc_count); if (!cc_count) { @@ -3369,7 +3420,7 @@ QDF_STATUS policy_mgr_is_chan_ok_for_dnbs(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_SUCCESS; } - if (!channel) { + if (!ch_freq) { policy_mgr_err("channel is 0, cc count %d", cc_count); return QDF_STATUS_E_INVAL; } @@ -3377,9 +3428,7 @@ QDF_STATUS policy_mgr_is_chan_ok_for_dnbs(struct wlan_objmgr_psoc *psoc, if (cc_count <= MAX_NUMBER_OF_CONC_CONNECTIONS) { for (i = 0; i < cc_count; i++) { vdev = wlan_objmgr_get_vdev_by_id_from_psoc( - psoc, - vdev_id[i], - WLAN_POLICY_MGR_ID); + psoc, vdev_id[i], WLAN_POLICY_MGR_ID); if (!vdev) { policy_mgr_err("vdev for vdev_id:%d is NULL", vdev_id[i]); @@ -3401,14 +3450,14 @@ QDF_STATUS policy_mgr_is_chan_ok_for_dnbs(struct wlan_objmgr_psoc *psoc, */ /* TODO: To be enhanced for SBS */ if (policy_mgr_is_dnsc_set(vdev)) { - if (operating_channel[i] == channel) { + if (op_ch_freq_list[i] == ch_freq) { *ok = true; wlan_objmgr_vdev_release_ref( vdev, WLAN_POLICY_MGR_ID); break; - } else if (WLAN_REG_IS_SAME_BAND_CHANNELS( - operating_channel[i], channel)) { + } else if (WLAN_REG_IS_SAME_BAND_FREQS( + op_ch_freq_list[i], ch_freq)) { *ok = false; wlan_objmgr_vdev_release_ref( vdev, @@ -3433,7 +3482,7 @@ QDF_STATUS policy_mgr_is_chan_ok_for_dnbs(struct wlan_objmgr_psoc *psoc, wlan_objmgr_vdev_release_ref(vdev, WLAN_POLICY_MGR_ID); } } - policy_mgr_debug("chan: %d ok %d", channel, *ok); + policy_mgr_debug("freq: %d ok %d", ch_freq, *ok); return QDF_STATUS_SUCCESS; } @@ -3648,7 +3697,8 @@ bool policy_mgr_is_sta_connected_2g(struct wlan_objmgr_psoc *psoc) for (conn_index = 0; conn_index < MAX_NUMBER_OF_CONC_CONNECTIONS; conn_index++) { if (pm_conc_connection_list[conn_index].mode == PM_STA_MODE && - pm_conc_connection_list[conn_index].chan <= 14 && + pm_conc_connection_list[conn_index].freq <= + WLAN_REG_MAX_24GHZ_CHAN_FREQ && pm_conc_connection_list[conn_index].in_use) ret = true; } @@ -3657,35 +3707,6 @@ bool policy_mgr_is_sta_connected_2g(struct wlan_objmgr_psoc *psoc) return ret; } -void policy_mgr_trim_acs_channel_list(uint8_t *pcl, uint8_t pcl_count, - uint8_t *org_ch_list, - uint8_t *org_ch_list_count) -{ - uint16_t i, j, ch_list_count = 0; - - if (*org_ch_list_count >= QDF_MAX_NUM_CHAN) { - policy_mgr_err("org_ch_list_count too big %d", - *org_ch_list_count); - return; - } - - if (pcl_count >= QDF_MAX_NUM_CHAN) { - policy_mgr_err("pcl_count is too big %d", - pcl_count); - return; - } - - policy_mgr_debug("Update ACS channels with PCL"); - for (j = 0; j < *org_ch_list_count; j++) - for (i = 0; i < pcl_count; i++) - if (pcl[i] == org_ch_list[j]) { - org_ch_list[ch_list_count++] = pcl[i]; - break; - } - - *org_ch_list_count = ch_list_count; -} - uint32_t policy_mgr_get_connection_info(struct wlan_objmgr_psoc *psoc, struct connection_info *info) { @@ -3705,8 +3726,9 @@ uint32_t policy_mgr_get_connection_info(struct wlan_objmgr_psoc *psoc, pm_conc_connection_list[conn_index].vdev_id; info[count].mac_id = pm_conc_connection_list[conn_index].mac; - info[count].channel = - pm_conc_connection_list[conn_index].chan; + info[count].channel = wlan_reg_freq_to_chan( + pm_ctx->pdev, + pm_conc_connection_list[conn_index].freq); count++; } } @@ -3716,13 +3738,12 @@ 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, + uint32_t ch_freq, uint32_t vdev_id) { enum policy_mgr_con_mode con_mode; - uint8_t con_chan; int id; - uint32_t vdev; + uint32_t vdev, con_freq; bool dbs; if (mode != PM_SAP_MODE && mode != PM_P2P_GO_MODE) @@ -3739,9 +3760,9 @@ bool policy_mgr_allow_sap_go_concurrency(struct wlan_objmgr_psoc *psoc, 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; + con_freq = pm_conc_connection_list[id].freq; if (policy_mgr_dual_beacon_on_single_mac_scc_capable(psoc) && - (channel == con_chan)) { + (ch_freq == con_freq)) { policy_mgr_debug("SCC enabled, 2 AP on same channel, allow 2nd AP"); return true; } @@ -3749,7 +3770,7 @@ bool policy_mgr_allow_sap_go_concurrency(struct wlan_objmgr_psoc *psoc, policy_mgr_debug("DBS unsupported, mcc and scc unsupported too, don't allow 2nd AP"); return false; } - if (WLAN_REG_IS_SAME_BAND_CHANNELS(channel, con_chan)) { + if (WLAN_REG_IS_SAME_BAND_FREQS(ch_freq, con_freq)) { policy_mgr_debug("DBS supported, 2 SAP on same band, reject 2nd AP"); return false; } @@ -3759,30 +3780,6 @@ bool policy_mgr_allow_sap_go_concurrency(struct wlan_objmgr_psoc *psoc, return true; } -bool policy_mgr_allow_multiple_sta_connections(struct wlan_objmgr_psoc *psoc, - uint8_t second_sta_chan, - uint8_t first_sta_chan) -{ - struct wmi_unified *wmi_handle; - - wmi_handle = get_wmi_unified_hdl_from_psoc(psoc); - if (!wmi_handle) { - policy_mgr_debug("Invalid WMI handle"); - return false; - } - if (!wmi_service_enabled(wmi_handle, - wmi_service_sta_plus_sta_support)) - return false; - - if (second_sta_chan && second_sta_chan != first_sta_chan && - wlan_reg_is_same_band_channels(second_sta_chan, first_sta_chan)) { - policy_mgr_err("STA+STA MCC isn't permitted"); - return false; - } - - return true; -} - bool policy_mgr_dual_beacon_on_single_mac_scc_capable( struct wlan_objmgr_psoc *psoc) { @@ -3841,8 +3838,8 @@ bool policy_mgr_sta_sap_scc_on_lte_coex_chan( return scc_lte_coex; } -bool policy_mgr_is_valid_for_channel_switch(struct wlan_objmgr_psoc *psoc, - uint8_t channel) +bool policy_mgr_is_valid_for_channel_switch_int(struct wlan_objmgr_psoc *psoc, + uint32_t ch_freq) { uint32_t sta_sap_scc_on_dfs_chan; uint32_t sap_count; @@ -3860,10 +3857,10 @@ bool policy_mgr_is_valid_for_channel_switch(struct wlan_objmgr_psoc *psoc, sap_count = policy_mgr_mode_specific_connection_count(psoc, PM_SAP_MODE, NULL); - state = wlan_reg_get_channel_state(pm_ctx->pdev, channel); + state = wlan_reg_get_channel_state_for_freq(pm_ctx->pdev, ch_freq); - policy_mgr_debug("sta_sap_scc_on_dfs_chan %u, sap_count %u, channel %u, state %u", - sta_sap_scc_on_dfs_chan, sap_count, channel, state); + policy_mgr_debug("sta_sap_scc_on_dfs_chan %u, sap_count %u, ch freq %u, state %u", + sta_sap_scc_on_dfs_chan, sap_count, ch_freq, state); if ((state == CHANNEL_STATE_ENABLE) || (sap_count == 0) || ((state == CHANNEL_STATE_DFS) && sta_sap_scc_on_dfs_chan)) { @@ -3875,7 +3872,8 @@ bool policy_mgr_is_valid_for_channel_switch(struct wlan_objmgr_psoc *psoc, return false; } -bool policy_mgr_is_sta_sap_scc(struct wlan_objmgr_psoc *psoc, uint8_t sap_ch) +bool policy_mgr_is_sta_sap_scc_int(struct wlan_objmgr_psoc *psoc, + uint32_t sap_freq) { uint32_t conn_index; bool is_scc = false; @@ -3897,9 +3895,9 @@ bool policy_mgr_is_sta_sap_scc(struct wlan_objmgr_psoc *psoc, uint8_t sap_ch) for (conn_index = 0; conn_index < MAX_NUMBER_OF_CONC_CONNECTIONS; conn_index++) { if (pm_conc_connection_list[conn_index].in_use && - (pm_conc_connection_list[conn_index].mode == - PM_STA_MODE) && - (sap_ch == pm_conc_connection_list[conn_index].chan)) { + (pm_conc_connection_list[conn_index].mode == + PM_STA_MODE) && (sap_freq == + pm_conc_connection_list[conn_index].freq)) { is_scc = true; break; } diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h index 5a2be24f2212..46c2f793f784 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h @@ -36,8 +36,8 @@ #define CONNECTION_UPDATE_TIMEOUT (POLICY_MGR_SER_CMD_TIMEOUT + 2000) #endif -#define PM_24_GHZ_CHANNEL_6 (6) -#define PM_5_GHZ_CHANNEL_36 (36) +#define PM_24_GHZ_CH_FREQ_6 (2437) +#define PM_5_GHZ_CH_FREQ_36 (5180) #define CHANNEL_SWITCH_COMPLETE_TIMEOUT (2000) /** @@ -291,7 +291,7 @@ struct policy_mgr_cfg { * interaction with Policy Manager * @sap_mandatory_channels: The user preferred master list on * which SAP can be brought up. This - * mandatory channel list would be as per + * mandatory channel freq list would be as per * OEMs preference & conforming to the * regulatory/other considerations * @sap_mandatory_channels_len: Length of the SAP mandatory @@ -313,12 +313,16 @@ struct policy_mgr_cfg { * change is in progress * @enable_mcc_adaptive_scheduler: Enable MCC adaptive scheduler * value from INI - * @unsafe_channel_list: LTE coex channel avoidance list + * @unsafe_channel_list: LTE coex channel freq avoidance list * @unsafe_channel_count: LTE coex channel avoidance list count * @sta_ap_intf_check_work_info: Info related to sta_ap_intf_check_work * @nan_sap_conc_work: Info related to nan sap conc work * @opportunistic_update_done_evt: qdf event to synchronize host * & FW HW mode + * @channel_switch_complete_evt: qdf event for channel switch completion check + * @mode_change_cb: Mode change callback + * @user_config_sap_ch_freq: SAP channel freq configured by user application + * @cfg: Policy manager config data */ struct policy_mgr_psoc_priv_obj { struct wlan_objmgr_psoc *psoc; @@ -332,7 +336,7 @@ struct policy_mgr_psoc_priv_obj { struct policy_mgr_tdls_cbacks tdls_cbacks; struct policy_mgr_cdp_cbacks cdp_cbacks; struct policy_mgr_dp_cbacks dp_cbacks; - uint8_t sap_mandatory_channels[QDF_MAX_NUM_CHAN]; + uint32_t sap_mandatory_channels[QDF_MAX_NUM_CHAN]; uint32_t sap_mandatory_channels_len; bool do_hw_mode_change; bool do_sap_unsafe_ch_check; @@ -348,14 +352,14 @@ struct policy_mgr_psoc_priv_obj { struct dual_mac_config dual_mac_cfg; uint32_t hw_mode_change_in_progress; struct policy_mgr_user_cfg user_cfg; - uint16_t unsafe_channel_list[QDF_MAX_NUM_CHAN]; + uint32_t unsafe_channel_list[QDF_MAX_NUM_CHAN]; uint16_t unsafe_channel_count; struct sta_ap_intf_check_work_ctx *sta_ap_intf_check_work_info; uint8_t cur_conc_system_pref; qdf_event_t opportunistic_update_done_evt; qdf_event_t channel_switch_complete_evt; send_mode_change_event_cb mode_change_cb; - uint32_t user_config_sap_channel; + uint32_t user_config_sap_ch_freq; struct policy_mgr_cfg cfg; }; @@ -433,7 +437,7 @@ QDF_STATUS policy_mgr_get_old_and_new_hw_index( void policy_mgr_update_conc_list(struct wlan_objmgr_psoc *psoc, uint32_t conn_index, enum policy_mgr_con_mode mode, - uint8_t chan, + uint32_t freq, enum hw_mode_bandwidth bw, uint8_t mac, enum policy_mgr_chain_mode chain_mask, @@ -471,7 +475,7 @@ void policy_mgr_store_and_del_conn_info_by_vdev_id( * policy_mgr_store_and_del_conn_info_by_chan_and_mode() - Store and del a * connection info by chan number and conn mode * @psoc: PSOC object information - * @chan: channel number + * @ch_freq: channel frequency value * @mode: conn mode * @info: structure array pointer where the connection info will be saved * @num_cxn_del: number of connection which are going to be deleted @@ -483,7 +487,7 @@ void policy_mgr_store_and_del_conn_info_by_vdev_id( */ void policy_mgr_store_and_del_conn_info_by_chan_and_mode( struct wlan_objmgr_psoc *psoc, - uint32_t chan, + uint32_t ch_freq, enum policy_mgr_con_mode mode, struct policy_mgr_conc_connection_info *info, uint8_t *num_cxn_del); @@ -532,15 +536,46 @@ enum phy_ch_width policy_mgr_get_ch_width(enum hw_mode_bandwidth bw); QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, enum policy_mgr_pcl_type pcl, - uint8_t *pcl_channels, uint32_t *len, + uint32_t *pcl_channels, uint32_t *len, enum policy_mgr_con_mode mode, uint8_t *pcl_weights, uint32_t weight_len); + +/** + * policy_mgr_allow_new_home_channel() - Check for allowed number of + * home channels + * @psoc: PSOC Pointer + * @mode: Connection mode + * @ch_freq: channel frequency on which new connection is coming up + * @num_connections: number of current connections + * + * When a new connection is about to come up check if current + * concurrency combination including the new connection is + * allowed or not based on the HW capability + * + * Return: True/False + */ bool policy_mgr_allow_new_home_channel( struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode, - uint8_t channel, uint32_t num_connections); + uint32_t ch_freq, uint32_t num_connections); + +/** + * policy_mgr_is_5g_channel_allowed() - check if 5g channel is allowed + * @ch_freq: channel frequency which needs to be validated + * @list: list of existing connections. + * @mode: mode against which channel needs to be validated + * + * This API takes the channel frequency as input and compares with existing + * connection channels. If existing connection's channel is DFS channel + * and provided channel is 5G channel then don't allow concurrency to + * happen as MCC with DFS channel is not yet supported + * + * Return: true if 5G channel is allowed, false if not allowed + * + */ bool policy_mgr_is_5g_channel_allowed(struct wlan_objmgr_psoc *psoc, - uint8_t channel, uint32_t *list, + uint32_t ch_freq, uint32_t *list, enum policy_mgr_con_mode mode); + 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, @@ -617,7 +652,7 @@ QDF_STATUS policy_mgr_nss_update(struct wlan_objmgr_psoc *psoc, * concurrency combination * @psoc: PSOC object information * @mode: new connection mode - * @channel: channel on which new connection is coming up + * @ch_freq: channel frequency on which new connection is coming up * @bw: Bandwidth requested by the connection (optional) * * When a new connection is about to come up check if current @@ -629,6 +664,6 @@ QDF_STATUS policy_mgr_nss_update(struct wlan_objmgr_psoc *psoc, */ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode, - uint8_t channel, + uint32_t ch_freq, enum hw_mode_bandwidth bw); #endif diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c index 3ba39eefd373..0b5e22bbd321 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c @@ -62,9 +62,10 @@ policy_mgr_next_action_two_connection_table_type policy_mgr_next_action_three_connection_table_type *next_action_three_connection_2x2_2g_1x1_5g_table; -QDF_STATUS policy_mgr_get_pcl_for_existing_conn(struct wlan_objmgr_psoc *psoc, +QDF_STATUS policy_mgr_get_pcl_for_existing_conn_int( + struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode, - uint8_t *pcl_ch, uint32_t *len, + uint32_t *pcl_ch, uint32_t *len, uint8_t *pcl_weight, uint32_t weight_len, bool all_matching_cxn_to_del) { @@ -81,15 +82,15 @@ QDF_STATUS policy_mgr_get_pcl_for_existing_conn(struct wlan_objmgr_psoc *psoc, policy_mgr_err("Invalid Context"); return QDF_STATUS_E_FAILURE; } - + *len = 0; qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); if (policy_mgr_mode_specific_connection_count(psoc, mode, NULL) > 0) { /* Check, store and temp delete the mode's parameter */ policy_mgr_store_and_del_conn_info(psoc, mode, all_matching_cxn_to_del, info, &num_cxn_del); /* Get the PCL */ - status = policy_mgr_get_pcl(psoc, mode, pcl_ch, len, - pcl_weight, weight_len); + status = policy_mgr_get_pcl_int(psoc, mode, pcl_ch, len, + pcl_weight, weight_len); policy_mgr_debug("Get PCL to FW for mode:%d", mode); /* Restore the connection info */ policy_mgr_restore_deleted_conn_info(psoc, info, num_cxn_del); @@ -99,6 +100,25 @@ QDF_STATUS policy_mgr_get_pcl_for_existing_conn(struct wlan_objmgr_psoc *psoc, return status; } +QDF_STATUS policy_mgr_get_pcl_for_existing_conn(struct wlan_objmgr_psoc *psoc, + enum policy_mgr_con_mode mode, + uint8_t *pcl_ch, uint32_t *len, + uint8_t *pcl_weight, + uint32_t weight_len, + bool all_matching_cxn_to_del) +{ + uint32_t i, pcl_freqs[QDF_MAX_NUM_CHAN] = {0}; + QDF_STATUS status; + + status = policy_mgr_get_pcl_for_existing_conn_int(psoc, mode, pcl_freqs, + len, pcl_weight, + weight_len, + all_matching_cxn_to_del); + for (i = 0; i < *len; i++) + pcl_ch[i] = wlan_freq_to_chan(pcl_freqs[i]); + return status; +} + void policy_mgr_decr_session_set_pcl(struct wlan_objmgr_psoc *psoc, enum QDF_OPMODE mode, uint8_t session_id) @@ -145,6 +165,7 @@ void policy_mgr_reg_chan_change_callback(struct wlan_objmgr_psoc *psoc, void *arg) { struct policy_mgr_psoc_priv_obj *pm_ctx; + uint32_t i; pm_ctx = policy_mgr_get_context(psoc); if (!pm_ctx) { @@ -165,20 +186,23 @@ void policy_mgr_reg_chan_change_callback(struct wlan_objmgr_psoc *psoc, pm_ctx->unsafe_channel_count = avoid_freq_ind->chan_list.ch_cnt >= NUM_CHANNELS ? NUM_CHANNELS : avoid_freq_ind->chan_list.ch_cnt; - if (pm_ctx->unsafe_channel_count) - qdf_mem_copy(pm_ctx->unsafe_channel_list, - avoid_freq_ind->chan_list.ch_list, - pm_ctx->unsafe_channel_count * - sizeof(pm_ctx->unsafe_channel_list[0])); + + for (i = 0; i < pm_ctx->unsafe_channel_count; i++) + pm_ctx->unsafe_channel_list[i] = + wlan_reg_chan_to_freq( + pm_ctx->pdev, avoid_freq_ind->chan_list.ch_list[i]); + policy_mgr_debug("Channel list update, received %d avoided channels", - pm_ctx->unsafe_channel_count); + pm_ctx->unsafe_channel_count); } -void policy_mgr_update_with_safe_channel_list(struct wlan_objmgr_psoc *psoc, - uint8_t *pcl_channels, uint32_t *len, - uint8_t *weight_list, uint32_t weight_len) +void policy_mgr_update_with_safe_channel_list_int(struct wlan_objmgr_psoc *psoc, + uint32_t *pcl_channels, + uint32_t *len, + uint8_t *weight_list, + uint32_t weight_len) { - uint8_t current_channel_list[QDF_MAX_NUM_CHAN]; + uint32_t current_channel_list[QDF_MAX_NUM_CHAN]; uint8_t org_weight_list[QDF_MAX_NUM_CHAN]; uint8_t is_unsafe = 1; uint8_t i, j; @@ -205,8 +229,9 @@ void policy_mgr_update_with_safe_channel_list(struct wlan_objmgr_psoc *psoc, } qdf_mem_copy(current_channel_list, pcl_channels, - current_channel_count); - qdf_mem_zero(pcl_channels, current_channel_count); + current_channel_count * sizeof(*current_channel_list)); + qdf_mem_zero(pcl_channels, + current_channel_count * sizeof(*pcl_channels)); qdf_mem_copy(org_weight_list, weight_list, QDF_MAX_NUM_CHAN); qdf_mem_zero(weight_list, weight_len); @@ -245,16 +270,34 @@ void policy_mgr_update_with_safe_channel_list(struct wlan_objmgr_psoc *psoc, return; } +void policy_mgr_update_with_safe_channel_list(struct wlan_objmgr_psoc *psoc, + uint8_t *pcl_channels, + uint32_t *len, + uint8_t *weight_list, + uint32_t weight_len) +{ + uint32_t i, pcl_freqs[QDF_MAX_NUM_CHAN]; + + for (i = 0; i < *len; i++) + pcl_freqs[i] = wlan_chan_to_freq(pcl_channels[i]); + + policy_mgr_update_with_safe_channel_list_int(psoc, pcl_freqs, len, + weight_list, weight_len); + + for (i = 0; i < *len; i++) + pcl_channels[i] = wlan_freq_to_chan(pcl_freqs[i]); +} + static QDF_STATUS policy_mgr_modify_pcl_based_on_enabled_channels( struct policy_mgr_psoc_priv_obj *pm_ctx, - uint8_t *pcl_list_org, + uint32_t *pcl_list_org, uint8_t *weight_list_org, uint32_t *pcl_len_org) { uint32_t i, pcl_len = 0; for (i = 0; i < *pcl_len_org; i++) { - if (!wlan_reg_is_passive_or_disable_ch( + if (!wlan_reg_is_passive_or_disable_for_freq( pm_ctx->pdev, pcl_list_org[i])) { pcl_list_org[pcl_len] = pcl_list_org[i]; weight_list_org[pcl_len++] = weight_list_org[i]; @@ -267,7 +310,7 @@ static QDF_STATUS policy_mgr_modify_pcl_based_on_enabled_channels( static QDF_STATUS policy_mgr_modify_pcl_based_on_dnbs( struct wlan_objmgr_psoc *psoc, - uint8_t *pcl_list_org, + uint32_t *pcl_list_org, uint8_t *weight_list_org, uint32_t *pcl_len_org) { @@ -295,20 +338,20 @@ static QDF_STATUS policy_mgr_modify_pcl_based_on_dnbs( } } - qdf_mem_zero(pcl_list_org, *pcl_len_org); + qdf_mem_zero(pcl_list_org, *pcl_len_org * sizeof(*pcl_list_org)); qdf_mem_zero(weight_list_org, *pcl_len_org); - qdf_mem_copy(pcl_list_org, pcl_list, pcl_len); + qdf_mem_copy(pcl_list_org, pcl_list, pcl_len * sizeof(*pcl_list_org)); qdf_mem_copy(weight_list_org, weight_list, pcl_len); *pcl_len_org = pcl_len; return QDF_STATUS_SUCCESS; } -uint8_t policy_mgr_get_channel(struct wlan_objmgr_psoc *psoc, - enum policy_mgr_con_mode mode, uint32_t *vdev_id) +uint32_t policy_mgr_get_channel_int(struct wlan_objmgr_psoc *psoc, + enum policy_mgr_con_mode mode, + uint32_t *vdev_id) { uint32_t idx = 0; - uint8_t chan; struct policy_mgr_psoc_priv_obj *pm_ctx; pm_ctx = policy_mgr_get_context(psoc); @@ -328,9 +371,8 @@ uint8_t policy_mgr_get_channel(struct wlan_objmgr_psoc *psoc, (!vdev_id || (*vdev_id == pm_conc_connection_list[idx].vdev_id)) && pm_conc_connection_list[idx].in_use) { - chan = pm_conc_connection_list[idx].chan; qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); - return chan; + return pm_conc_connection_list[idx].freq; } qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); } @@ -390,7 +432,7 @@ static QDF_STATUS policy_mgr_skip_dfs_ch(struct wlan_objmgr_psoc *psoc, */ static QDF_STATUS policy_mgr_modify_sap_pcl_based_on_dfs( struct wlan_objmgr_psoc *psoc, - uint8_t *pcl_list_org, + uint32_t *pcl_list_org, uint8_t *weight_list_org, uint32_t *pcl_len_org) { @@ -421,7 +463,7 @@ static QDF_STATUS policy_mgr_modify_sap_pcl_based_on_dfs( } for (i = 0; i < *pcl_len_org; i++) { - if (!wlan_reg_is_dfs_ch(pm_ctx->pdev, pcl_list_org[i])) { + if (!wlan_reg_is_dfs_for_freq(pm_ctx->pdev, pcl_list_org[i])) { pcl_list_org[pcl_len] = pcl_list_org[i]; weight_list_org[pcl_len++] = weight_list_org[i]; } @@ -434,12 +476,12 @@ static QDF_STATUS policy_mgr_modify_sap_pcl_based_on_dfs( static QDF_STATUS policy_mgr_modify_sap_pcl_based_on_nol( struct wlan_objmgr_psoc *psoc, - uint8_t *pcl_list_org, + uint32_t *pcl_list_org, uint8_t *weight_list_org, uint32_t *pcl_len_org) { uint32_t i, pcl_len = 0; - uint8_t pcl_list[QDF_MAX_NUM_CHAN]; + uint32_t pcl_list[QDF_MAX_NUM_CHAN]; uint8_t weight_list[QDF_MAX_NUM_CHAN]; struct policy_mgr_psoc_priv_obj *pm_ctx; @@ -454,15 +496,16 @@ static QDF_STATUS policy_mgr_modify_sap_pcl_based_on_nol( } for (i = 0; i < *pcl_len_org; i++) { - if (!wlan_reg_is_disable_ch(pm_ctx->pdev, pcl_list_org[i])) { + if (!wlan_reg_is_disable_for_freq( + pm_ctx->pdev, pcl_list_org[i])) { pcl_list[pcl_len] = pcl_list_org[i]; weight_list[pcl_len++] = weight_list_org[i]; } } - qdf_mem_zero(pcl_list_org, *pcl_len_org); + qdf_mem_zero(pcl_list_org, *pcl_len_org * sizeof(*pcl_list_org)); qdf_mem_zero(weight_list_org, *pcl_len_org); - qdf_mem_copy(pcl_list_org, pcl_list, pcl_len); + qdf_mem_copy(pcl_list_org, pcl_list, pcl_len * sizeof(*pcl_list_org)); qdf_mem_copy(weight_list_org, weight_list, pcl_len); *pcl_len_org = pcl_len; @@ -471,12 +514,12 @@ static QDF_STATUS policy_mgr_modify_sap_pcl_based_on_nol( static QDF_STATUS policy_mgr_modify_pcl_based_on_srd(struct wlan_objmgr_psoc *psoc, - uint8_t *pcl_list_org, + uint32_t *pcl_list_org, uint8_t *weight_list_org, uint32_t *pcl_len_org) { uint32_t i, pcl_len = 0; - uint8_t pcl_list[QDF_MAX_NUM_CHAN]; + uint32_t pcl_list[QDF_MAX_NUM_CHAN]; uint8_t weight_list[QDF_MAX_NUM_CHAN]; struct policy_mgr_psoc_priv_obj *pm_ctx; bool is_etsi13_srd_chan_allowed_in_mas_mode = true; @@ -497,16 +540,16 @@ policy_mgr_modify_pcl_based_on_srd(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_E_FAILURE; } for (i = 0; i < *pcl_len_org; i++) { - if (wlan_reg_is_etsi13_srd_chan(pm_ctx->pdev, - pcl_list_org[i])) + if (wlan_reg_is_etsi13_srd_chan_for_freq( + pm_ctx->pdev, pcl_list_org[i])) continue; pcl_list[pcl_len] = pcl_list_org[i]; weight_list[pcl_len++] = weight_list_org[i]; } - qdf_mem_zero(pcl_list_org, *pcl_len_org); + qdf_mem_zero(pcl_list_org, *pcl_len_org * sizeof(*pcl_list_org)); qdf_mem_zero(weight_list_org, *pcl_len_org); - qdf_mem_copy(pcl_list_org, pcl_list, pcl_len); + qdf_mem_copy(pcl_list_org, pcl_list, pcl_len * sizeof(*pcl_list_org)); qdf_mem_copy(weight_list_org, weight_list, pcl_len); *pcl_len_org = pcl_len; @@ -515,7 +558,7 @@ policy_mgr_modify_pcl_based_on_srd(struct wlan_objmgr_psoc *psoc, static QDF_STATUS policy_mgr_pcl_modification_for_sap( struct wlan_objmgr_psoc *psoc, - uint8_t *pcl_channels, uint8_t *pcl_weight, + uint32_t *pcl_channels, uint8_t *pcl_weight, uint32_t *len) { QDF_STATUS status = QDF_STATUS_E_FAILURE; @@ -573,7 +616,7 @@ static QDF_STATUS policy_mgr_pcl_modification_for_sap( static QDF_STATUS policy_mgr_pcl_modification_for_p2p_go( struct wlan_objmgr_psoc *psoc, - uint8_t *pcl_channels, uint8_t *pcl_weight, + uint32_t *pcl_channels, uint8_t *pcl_weight, uint32_t *len) { QDF_STATUS status = QDF_STATUS_E_FAILURE; @@ -601,15 +644,15 @@ static QDF_STATUS policy_mgr_pcl_modification_for_p2p_go( } policy_mgr_debug("modified pcl len:%d", *len); for (i = 0; i < *len; i++) - policy_mgr_debug("chan:%d weight:%d", - pcl_channels[i], pcl_weight[i]); + policy_mgr_debug("ch freq:%d weight:%d", + pcl_channels[i], pcl_weight[i]); return QDF_STATUS_SUCCESS; } static QDF_STATUS policy_mgr_mode_specific_modification_on_pcl( struct wlan_objmgr_psoc *psoc, - uint8_t *pcl_channels, uint8_t *pcl_weight, + uint32_t *pcl_channels, uint8_t *pcl_weight, uint32_t *len, enum policy_mgr_con_mode mode) { QDF_STATUS status = QDF_STATUS_E_FAILURE; @@ -680,10 +723,10 @@ static inline enum policy_mgr_pcl_type policy_mgr_get_pcl_4_port( {return PM_MAX_PCL_TYPE; } #endif -QDF_STATUS policy_mgr_get_pcl(struct wlan_objmgr_psoc *psoc, - enum policy_mgr_con_mode mode, - uint8_t *pcl_channels, uint32_t *len, - uint8_t *pcl_weight, uint32_t weight_len) +QDF_STATUS policy_mgr_get_pcl_int(struct wlan_objmgr_psoc *psoc, + enum policy_mgr_con_mode mode, + uint32_t *pcl_channels, uint32_t *len, + uint8_t *pcl_weight, uint32_t weight_len) { QDF_STATUS status = QDF_STATUS_E_FAILURE; uint32_t num_connections = 0, i; @@ -812,6 +855,23 @@ QDF_STATUS policy_mgr_get_pcl(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_SUCCESS; } +QDF_STATUS policy_mgr_get_pcl(struct wlan_objmgr_psoc *psoc, + enum policy_mgr_con_mode mode, + uint8_t *pcl_channels, uint32_t *len, + uint8_t *pcl_weight, uint32_t weight_len) +{ + uint32_t i, pcl_freqs[QDF_MAX_NUM_CHAN] = {0}; + QDF_STATUS status; + + status = policy_mgr_get_pcl_int(psoc, mode, pcl_freqs, len, pcl_weight, + weight_len); + + for (i = 0; i < *len; i++) + pcl_channels[i] = wlan_freq_to_chan(pcl_freqs[i]); + + return status; +} + enum policy_mgr_conc_priority_mode policy_mgr_get_first_connection_pcl_table_index( struct wlan_objmgr_psoc *psoc) @@ -845,7 +905,8 @@ enum policy_mgr_one_connection_mode qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); if (PM_STA_MODE == pm_conc_connection_list[0].mode) { - if (WLAN_REG_IS_24GHZ_CH(pm_conc_connection_list[0].chan)) { + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_STA_24_1x1; @@ -859,7 +920,8 @@ enum policy_mgr_one_connection_mode index = PM_STA_5_2x2; } } else if (PM_SAP_MODE == pm_conc_connection_list[0].mode) { - if (WLAN_REG_IS_24GHZ_CH(pm_conc_connection_list[0].chan)) { + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_SAP_24_1x1; @@ -873,7 +935,8 @@ enum policy_mgr_one_connection_mode index = PM_SAP_5_2x2; } } else if (PM_P2P_CLIENT_MODE == pm_conc_connection_list[0].mode) { - if (WLAN_REG_IS_24GHZ_CH(pm_conc_connection_list[0].chan)) { + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_P2P_CLI_24_1x1; @@ -887,7 +950,8 @@ enum policy_mgr_one_connection_mode index = PM_P2P_CLI_5_2x2; } } else if (PM_P2P_GO_MODE == pm_conc_connection_list[0].mode) { - if (WLAN_REG_IS_24GHZ_CH(pm_conc_connection_list[0].chan)) { + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_P2P_GO_24_1x1; @@ -901,7 +965,8 @@ enum policy_mgr_one_connection_mode index = PM_P2P_GO_5_2x2; } } else if (PM_IBSS_MODE == pm_conc_connection_list[0].mode) { - if (WLAN_REG_IS_24GHZ_CH(pm_conc_connection_list[0].chan)) { + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_IBSS_24_1x1; @@ -921,10 +986,10 @@ enum policy_mgr_one_connection_mode index = PM_NAN_DISC_24_2x2; } - policy_mgr_debug("mode:%d chan:%d chain:%d index:%d", - pm_conc_connection_list[0].mode, - pm_conc_connection_list[0].chan, - pm_conc_connection_list[0].chain_mask, index); + policy_mgr_debug("mode:%d freq:%d chain:%d index:%d", + pm_conc_connection_list[0].mode, + pm_conc_connection_list[0].freq, + pm_conc_connection_list[0].chain_mask, index); qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); @@ -936,10 +1001,10 @@ static enum policy_mgr_two_connection_mode { enum policy_mgr_two_connection_mode index = PM_MAX_TWO_CONNECTION_MODE; /* SCC */ - if (pm_conc_connection_list[0].chan == - pm_conc_connection_list[1].chan) { - if (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[0].chan)) { + if (pm_conc_connection_list[0].freq == + pm_conc_connection_list[1].freq) { + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_P2P_CLI_SAP_SCC_24_1x1; @@ -955,19 +1020,19 @@ static enum policy_mgr_two_connection_mode /* MCC */ } else if (pm_conc_connection_list[0].mac == pm_conc_connection_list[1].mac) { - if ((WLAN_REG_IS_24GHZ_CH - (pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_24GHZ_CH - (pm_conc_connection_list[1].chan))) { + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq) && + WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[1].freq)) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_P2P_CLI_SAP_MCC_24_1x1; else index = PM_P2P_CLI_SAP_MCC_24_2x2; - } else if ((WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[1].chan))) { + } else if ((WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) && + (WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[1].freq))) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_P2P_CLI_SAP_MCC_5_1x1; @@ -984,8 +1049,10 @@ static enum policy_mgr_two_connection_mode } else if (pm_conc_connection_list[0].mac != pm_conc_connection_list[1].mac) { /* SBS */ - if ((WLAN_REG_IS_5GHZ_CH(pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_5GHZ_CH(pm_conc_connection_list[1].chan))) { + if ((WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) && + (WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[1].freq))) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_P2P_CLI_SAP_SBS_5_1x1; @@ -1006,10 +1073,10 @@ static enum policy_mgr_two_connection_mode { enum policy_mgr_two_connection_mode index = PM_MAX_TWO_CONNECTION_MODE; /* SCC */ - if (pm_conc_connection_list[0].chan == - pm_conc_connection_list[1].chan) { - if (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[0].chan)) { + if (pm_conc_connection_list[0].freq == + pm_conc_connection_list[1].freq) { + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_STA_SAP_SCC_24_1x1; @@ -1025,19 +1092,19 @@ static enum policy_mgr_two_connection_mode /* MCC */ } else if (pm_conc_connection_list[0].mac == pm_conc_connection_list[1].mac) { - if ((WLAN_REG_IS_24GHZ_CH - (pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_24GHZ_CH - (pm_conc_connection_list[1].chan))) { + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq) && + WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[1].freq)) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_STA_SAP_MCC_24_1x1; else index = PM_STA_SAP_MCC_24_2x2; - } else if ((WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[1].chan))) { + } else if (WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[0].freq) && + WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[1].freq)) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_STA_SAP_MCC_5_1x1; @@ -1054,8 +1121,10 @@ static enum policy_mgr_two_connection_mode } else if (pm_conc_connection_list[0].mac != pm_conc_connection_list[1].mac) { /* SBS */ - if ((WLAN_REG_IS_5GHZ_CH(pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_5GHZ_CH(pm_conc_connection_list[1].chan))) { + if ((WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) && + (WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[1].freq))) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_STA_SAP_SBS_5_1x1; @@ -1076,10 +1145,10 @@ static enum policy_mgr_two_connection_mode { enum policy_mgr_two_connection_mode index = PM_MAX_TWO_CONNECTION_MODE; /* SCC */ - if (pm_conc_connection_list[0].chan == - pm_conc_connection_list[1].chan) { - if (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[0].chan)) { + if (pm_conc_connection_list[0].freq == + pm_conc_connection_list[1].freq) { + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_SAP_SAP_SCC_24_1x1; @@ -1095,19 +1164,19 @@ static enum policy_mgr_two_connection_mode /* MCC */ } else if (pm_conc_connection_list[0].mac == pm_conc_connection_list[1].mac) { - if ((WLAN_REG_IS_24GHZ_CH - (pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_24GHZ_CH - (pm_conc_connection_list[1].chan))) { + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq) && + WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[1].freq)) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_SAP_SAP_MCC_24_1x1; else index = PM_SAP_SAP_MCC_24_2x2; - } else if ((WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[1].chan))) { + } else if (WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[0].freq) && + WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[1].freq)) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_SAP_SAP_MCC_5_1x1; @@ -1124,8 +1193,10 @@ static enum policy_mgr_two_connection_mode } else if (pm_conc_connection_list[0].mac != pm_conc_connection_list[1].mac) { /* SBS */ - if ((WLAN_REG_IS_5GHZ_CH(pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_5GHZ_CH(pm_conc_connection_list[1].chan))) { + if (WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[0].freq) && + WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[1].freq)) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_SAP_SAP_SBS_5_1x1; @@ -1146,18 +1217,18 @@ static enum policy_mgr_two_connection_mode { enum policy_mgr_two_connection_mode index = PM_MAX_TWO_CONNECTION_MODE; /* SCC */ - if (pm_conc_connection_list[0].chan == - pm_conc_connection_list[1].chan) { - if (WLAN_REG_IS_24GHZ_CH - (pm_conc_connection_list[0].chan)) { + if (pm_conc_connection_list[0].freq == + pm_conc_connection_list[1].freq) { + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) { if (POLICY_MGR_ONE_ONE == - pm_conc_connection_list[0].chain_mask) + pm_conc_connection_list[0].chain_mask) index = PM_STA_P2P_GO_SCC_24_1x1; else index = PM_STA_P2P_GO_SCC_24_2x2; } else { if (POLICY_MGR_ONE_ONE == - pm_conc_connection_list[0].chain_mask) + pm_conc_connection_list[0].chain_mask) index = PM_STA_P2P_GO_SCC_5_1x1; else index = PM_STA_P2P_GO_SCC_5_2x2; @@ -1165,19 +1236,19 @@ static enum policy_mgr_two_connection_mode /* MCC */ } else if (pm_conc_connection_list[0].mac == pm_conc_connection_list[1].mac) { - if ((WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_24GHZ_CH - (pm_conc_connection_list[1].chan))) { + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq) && + WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[1].freq)) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_STA_P2P_GO_MCC_24_1x1; else index = PM_STA_P2P_GO_MCC_24_2x2; - } else if ((WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[1].chan))) { + } else if (WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[0].freq) && + WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[1].freq)) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_STA_P2P_GO_MCC_5_1x1; @@ -1194,8 +1265,10 @@ static enum policy_mgr_two_connection_mode } else if (pm_conc_connection_list[0].mac != pm_conc_connection_list[1].mac) { /* SBS */ - if ((WLAN_REG_IS_5GHZ_CH(pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_5GHZ_CH(pm_conc_connection_list[1].chan))) { + if ((WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) && + (WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[1].freq))) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_STA_P2P_GO_SBS_5_1x1; @@ -1216,18 +1289,18 @@ static enum policy_mgr_two_connection_mode { enum policy_mgr_two_connection_mode index = PM_MAX_TWO_CONNECTION_MODE; /* SCC */ - if (pm_conc_connection_list[0].chan == - pm_conc_connection_list[1].chan) { - if (WLAN_REG_IS_24GHZ_CH - (pm_conc_connection_list[0].chan)) { + if (pm_conc_connection_list[0].freq == + pm_conc_connection_list[1].freq) { + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) { if (POLICY_MGR_ONE_ONE == - pm_conc_connection_list[0].chain_mask) + pm_conc_connection_list[0].chain_mask) index = PM_STA_P2P_CLI_SCC_24_1x1; else index = PM_STA_P2P_CLI_SCC_24_2x2; } else { if (POLICY_MGR_ONE_ONE == - pm_conc_connection_list[0].chain_mask) + pm_conc_connection_list[0].chain_mask) index = PM_STA_P2P_CLI_SCC_5_1x1; else index = PM_STA_P2P_CLI_SCC_5_2x2; @@ -1235,19 +1308,19 @@ static enum policy_mgr_two_connection_mode /* MCC */ } else if (pm_conc_connection_list[0].mac == pm_conc_connection_list[1].mac) { - if ((WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[1].chan))) { + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq) && + WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[1].freq)) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_STA_P2P_CLI_MCC_24_1x1; else index = PM_STA_P2P_CLI_MCC_24_2x2; - } else if ((WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[1].chan))) { + } else if ((WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) && + (WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[1].freq))) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_STA_P2P_CLI_MCC_5_1x1; @@ -1264,8 +1337,10 @@ static enum policy_mgr_two_connection_mode } else if (pm_conc_connection_list[0].mac != pm_conc_connection_list[1].mac) { /* SBS */ - if ((WLAN_REG_IS_5GHZ_CH(pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_5GHZ_CH(pm_conc_connection_list[1].chan))) { + if ((WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) && + (WLAN_REG_IS_5GHZ_CH( + pm_conc_connection_list[1].freq))) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_STA_P2P_CLI_SBS_5_1x1; @@ -1286,10 +1361,10 @@ static enum policy_mgr_two_connection_mode { enum policy_mgr_two_connection_mode index = PM_MAX_TWO_CONNECTION_MODE; /* SCC */ - if (pm_conc_connection_list[0].chan == - pm_conc_connection_list[1].chan) { - if (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[0].chan)) { + if (pm_conc_connection_list[0].freq == + pm_conc_connection_list[1].freq) { + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_P2P_GO_P2P_CLI_SCC_24_1x1; @@ -1305,19 +1380,19 @@ static enum policy_mgr_two_connection_mode /* MCC */ } else if (pm_conc_connection_list[0].mac == pm_conc_connection_list[1].mac) { - if ((WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[1].chan))) { + if ((WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) && + (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[1].freq))) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_P2P_GO_P2P_CLI_MCC_24_1x1; else index = PM_P2P_GO_P2P_CLI_MCC_24_2x2; - } else if ((WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[1].chan))) { + } else if ((WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) && + (WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[1].freq))) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_P2P_GO_P2P_CLI_MCC_5_1x1; @@ -1334,8 +1409,10 @@ static enum policy_mgr_two_connection_mode } else if (pm_conc_connection_list[0].mac != pm_conc_connection_list[1].mac) { /* SBS */ - if ((WLAN_REG_IS_5GHZ_CH(pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_5GHZ_CH(pm_conc_connection_list[1].chan))) { + if ((WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) && + (WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[1].freq))) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_P2P_GO_P2P_CLI_SBS_5_1x1; @@ -1356,10 +1433,10 @@ static enum policy_mgr_two_connection_mode { enum policy_mgr_two_connection_mode index = PM_MAX_TWO_CONNECTION_MODE; /* SCC */ - if (pm_conc_connection_list[0].chan == - pm_conc_connection_list[1].chan) { - if (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[0].chan)) { + if (pm_conc_connection_list[0].freq == + pm_conc_connection_list[1].freq) { + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_P2P_GO_SAP_SCC_24_1x1; @@ -1375,19 +1452,19 @@ static enum policy_mgr_two_connection_mode /* MCC */ } else if (pm_conc_connection_list[0].mac == pm_conc_connection_list[1].mac) { - if ((WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[1].chan))) { + if ((WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) && + (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[1].freq))) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_P2P_GO_SAP_MCC_24_1x1; else index = PM_P2P_GO_SAP_MCC_24_2x2; - } else if ((WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[1].chan))) { + } else if ((WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) && + (WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[1].freq))) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_P2P_GO_SAP_MCC_5_1x1; @@ -1404,8 +1481,10 @@ static enum policy_mgr_two_connection_mode } else if (pm_conc_connection_list[0].mac != pm_conc_connection_list[1].mac) { /* SBS */ - if ((WLAN_REG_IS_5GHZ_CH(pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_5GHZ_CH(pm_conc_connection_list[1].chan))) { + if ((WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) && + (WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[1].freq))) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_P2P_GO_SAP_SBS_5_1x1; @@ -1426,38 +1505,38 @@ static enum policy_mgr_two_connection_mode { enum policy_mgr_two_connection_mode index = PM_MAX_TWO_CONNECTION_MODE; /* SCC */ - if (pm_conc_connection_list[0].chan == - pm_conc_connection_list[1].chan) { - if (WLAN_REG_IS_24GHZ_CH - (pm_conc_connection_list[0].chan)) { + if (pm_conc_connection_list[0].freq == + pm_conc_connection_list[1].freq) { + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) { if (POLICY_MGR_ONE_ONE == - pm_conc_connection_list[0].chain_mask) + pm_conc_connection_list[0].chain_mask) index = PM_STA_STA_SCC_24_1x1; else index = PM_STA_STA_SCC_24_2x2; } else { if (POLICY_MGR_ONE_ONE == - pm_conc_connection_list[0].chain_mask) + pm_conc_connection_list[0].chain_mask) index = PM_STA_STA_SCC_5_1x1; else index = PM_STA_STA_SCC_5_2x2; } /* MCC */ } else if (pm_conc_connection_list[0].mac == - pm_conc_connection_list[1].mac) { - if ((WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[1].chan))) { + pm_conc_connection_list[1].mac) { + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq) && + WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[1].freq)) { if (POLICY_MGR_ONE_ONE == - pm_conc_connection_list[0].chain_mask) + pm_conc_connection_list[0].chain_mask) index = PM_STA_STA_MCC_24_1x1; else index = PM_STA_STA_MCC_24_2x2; - } else if ((WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[1].chan))) { + } else if (WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[0].freq) && + WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[1].freq)) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_STA_STA_MCC_5_1x1; @@ -1474,8 +1553,10 @@ static enum policy_mgr_two_connection_mode } else if (pm_conc_connection_list[0].mac != pm_conc_connection_list[1].mac) { /* SBS */ - if ((WLAN_REG_IS_5GHZ_CH(pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_5GHZ_CH(pm_conc_connection_list[1].chan))) { + if ((WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) && + (WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[1].freq))) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_STA_STA_SBS_5_1x1; @@ -1496,10 +1577,10 @@ static enum policy_mgr_two_connection_mode { enum policy_mgr_two_connection_mode index = PM_MAX_TWO_CONNECTION_MODE; /* SCC */ - if (pm_conc_connection_list[0].chan == - pm_conc_connection_list[1].chan) { - if (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[0].chan)) { + if (pm_conc_connection_list[0].freq == + pm_conc_connection_list[1].freq) { + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_P2P_GO_P2P_GO_SCC_24_1x1; @@ -1515,19 +1596,19 @@ static enum policy_mgr_two_connection_mode /* MCC */ } else if (pm_conc_connection_list[0].mac == pm_conc_connection_list[1].mac) { - if ((WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[1].chan))) { + if ((WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) && + (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[1].freq))) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_P2P_GO_P2P_GO_MCC_24_1x1; else index = PM_P2P_GO_P2P_GO_MCC_24_2x2; - } else if ((WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[1].chan))) { + } else if ((WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) && + (WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[1].freq))) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_P2P_GO_P2P_GO_MCC_5_1x1; @@ -1544,8 +1625,10 @@ static enum policy_mgr_two_connection_mode } else if (pm_conc_connection_list[0].mac != pm_conc_connection_list[1].mac) { /* SBS */ - if ((WLAN_REG_IS_5GHZ_CH(pm_conc_connection_list[0].chan)) && - (WLAN_REG_IS_5GHZ_CH(pm_conc_connection_list[1].chan))) { + if ((WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[0].freq)) && + (WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[1].freq))) { if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_P2P_GO_P2P_GO_SBS_5_1x1; @@ -1566,8 +1649,8 @@ static enum policy_mgr_two_connection_mode { enum policy_mgr_two_connection_mode index = PM_MAX_TWO_CONNECTION_MODE; /* SCC */ - if (pm_conc_connection_list[0].chan == - pm_conc_connection_list[1].chan) { + if (pm_conc_connection_list[0].freq == + pm_conc_connection_list[1].freq) { /* NAN Discovery can only be on 2.4GHz */ if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_NAN_DISC_NDI_SCC_24_1x1; @@ -1597,8 +1680,8 @@ static enum policy_mgr_two_connection_mode { enum policy_mgr_two_connection_mode index = PM_MAX_TWO_CONNECTION_MODE; /* SCC */ - if (pm_conc_connection_list[0].chan == - pm_conc_connection_list[1].chan) { + if (pm_conc_connection_list[0].freq == + pm_conc_connection_list[1].freq) { /* NAN Discovery can only be on 2.4GHz */ if (POLICY_MGR_ONE_ONE == pm_conc_connection_list[0].chain_mask) index = PM_STA_NAN_DISC_SCC_24_1x1; @@ -1700,12 +1783,12 @@ enum policy_mgr_two_connection_mode index = policy_mgr_get_third_connection_pcl_table_index_go_go(); - policy_mgr_debug("mode0:%d mode1:%d chan0:%d chan1:%d chain:%d index:%d", - pm_conc_connection_list[0].mode, - pm_conc_connection_list[1].mode, - pm_conc_connection_list[0].chan, - pm_conc_connection_list[1].chan, - pm_conc_connection_list[0].chain_mask, index); + policy_mgr_debug("mode0:%d mode1:%d freq0:%d freq1:%d chain:%d index:%d", + pm_conc_connection_list[0].mode, + pm_conc_connection_list[1].mode, + pm_conc_connection_list[0].freq, + pm_conc_connection_list[1].freq, + pm_conc_connection_list[0].chain_mask, index); qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); @@ -1747,36 +1830,36 @@ enum policy_mgr_three_connection_mode if (count_sap == 2 && count_sta == 1) { policy_mgr_debug( "channel: sap0: %d, sap1: %d, sta0: %d", - pm_conc_connection_list[list_sap[0]].chan, - pm_conc_connection_list[list_sap[1]].chan, - pm_conc_connection_list[list_sta[0]].chan); - if (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[list_sap[0]].chan) && - WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[list_sta[0]].chan) && - WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[list_sap[1]].chan)) { + pm_conc_connection_list[list_sap[0]].freq, + pm_conc_connection_list[list_sap[1]].freq, + pm_conc_connection_list[list_sta[0]].freq); + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[list_sap[0]].freq) && + WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[list_sta[0]].freq) && + WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[list_sap[1]].freq)) { index = PM_STA_SAP_SCC_24_SAP_5_DBS; - } else if (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[list_sap[1]].chan) && - WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[list_sta[0]].chan) && - WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[list_sap[0]].chan)) { + } else if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[list_sap[1]].freq) && + WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[list_sta[0]].freq) && + WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[list_sap[0]].freq)) { index = PM_STA_SAP_SCC_24_SAP_5_DBS; - } else if (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[list_sap[0]].chan) && - WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[list_sta[0]].chan) && - WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[list_sap[1]].chan)) { + } else if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[list_sap[0]].freq) && + WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[list_sta[0]].freq) && + WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[list_sap[1]].freq)) { index = PM_STA_SAP_SCC_5_SAP_24_DBS; - } else if (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[list_sap[1]].chan) && - WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[list_sta[0]].chan) && - WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[list_sap[0]].chan)) { + } else if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[list_sap[1]].freq) && + WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[list_sta[0]].freq) && + WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[list_sap[0]].freq)) { index = PM_STA_SAP_SCC_5_SAP_24_DBS; } else { index = PM_MAX_THREE_CONNECTION_MODE; @@ -1784,36 +1867,36 @@ enum policy_mgr_three_connection_mode } else if (count_sap == 1 && count_sta == 2) { policy_mgr_debug( "channel: sap0: %d, sta0: %d, sta1: %d", - pm_conc_connection_list[list_sap[0]].chan, - pm_conc_connection_list[list_sta[0]].chan, - pm_conc_connection_list[list_sta[1]].chan); - if (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[list_sta[0]].chan) && - WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[list_sap[0]].chan) && - WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[list_sta[1]].chan)) { + pm_conc_connection_list[list_sap[0]].freq, + pm_conc_connection_list[list_sta[0]].freq, + pm_conc_connection_list[list_sta[1]].freq); + if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[list_sta[0]].freq) && + WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[list_sap[0]].freq) && + WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[list_sta[1]].freq)) { index = PM_STA_SAP_SCC_24_STA_5_DBS; - } else if (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[list_sta[1]].chan) && - WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[list_sap[0]].chan) && - WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[list_sta[0]].chan)) { + } else if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[list_sta[1]].freq) && + WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[list_sap[0]].freq) && + WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[list_sta[0]].freq)) { index = PM_STA_SAP_SCC_24_STA_5_DBS; - } else if (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[list_sta[0]].chan) && - WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[list_sap[0]].chan) && - WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[list_sta[1]].chan)) { + } else if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[list_sta[0]].freq) && + WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[list_sap[0]].freq) && + WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[list_sta[1]].freq)) { index = PM_STA_SAP_SCC_5_STA_24_DBS; - } else if (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[list_sta[1]].chan) && - WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[list_sap[0]].chan) && - WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[list_sta[0]].chan)) { + } else if (WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[list_sta[1]].freq) && + WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[list_sap[0]].freq) && + WLAN_REG_IS_5GHZ_CH_FREQ( + pm_conc_connection_list[list_sta[0]].freq)) { index = PM_STA_SAP_SCC_5_STA_24_DBS; } else { index = PM_MAX_THREE_CONNECTION_MODE; @@ -1825,9 +1908,9 @@ enum policy_mgr_three_connection_mode pm_conc_connection_list[0].mode, pm_conc_connection_list[1].mode, pm_conc_connection_list[2].mode, - pm_conc_connection_list[0].chan, - pm_conc_connection_list[1].chan, - pm_conc_connection_list[2].chan, + pm_conc_connection_list[0].freq, + pm_conc_connection_list[1].freq, + pm_conc_connection_list[2].freq, pm_conc_connection_list[0].chain_mask, index); qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); @@ -1836,12 +1919,12 @@ enum policy_mgr_three_connection_mode } #endif -uint8_t -policy_mgr_get_nondfs_preferred_channel(struct wlan_objmgr_psoc *psoc, - enum policy_mgr_con_mode mode, - bool for_existing_conn) +uint32_t +policy_mgr_get_nondfs_preferred_channel_int(struct wlan_objmgr_psoc *psoc, + enum policy_mgr_con_mode mode, + bool for_existing_conn) { - uint8_t pcl_channels[QDF_MAX_NUM_CHAN]; + uint32_t pcl_channels[QDF_MAX_NUM_CHAN]; uint8_t pcl_weight[QDF_MAX_NUM_CHAN]; struct policy_mgr_psoc_priv_obj *pm_ctx; @@ -1850,15 +1933,15 @@ policy_mgr_get_nondfs_preferred_channel(struct wlan_objmgr_psoc *psoc, * then return 2.4G channel, so atleast we won't fall * under 5G MCC scenario */ - uint8_t channel = PM_24_GHZ_CHANNEL_6; - uint32_t i, pcl_len = 0; + uint32_t i, pcl_len = 0, non_dfs_freq, freq; pm_ctx = policy_mgr_get_context(psoc); if (!pm_ctx) { policy_mgr_err("Invalid Context"); - return channel; + return PM_24_GHZ_CH_FREQ_6; } + freq = PM_24_GHZ_CH_FREQ_6; if (true == for_existing_conn) { /* * First try to see if there is any non-dfs channel already @@ -1866,36 +1949,37 @@ policy_mgr_get_nondfs_preferred_channel(struct wlan_objmgr_psoc *psoc, * that channel */ if (true == policy_mgr_is_any_nondfs_chnl_present( - psoc, &channel)) - return channel; + psoc, &non_dfs_freq)) + return non_dfs_freq; - if (QDF_STATUS_SUCCESS != policy_mgr_get_pcl_for_existing_conn( + if (QDF_STATUS_SUCCESS != + policy_mgr_get_pcl_for_existing_conn_int( psoc, mode, - &pcl_channels[0], &pcl_len, + pcl_channels, &pcl_len, pcl_weight, QDF_ARRAY_SIZE(pcl_weight), false)) - return channel; + return freq; } else { - if (QDF_STATUS_SUCCESS != policy_mgr_get_pcl(psoc, mode, - &pcl_channels[0], &pcl_len, - pcl_weight, QDF_ARRAY_SIZE(pcl_weight))) - return channel; + if (QDF_STATUS_SUCCESS != policy_mgr_get_pcl_int( + psoc, mode, pcl_channels, &pcl_len, pcl_weight, + QDF_ARRAY_SIZE(pcl_weight))) + return freq; } for (i = 0; i < pcl_len; i++) { - if (wlan_reg_is_dfs_ch(pm_ctx->pdev, pcl_channels[i]) || - !policy_mgr_is_safe_channel(psoc, pcl_channels[i])) { + if (wlan_reg_is_dfs_for_freq(pm_ctx->pdev, pcl_channels[i]) || + !policy_mgr_is_safe_channel_int(psoc, pcl_channels[i])) { continue; } else { - channel = pcl_channels[i]; + freq = pcl_channels[i]; break; } } - return channel; + return freq; } -static void policy_mgr_remove_dsrc_channels(uint8_t *chan_list, +static void policy_mgr_remove_dsrc_channels(uint32_t *ch_freq_list, uint32_t *num_channels, struct wlan_objmgr_pdev *pdev) { @@ -1903,8 +1987,8 @@ static void policy_mgr_remove_dsrc_channels(uint8_t *chan_list, int i; for (i = 0; i < *num_channels; i++) { - if (!wlan_reg_is_dsrc_chan(pdev, chan_list[i])) { - chan_list[num_chan_temp] = chan_list[i]; + if (!wlan_reg_is_dsrc_freq(ch_freq_list[i])) { + ch_freq_list[num_chan_temp] = ch_freq_list[i]; num_chan_temp++; } } @@ -1912,17 +1996,16 @@ static void policy_mgr_remove_dsrc_channels(uint8_t *chan_list, *num_channels = num_chan_temp; } -QDF_STATUS policy_mgr_get_valid_chans_from_range(struct wlan_objmgr_psoc *psoc, - uint8_t *ch_list, - uint32_t *ch_cnt, - enum policy_mgr_con_mode mode) +QDF_STATUS policy_mgr_get_valid_chans_from_range_int( + struct wlan_objmgr_psoc *psoc, uint32_t *ch_freq_list, + uint32_t *ch_cnt, enum policy_mgr_con_mode mode) { uint8_t ch_weight_list[QDF_MAX_NUM_CHAN] = {0}; uint32_t ch_weight_len; QDF_STATUS status = QDF_STATUS_E_FAILURE; size_t chan_index = 0; - if (!ch_list || !ch_cnt) { + if (!ch_freq_list || !ch_cnt) { policy_mgr_err("NULL parameters"); return QDF_STATUS_E_FAILURE; } @@ -1934,19 +2017,19 @@ QDF_STATUS policy_mgr_get_valid_chans_from_range(struct wlan_objmgr_psoc *psoc, /* check the channel avoidance list for beaconing entities */ if (mode == PM_SAP_MODE || mode == PM_P2P_GO_MODE) - policy_mgr_update_with_safe_channel_list(psoc, ch_list, - ch_cnt, ch_weight_list, - ch_weight_len); + policy_mgr_update_with_safe_channel_list_int( + psoc, ch_freq_list, ch_cnt, ch_weight_list, + ch_weight_len); status = policy_mgr_mode_specific_modification_on_pcl( - psoc, ch_list, ch_weight_list, ch_cnt, mode); + psoc, ch_freq_list, ch_weight_list, ch_cnt, mode); if (QDF_IS_STATUS_ERROR(status)) { policy_mgr_err("failed to get modified pcl for mode %d", mode); return status; } - status = policy_mgr_modify_pcl_based_on_dnbs(psoc, ch_list, + status = policy_mgr_modify_pcl_based_on_dnbs(psoc, ch_freq_list, ch_weight_list, ch_cnt); if (QDF_IS_STATUS_ERROR(status)) { @@ -1957,8 +2040,28 @@ QDF_STATUS policy_mgr_get_valid_chans_from_range(struct wlan_objmgr_psoc *psoc, return status; } -QDF_STATUS policy_mgr_get_valid_chans(struct wlan_objmgr_psoc *psoc, - uint8_t *chan_list, uint32_t *list_len) +QDF_STATUS policy_mgr_get_valid_chans_from_range(struct wlan_objmgr_psoc *psoc, + uint8_t *ch_list, + uint32_t *ch_cnt, + enum policy_mgr_con_mode mode) +{ + uint32_t i, ch_freq_list[QDF_MAX_NUM_CHAN]; + QDF_STATUS status; + + for (i = 0; i < *ch_cnt; i++) + ch_freq_list[i] = wlan_chan_to_freq(ch_list[i]); + + status = policy_mgr_get_valid_chans_from_range_int(psoc, ch_freq_list, + ch_cnt, mode); + + for (i = 0; i < *ch_cnt; i++) + ch_list[i] = wlan_freq_to_chan(ch_freq_list[i]); + return status; +} + +QDF_STATUS policy_mgr_get_valid_chans_int(struct wlan_objmgr_psoc *psoc, + uint32_t *ch_freq_list, + uint32_t *list_len) { QDF_STATUS status; struct policy_mgr_psoc_priv_obj *pm_ctx; @@ -1978,33 +2081,47 @@ QDF_STATUS policy_mgr_get_valid_chans(struct wlan_objmgr_psoc *psoc, *list_len = QDF_MAX_NUM_CHAN; status = pm_ctx->sme_cbacks.sme_get_valid_channels( - chan_list, list_len); + ch_freq_list, list_len); if (QDF_IS_STATUS_ERROR(status)) { policy_mgr_err("Error in getting valid channels"); *list_len = 0; return status; } - policy_mgr_remove_dsrc_channels(chan_list, list_len, pm_ctx->pdev); + policy_mgr_remove_dsrc_channels(ch_freq_list, list_len, pm_ctx->pdev); return QDF_STATUS_SUCCESS; } -bool policy_mgr_list_has_24GHz_channel(uint8_t *channel_list, - uint32_t list_len) +QDF_STATUS policy_mgr_get_valid_chans(struct wlan_objmgr_psoc *psoc, + uint8_t *ch_list, uint32_t *list_len) +{ + uint32_t i, ch_freq_list[QDF_MAX_NUM_CHAN] = {0}; + QDF_STATUS status; + + status = policy_mgr_get_valid_chans_int(psoc, ch_freq_list, list_len); + for (i = 0; i < *list_len; i++) + ch_list[i] = wlan_freq_to_chan(ch_freq_list[i]); + + return status; +} + +bool policy_mgr_list_has_24GHz_channel(uint32_t *ch_freq_list, + uint32_t list_len) { uint32_t i; for (i = 0; i < list_len; i++) { - if (WLAN_REG_IS_24GHZ_CH(channel_list[i])) + if (WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq_list[i])) return true; } return false; } -QDF_STATUS policy_mgr_set_sap_mandatory_channels(struct wlan_objmgr_psoc *psoc, - uint8_t *channels, uint32_t len) +QDF_STATUS +policy_mgr_set_sap_mandatory_channels_int(struct wlan_objmgr_psoc *psoc, + uint32_t *ch_freq_list, uint32_t len) { uint32_t i; struct policy_mgr_psoc_priv_obj *pm_ctx; @@ -2020,7 +2137,7 @@ QDF_STATUS policy_mgr_set_sap_mandatory_channels(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_E_FAILURE; } - if (!policy_mgr_list_has_24GHz_channel(channels, len)) { + if (!policy_mgr_list_has_24GHz_channel(ch_freq_list, len)) { policy_mgr_err("2.4GHz channels missing, this is not expected"); return QDF_STATUS_E_FAILURE; } @@ -2029,7 +2146,7 @@ QDF_STATUS policy_mgr_set_sap_mandatory_channels(struct wlan_objmgr_psoc *psoc, pm_ctx->sap_mandatory_channels_len); for (i = 0; i < len; i++) { - pm_ctx->sap_mandatory_channels[i] = channels[i]; + pm_ctx->sap_mandatory_channels[i] = ch_freq_list[i]; policy_mgr_debug("chan:%d", pm_ctx->sap_mandatory_channels[i]); } @@ -2038,6 +2155,22 @@ QDF_STATUS policy_mgr_set_sap_mandatory_channels(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_SUCCESS; } +QDF_STATUS policy_mgr_set_sap_mandatory_channels(struct wlan_objmgr_psoc *psoc, + uint8_t *ch_list, + uint32_t len) +{ + uint32_t i, ch_freq_list[QDF_MAX_NUM_CHAN] = {0}; + QDF_STATUS status; + + for (i = 0; i < len; i++) + ch_freq_list[i] = wlan_chan_to_freq(ch_list[i]); + + status = policy_mgr_set_sap_mandatory_channels_int(psoc, ch_freq_list, + len); + + return status; +} + bool policy_mgr_is_sap_mandatory_channel_set(struct wlan_objmgr_psoc *psoc) { struct policy_mgr_psoc_priv_obj *pm_ctx; @@ -2055,10 +2188,8 @@ bool policy_mgr_is_sap_mandatory_channel_set(struct wlan_objmgr_psoc *psoc) } QDF_STATUS policy_mgr_modify_sap_pcl_based_on_mandatory_channel( - struct wlan_objmgr_psoc *psoc, - uint8_t *pcl_list_org, - uint8_t *weight_list_org, - uint32_t *pcl_len_org) + struct wlan_objmgr_psoc *psoc, uint32_t *pcl_list_org, + uint8_t *weight_list_org, uint32_t *pcl_len_org) { uint32_t i, j, pcl_len = 0; bool found; @@ -2106,16 +2237,17 @@ QDF_STATUS policy_mgr_modify_sap_pcl_based_on_mandatory_channel( return QDF_STATUS_SUCCESS; } -QDF_STATUS policy_mgr_get_sap_mandatory_channel(struct wlan_objmgr_psoc *psoc, - uint16_t *chan) +QDF_STATUS policy_mgr_get_sap_mandatory_channel_int( + struct wlan_objmgr_psoc *psoc, + uint32_t *ch_freq) { QDF_STATUS status; struct policy_mgr_pcl_list pcl; qdf_mem_zero(&pcl, sizeof(pcl)); - status = policy_mgr_get_pcl_for_existing_conn(psoc, PM_SAP_MODE, - pcl.pcl_list, &pcl.pcl_len, + status = policy_mgr_get_pcl_for_existing_conn_int( + psoc, PM_SAP_MODE, pcl.pcl_list, &pcl.pcl_len, pcl.weight_list, QDF_ARRAY_SIZE(pcl.weight_list), false); if (QDF_IS_STATUS_ERROR(status)) { @@ -2129,9 +2261,10 @@ QDF_STATUS policy_mgr_get_sap_mandatory_channel(struct wlan_objmgr_psoc *psoc, * channel between PCL & mandatory channel list as well */ if (!pcl.pcl_len && !policy_mgr_mode_specific_connection_count(psoc, - PM_SAP_MODE, NULL)) { + PM_SAP_MODE, NULL)) { policy_mgr_debug("policy_mgr_get_pcl_for_existing_conn returned no pcl"); - status = policy_mgr_get_pcl(psoc, PM_SAP_MODE, + status = policy_mgr_get_pcl_int( + psoc, PM_SAP_MODE, pcl.pcl_list, &pcl.pcl_len, pcl.weight_list, QDF_ARRAY_SIZE(pcl.weight_list)); @@ -2155,8 +2288,8 @@ QDF_STATUS policy_mgr_get_sap_mandatory_channel(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_E_FAILURE; } - *chan = pcl.pcl_list[0]; - policy_mgr_debug("mandatory channel:%d", *chan); + *ch_freq = pcl.pcl_list[0]; + policy_mgr_debug("mandatory channel:%d", *ch_freq); return QDF_STATUS_SUCCESS; } @@ -2220,40 +2353,40 @@ QDF_STATUS policy_mgr_get_valid_chan_weights(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_SUCCESS; } -uint8_t policy_mgr_mode_specific_get_channel( +uint32_t policy_mgr_mode_specific_get_channel( struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode) { uint32_t conn_index; - uint8_t channel = 0; struct policy_mgr_psoc_priv_obj *pm_ctx; + uint32_t freq = 0; pm_ctx = policy_mgr_get_context(psoc); if (!pm_ctx) { policy_mgr_err("Invalid Context"); - return channel; + return 0; } /* provides the channel for the first matching mode type */ qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); for (conn_index = 0; conn_index < MAX_NUMBER_OF_CONC_CONNECTIONS; conn_index++) { if ((pm_conc_connection_list[conn_index].mode == mode) && - pm_conc_connection_list[conn_index].in_use) { - channel = pm_conc_connection_list[conn_index].chan; + pm_conc_connection_list[conn_index].in_use) { + freq = pm_conc_connection_list[conn_index].freq; break; } } qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); - return channel; + return freq; } -uint8_t policy_mgr_get_alternate_channel_for_sap( +uint32_t policy_mgr_get_alternate_channel_for_sap( struct wlan_objmgr_psoc *psoc, uint8_t sap_vdev_id, - uint8_t sap_channel) + uint32_t sap_ch_freq) { - uint8_t pcl_channels[QDF_MAX_NUM_CHAN]; + uint32_t pcl_channels[QDF_MAX_NUM_CHAN]; uint8_t pcl_weight[QDF_MAX_NUM_CHAN]; - uint8_t channel = 0; + uint32_t ch_freq = 0; uint32_t pcl_len = 0; struct policy_mgr_conc_connection_info info; uint8_t num_cxn_del = 0; @@ -2276,13 +2409,13 @@ uint8_t policy_mgr_get_alternate_channel_for_sap( policy_mgr_store_and_del_conn_info_by_vdev_id(psoc, sap_vdev_id, &info, &num_cxn_del); - if (QDF_STATUS_SUCCESS == policy_mgr_get_pcl(psoc, PM_SAP_MODE, - pcl_channels, &pcl_len, - pcl_weight, QDF_ARRAY_SIZE(pcl_weight))) { + if (QDF_STATUS_SUCCESS == policy_mgr_get_pcl_int( + psoc, PM_SAP_MODE, pcl_channels, &pcl_len, + pcl_weight, QDF_ARRAY_SIZE(pcl_weight))) { for (i = 0; i < pcl_len; i++) { - if (pcl_channels[i] == sap_channel) + if (pcl_channels[i] == sap_ch_freq) continue; - channel = pcl_channels[i]; + ch_freq = pcl_channels[i]; break; } } @@ -2291,6 +2424,6 @@ uint8_t policy_mgr_get_alternate_channel_for_sap( policy_mgr_restore_deleted_conn_info(psoc, &info, num_cxn_del); qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); - return channel; + return ch_freq; } diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 680d7a6be0dc..a4f225078887 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -2641,6 +2641,44 @@ static void hdd_avoid_acs_channels(struct hdd_context *hdd_ctx, } #endif +/** + * wlan_hdd_trim_acs_channel_list() - Trims ACS channel list with + * intersection of PCL + * @pcl: preferred channel list + * @pcl_count: Preferred channel list count + * @org_ch_list: ACS channel list from user space + * @org_ch_list_count: ACS channel count from user space + * + * Return: None + */ +static void wlan_hdd_trim_acs_channel_list(uint8_t *pcl, uint8_t pcl_count, + uint8_t *org_ch_list, + uint8_t *org_ch_list_count) +{ + uint16_t i, j, ch_list_count = 0; + + if (*org_ch_list_count >= QDF_MAX_NUM_CHAN) { + hdd_err("org_ch_list_count too big %d", + *org_ch_list_count); + return; + } + + if (pcl_count >= QDF_MAX_NUM_CHAN) { + hdd_err("pcl_count is too big %d", pcl_count); + return; + } + + hdd_debug("Update ACS channels with PCL"); + for (j = 0; j < *org_ch_list_count; j++) + for (i = 0; i < pcl_count; i++) + if (pcl[i] == org_ch_list[j]) { + org_ch_list[ch_list_count++] = pcl[i]; + break; + } + + *org_ch_list_count = ch_list_count; +} + /** * __wlan_hdd_cfg80211_do_acs(): CFG80211 handler function for DO_ACS Vendor CMD * @wiphy: Linux wiphy struct pointer @@ -2927,7 +2965,7 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy, if (is_external_acs_policy && policy_mgr_is_force_scc(hdd_ctx->psoc) && policy_mgr_get_connection_count(hdd_ctx->psoc)) { - policy_mgr_trim_acs_channel_list( + wlan_hdd_trim_acs_channel_list( sap_config->acs_cfg.pcl_channels, sap_config->acs_cfg.pcl_ch_count, sap_config->acs_cfg.ch_list, @@ -9479,13 +9517,7 @@ static uint32_t wlan_hdd_populate_weigh_pcl( for (i = 0; i < chan_weights->pcl_len; i++) { if (chan_weights->pcl_list[i] <= ARRAY_SIZE(hdd_channels_2_4_ghz)) - w_pcl[i].freq = ieee80211_channel_to_frequency( - chan_weights->pcl_list[i], - HDD_NL80211_BAND_2GHZ); - else - w_pcl[i].freq = ieee80211_channel_to_frequency( - chan_weights->pcl_list[i], - HDD_NL80211_BAND_5GHZ); + w_pcl[i].freq = chan_weights->pcl_list[i]; w_pcl[i].weight = chan_weights->weight_list[i]; if (intf_mode == PM_SAP_MODE || intf_mode == PM_P2P_GO_MODE) @@ -9513,14 +9545,7 @@ static uint32_t wlan_hdd_populate_weigh_pcl( if (chan_weights->saved_chan_list[i] <= ARRAY_SIZE(hdd_channels_2_4_ghz)) w_pcl[chan_idx].freq = - ieee80211_channel_to_frequency( - chan_weights->saved_chan_list[i], - HDD_NL80211_BAND_2GHZ); - else - w_pcl[chan_idx].freq = - ieee80211_channel_to_frequency( - chan_weights->saved_chan_list[i], - HDD_NL80211_BAND_5GHZ); + chan_weights->saved_chan_list[i]; if (!chan_weights->weighed_valid_list[i]) { w_pcl[chan_idx].flag = @@ -9604,11 +9629,10 @@ static int __wlan_hdd_cfg80211_get_preferred_freq_list(struct wiphy *wiphy, if (!chan_weights) return -ENOMEM; - status = policy_mgr_get_pcl(hdd_ctx->psoc, - intf_mode, chan_weights->pcl_list, - &chan_weights->pcl_len, - chan_weights->weight_list, - QDF_ARRAY_SIZE(chan_weights->weight_list)); + status = policy_mgr_get_pcl_int( + hdd_ctx->psoc, intf_mode, chan_weights->pcl_list, + &chan_weights->pcl_len, chan_weights->weight_list, + QDF_ARRAY_SIZE(chan_weights->weight_list)); if (status != QDF_STATUS_SUCCESS) { hdd_err("Get pcl failed"); qdf_mem_free(chan_weights); diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index cecf79b53f66..274ceff38123 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -3096,7 +3096,7 @@ void hdd_sap_restart_with_channel_switch(struct hdd_adapter *ap_adapter, } void hdd_sap_restart_chan_switch_cb(struct wlan_objmgr_psoc *psoc, - uint8_t vdev_id, uint32_t channel, + uint8_t vdev_id, uint32_t ch_freq, uint32_t channel_bw, bool forced) { @@ -3107,7 +3107,8 @@ void hdd_sap_restart_chan_switch_cb(struct wlan_objmgr_psoc *psoc, hdd_err("Adapter is NULL"); return; } - hdd_sap_restart_with_channel_switch(ap_adapter, channel, + hdd_sap_restart_with_channel_switch(ap_adapter, + wlan_freq_to_chan(ch_freq), channel_bw, forced); } @@ -3128,7 +3129,7 @@ void wlan_hdd_set_sap_csa_reason(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, QDF_STATUS wlan_hdd_get_channel_for_sap_restart( struct wlan_objmgr_psoc *psoc, - uint8_t vdev_id, uint8_t *channel) + uint8_t vdev_id, uint32_t *ch_freq) { mac_handle_t mac_handle; struct hdd_ap_ctx *hdd_ap_ctx; @@ -3159,7 +3160,7 @@ QDF_STATUS wlan_hdd_get_channel_for_sap_restart( return QDF_STATUS_E_FAILURE; } - if (!channel) { + if (!ch_freq) { hdd_err("Null parameters"); return QDF_STATUS_E_FAILURE; } @@ -3231,12 +3232,10 @@ sap_restart: 0, &ch_params); - *channel = intf_ch; - + *ch_freq = wlan_chan_to_freq(intf_ch); hdd_info("SAP channel change with CSA/ECSA"); - hdd_sap_restart_chan_switch_cb(psoc, vdev_id, - intf_ch, - ch_params.ch_width, false); + hdd_sap_restart_chan_switch_cb(psoc, vdev_id, *ch_freq, + ch_params.ch_width, false); return QDF_STATUS_SUCCESS; } diff --git a/core/hdd/src/wlan_hdd_hostapd.h b/core/hdd/src/wlan_hdd_hostapd.h index 289f2f55dbd8..cd052157edfb 100644 --- a/core/hdd/src/wlan_hdd_hostapd.h +++ b/core/hdd/src/wlan_hdd_hostapd.h @@ -58,7 +58,7 @@ void hdd_sap_restart_with_channel_switch(struct hdd_adapter *adapter, * a different channel * @psoc: PSOC object information * @vdev_id: vdev id - * @channel: channel to switch + * @ch_freq: channel to switch * @forced: Force to switch channel, ignore SCC/MCC check * * This function restarts SAP with a different channel @@ -67,7 +67,7 @@ void hdd_sap_restart_with_channel_switch(struct hdd_adapter *adapter, * */ void hdd_sap_restart_chan_switch_cb(struct wlan_objmgr_psoc *psoc, - uint8_t vdev_id, uint32_t channel, + uint8_t vdev_id, uint32_t ch_freq, uint32_t channel_bw, bool forced); /** @@ -75,7 +75,7 @@ void hdd_sap_restart_chan_switch_cb(struct wlan_objmgr_psoc *psoc, * suitable channel and restart SAP * @psoc: PSOC object information * @vdev_id: vdev id - * @channel: channel to be returned + * @ch_freq: channel to be returned * * This function gets the channel parameters to restart SAP * @@ -84,7 +84,7 @@ void hdd_sap_restart_chan_switch_cb(struct wlan_objmgr_psoc *psoc, */ QDF_STATUS wlan_hdd_get_channel_for_sap_restart( struct wlan_objmgr_psoc *psoc, - uint8_t vdev_id, uint8_t *channel); + uint8_t vdev_id, uint32_t *ch_freq); #endif /** diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index 1df68e2c92b5..7745532f820b 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -7927,7 +7927,8 @@ static int __iw_set_var_ints_getnone(struct net_device *dev, for (i = 0; i < len; i++) { pr_info("|table_index[%d]\t\t\n", i); pr_info("|\t|vdev_id - %-10d|\n", conn_info->vdev_id); - pr_info("|\t|chan - %-10d|\n", conn_info->chan); + pr_info("|\t|chan - %-10d|\n", + wlan_freq_to_chan(conn_info->freq)); pr_info("|\t|bw - %-10d|\n", conn_info->bw); pr_info("|\t|mode - %-10d|\n", conn_info->mode); pr_info("|\t|mac - %-10d|\n", conn_info->mac); diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index fb23b3506924..d781e8f33cac 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -491,9 +491,25 @@ QDF_STATUS sme_get_ap_channel_from_scan_cache( struct csr_roam_profile *profile, tScanResultHandle *scan_cache, uint8_t *ap_chnl_id); +/** + * sme_get_ap_channel_from_scan() - a wrapper function to get + * AP's channel id from + * CSR by filtering the + * result which matches + * our roam profile. + * @profile: SAP profile + * @ap_ch_freq: pointer to channel id of SAP. Fill the value after finding the + * best ap from scan cache. + * + * This function is written to get AP's channel id from CSR by filtering + * the result which matches our roam profile. This is a synchronous call. + * + * Return: QDF_STATUS. + */ QDF_STATUS sme_get_ap_channel_from_scan(void *profile, - tScanResultHandle *scan_cache, - uint8_t *ap_chnl_id); + tScanResultHandle *scan_cache, + uint32_t *ap_ch_freq); + tCsrScanResultInfo *sme_scan_result_get_first(mac_handle_t, tScanResultHandle hScanResult); tCsrScanResultInfo *sme_scan_result_get_next(mac_handle_t, @@ -2536,7 +2552,7 @@ QDF_STATUS sme_get_fw_state(mac_handle_t mac_handle, /** * sme_get_valid_channels() - sme api to get valid channels for * current regulatory domain - * @chan_list: list of the valid channels + * @ch_freq_list: list of the valid channel frequencies * @list_len: length of the channel list * * This function will get valid channels for current regulatory @@ -2544,7 +2560,7 @@ QDF_STATUS sme_get_fw_state(mac_handle_t mac_handle, * * Return: QDF_STATUS_SUCCESS or non-zero on failure */ -QDF_STATUS sme_get_valid_channels(uint8_t *chan_list, uint32_t *list_len); +QDF_STATUS sme_get_valid_channels(uint32_t *ch_freq_list, uint32_t *list_len); /** * sme_get_mac_context() - sme api to get the pmac context diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 020486d8c37f..3da31d04c4b6 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -1123,7 +1123,7 @@ sme_register_bcn_report_pe_cb(mac_handle_t mac_handle, beacon_report_cb cb) } #endif -QDF_STATUS sme_get_valid_channels(uint8_t *chan_list, uint32_t *list_len) +QDF_STATUS sme_get_valid_channels(uint32_t *ch_freq_list, uint32_t *list_len) { struct mac_context *mac_ctx = sme_get_mac_context(); uint32_t num_valid_chan; @@ -1145,8 +1145,8 @@ QDF_STATUS sme_get_valid_channels(uint8_t *chan_list, uint32_t *list_len) } *list_len = num_valid_chan; for (i = 0; i < *list_len; i++) { - chan_list[i] = wlan_reg_freq_to_chan(mac_ctx->pdev, - mac_ctx->mlme_cfg->reg.valid_channel_freq_list[i]); + ch_freq_list[i] = + mac_ctx->mlme_cfg->reg.valid_channel_freq_list[i]; } return QDF_STATUS_SUCCESS; @@ -2579,29 +2579,19 @@ QDF_STATUS sme_scan_get_result_for_bssid(mac_handle_t mac_handle, return status; } -/** - * sme_get_ap_channel_from_scan() - a wrapper function to get - * AP's channel id from - * CSR by filtering the - * result which matches - * our roam profile. - * @profile: SAP profile - * @ap_chnl_id: pointer to channel id of SAP. Fill the value after finding the - * best ap from scan cache. - * - * This function is written to get AP's channel id from CSR by filtering - * the result which matches our roam profile. This is a synchronous call. - * - * Return: QDF_STATUS. - */ QDF_STATUS sme_get_ap_channel_from_scan(void *profile, tScanResultHandle *scan_cache, - uint8_t *ap_chnl_id) + uint32_t *ap_ch_freq) { - return sme_get_ap_channel_from_scan_cache((struct csr_roam_profile *) + uint8_t ap_ch; + QDF_STATUS status; + + status = sme_get_ap_channel_from_scan_cache((struct csr_roam_profile *) profile, scan_cache, - ap_chnl_id); + &ap_ch); + *ap_ch_freq = wlan_chan_to_freq(ap_ch); + return status; } /** @@ -12306,7 +12296,8 @@ QDF_STATUS sme_pdev_set_pcl(struct policy_mgr_pcl_list *msg) sme_debug("Connected STA band %d", req_msg->band); } for (i = 0; i < msg->pcl_len; i++) { - req_msg->chan_weights.pcl_list[i] = msg->pcl_list[i]; + req_msg->chan_weights.pcl_list[i] = wlan_freq_to_chan( + msg->pcl_list[i]); req_msg->chan_weights.weight_list[i] = msg->weight_list[i]; } diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 79dc9c335e41..75deb26c9d25 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -9248,13 +9248,14 @@ QDF_STATUS wma_send_pdev_set_pcl_cmd(tp_wma_handle wma_handle, /* Dont allow roaming on 2G when 5G_ONLY configured */ if (((wma_handle->bandcapability == BAND_5G) || (msg->band == BAND_5G)) && - (WLAN_REG_IS_24GHZ_CH( - msg->chan_weights.saved_chan_list[i]))) { + (WLAN_REG_IS_24GHZ_CH_FREQ( + msg->chan_weights.saved_chan_list[i]))) { msg->chan_weights.weighed_valid_list[i] = WEIGHT_OF_DISALLOWED_CHANNELS; } if ((msg->band == BAND_2G) && - WLAN_REG_IS_5GHZ_CH(msg->chan_weights.saved_chan_list[i])) + WLAN_REG_IS_5GHZ_CH_FREQ( + msg->chan_weights.saved_chan_list[i])) msg->chan_weights.weighed_valid_list[i] = WEIGHT_OF_DISALLOWED_CHANNELS; WMA_LOGD("%s: chan:%d weight[%d]=%d", __func__,