summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVulupala Shashank Reddy <vulupa@codeaurora.org>2019-08-29 17:29:29 +0530
committernshrivas <nshrivas@codeaurora.org>2019-10-01 04:12:47 -0700
commit983bbf82e3dd9e802e4b370fb217e7f514fbeeb5 (patch)
tree68d36008f28a6146677f65a67a71696bfc363da6
parent7b24165cad22b17bd51c046d12b7225aa6d2abf1 (diff)
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: I63a0b58fdcf3adb9cb82263a14390f78762d5374 CRs-Fixed: 2492560
-rw-r--r--core/wma/inc/wma.h3
-rw-r--r--core/wma/src/wma_data.c12
-rw-r--r--core/wma/src/wma_mgmt.c51
3 files changed, 66 insertions, 0 deletions
diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h
index 67e3c611af59..5728194c58d6 100644
--- a/core/wma/inc/wma.h
+++ b/core/wma/inc/wma.h
@@ -2423,6 +2423,9 @@ int wmi_desc_pool_init(tp_wma_handle wma_handle, uint32_t pool_size);
void wmi_desc_pool_deinit(tp_wma_handle wma_handle);
struct wmi_desc_t *wmi_desc_get(tp_wma_handle wma_handle);
void wmi_desc_put(tp_wma_handle wma_handle, struct wmi_desc_t *wmi_desc);
+int wma_process_mon_mgmt_tx(qdf_nbuf_t nbuf, uint32_t nbuf_len,
+ struct wmi_mgmt_params *mgmt_param,
+ uint16_t chanfreq);
int wma_mgmt_tx_completion_handler(void *handle, uint8_t *cmpl_event_params,
uint32_t len);
int wma_mgmt_tx_bundle_completion_handler(void *handle,
diff --git a/core/wma/src/wma_data.c b/core/wma/src/wma_data.c
index 22a10c50310c..f5580bb7bc23 100644
--- a/core/wma/src/wma_data.c
+++ b/core/wma/src/wma_data.c
@@ -2652,6 +2652,8 @@ QDF_STATUS wma_tx_packet(void *wma_context, void *tx_frame, uint16_t frmLen,
ol_pdev_handle ctrl_pdev;
bool is_5g = false;
+ ol_txrx_pdev_handle pdev = cds_get_context(QDF_MODULE_ID_TXRX);
+
if (NULL == wma_handle) {
WMA_LOGE("wma_handle is NULL");
cds_packet_free((void *)tx_frame);
@@ -3043,6 +3045,16 @@ QDF_STATUS wma_tx_packet(void *wma_context, void *tx_frame, uint16_t frmLen,
wmi_desc->nbuf = tx_frame;
wmi_desc->tx_cmpl_cb = tx_frm_download_comp_cb;
wmi_desc->ota_post_proc_cb = tx_frm_ota_comp_cb;
+
+ if (pdev && cds_get_pktcap_mode_enable() &&
+ (ol_cfg_pktcapture_mode(pdev->ctrl_pdev) &
+ PKT_CAPTURE_MODE_MGMT_ONLY) &&
+ pdev->mon_cb) {
+ chanfreq = wma_handle->interfaces[vdev_id].mhz;
+ wma_process_mon_mgmt_tx(tx_frame,
+ qdf_nbuf_len(tx_frame),
+ &mgmt_param, chanfreq);
+ }
status = wmi_mgmt_unified_cmd_send(
wma_handle->wmi_handle,
&mgmt_param);
diff --git a/core/wma/src/wma_mgmt.c b/core/wma/src/wma_mgmt.c
index 2c5d519623e7..dbe8469455d1 100644
--- a/core/wma/src/wma_mgmt.c
+++ b/core/wma/src/wma_mgmt.c
@@ -2948,6 +2948,57 @@ static int wma_process_mon_mgmt_tx_completion(tp_wma_handle wma_handle,
}
/**
+ * wma_process_mon_mgmt_tx() - process tx mgmt packets for mon interface
+ * without waiting for tx completion
+ * @nbuf: netbuf
+ * @nbuf_len: nbuf length
+ *
+ * Return: 0 for success or error code
+ */
+int wma_process_mon_mgmt_tx(qdf_nbuf_t nbuf, uint32_t nbuf_len,
+ struct wmi_mgmt_params *mgmt_param,
+ uint16_t chanfreq)
+{
+ qdf_nbuf_t wbuf;
+ wmi_mgmt_hdr mgmt_hdr = {0};
+
+ wbuf = qdf_nbuf_alloc(NULL, roundup(nbuf_len + RESERVE_BYTES, 4),
+ RESERVE_BYTES, 4, false);
+
+ if (!wbuf) {
+ WMA_LOGE("%s: Failed to allocate wbuf for mgmt len(%u)",
+ __func__, nbuf_len);
+ return -ENOMEM;
+ }
+
+ qdf_nbuf_put_tail(wbuf, nbuf_len);
+
+ qdf_mem_copy(qdf_nbuf_data(wbuf), qdf_nbuf_data(nbuf), nbuf_len);
+
+ mgmt_hdr.chan_freq = chanfreq;
+ /* Filling Tpc in rssi field.
+ * As Tpc is not available, filling with default value of tpc
+ */
+ mgmt_hdr.rssi = 0;
+ /* Assigning the local timestamp as TSF timestamp is not available*/
+ mgmt_hdr.tsf_l32 = (uint32_t)jiffies;
+
+ if (mgmt_param->tx_param.preamble_type == (1 << WMI_RATE_PREAMBLE_CCK))
+ mgmt_hdr.rate_kbps = 1000; /* Rate is 1 Mbps for CCK */
+ else
+ mgmt_hdr.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 (!wma_process_mon_mgmt_tx_data(&mgmt_hdr, wbuf, 0xFF))
+ qdf_nbuf_free(wbuf);
+
+ return 0;
+}
+
+/**
* wma_process_mgmt_tx_completion() - process mgmt completion
* @wma_handle: wma handle
* @desc_id: descriptor id