diff --git a/components/nan/core/inc/nan_public_structs.h b/components/nan/core/inc/nan_public_structs.h index 40eedf60e0..8b76015c83 100644 --- a/components/nan/core/inc/nan_public_structs.h +++ b/components/nan/core/inc/nan_public_structs.h @@ -612,6 +612,17 @@ struct nan_datapath_end_indication_event { struct peer_nan_datapath_map ndp_map[]; }; +/** + * struct nan_datapath_peer_ind - ndp peer indication + * @msg: msg received by FW + * @data_len: data length + * + */ +struct nan_dump_msg { + uint8_t *msg; + uint32_t data_len; +}; + /** * struct nan_datapath_confirm_event - ndp confirmation event from FW * @vdev: pointer to vdev object diff --git a/components/target_if/nan/src/target_if_nan.c b/components/target_if/nan/src/target_if_nan.c index 3919315301..3706b3f110 100644 --- a/components/target_if/nan/src/target_if_nan.c +++ b/components/target_if/nan/src/target_if_nan.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2020 The Linux Foundation. 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 @@ -224,6 +224,42 @@ static QDF_STATUS target_if_nan_ndp_initiator_req( return status; } +static int target_if_nan_dmesg_handler(ol_scn_t scn, uint8_t *data, + uint32_t data_len) +{ + QDF_STATUS status; + struct nan_dump_msg msg; + struct wmi_unified *wmi_handle; + struct wlan_objmgr_psoc *psoc; + + psoc = target_if_get_psoc_from_scn_hdl(scn); + if (!psoc) { + target_if_err("psoc is null"); + return -EINVAL; + } + + wmi_handle = get_wmi_unified_hdl_from_psoc(psoc); + if (!wmi_handle) { + target_if_err("wmi_handle is null"); + return -EINVAL; + } + + status = wmi_extract_nan_msg(wmi_handle, data, &msg); + if (QDF_IS_STATUS_ERROR(status)) { + target_if_err("parsing of event failed, %d", status); + return -EINVAL; + } + + if (!msg.msg) { + target_if_err("msg not present %d", msg.data_len); + return -EINVAL; + } + + target_if_info("%s", msg.msg); + + return 0; +} + static int target_if_ndp_initiator_rsp_handler(ol_scn_t scn, uint8_t *data, uint32_t len) { @@ -968,6 +1004,15 @@ QDF_STATUS target_if_nan_register_events(struct wlan_objmgr_psoc *psoc) return QDF_STATUS_E_FAILURE; } + ret = wmi_unified_register_event_handler(handle, wmi_nan_dmesg_event_id, + target_if_nan_dmesg_handler, + WMI_RX_UMAC_CTX); + if (ret) { + target_if_err("wmi event registration failed, ret: %d", ret); + target_if_nan_deregister_events(psoc); + return QDF_STATUS_E_FAILURE; + } + ret = wmi_unified_register_event_handler(handle, wmi_ndp_indication_event_id, target_if_ndp_ind_handler, @@ -1091,6 +1136,13 @@ QDF_STATUS target_if_nan_deregister_events(struct wlan_objmgr_psoc *psoc) status = ret; } + ret = wmi_unified_unregister_event_handler(handle, + wmi_nan_dmesg_event_id); + if (ret) { + target_if_err("wmi event deregistration failed, ret: %d", ret); + status = ret; + } + ret = wmi_unified_unregister_event_handler(handle, wmi_ndp_initiator_rsp_event_id); if (ret) {