Browse Source

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
Jinwei Chen 4 years ago
parent
commit
6676daab7d
1 changed files with 24 additions and 1 deletions
  1. 24 1
      dp/wifi3.0/dp_rx_mon_dest.c

+ 24 - 1
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
@@ -1390,6 +1390,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
@@ -1433,6 +1454,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);