From 21aa15dc9f9f6d2e1231b024ddddc8eff1af1637 Mon Sep 17 00:00:00 2001 From: Balaji Pothunoori Date: Fri, 7 Jul 2023 19:34:03 +0530 Subject: [PATCH] qcacld-3.0: Fix data rate for mgmt tx packets in packet capture mode Currently, data rate for management tx packets is filled only as 1 or 6 Mbps which is wrong. Sniffer expect data rate multiple of 2. Hence fill the data rate with multiple of 2 for tx management packets which received from firmware and converting into mbps. Change-Id: I5dd6515804cd3751925af0992a30a7441ebf9bbb CRs-Fixed: 3444177 --- .../core/src/wlan_pkt_capture_mgmt_txrx.c | 16 +++++++++------- .../inc/wlan_pkt_capture_public_structs.h | 4 ++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/components/pkt_capture/core/src/wlan_pkt_capture_mgmt_txrx.c b/components/pkt_capture/core/src/wlan_pkt_capture_mgmt_txrx.c index d185bb943250..b2cfe1332536 100644 --- a/components/pkt_capture/core/src/wlan_pkt_capture_mgmt_txrx.c +++ b/components/pkt_capture/core/src/wlan_pkt_capture_mgmt_txrx.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, 2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2023 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 @@ -362,6 +362,7 @@ pkt_capture_process_mgmt_tx_data(struct wlan_objmgr_pdev *pdev, struct wlan_objmgr_psoc *psoc; tpSirMacFrameCtl pfc = (tpSirMacFrameCtl)(qdf_nbuf_data(nbuf)); struct ieee80211_frame *wh; + uint16_t rate; psoc = wlan_pdev_get_psoc(pdev); if (!psoc) { @@ -388,8 +389,6 @@ pkt_capture_process_mgmt_tx_data(struct wlan_objmgr_pdev *pdev, txrx_status.tsft = (u_int64_t)params->tsf_l32; txrx_status.chan_num = wlan_freq_to_chan(params->chan_freq); txrx_status.chan_freq = params->chan_freq; - /* params->rate is in Kbps, convert into Mbps */ - txrx_status.rate = (params->rate_kbps / 1000); if (params->rssi == INVALID_RSSI_FOR_TX) /* RSSI -128 is invalid rssi for TX, make it 0 here, * will be normalized during radiotap updation @@ -400,15 +399,18 @@ pkt_capture_process_mgmt_tx_data(struct wlan_objmgr_pdev *pdev, txrx_status.rssi_comb = txrx_status.ant_signal_db; txrx_status.nr_ant = 1; - txrx_status.rtap_flags |= - ((txrx_status.rate == 6 /* Mbps */) ? BIT(1) : 0); + rate = params->rate_kbps * 2; + /* params->rate is in Kbps, convert into Mbps */ + txrx_status.rate = (uint8_t)(rate / 1000); - if (txrx_status.rate == 6) + txrx_status.rtap_flags |= + ((txrx_status.rate == 12 /* Mbps */) ? BIT(1) : 0); + + if (txrx_status.rate == 12) txrx_status.ofdm_flag = 1; else txrx_status.cck_flag = 1; - txrx_status.rate = ((txrx_status.rate == 6 /* Mbps */) ? 0x0c : 0x02); txrx_status.tx_status = status; txrx_status.tx_retry_cnt = params->tx_retry_cnt; txrx_status.add_rtap_ext = true; diff --git a/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_public_structs.h b/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_public_structs.h index 946d812f4eaf..f4e637ca1994 100644 --- a/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_public_structs.h +++ b/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_public_structs.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2020-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021, 2023 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 @@ -73,7 +73,7 @@ enum pkt_capture_config { struct mgmt_offload_event_params { uint32_t tsf_l32; uint32_t chan_freq; - uint32_t rate_kbps; + uint16_t rate_kbps; uint32_t rssi; uint32_t buf_len; uint32_t tx_status;