diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index defd9ab8d8..a1d99dc044 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -1270,4 +1270,19 @@ QDF_STATUS wmi_unified_peer_rx_reorder_queue_setup_send(void *wmi_hdl, struct rx_reorder_queue_setup_params *param); QDF_STATUS wmi_unified_peer_rx_reorder_queue_remove_send(void *wmi_hdl, struct rx_reorder_queue_remove_params *param); + +QDF_STATUS wmi_extract_service_ready_ext(void *wmi_hdl, uint8_t *evt_buf, + struct wmi_host_service_ext_param *param); +QDF_STATUS wmi_extract_hw_mode_cap_service_ready_ext( + void *wmi_hdl, + uint8_t *evt_buf, uint8_t hw_mode_idx, + struct wmi_host_hw_mode_caps *param); +QDF_STATUS wmi_extract_mac_phy_cap_service_ready_ext( + void *wmi_hdl, + uint8_t *evt_buf, uint8_t hw_mode_idx, + struct wmi_host_mac_phy_caps *param); +QDF_STATUS wmi_extract_reg_cap_service_ready_ext( + void *wmi_hdl, + uint8_t *evt_buf, uint8_t phy_idx, + struct WMI_HOST_HAL_REG_CAPABILITIES_EXT *param); #endif /* _WMI_UNIFIED_API_H_ */ diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index e53324b41f..28a40c8b04 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -6685,5 +6685,156 @@ struct encrypt_decrypt_req_params { uint8_t *data; }; +/** + * struct wmi_host_ppe_threshold -PPE threshold + * @numss_m1: NSS - 1 + * @ru_count: Max RU count + * @ppet16_ppet8_ru3_ru0: ppet8 and ppet16 for max num ss + */ +#define WMI_HOST_MAX_NUM_SS 8 +struct wmi_host_ppe_threshold { + uint32_t numss_m1; + uint32_t ru_count; + uint32_t ppet16_ppet8_ru3_ru0[WMI_HOST_MAX_NUM_SS]; +}; + +/** + * struct wmi_host_service_ext_param - EXT service base params in event + * @default_conc_scan_config_bits: Default concurrenct scan config + * @default_fw_config_bits: Default HW config bits + * @wmi_host_ppe_threshold ppet: Host PPE threshold struct + * @he_cap_info: HE capabality info + * @mpdu_density: units are microseconds + * @max_bssid_rx_filters: Maximum no of BSSID based RX filters host can program + * Value 0 means FW hasn't given any limit to host. + * @num_hw_modes: Number of HW modes in event + * @num_phy: Number of Phy mode. + */ +struct wmi_host_service_ext_param { + uint32_t default_conc_scan_config_bits; + uint32_t default_fw_config_bits; + struct wmi_host_ppe_threshold ppet; + uint32_t he_cap_info; + uint32_t mpdu_density; + uint32_t max_bssid_rx_filters; + uint32_t num_hw_modes; + uint32_t num_phy; +}; + +/** + * struct wmi_host_hw_mode_caps - HW mode capabilities in EXT event + * @hw_mode_id: identify a particular set of HW characteristics, + * as specified by the subsequent fields + * @phy_id_map: BIT0 represents phy_id 0, BIT1 represent phy_id 1 and so on + */ +struct wmi_host_hw_mode_caps { + uint32_t hw_mode_id; + uint32_t phy_id_map; +}; + +/** + * struct wmi_host_mac_phy_caps - Phy caps recvd in EXT service + * @hw_mode_id: identify a particular set of HW characteristics, + * as specified by the subsequent fields. WMI_MAC_PHY_CAPABILITIES + * element must be mapped to its parent WMI_HW_MODE_CAPABILITIES + * element using hw_mode_id. No particular ordering of + * WMI_MAC_PHY_CAPABILITIES elements should be + * assumed, though in practice the elements may always be ordered + * by hw_mode_id. + * @pdev_id: pdev_id starts with 1. pdev_id 1 => phy_id 0, pdev_id 2 => phy_id 1 + * @phy_id: Starts with 0 + * @union of supported modulations + * @supported_bands: supported bands, enum WLAN_BAND_CAPABILITY + * @ampdu_density: ampdu density 0 for no restriction, 1 for 1/4 us, + * 2 for 1/2 us, 3 for 1 us,4 for 2 us, 5 for 4 us, + * 6 for 8 us,7 for 16 us + * @max_bw_supported_2G: max bw supported 2G, enum wmi_channel_width + * @ht_cap_info_2G: WMI HT Capability, WMI_HT_CAP defines + * @vht_cap_info_2G: VHT capability info field of 802.11ac, WMI_VHT_CAP defines + * @vht_supp_mcs_2G: VHT Supported MCS Set field Rx/Tx same + * The max VHT-MCS for n SS subfield (where n = 1,...,8) is encoded as + * follows + * - 0 indicates support for VHT-MCS 0-7 for n spatial streams + * - 1 indicates support for VHT-MCS 0-8 for n spatial streams + * - 2 indicates support for VHT-MCS 0-9 for n spatial streams + * - 3 indicates that n spatial streams is not supported + * @he_cap_info_2G: HE capability info field of 802.11ax, WMI_HE_CAP defines + * @he_supp_mcs_2G: HE Supported MCS Set field Rx/Tx same + * @tx_chain_mask_2G: Valid Transmit chain mask + * @rx_chain_mask_2G: Valid Receive chain mask + * @max_bw_supported_5G: max bw supported 5G, enum wmi_channel_width + * @ht_cap_info_5G: WMI HT Capability, WMI_HT_CAP defines + * @vht_cap_info_5G: VHT capability info field of 802.11ac, WMI_VHT_CAP defines + * @vht_supp_mcs_5G: VHT Supported MCS Set field Rx/Tx same + * The max VHT-MCS for n SS subfield (where n = 1,...,8) is encoded as + * follows + * - 0 indicates support for VHT-MCS 0-7 for n spatial streams + * - 1 indicates support for VHT-MCS 0-8 for n spatial streams + * - 2 indicates support for VHT-MCS 0-9 for n spatial streams + * - 3 indicates that n spatial streams is not supported + * @he_cap_info_5G: HE capability info field of 802.11ax, WMI_HE_CAP defines + * @he_supp_mcs_5G: HE Supported MCS Set field Rx/Tx same + * @tx_chain_mask_5G: Valid Transmit chain mask + * @rx_chain_mask_5G: Valid Receive chain mask + */ +struct wmi_host_mac_phy_caps { + uint32_t hw_mode_id; + uint32_t pdev_id; + uint32_t phy_id; + union { + uint32_t supports_11b:1, + supports_11g:1, + supports_11a:1, + supports_11n:1, + supports_11ac:1, + supports_11ax:1; + uint32_t supported_flags; + }; + uint32_t supported_bands; + uint32_t ampdu_density; + uint32_t max_bw_supported_2G; + uint32_t ht_cap_info_2G; + uint32_t vht_cap_info_2G; + uint32_t vht_supp_mcs_2G; + uint32_t he_cap_info_2G; + uint32_t he_supp_mcs_2G; + uint32_t tx_chain_mask_2G; + uint32_t rx_chain_mask_2G; + uint32_t max_bw_supported_5G; + uint32_t ht_cap_info_5G; + uint32_t vht_cap_info_5G; + uint32_t vht_supp_mcs_5G; + uint32_t he_cap_info_5G; + uint32_t he_supp_mcs_5G; + uint32_t tx_chain_mask_5G; + uint32_t rx_chain_mask_5G; +}; + +/** + * struct WMI_HOST_HAL_REG_CAPABILITIES_EXT: Below are Reg caps per PHY. + * Please note PHY ID starts with 0. + * @phy_id: phy id starts with 0. + * @eeprom_reg_domain: regdomain value specified in EEPROM + * @eeprom_reg_domain_ext: regdomain + * @regcap1: CAP1 capabilities bit map, see REGDMN_CAP1_ defines + * @regcap2: REGDMN EEPROM CAP, see REGDMN_EEPROM_EEREGCAP_ defines + * @wireless_modes: REGDMN MODE, see REGDMN_MODE_ enum + * @low_2ghz_chan: 2G channel low + * @high_2ghz_chan: 2G channel High + * @low_5ghz_chan: 5G channel low + * @high_5ghz_chan: 5G channel High + */ +struct WMI_HOST_HAL_REG_CAPABILITIES_EXT { + uint32_t phy_id; + uint32_t eeprom_reg_domain; + uint32_t eeprom_reg_domain_ext; + uint32_t regcap1; + uint32_t regcap2; + uint32_t wireless_modes; + uint32_t low_2ghz_chan; + uint32_t high_2ghz_chan; + uint32_t low_5ghz_chan; + uint32_t high_5ghz_chan; +}; #endif /* _WMI_UNIFIED_PARAM_H_ */ diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index 734330d6c7..918f083bfd 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -1142,6 +1142,25 @@ QDF_STATUS (*send_peer_rx_reorder_queue_setup_cmd)(wmi_unified_t wmi_handle, QDF_STATUS (*send_peer_rx_reorder_queue_remove_cmd)(wmi_unified_t wmi_handle, struct rx_reorder_queue_remove_params *param); + +QDF_STATUS (*extract_service_ready_ext)(wmi_unified_t wmi_handle, + uint8_t *evt_buf, + struct wmi_host_service_ext_param *param); + +QDF_STATUS (*extract_hw_mode_cap_service_ready_ext)( + wmi_unified_t wmi_handle, + uint8_t *evt_buf, uint8_t hw_mode_idx, + struct wmi_host_hw_mode_caps *param); + +QDF_STATUS (*extract_mac_phy_cap_service_ready_ext)( + wmi_unified_t wmi_handle, + uint8_t *evt_buf, uint8_t hw_mode_idx, + struct wmi_host_mac_phy_caps *param); + +QDF_STATUS (*extract_reg_cap_service_ready_ext)( + wmi_unified_t wmi_handle, + uint8_t *evt_buf, uint8_t phy_idx, + struct WMI_HOST_HAL_REG_CAPABILITIES_EXT *param); }; struct target_abi_version { diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index 56974e6355..660348b5b3 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -6182,3 +6182,96 @@ QDF_STATUS wmi_unified_encrypt_decrypt_send_cmd(void *wmi_hdl, return QDF_STATUS_E_FAILURE; } + +/* + * wmi_extract_service_ready_ext() - extract extended service ready + * @wmi_handle: wmi handle + * @param: wmi power debug parameter + * + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wmi_extract_service_ready_ext(void *wmi_hdl, uint8_t *evt_buf, + struct wmi_host_service_ext_param *param) +{ + wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl; + + if (wmi_handle->ops->extract_service_ready_ext) + return wmi_handle->ops->extract_service_ready_ext(wmi_handle, + evt_buf, param); + + return QDF_STATUS_E_FAILURE; +} + +/** + * wmi_extract_hw_mode_cap_service_ready_ext() - + * extract HW mode cap from service ready event + * @wmi_handle: wmi handle + * @param evt_buf: pointer to event buffer + * @param param: Pointer to hold evt buf + * @param hw_mode_idx: hw mode idx should be less than num_mode + * + * Return: QDF_STATUS_SUCCESS for success or error code + */ +QDF_STATUS wmi_extract_hw_mode_cap_service_ready_ext( + void *wmi_hdl, + uint8_t *evt_buf, uint8_t hw_mode_idx, + struct wmi_host_hw_mode_caps *param) +{ + wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl; + + if (wmi_handle->ops->extract_hw_mode_cap_service_ready_ext) + return wmi_handle->ops->extract_hw_mode_cap_service_ready_ext( + wmi_handle, + evt_buf, hw_mode_idx, param); + + return QDF_STATUS_E_FAILURE; +} +/** + * wmi_extract_mac_phy_cap_service_ready_ext() - + * extract MAC phy cap from service ready event + * @wmi_handle: wmi handle + * @param evt_buf: pointer to event buffer + * @param param: Pointer to hold evt buf + * @param hw_mode_idx: hw mode idx should be less than num_mode + * + * Return: QDF_STATUS_SUCCESS for success or error code + */ +QDF_STATUS wmi_extract_mac_phy_cap_service_ready_ext( + void *wmi_hdl, + uint8_t *evt_buf, uint8_t hw_mode_idx, + struct wmi_host_mac_phy_caps *param) +{ + wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl; + + if (wmi_handle->ops->extract_mac_phy_cap_service_ready_ext) + return wmi_handle->ops->extract_mac_phy_cap_service_ready_ext( + wmi_handle, + evt_buf, hw_mode_idx, param); + + return QDF_STATUS_E_FAILURE; +} +/** + * wmi_extract_reg_cap_service_ready_ext() - + * extract REG cap from service ready event + * @wmi_handle: wmi handle + * @param evt_buf: pointer to event buffer + * @param param: Pointer to hold evt buf + * @param phy_idx: phy idx should be less than num_mode + * + * Return: QDF_STATUS_SUCCESS for success or error code + */ +QDF_STATUS wmi_extract_reg_cap_service_ready_ext( + void *wmi_hdl, + uint8_t *evt_buf, uint8_t phy_idx, + struct WMI_HOST_HAL_REG_CAPABILITIES_EXT *param) +{ + wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl; + + if (wmi_handle->ops->extract_reg_cap_service_ready_ext) + return wmi_handle->ops->extract_reg_cap_service_ready_ext( + wmi_handle, + evt_buf, phy_idx, param); + + return QDF_STATUS_E_FAILURE; +} diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 3ad2d51a68..39c8504a25 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -12502,6 +12502,185 @@ static QDF_STATUS extract_channel_hopping_event_tlv(wmi_unified_t wmi_handle, return QDF_STATUS_SUCCESS; } +/** + * extract_service_ready_ext_tlv() - extract basic extended service ready params + * from event + * @wmi_handle: wmi handle + * @param evt_buf: pointer to event buffer + * @param param: Pointer to hold evt buf + * + * Return: QDF_STATUS_SUCCESS for success or error code + */ +static QDF_STATUS extract_service_ready_ext_tlv(wmi_unified_t wmi_handle, + uint8_t *event, struct wmi_host_service_ext_param *param) +{ + WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; + wmi_service_ready_ext_event_fixed_param *ev; + WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; + WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; + + param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; + if (!param_buf) + return -EINVAL; + + ev = param_buf->fixed_param; + if (!ev) + return -EINVAL; + + /* Move this to host based bitmap */ + param->default_conc_scan_config_bits = + ev->default_conc_scan_config_bits; + param->default_fw_config_bits = ev->default_fw_config_bits; + param->he_cap_info = ev->he_cap_info; + param->mpdu_density = ev->mpdu_density; + param->max_bssid_rx_filters = ev->max_bssid_rx_filters; + qdf_mem_copy(¶m->ppet, &ev->ppet, sizeof(param->ppet)); + + hw_caps = param_buf->soc_hw_mode_caps; + param->num_hw_modes = hw_caps->num_hw_modes; + + reg_caps = param_buf->soc_hal_reg_caps; + param->num_phy = reg_caps->num_phy; + + return QDF_STATUS_SUCCESS; +} + +/** + * extract_hw_mode_cap_service_ready_ext_tlv() - + * extract HW mode cap from service ready event + * @wmi_handle: wmi handle + * @param evt_buf: pointer to event buffer + * @param param: Pointer to hold evt buf + * @param hw_mode_idx: hw mode idx should be less than num_mode + * + * Return: QDF_STATUS_SUCCESS for success or error code + */ +static QDF_STATUS extract_hw_mode_cap_service_ready_ext_tlv( + wmi_unified_t wmi_handle, + uint8_t *event, uint8_t hw_mode_idx, + struct wmi_host_hw_mode_caps *param) +{ + WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; + WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; + + param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; + if (!param_buf) + return -EINVAL; + + hw_caps = param_buf->soc_hw_mode_caps; + if (hw_mode_idx >= hw_caps->num_hw_modes) + return -EINVAL; + + param->hw_mode_id = param_buf->hw_mode_caps[hw_mode_idx].hw_mode_id; + param->phy_id_map = param_buf->hw_mode_caps[hw_mode_idx].phy_id_map; + + return QDF_STATUS_SUCCESS; +} + +/** + * extract_mac_phy_cap_service_ready_ext_tlv() - + * extract MAC phy cap from service ready event + * @wmi_handle: wmi handle + * @param evt_buf: pointer to event buffer + * @param param: Pointer to hold evt buf + * @param hw_mode_idx: hw mode idx should be less than num_mode + * + * Return: QDF_STATUS_SUCCESS for success or error code + */ +static QDF_STATUS extract_mac_phy_cap_service_ready_ext_tlv( + wmi_unified_t wmi_handle, + uint8_t *event, uint8_t hw_mode_idx, + struct wmi_host_mac_phy_caps *param) +{ + WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; + WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps; + WMI_MAC_PHY_CAPABILITIES *mac_phy_caps; + + param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; + if (!param_buf) + return -EINVAL; + + hw_caps = param_buf->soc_hw_mode_caps; + if (hw_mode_idx >= hw_caps->num_hw_modes) + return -EINVAL; + + mac_phy_caps = ¶m_buf->mac_phy_caps[hw_mode_idx]; + + param->hw_mode_id = mac_phy_caps->hw_mode_id; + param->pdev_id = mac_phy_caps->pdev_id; + param->phy_id = mac_phy_caps->phy_id; + param->supports_11b = mac_phy_caps->supports_11b; + param->supports_11g = mac_phy_caps->supports_11g; + param->supports_11a = mac_phy_caps->supports_11a; + param->supports_11n = mac_phy_caps->supports_11n; + param->supports_11ac = mac_phy_caps->supports_11ac; + param->supports_11ax = mac_phy_caps->supports_11ax; + + param->supported_bands = mac_phy_caps->supported_bands; + param->ampdu_density = mac_phy_caps->ampdu_density; + param->max_bw_supported_2G = mac_phy_caps->max_bw_supported_2G; + param->ht_cap_info_2G = mac_phy_caps->ht_cap_info_2G; + param->vht_cap_info_2G = mac_phy_caps->vht_cap_info_2G; + param->vht_supp_mcs_2G = mac_phy_caps->vht_supp_mcs_2G; + param->he_cap_info_2G = mac_phy_caps->he_cap_info_2G; + param->he_supp_mcs_2G = mac_phy_caps->he_supp_mcs_2G; + param->tx_chain_mask_2G = mac_phy_caps->tx_chain_mask_2G; + param->rx_chain_mask_2G = mac_phy_caps->rx_chain_mask_2G; + param->max_bw_supported_5G = mac_phy_caps->max_bw_supported_5G; + param->ht_cap_info_5G = mac_phy_caps->ht_cap_info_5G; + param->vht_cap_info_5G = mac_phy_caps->vht_cap_info_5G; + param->vht_supp_mcs_5G = mac_phy_caps->vht_supp_mcs_5G; + param->he_cap_info_5G = mac_phy_caps->he_cap_info_5G; + param->he_supp_mcs_5G = mac_phy_caps->he_supp_mcs_5G; + param->tx_chain_mask_5G = mac_phy_caps->tx_chain_mask_5G; + param->rx_chain_mask_5G = mac_phy_caps->rx_chain_mask_5G; + + return QDF_STATUS_SUCCESS; +} + +/** + * extract_reg_cap_service_ready_ext_tlv() - + * extract REG cap from service ready event + * @wmi_handle: wmi handle + * @param evt_buf: pointer to event buffer + * @param param: Pointer to hold evt buf + * @param phy_idx: phy idx should be less than num_mode + * + * Return: QDF_STATUS_SUCCESS for success or error code + */ +static QDF_STATUS extract_reg_cap_service_ready_ext_tlv( + wmi_unified_t wmi_handle, + uint8_t *event, uint8_t phy_idx, + struct WMI_HOST_HAL_REG_CAPABILITIES_EXT *param) +{ + WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf; + WMI_SOC_HAL_REG_CAPABILITIES *reg_caps; + WMI_HAL_REG_CAPABILITIES_EXT *ext_reg_cap; + + param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event; + if (!param_buf) + return -EINVAL; + + reg_caps = param_buf->soc_hal_reg_caps; + if (phy_idx >= reg_caps->num_phy) + return -EINVAL; + + ext_reg_cap = ¶m_buf->hal_reg_caps[phy_idx]; + + param->phy_id = ext_reg_cap->phy_id; + param->eeprom_reg_domain = ext_reg_cap->eeprom_reg_domain; + param->eeprom_reg_domain_ext = ext_reg_cap->eeprom_reg_domain_ext; + param->regcap1 = ext_reg_cap->regcap1; + param->regcap2 = ext_reg_cap->regcap2; + param->wireless_modes = ext_reg_cap->wireless_modes; + param->low_2ghz_chan = ext_reg_cap->low_2ghz_chan; + param->high_2ghz_chan = ext_reg_cap->high_2ghz_chan; + param->low_5ghz_chan = ext_reg_cap->low_5ghz_chan; + param->high_5ghz_chan = ext_reg_cap->high_5ghz_chan; + + return QDF_STATUS_SUCCESS; +} + #ifdef WMI_INTERFACE_EVENT_LOGGING static bool is_management_record_tlv(uint32_t cmd_id) { @@ -12769,6 +12948,13 @@ struct wmi_ops tlv_ops = { .send_encrypt_decrypt_send_cmd = send_encrypt_decrypt_send_cmd_tlv, .send_power_dbg_cmd = send_power_dbg_cmd_tlv, + .extract_service_ready_ext = extract_service_ready_ext_tlv, + .extract_hw_mode_cap_service_ready_ext = + extract_hw_mode_cap_service_ready_ext_tlv, + .extract_mac_phy_cap_service_ready_ext = + extract_mac_phy_cap_service_ready_ext_tlv, + .extract_reg_cap_service_ready_ext = + extract_reg_cap_service_ready_ext_tlv, }; #ifndef CONFIG_MCL