From ab4cfe87b03d83f398e37a4b12b303a40ae1dd4f Mon Sep 17 00:00:00 2001 From: Bing Sun Date: Wed, 26 Jan 2022 11:23:20 +0800 Subject: [PATCH] qcacmn: Handle wmi event wmi_vdev_quiet_offload_eventid Extract information from wmi event wmi_vdev_quiet_offload_eventid and send it to mlme Change-Id: I49ef7f2811c5975a95e8e33050977c49e2b104e4 CRs-Fixed: 3101974 --- .../vdev_mgr/src/target_if_vdev_mgr_rx_ops.c | 87 ++++++++++++++++++- wmi/inc/wmi_unified_api.h | 14 +++ wmi/inc/wmi_unified_param.h | 3 + wmi/inc/wmi_unified_priv.h | 6 ++ wmi/src/wmi_unified_api.c | 13 +++ wmi/src/wmi_unified_tlv.c | 56 ++++++++++++ 6 files changed, 178 insertions(+), 1 deletion(-) diff --git a/target_if/mlme/vdev_mgr/src/target_if_vdev_mgr_rx_ops.c b/target_if/mlme/vdev_mgr/src/target_if_vdev_mgr_rx_ops.c index afa2e8dbcd..7811a7abbe 100644 --- a/target_if/mlme/vdev_mgr/src/target_if_vdev_mgr_rx_ops.c +++ b/target_if/mlme/vdev_mgr/src/target_if_vdev_mgr_rx_ops.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved. - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -912,6 +912,87 @@ target_if_unregister_set_mac_addr_evt_cbk(struct wmi_unified *wmi_handle) } #endif +#ifdef WLAN_FEATURE_11BE_MLO +/** + * target_if_quiet_offload_event_handler() - Quiet IE offload mlo + * station event handler + * @scn: Pointer to scn structure + * @event_buff: event data + * @len: length + * + * Return: 0 for success or error code + */ +static int target_if_quiet_offload_event_handler(ol_scn_t scn, + uint8_t *event_buff, + uint32_t len) +{ + struct wlan_objmgr_psoc *psoc; + struct wmi_unified *wmi_handle; + QDF_STATUS status; + struct wlan_lmac_if_mlme_rx_ops *rx_ops; + struct vdev_sta_quiet_event sta_quiet_event = {0}; + + if (!event_buff) { + mlme_err("Received NULL event ptr from FW"); + return -EINVAL; + } + + psoc = target_if_get_psoc_from_scn_hdl(scn); + if (!psoc) { + mlme_err("PSOC is NULL"); + return -EINVAL; + } + + wmi_handle = get_wmi_unified_hdl_from_psoc(psoc); + if (!wmi_handle) { + mlme_err("wmi_handle is null"); + return -EINVAL; + } + + status = wmi_extract_quiet_offload_event(wmi_handle, event_buff, + &sta_quiet_event); + if (QDF_IS_STATUS_ERROR(status)) { + mlme_err("Failed to extract quiet IE offload event"); + return -EINVAL; + } + + rx_ops = target_if_vdev_mgr_get_rx_ops(psoc); + if (!rx_ops || !rx_ops->vdev_mgr_quiet_offload) { + mlme_err("No Rx Ops"); + return -EINVAL; + } + + rx_ops->vdev_mgr_quiet_offload(psoc, &sta_quiet_event); + + return 0; +} + +static inline void +target_if_register_quiet_offload_event(struct wmi_unified *wmi_handle) +{ + wmi_unified_register_event_handler( + wmi_handle, wmi_vdev_quiet_offload_eventid, + target_if_quiet_offload_event_handler, VDEV_RSP_RX_CTX); +} + +static inline void +target_if_unregister_quiet_offload_event(struct wmi_unified *wmi_handle) +{ + wmi_unified_unregister_event_handler( + wmi_handle, wmi_vdev_quiet_offload_eventid); +} +#else +static inline void +target_if_register_quiet_offload_event(struct wmi_unified *wmi_handle) +{ +} + +static inline void +target_if_unregister_quiet_offload_event(struct wmi_unified *wmi_handle) +{ +} +#endif + QDF_STATUS target_if_vdev_mgr_wmi_event_register( struct wlan_objmgr_psoc *psoc) { @@ -981,6 +1062,8 @@ QDF_STATUS target_if_vdev_mgr_wmi_event_register( target_if_register_set_mac_addr_evt_cbk(wmi_handle); + target_if_register_quiet_offload_event(wmi_handle); + return retval; } @@ -1000,6 +1083,8 @@ QDF_STATUS target_if_vdev_mgr_wmi_event_unregister( return QDF_STATUS_E_INVAL; } + target_if_unregister_quiet_offload_event(wmi_handle); + target_if_unregister_set_mac_addr_evt_cbk(wmi_handle); wmi_unified_unregister_event_handler( diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index 63effec0fe..6f16fd8f30 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -4646,4 +4646,18 @@ QDF_STATUS wmi_extract_update_mac_address_event(wmi_unified_t wmi_handle, void *evt_buf, uint8_t *vdev_id, uint8_t *status); #endif + +#ifdef WLAN_FEATURE_11BE_MLO +/** + * wmi_extract_quiet_offload_event() - Extra mlo sta quiet IE offload event + * @wmi_handle: WMI handle + * @evt_buf: event buffer + * @quiet_event: pointer to struct vdev_sta_quiet_event + * + * Return: QDF_STATUS_SUCCESS for success or error code + */ +QDF_STATUS wmi_extract_quiet_offload_event( + struct wmi_unified *wmi_handle, void *evt_buf, + struct vdev_sta_quiet_event *quiet_event); +#endif #endif /* _WMI_UNIFIED_API_H_ */ diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index b4f3c9fa47..5c1fcf611a 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -4869,6 +4869,9 @@ typedef enum { wmi_roam_frame_event_id, #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE wmi_vdev_update_mac_addr_conf_eventid, +#endif +#ifdef WLAN_FEATURE_11BE_MLO + wmi_vdev_quiet_offload_eventid, #endif wmi_events_max, } wmi_conv_event_id; diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index a1c43328be..65feabd895 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -2926,6 +2926,12 @@ QDF_STATUS (*send_set_nss_probe_intvl_cmd)(wmi_unified_t wmi_handle, uint8_t pdev_id, struct wmi_rc_params *param); #endif + +#ifdef WLAN_FEATURE_11BE_MLO +QDF_STATUS (*extract_quiet_offload_event)( + wmi_unified_t wmi_handle, void *evt_buf, + struct vdev_sta_quiet_event *quiet_event); +#endif }; /* Forward declartion for psoc*/ diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index 6792a69fe1..22f98eb1c3 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -3719,3 +3719,16 @@ QDF_STATUS wmi_extract_update_mac_address_event(wmi_unified_t wmi_handle, return QDF_STATUS_E_FAILURE; } #endif + +#ifdef WLAN_FEATURE_11BE_MLO +QDF_STATUS wmi_extract_quiet_offload_event( + struct wmi_unified *wmi_handle, void *evt_buf, + struct vdev_sta_quiet_event *quiet_event) +{ + if (wmi_handle->ops->extract_quiet_offload_event) + return wmi_handle->ops->extract_quiet_offload_event( + wmi_handle, evt_buf, quiet_event); + + return QDF_STATUS_E_FAILURE; +} +#endif diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 5f667e1605..768759ed3a 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -17046,6 +17046,53 @@ static QDF_STATUS extract_update_mac_address_event_tlv( } #endif +#ifdef WLAN_FEATURE_11BE_MLO +/** + * extract_quiet_offload_event_tlv() - extract quiet offload event + * @wmi_handle: WMI handle + * @evt_buf: event buffer + * @mld_mac: mld mac address + * @link_mac: link mac address + * @link_id: link id + * @quiet_status: quiet is started or stopped + * + * Return: QDF_STATUS + */ +static QDF_STATUS extract_quiet_offload_event_tlv( + wmi_unified_t wmi_handle, void *evt_buf, + struct vdev_sta_quiet_event *quiet_event) +{ + WMI_QUIET_HANDLING_EVENTID_param_tlvs *param_buf; + wmi_quiet_event_fixed_param *event; + + param_buf = (WMI_QUIET_HANDLING_EVENTID_param_tlvs *)evt_buf; + + event = param_buf->fixed_param; + + if (!(event->mld_mac_address_present && event->linkid_present) && + !event->link_mac_address_present) { + wmi_err("Invalid sta quiet offload event. present bit: mld mac %d link mac %d linkid %d", + event->mld_mac_address_present, + event->linkid_present, + event->link_mac_address_present); + return QDF_STATUS_E_INVAL; + } + + if (event->mld_mac_address_present) + WMI_MAC_ADDR_TO_CHAR_ARRAY(&event->mld_mac_address, + quiet_event->mld_mac.bytes); + if (event->link_mac_address_present) + WMI_MAC_ADDR_TO_CHAR_ARRAY(&event->link_mac_address, + quiet_event->link_mac.bytes); + if (event->linkid_present) + quiet_event->link_id = event->linkid; + quiet_event->quiet_status = (event->quiet_status == + WMI_QUIET_EVENT_START); + + return QDF_STATUS_SUCCESS; +} +#endif + struct wmi_ops tlv_ops = { .send_vdev_create_cmd = send_vdev_create_cmd_tlv, .send_vdev_delete_cmd = send_vdev_delete_cmd_tlv, @@ -17468,6 +17515,11 @@ struct wmi_ops tlv_ops = { .extract_update_mac_address_event = extract_update_mac_address_event_tlv, #endif + +#ifdef WLAN_FEATURE_11BE_MLO + .extract_quiet_offload_event = + extract_quiet_offload_event_tlv, +#endif }; /** @@ -17910,6 +17962,10 @@ event_ids[wmi_roam_scan_chan_list_id] = event_ids[wmi_vdev_update_mac_addr_conf_eventid] = WMI_VDEV_UPDATE_MAC_ADDR_CONF_EVENTID; #endif +#ifdef WLAN_FEATURE_11BE_MLO + event_ids[wmi_vdev_quiet_offload_eventid] = + WMI_QUIET_HANDLING_EVENTID; +#endif } #ifdef WLAN_FEATURE_LINK_LAYER_STATS