diff --git a/os_if/linux/mlme/inc/osif_vdev_mgr_util.h b/os_if/linux/mlme/inc/osif_vdev_mgr_util.h new file mode 100644 index 0000000000..2293f5e564 --- /dev/null +++ b/os_if/linux/mlme/inc/osif_vdev_mgr_util.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2021 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 above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: osif_vdev_mgr_util.h + * + * This header file maintains declarations of osif APIs corresponding to vdev + * manager. + */ + +#ifndef __OSIF_VDEV_MGR_UTIL_H +#define __OSIF_VDEV_MGR_UTIL_H +/** + * struct osif_vdev_mgr_ops - VDEV mgr legacy callbacks + * @osif_vdev_mgr_set_mac_addr_response: Callback to indicate set MAC address + * response from FW + */ +struct osif_vdev_mgr_ops { +#ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE + void (*osif_vdev_mgr_set_mac_addr_response)(uint8_t vdev_id, + uint8_t resp_status); +#endif +}; + +/** + * osif_vdev_mgr_set_legacy_cb() - Sets legacy callbacks to osif + * @osif_legacy_ops: Function pointer to legacy ops structure + * + * API to set legacy callbacks to osif + * Context: Any context. + * + * Return: void + */ +void osif_vdev_mgr_set_legacy_cb(struct osif_vdev_mgr_ops *osif_legacy_ops); + +/** + * osif_vdev_mgr_reset_legacy_cb() - Resets legacy callbacks to osif + * + * API to reset legacy callbacks to osif + * Context: Any context. + * + * Return: void + */ +void osif_vdev_mgr_reset_legacy_cb(void); + +/** + * osif_vdev_mgr_register_cb() - Register VDEV manager legacy callbacks + * + * API to register legavy VDEV manager callbacks + * + * Return: QDF_STATUS + */ +QDF_STATUS osif_vdev_mgr_register_cb(void); +#endif /* __OSIF_CM_UTIL_H */ diff --git a/os_if/linux/mlme/src/osif_vdev_mgr_util.c b/os_if/linux/mlme/src/osif_vdev_mgr_util.c new file mode 100644 index 0000000000..cf2f0e2d88 --- /dev/null +++ b/os_if/linux/mlme/src/osif_vdev_mgr_util.c @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2021 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 above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: osif_vdev_mgr_util.c + * + * This header file maintains definitaions of osif APIs corresponding to vdev + * manager. + */ + +#include +#include "osif_vdev_mgr_util.h" + +static struct osif_vdev_mgr_ops *osif_vdev_mgr_legacy_ops; + +#ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE +static QDF_STATUS osif_vdev_mgr_set_mac_addr_response(uint8_t vdev_id, + uint8_t resp_status) +{ + if (osif_vdev_mgr_legacy_ops && + osif_vdev_mgr_legacy_ops->osif_vdev_mgr_set_mac_addr_response) + osif_vdev_mgr_legacy_ops->osif_vdev_mgr_set_mac_addr_response( + vdev_id, resp_status); + + return QDF_STATUS_SUCCESS; +} +#endif + +static struct mlme_vdev_mgr_ops vdev_mgr_ops = { +#ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE + .mlme_vdev_mgr_set_mac_addr_response = + osif_vdev_mgr_set_mac_addr_response +#endif +}; + +/** + * osif_vdev_mgr_get_global_ops() - Get vdev manager global ops + * + * Return: Connection manager global ops + */ +static struct mlme_vdev_mgr_ops *osif_vdev_mgr_get_global_ops(void) +{ + return &vdev_mgr_ops; +} + +QDF_STATUS osif_vdev_mgr_register_cb(void) +{ + mlme_set_osif_vdev_mgr_cb(osif_vdev_mgr_get_global_ops); + + return QDF_STATUS_SUCCESS; +} + +void osif_vdev_mgr_set_legacy_cb(struct osif_vdev_mgr_ops *osif_legacy_ops) +{ + osif_vdev_mgr_legacy_ops = osif_legacy_ops; +} + +void osif_vdev_mgr_reset_legacy_cb(void) +{ + osif_vdev_mgr_legacy_ops = NULL; +} 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 d8502b582e..0e5fc987e4 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,5 +1,6 @@ /* * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2021 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 @@ -817,6 +818,89 @@ static int target_if_pdev_csa_status_event_handler( return target_if_csa_switch_count_status(psoc, tgt_hdl, csa_status); } +#ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE +/** + * target_if_update_macaddr_conf_evt_handler() - Set MAC address confirmation + * event handler + * @scn: Pointer to scn structure + * @event_buff: event data + * @len: length + * + * Response handler for set MAC address request command. + * + * Return: 0 for success or error code + */ +static int target_if_update_macaddr_conf_evt_handler(ol_scn_t scn, + uint8_t *event_buff, + uint32_t len) +{ + struct wlan_objmgr_psoc *psoc; + struct wmi_unified *wmi_handle; + uint8_t vdev_id, resp_status; + QDF_STATUS status; + struct wlan_lmac_if_mlme_rx_ops *rx_ops; + + 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_update_mac_address_event(wmi_handle, event_buff, + &vdev_id, &resp_status); + if (QDF_IS_STATUS_ERROR(status)) { + mlme_err("Failed to extract update MAC address event"); + return -EINVAL; + } + + rx_ops = target_if_vdev_mgr_get_rx_ops(psoc); + if (!rx_ops || !rx_ops->vdev_mgr_set_mac_addr_response) { + mlme_err("No Rx Ops"); + return -EINVAL; + } + + rx_ops->vdev_mgr_set_mac_addr_response(vdev_id, resp_status); + + return 0; +} + +static inline void +target_if_register_set_mac_addr_evt_cbk(struct wmi_unified *wmi_handle) +{ + wmi_unified_register_event_handler( + wmi_handle, wmi_vdev_update_mac_addr_conf_eventid, + target_if_update_macaddr_conf_evt_handler, VDEV_RSP_RX_CTX); +} + +static inline void +target_if_unregister_set_mac_addr_evt_cbk(struct wmi_unified *wmi_handle) +{ + wmi_unified_unregister_event_handler( + wmi_handle, wmi_vdev_update_mac_addr_conf_eventid); +} +#else +static inline void +target_if_register_set_mac_addr_evt_cbk(struct wmi_unified *wmi_handle) +{ +} + +static inline void +target_if_unregister_set_mac_addr_evt_cbk(struct wmi_unified *wmi_handle) +{ +} +#endif + QDF_STATUS target_if_vdev_mgr_wmi_event_register( struct wlan_objmgr_psoc *psoc) { @@ -884,6 +968,8 @@ QDF_STATUS target_if_vdev_mgr_wmi_event_register( mlme_err("failed to register for csa event handler"); } + target_if_register_set_mac_addr_evt_cbk(wmi_handle); + return retval; } @@ -903,6 +989,8 @@ QDF_STATUS target_if_vdev_mgr_wmi_event_unregister( return QDF_STATUS_E_INVAL; } + target_if_unregister_set_mac_addr_evt_cbk(wmi_handle); + wmi_unified_unregister_event_handler( wmi_handle, wmi_pdev_multi_vdev_restart_response_event_id); diff --git a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h index 6d9d0859f6..4690fa476e 100644 --- a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h +++ b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h @@ -2018,6 +2018,8 @@ struct wlan_lmac_if_dfs_rx_ops { * @psoc_get_vdev_response_timer_info: function to get vdev response timer * structure for a specific vdev id * @vdev_mgr_multi_vdev_restart_resp: function to handle mvr response + * @vdev_mgr_set_mac_addr_response: Callback to get response for set MAC address + * command */ struct wlan_lmac_if_mlme_rx_ops { QDF_STATUS (*vdev_mgr_start_response)( @@ -2048,6 +2050,9 @@ struct wlan_lmac_if_mlme_rx_ops { struct vdev_response_timer *(*psoc_get_vdev_response_timer_info)( struct wlan_objmgr_psoc *psoc, uint8_t vdev_id); +#ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE + void (*vdev_mgr_set_mac_addr_response)(uint8_t vdev_id, uint8_t status); +#endif }; #ifdef WLAN_SUPPORT_GREEN_AP diff --git a/umac/mlme/include/wlan_mlme_cmn.h b/umac/mlme/include/wlan_mlme_cmn.h index 2eb2361640..d9217dd9f5 100644 --- a/umac/mlme/include/wlan_mlme_cmn.h +++ b/umac/mlme/include/wlan_mlme_cmn.h @@ -115,6 +115,18 @@ struct mlme_cm_ops { #endif }; +/** + * struct mlme_vdev_mgr_ops - MLME VDEV mgr osif callbacks + * @mlme_vdev_mgr_set_mac_addr_response: Callback to indicate set MAC address + * response to osif + */ +struct mlme_vdev_mgr_ops { +#ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE + QDF_STATUS (*mlme_vdev_mgr_set_mac_addr_response)(uint8_t vdev_id, + uint8_t resp_status); +#endif +}; + /** * struct vdev_mlme_ext_ops - VDEV MLME legacy callbacks structure * @mlme_psoc_ext_hdl_create: callback to invoke creation of @@ -752,6 +764,23 @@ typedef struct mlme_cm_ops *(*osif_cm_get_global_ops_cb)(void); */ void mlme_set_osif_cm_cb(osif_cm_get_global_ops_cb cm_osif_ops); +/** + * typedef osif_vdev_mgr_get_global_ops_cb() - Callback to get vdev manager + * global ops + */ +typedef struct mlme_vdev_mgr_ops *(*osif_vdev_mgr_get_global_ops_cb)(void); + +/** + * mlme_set_osif_vdev_mgr_cb() - Sets ops registration callback + * @mlme_vdev_mgr_osif_ops: Function pointer + * + * API to set ops registration call back + * + * Return: void + */ +void mlme_set_osif_vdev_mgr_cb( + osif_vdev_mgr_get_global_ops_cb mlme_vdev_mgr_osif_ops); + /** * mlme_max_chan_switch_is_set() - Get if max chan switch IE is enabled * @vdev: Object manager vdev pointer @@ -774,5 +803,18 @@ bool mlme_max_chan_switch_is_set(struct wlan_objmgr_psoc *psoc); QDF_STATUS mlme_vdev_ops_send_set_mac_address(struct qdf_mac_addr mac_addr, struct qdf_mac_addr mld_addr, struct wlan_objmgr_vdev *vdev); + +/** + * mlme_vdev_mgr_notify_set_mac_addr_response() - Notify set MAC address + * response + * @vdev_id: VDEV ID + * @resp_status: FW response for the set MAC address operation + * + * API to notify set MAC address to osif + * + * Return: None + */ +void mlme_vdev_mgr_notify_set_mac_addr_response(uint8_t vdev_id, + uint8_t resp_status); #endif #endif diff --git a/umac/mlme/mlme_objmgr/dispatcher/src/wlan_cmn_mlme_main.c b/umac/mlme/mlme_objmgr/dispatcher/src/wlan_cmn_mlme_main.c index 811ca2dc6b..08de400f4e 100644 --- a/umac/mlme/mlme_objmgr/dispatcher/src/wlan_cmn_mlme_main.c +++ b/umac/mlme/mlme_objmgr/dispatcher/src/wlan_cmn_mlme_main.c @@ -47,6 +47,21 @@ static void mlme_cm_ops_deinit(void) glbl_cm_ops = NULL; } +struct mlme_vdev_mgr_ops *glbl_vdev_mgr_ops; +osif_vdev_mgr_get_global_ops_cb glbl_vdev_mgr_ops_cb; + +static void mlme_vdev_mgr_ops_init(void) +{ + if (glbl_vdev_mgr_ops_cb) + glbl_vdev_mgr_ops = glbl_vdev_mgr_ops_cb(); +} + +static void mlme_vdev_mgr_ops_deinit(void) +{ + if (glbl_vdev_mgr_ops_cb) + glbl_vdev_mgr_ops = NULL; +} + QDF_STATUS wlan_cmn_mlme_init(void) { QDF_STATUS status; @@ -68,6 +83,8 @@ QDF_STATUS wlan_cmn_mlme_init(void) mlme_cm_ops_init(); + mlme_vdev_mgr_ops_init(); + return QDF_STATUS_SUCCESS; } @@ -75,6 +92,7 @@ QDF_STATUS wlan_cmn_mlme_deinit(void) { QDF_STATUS status; + mlme_vdev_mgr_ops_deinit(); status = wlan_vdev_mlme_deinit(); if (status != QDF_STATUS_SUCCESS) return status; @@ -574,6 +592,12 @@ bool mlme_max_chan_switch_is_set(struct wlan_objmgr_psoc *psoc) return phy_config->max_chan_switch_ie; } +void mlme_set_osif_vdev_mgr_cb( + osif_vdev_mgr_get_global_ops_cb mlme_vdev_mgr_osif_ops) +{ + glbl_vdev_mgr_ops_cb = mlme_vdev_mgr_osif_ops; +} + #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE QDF_STATUS mlme_vdev_ops_send_set_mac_address(struct qdf_mac_addr mac_addr, struct qdf_mac_addr mld_addr, @@ -587,4 +611,13 @@ QDF_STATUS mlme_vdev_ops_send_set_mac_address(struct qdf_mac_addr mac_addr, return ret; } + +void mlme_vdev_mgr_notify_set_mac_addr_response(uint8_t vdev_id, + uint8_t resp_status) +{ + if (glbl_vdev_mgr_ops && + glbl_vdev_mgr_ops->mlme_vdev_mgr_set_mac_addr_response) + glbl_vdev_mgr_ops->mlme_vdev_mgr_set_mac_addr_response( + vdev_id, resp_status); +} #endif diff --git a/umac/mlme/vdev_mgr/dispatcher/src/wlan_vdev_mgr_tgt_if_rx_api.c b/umac/mlme/vdev_mgr/dispatcher/src/wlan_vdev_mgr_tgt_if_rx_api.c index 9c13105c4b..c5c7c34e13 100644 --- a/umac/mlme/vdev_mgr/dispatcher/src/wlan_vdev_mgr_tgt_if_rx_api.c +++ b/umac/mlme/vdev_mgr/dispatcher/src/wlan_vdev_mgr_tgt_if_rx_api.c @@ -264,6 +264,20 @@ tgt_psoc_reg_wakelock_info_rx_op(struct wlan_lmac_if_mlme_rx_ops } #endif +#ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE +static inline void tgt_vdev_mgr_reg_set_mac_address_response( + struct wlan_lmac_if_mlme_rx_ops *mlme_rx_ops) +{ + mlme_rx_ops->vdev_mgr_set_mac_addr_response = + mlme_vdev_mgr_notify_set_mac_addr_response; +} +#else +static inline void tgt_vdev_mgr_reg_set_mac_address_response( + struct wlan_lmac_if_mlme_rx_ops *mlme_rx_ops) +{ +} +#endif + void tgt_vdev_mgr_register_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops) { struct wlan_lmac_if_mlme_rx_ops *mlme_rx_ops = &rx_ops->mops; @@ -285,4 +299,5 @@ void tgt_vdev_mgr_register_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops) mlme_rx_ops->vdev_mgr_multi_vdev_restart_resp = tgt_vdev_mgr_multi_vdev_restart_resp_handler; tgt_psoc_reg_wakelock_info_rx_op(&rx_ops->mops); + tgt_vdev_mgr_reg_set_mac_address_response(mlme_rx_ops); } diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index 5f0cf1aab7..10f357b6f6 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -4590,5 +4590,18 @@ wmi_unified_pdev_set_mec_timer(struct wmi_unified *wmi_handle, */ QDF_STATUS wmi_unified_send_set_mac_addr(struct wmi_unified *wmi_handle, struct set_mac_addr_params *params); + +/** + * wmi_extract_update_mac_address_event() - Extract update MAC address event + * @wmi_handle: WMI handle + * @evt_buf: event buffer + * @vdev_id: VDEV ID + * @status: FW status for the set MAC address operation + * + * Return: QDF_STATUS_SUCCESS for success or error code + */ +QDF_STATUS wmi_extract_update_mac_address_event(wmi_unified_t wmi_handle, + void *evt_buf, uint8_t *vdev_id, + uint8_t *status); #endif #endif /* _WMI_UNIFIED_API_H_ */ diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index c2f807a86f..ad639b7258 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -2793,6 +2793,9 @@ QDF_STATUS #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE QDF_STATUS (*send_set_mac_address_cmd)(wmi_unified_t wmi, struct set_mac_addr_params *params); +QDF_STATUS (*extract_update_mac_address_event)(wmi_unified_t wmi_handle, + void *evt_buf, uint8_t *vdev_id, + uint8_t *status); #endif }; diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index a2e1a9441d..17185287f0 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -3672,4 +3672,15 @@ QDF_STATUS wmi_unified_send_set_mac_addr(struct wmi_unified *wmi_handle, params); return QDF_STATUS_E_FAILURE; } + +QDF_STATUS wmi_extract_update_mac_address_event(wmi_unified_t wmi_handle, + void *evt_buf, uint8_t *vdev_id, + uint8_t *status) +{ + if (wmi_handle->ops->extract_update_mac_address_event) + return wmi_handle->ops->extract_update_mac_address_event( + wmi_handle, evt_buf, vdev_id, status); + + return QDF_STATUS_E_FAILURE; +} #endif diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 6e485ff273..da80ad0238 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -16824,6 +16824,33 @@ send_set_mac_address_cmd_tlv(wmi_unified_t wmi, return QDF_STATUS_SUCCESS; } + +/** + * extract_update_mac_address_event_tlv() - extract update MAC address event + * @wmi_handle: WMI handle + * @evt_buf: event buffer + * @vdev_id: VDEV ID + * @status: FW status of the set MAC address operation + * + * Return: QDF_STATUS + */ +static QDF_STATUS extract_update_mac_address_event_tlv( + wmi_unified_t wmi_handle, void *evt_buf, + uint8_t *vdev_id, uint8_t *status) +{ + WMI_VDEV_UPDATE_MAC_ADDR_CONF_EVENTID_param_tlvs *param_buf; + wmi_vdev_update_mac_addr_conf_event_fixed_param *event; + + param_buf = + (WMI_VDEV_UPDATE_MAC_ADDR_CONF_EVENTID_param_tlvs *)evt_buf; + + event = param_buf->fixed_param; + + *vdev_id = event->vdev_id; + *status = event->status; + + return QDF_STATUS_SUCCESS; +} #endif struct wmi_ops tlv_ops = { @@ -17241,6 +17268,8 @@ struct wmi_ops tlv_ops = { #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE .send_set_mac_address_cmd = send_set_mac_address_cmd_tlv, + .extract_update_mac_address_event = + extract_update_mac_address_event_tlv, #endif };