From 20fb5565d6b1851f38a045ca23fef645f00baa39 Mon Sep 17 00:00:00 2001 From: Surabhi Vishnoi Date: Tue, 15 Jun 2021 18:13:02 +0530 Subject: [PATCH] qcacld-3.0: Add function to fill rssi received from target in vdev_priv Add function to populate the rx average rssi received from target in pkt_capture vdev_priv structure. The rx average rssi is received in wmi smart monitor event. Change-Id: I9206669b418a2245bb8d53920040fddea77ce06c CRs-Fixed: 2969242 --- .../core/inc/wlan_pkt_capture_priv.h | 4 ++- .../dispatcher/inc/wlan_pkt_capture_tgt_api.h | 19 ++++++++++++ .../dispatcher/src/wlan_pkt_capture_tgt_api.c | 31 +++++++++++++++++++ .../pkt_capture/src/target_if_pkt_capture.c | 1 + 4 files changed, 54 insertions(+), 1 deletion(-) diff --git a/components/pkt_capture/core/inc/wlan_pkt_capture_priv.h b/components/pkt_capture/core/inc/wlan_pkt_capture_priv.h index 62a0f1615827..d48d0c4b209d 100644 --- a/components/pkt_capture/core/inc/wlan_pkt_capture_priv.h +++ b/components/pkt_capture/core/inc/wlan_pkt_capture_priv.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2020-2021 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 @@ -58,6 +58,7 @@ struct pkt_capture_cb_context { * @cb_ctx: pointer to packet capture mon callback context * @rx_ops: rx ops * @tx_ops: tx ops + * @rx_avg_rssi: avg rssi of rx data packets */ struct pkt_capture_vdev_priv { struct wlan_objmgr_vdev *vdev; @@ -65,6 +66,7 @@ struct pkt_capture_vdev_priv { struct pkt_capture_cb_context *cb_ctx; struct wlan_pkt_capture_rx_ops rx_ops; struct wlan_pkt_capture_tx_ops tx_ops; + int32_t rx_avg_rssi; }; /** diff --git a/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_tgt_api.h b/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_tgt_api.h index fe5fcf28a3d2..e4c1c3da7fc1 100644 --- a/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_tgt_api.h +++ b/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_tgt_api.h @@ -64,5 +64,24 @@ tgt_pkt_capture_send_mode(struct wlan_objmgr_vdev *vdev, QDF_STATUS tgt_pkt_capture_send_config(struct wlan_objmgr_vdev *vdev, enum pkt_capture_trigger_qos_config config); + +/** + * tgt_pkt_capture_smu_event() - Receive smart monitor event from firmware + * @psoc: pointer to psoc + * @param: smart monitor event params + * + * Return: QDF_STATUS + */ +QDF_STATUS +tgt_pkt_capture_smu_event(struct wlan_objmgr_psoc *psoc, + struct smu_event_params *param); +#else +static inline QDF_STATUS +tgt_pkt_capture_smu_event(struct wlan_objmgr_psoc *psoc, + struct smu_event_params *param) +{ + return QDF_STATUS_SUCCESS; +} #endif + #endif /* _WLAN_PKT_CAPTURE_TGT_API_H */ diff --git a/components/pkt_capture/dispatcher/src/wlan_pkt_capture_tgt_api.c b/components/pkt_capture/dispatcher/src/wlan_pkt_capture_tgt_api.c index ee09bd3afb78..0d069cd0cccd 100644 --- a/components/pkt_capture/dispatcher/src/wlan_pkt_capture_tgt_api.c +++ b/components/pkt_capture/dispatcher/src/wlan_pkt_capture_tgt_api.c @@ -160,4 +160,35 @@ tgt_pkt_capture_send_config(struct wlan_objmgr_vdev *vdev, return status; } + +QDF_STATUS +tgt_pkt_capture_smu_event(struct wlan_objmgr_psoc *psoc, + struct smu_event_params *param) +{ + struct pkt_capture_vdev_priv *vdev_priv; + struct wlan_objmgr_vdev *vdev; + uint8_t vdev_id; + + vdev_id = param->vdev_id; + + vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id, + WLAN_PKT_CAPTURE_ID); + if (!vdev) { + pkt_capture_err("failed to get vdev"); + return QDF_STATUS_E_FAILURE; + } + + vdev_priv = pkt_capture_vdev_get_priv(vdev); + if (!vdev_priv) { + pkt_capture_err("vdev priv is NULL"); + pkt_capture_vdev_put_ref(vdev); + return QDF_STATUS_E_FAILURE; + } + + vdev_priv->rx_avg_rssi = param->rx_avg_rssi; + + pkt_capture_vdev_put_ref(vdev); + + return QDF_STATUS_SUCCESS; +} #endif diff --git a/components/target_if/pkt_capture/src/target_if_pkt_capture.c b/components/target_if/pkt_capture/src/target_if_pkt_capture.c index d74cbb33d4ff..4361c157fa90 100644 --- a/components/target_if/pkt_capture/src/target_if_pkt_capture.c +++ b/components/target_if/pkt_capture/src/target_if_pkt_capture.c @@ -310,6 +310,7 @@ target_if_smart_monitor_event_handler(void *handle, uint8_t *data, return -EINVAL; } + tgt_pkt_capture_smu_event(psoc, ¶ms); return 0; }