From ef24abebc8d66bf578873d49c6b414bae8105ece Mon Sep 17 00:00:00 2001 From: Jinwei Chen Date: Wed, 30 Dec 2020 00:05:21 -0800 Subject: [PATCH] qcacmn: fix incorrect radiotap rssi for monitor frame For lithium based chip, the rssi_comb value fetched from monitor buffer TLV is in unit dBm already, if plus noise_floor value in qdf_nbuf_update_radiotap() again, then the rssi showed in wireshark will be incorrect. Convert rssi_comb to unit dB and not impact legacy chip in qdf_nbuf_update_radiotap(). Change-Id: I889a15f39ebc639386405fb0aae1909c0cce75e0 CRs-Fixed: 2844896 --- dp/wifi3.0/dp_rx_mon_dest.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/dp/wifi3.0/dp_rx_mon_dest.c b/dp/wifi3.0/dp_rx_mon_dest.c index 6d923e9f71df..7e0eea1062cc 100644 --- a/dp/wifi3.0/dp_rx_mon_dest.c +++ b/dp/wifi3.0/dp_rx_mon_dest.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-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 @@ -1411,6 +1411,27 @@ qdf_nbuf_t dp_rx_mon_restitch_mpdu(struct dp_soc *soc, uint32_t mac_id, } #endif +#ifdef DP_MON_RSSI_IN_DBM +/* + * dp_rx_mon_rssi_convert(): convert rssi_comb from unit dBm to dB + * to match with radiotap further conversion requirement + * @rx_status: monitor mode rx status pointer + * + * Return: none + */ +static inline +void dp_rx_mon_rssi_convert(struct mon_rx_status *rx_status) +{ + rx_status->rssi_comb = rx_status->rssi_comb - + rx_status->chan_noise_floor; +} +#else +static inline +void dp_rx_mon_rssi_convert(struct mon_rx_status *rx_status) +{ +} +#endif + /* * dp_rx_mon_deliver(): function to deliver packets to stack * @soc: DP soc @@ -1448,6 +1469,8 @@ QDF_STATUS dp_rx_mon_deliver(struct dp_soc *soc, uint32_t mac_id, pdev->ppdu_info.rx_status.device_id = soc->device_id; pdev->ppdu_info.rx_status.chan_noise_floor = pdev->chan_noise_floor; + /* convert rssi_comb from dBm to positive dB value */ + dp_rx_mon_rssi_convert(&pdev->ppdu_info.rx_status); dp_handle_tx_capture(soc, pdev, mon_mpdu);