From 13b07929c6d36ed4a2d166fc25972b40893bff28 Mon Sep 17 00:00:00 2001 From: Vulupala Shashank Reddy Date: Wed, 19 Feb 2020 21:45:58 +0530 Subject: [PATCH] qcacld-3.0: Fix OUT OF SYNC for Mgmt Tx Pkts on Virtual Mon Interface For the MON Interface, sometimes Mgmt Tx Pkts are captured after Rx Pkts get captured in tcpdump. This is happening because Tx Pkts are sent to mon after waiting for Tx completion. Now Mgmt Tx frames are sent twice to MON interface, one without waiting for Tx completion with magic number as status field, so that the Tx Pkts get captured in tcpdump before Rx Pkts and normal Tx Pkts get captured, which is after Tx completion will remain same. Change-Id: Idfc65087bd62cd8ef64306501b600caec424ba02 CRs-Fixed: 2627716 --- .../core/inc/wlan_pkt_capture_mgmt_txrx.h | 14 ++++++ .../core/src/wlan_pkt_capture_mgmt_txrx.c | 50 +++++++++++++++++++ .../inc/wlan_pkt_capture_ucfg_api.h | 26 +++++++++- .../src/wlan_pkt_capture_ucfg_api.c | 9 ++++ core/wma/src/wma_data.c | 5 ++ 5 files changed, 103 insertions(+), 1 deletion(-) diff --git a/components/pkt_capture/core/inc/wlan_pkt_capture_mgmt_txrx.h b/components/pkt_capture/core/inc/wlan_pkt_capture_mgmt_txrx.h index 60692788a54a..e2e80dc661f8 100644 --- a/components/pkt_capture/core/inc/wlan_pkt_capture_mgmt_txrx.h +++ b/components/pkt_capture/core/inc/wlan_pkt_capture_mgmt_txrx.h @@ -48,6 +48,20 @@ pkt_capture_process_mgmt_tx_data(struct wlan_objmgr_pdev *pdev, struct mgmt_offload_event_params *params, qdf_nbuf_t nbuf, uint8_t status); +/** + * pkt_capture_mgmt_tx() - process mgmt tx completion + * for pkt capture mode + * @pdev: pointer to pdev object + * @nbuf: netbuf + * @chan_freq: channel freq + * @preamble_type: preamble_type + * + * Return: none + */ +void pkt_capture_mgmt_tx(struct wlan_objmgr_pdev *pdev, + qdf_nbuf_t nbuf, + uint16_t chan_freq, + uint8_t preamble_type); /** * pkt_capture_mgmt_tx_completion() - process mgmt tx completion 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 fdf9e9d5ae62..dd3253bebaac 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 @@ -238,6 +238,56 @@ pkt_capture_process_mgmt_tx_data(struct wlan_objmgr_pdev *pdev, nbuf, status); } +void pkt_capture_mgmt_tx(struct wlan_objmgr_pdev *pdev, + qdf_nbuf_t nbuf, + uint16_t chan_freq, + uint8_t preamble_type) +{ + qdf_nbuf_t wbuf; + int nbuf_len; + struct mgmt_offload_event_params params = {0}; + + if (!pdev) { + pkt_capture_err("pdev is NULL"); + return; + } + + nbuf_len = qdf_nbuf_len(nbuf); + wbuf = qdf_nbuf_alloc(NULL, roundup(nbuf_len + RESERVE_BYTES, 4), + RESERVE_BYTES, 4, false); + if (!wbuf) { + pkt_capture_err("Failed to allocate wbuf for mgmt len(%u)", + nbuf_len); + return; + } + + qdf_nbuf_put_tail(wbuf, nbuf_len); + qdf_mem_copy(qdf_nbuf_data(wbuf), qdf_nbuf_data(nbuf), nbuf_len); + + params.chan_freq = chan_freq; + /* + * Filling Tpc in rssi field. + * As Tpc is not available, filling with default value of tpc + */ + params.rssi = 0; + /* Assigning the local timestamp as TSF timestamp is not available*/ + params.tsf_l32 = (uint32_t)jiffies; + + if (preamble_type == (1 << WMI_RATE_PREAMBLE_CCK)) + params.rate_kbps = 1000; /* Rate is 1 Mbps for CCK */ + else + params.rate_kbps = 6000; /* Rate is 6 Mbps for OFDM */ + + /* + * The mgmt tx packet is send to mon interface before tx completion. + * we do not have status for this packet, using magic number(0xFF) + * as status for mgmt tx packet + */ + if (QDF_STATUS_SUCCESS != + pkt_capture_process_mgmt_tx_data(pdev, ¶ms, wbuf, 0xFF)) + qdf_nbuf_free(wbuf); +} + void pkt_capture_mgmt_tx_completion(struct wlan_objmgr_pdev *pdev, uint32_t desc_id, diff --git a/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_ucfg_api.h b/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_ucfg_api.h index ff7112b48dd7..c1cd376ca4d4 100644 --- a/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_ucfg_api.h +++ b/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_ucfg_api.h @@ -136,7 +136,23 @@ ucfg_pkt_capture_process_mgmt_tx_data(struct wlan_objmgr_pdev *pdev, uint8_t status); /** - * ucfg_pkt_capture_mgmt_tx_completion(): process mgmt tx completion + * ucfg_pkt_capture_mgmt_tx() - process mgmt tx completion + * for pkt capture mode + * @pdev: pointer to pdev object + * @nbuf: netbuf + * @chan_freq: channel freq + * @preamble_type: preamble_type + * + * Return: none + */ +void +ucfg_pkt_capture_mgmt_tx(struct wlan_objmgr_pdev *pdev, + qdf_nbuf_t nbuf, + uint16_t chan_freq, + uint8_t preamble_type); + +/** + * ucfg_pkt_capture_mgmt_tx_completion() - process mgmt tx completion * for pkt capture mode * @pdev: pointer to pdev object * @desc_id: desc_id @@ -309,6 +325,14 @@ ucfg_pkt_capture_process_mgmt_tx_data( return 0; } +static inline void +ucfg_pkt_capture_mgmt_tx(struct wlan_objmgr_pdev *pdev, + qdf_nbuf_t nbuf, + uint16_t chan_freq, + uint8_t preamble_type) +{ +} + static inline void ucfg_pkt_capture_mgmt_tx_completion(struct wlan_objmgr_pdev *pdev, uint32_t desc_id, diff --git a/components/pkt_capture/dispatcher/src/wlan_pkt_capture_ucfg_api.c b/components/pkt_capture/dispatcher/src/wlan_pkt_capture_ucfg_api.c index 525274e3c88d..7155a3c0f39f 100644 --- a/components/pkt_capture/dispatcher/src/wlan_pkt_capture_ucfg_api.c +++ b/components/pkt_capture/dispatcher/src/wlan_pkt_capture_ucfg_api.c @@ -206,6 +206,15 @@ ucfg_pkt_capture_process_mgmt_tx_data(struct wlan_objmgr_pdev *pdev, return pkt_capture_process_mgmt_tx_data(pdev, params, nbuf, status); } +void +ucfg_pkt_capture_mgmt_tx(struct wlan_objmgr_pdev *pdev, + qdf_nbuf_t nbuf, + uint16_t chan_freq, + uint8_t preamble_type) +{ + pkt_capture_mgmt_tx(pdev, nbuf, chan_freq, preamble_type); +} + /** * ucfg_process_pktcapture_mgmt_tx_completion(): process mgmt tx completion * for pkt capture mode diff --git a/core/wma/src/wma_data.c b/core/wma/src/wma_data.c index 43a4ee960995..13c7259b6e37 100644 --- a/core/wma/src/wma_data.c +++ b/core/wma/src/wma_data.c @@ -79,6 +79,7 @@ #include #include #include +#include "wlan_pkt_capture_ucfg_api.h" struct wma_search_rate { int32_t rate; @@ -2791,6 +2792,10 @@ QDF_STATUS wma_tx_packet(void *wma_context, void *tx_frame, uint16_t frmLen, WLAN_MGMT_NB_ID); } + ucfg_pkt_capture_mgmt_tx(wma_handle->pdev, + tx_frame, wma_handle->interfaces[vdev_id].mhz, + mgmt_param.tx_param.preamble_type); + status = wlan_mgmt_txrx_mgmt_frame_tx(peer, wma_handle->mac_context, (qdf_nbuf_t)tx_frame, NULL, tx_frm_ota_comp_cb,