diff --git a/umac/regulatory/core/src/reg_priv_objs.h b/umac/regulatory/core/src/reg_priv_objs.h index b5545ef1b8..e983eff047 100644 --- a/umac/regulatory/core/src/reg_priv_objs.h +++ b/umac/regulatory/core/src/reg_priv_objs.h @@ -187,11 +187,20 @@ struct wlan_regulatory_psoc_priv_obj { * @secondary_cur_chan_list: secondary current channel list, for concurrency * situations * @mas_chan_list: master channel list + * from the firmware. + * @is_6g_afc_power_event_received: indicates if the AFC power event is + * received + * @is_6g_afc_expiry_event_received: indicates if the AFC exipiry event is + * received + * @afc_chan_list: Intersection of AFC master and Standard power channel list + * @mas_chan_list_6g_afc: AFC master channel list constructed from the AFC + * server response. + * @power_info: pointer to AFC power information received from the AFC event + * sent by the target * @is_6g_channel_list_populated: indicates the channel lists are populated * @mas_chan_list_6g_ap: master channel list for 6G AP, includes all power types * @mas_chan_list_6g_client: master channel list for 6G client, includes * all power types - * @afc_chan_list : afc chan list for 6Ghz * @band_capability: bitmap of bands enabled, using enum reg_wifi_band as the * bit position value * @reg_6g_superid: 6Ghz super domain id @@ -215,10 +224,16 @@ struct wlan_regulatory_pdev_priv_obj { #endif struct regulatory_channel mas_chan_list[NUM_CHANNELS]; #ifdef CONFIG_BAND_6GHZ +#ifdef CONFIG_AFC_SUPPORT + bool is_6g_afc_power_event_received; + bool is_6g_afc_expiry_event_received; + struct regulatory_channel afc_chan_list[NUM_6GHZ_CHANNELS]; + struct regulatory_channel mas_chan_list_6g_afc[NUM_6GHZ_CHANNELS]; + struct reg_fw_afc_power_event *power_info; +#endif bool is_6g_channel_list_populated; struct regulatory_channel mas_chan_list_6g_ap[REG_CURRENT_MAX_AP_TYPE][NUM_6GHZ_CHANNELS]; struct regulatory_channel mas_chan_list_6g_client[REG_CURRENT_MAX_AP_TYPE][REG_MAX_CLIENT_TYPE][NUM_6GHZ_CHANNELS]; - struct regulatory_channel afc_chan_list[NUM_6GHZ_CHANNELS]; #endif #ifdef DISABLE_CHANNEL_LIST struct regulatory_channel cache_disable_chan_list[NUM_CHANNELS]; diff --git a/umac/regulatory/dispatcher/inc/reg_services_public_struct.h b/umac/regulatory/dispatcher/inc/reg_services_public_struct.h index 80f4c1d8c6..68edf2fa9f 100644 --- a/umac/regulatory/dispatcher/inc/reg_services_public_struct.h +++ b/umac/regulatory/dispatcher/inc/reg_services_public_struct.h @@ -1127,6 +1127,161 @@ struct cur_regulatory_info { struct cur_reg_rule *reg_rules_6g_client_ptr[REG_CURRENT_MAX_AP_TYPE][REG_MAX_CLIENT_TYPE]; }; +#if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ) + +/** + * reg_afc_event_type indicates the type of AFC event sent from FW to host. + * 1. For sending Power Info REG_AFC_EVENT_POWER_INFO event is used. + * 2. For sending AFC expiry use REG_AFC_EVENT_TIMER_EXPIRY + * This type can be expanded in future as per requirements. + */ +enum reg_afc_event_type { + REG_AFC_EVENT_POWER_INFO = 1, + REG_AFC_EVENT_TIMER_EXPIRY = 2, +}; + +/** + * reg_afc_expiry_event_subtype indicates the subtype. + * 1. At boot up AFC expiry will contain AFC start. + * 2. If AFC timer expires AFC_RENEW status code will be sent to host + * with expiry event. + * 3. If AFC server is not responding to FW in specified time, FW will + * indicate host to switch to LPI. + */ +enum reg_afc_expiry_event_subtype { + REG_AFC_EXPIRY_EVENT_START = 1, + REG_AFC_EXPIRY_EVENT_RENEW = 2, + REG_AFC_EXPIRY_EVENT_SWITCH_TO_LPI = 3, +}; + +/** + * The following fw_status_code is mutually exclusive + * and is used in power event. + * 0. AFC power event is success. + * 1. If Host does not indicate AFC indication cmd within certain time + * of AFC expiry, REG_FW_AFC_POWER_EVENT_RESP_NOT_RECEIVED will be used. + * 2. If FW is not able to parse afc_info, parsing_failure will be + * indicated using REG_FW_AFC_POWER_EVENT_RESP_NOT_RECEIVED. + * 3. If due to some local reason AFC event is failed, AFC event failure + * is indicated using REG_FW_AFC_POWER_EVENT_FAILURE. + */ +enum reg_fw_afc_power_event_status_code { + REG_FW_AFC_POWER_EVENT_SUCCESS = 0, + REG_FW_AFC_POWER_EVENT_RESP_NOT_RECEIVED = 1, + REG_FW_AFC_POWER_EVENT_RESP_PARSING_FAILURE = 2, + REG_FW_AFC_POWER_EVENT_FAILURE = 3, +}; + +/** + * The following reg_afc_server_resp_code is mutually exclusive. + * This response code will be indicated to AFC server. + * These codes are defined in WIFI spec doc for AFC as follows + * -1: General Failure + * 0: Success + * 100 - 199: General errors related to the protocol + * 300 - 399: Error events specific to message exchange for the + * Available Spectrum Inquiry + */ +enum reg_afc_serv_resp_code { + REG_AFC_SERV_RESP_GENERAL_FAILURE = -1, + REG_AFC_SERV_RESP_SUCCESS = 0, + REG_AFC_SERV_RESP_VERSION_NOT_SUPPORTED = 100, + REG_AFC_SERV_RESP_DEVICE_UNALLOWED = 101, + REG_AFC_SERV_RESP_MISSING_PARAM = 102, + REG_AFC_SERV_RESP_INVALID_VALUE = 103, + REG_AFC_SERV_RESP_UNEXPECTED_PARAM = 106, + REG_AFC_SERV_RESP_UNSUPPORTED_SPECTRUM = 300, +}; + +/** + * struct afc_freq_obj + * @low_freq: Lower edge frequency + * @high_freq: Upper edge frequency + * @max_psd: Max PSD in 0.01 dBm/MHz units + */ +struct afc_freq_obj { + qdf_freq_t low_freq; + qdf_freq_t high_freq; + int16_t max_psd; +}; + +/** + * struct chan_eirp_obj + * @cfi: Channel frequency index + * @eirp_power: Max EIRP power in 0.01 dBm units + */ +struct chan_eirp_obj { + uint8_t cfi; + uint16_t eirp_power; +}; + +/** + * struct afc_chan_obj + * @global_opclass: Global Operating class + * @num_chans: Number of channels + * @chan_eirp_info: Pointer to afc channel EIRP object + */ +struct afc_chan_obj { + uint8_t global_opclass; + uint8_t num_chans; + struct chan_eirp_obj *chan_eirp_info; +}; + +/** + * struct reg_afc_expiry_event + * @request_id: AFC request id generated by the firmware + * @event_subtype: AFC expiry event subtype + */ +struct reg_afc_expiry_event { + uint32_t request_id; + enum reg_afc_expiry_event_subtype event_subtype; +}; + +/** + * struct reg_fw_afc_power_event + * @resp_id: AFC server response id + * @fw_status_code: firmware status code + * @serv_resp_code: AFC server response code + * @afc_wfa_version: AFC version + * @avail_exp_time_d: Expiry date of the AFC power info + * @avail_exp_time_t: Time left for expiry of the AFC power info + * @num_freq_objs: Number of freq objects + * @num_chan_objs: Number of channel objects + * @afc_freq_info: Pointer to AFC freq object + * @afc_chan_info: Pointer to AFC channel object + */ +struct reg_fw_afc_power_event { + uint8_t resp_id; + enum reg_fw_afc_power_event_status_code fw_status_code; + enum reg_afc_serv_resp_code serv_resp_code; + uint32_t afc_wfa_version; + uint32_t avail_exp_time_d; + uint32_t avail_exp_time_t; + uint8_t num_freq_objs; + uint8_t num_chan_objs; + struct afc_freq_obj *afc_freq_info; + struct afc_chan_obj *afc_chan_info; +}; + +/** + * struct afc_regulatory_info + * @psoc: psoc ptr + * @phy_id: phy id + * @event_type: AFC event type + * @expiry_info: pointer to information present in the AFC expiry event + * @power_info: pointer to information present in the AFC power event + */ +struct afc_regulatory_info { + struct wlan_objmgr_psoc *psoc; + uint8_t phy_id; + enum reg_afc_event_type event_type; + union { + struct reg_afc_expiry_event *expiry_info; + struct reg_fw_afc_power_event *power_info; + }; +}; +#endif + /** * struct reg_rule_info * @alpha2: alpha2 of reg rules @@ -1267,8 +1422,11 @@ enum direction { * @dfs_region: dfs region * @phybitmap: phybitmap * @mas_chan_list: master chan list for 2GHz and 5GHz channels + * @is_6g_channel_list_populated: indicates the channel lists are populated * @mas_chan_list_6g_ap: master chan list for 6GHz AP channels * @mas_chan_list_6g_client: master chan list for 6GHz client + * @is_6g_afc_power_event_received: indicates if the AFC event is received. + * @mas_chan_list_6g_afc: master chan list for 6GHz AFC * @default_country: default country * @current_country: current country * @def_region_domain: default reg domain @@ -1289,6 +1447,10 @@ struct mas_chan_params { bool is_6g_channel_list_populated; struct regulatory_channel mas_chan_list_6g_ap[REG_CURRENT_MAX_AP_TYPE][NUM_6GHZ_CHANNELS]; struct regulatory_channel mas_chan_list_6g_client[REG_CURRENT_MAX_AP_TYPE][REG_MAX_CLIENT_TYPE][NUM_6GHZ_CHANNELS]; +#ifdef CONFIG_AFC_SUPPORT + bool is_6g_afc_power_event_received; + struct regulatory_channel mas_chan_list_6g_afc[NUM_6GHZ_CHANNELS]; +#endif #endif char default_country[REG_ALPHA2_LEN + 1]; char current_country[REG_ALPHA2_LEN + 1];