Sfoglia il codice sorgente

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
Vulupala Shashank Reddy 5 anni fa
parent
commit
13b07929c6

+ 14 - 0
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

+ 50 - 0
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, &params, wbuf, 0xFF))
+		qdf_nbuf_free(wbuf);
+}
+
 void
 pkt_capture_mgmt_tx_completion(struct wlan_objmgr_pdev *pdev,
 			       uint32_t desc_id,

+ 25 - 1
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,

+ 9 - 0
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

+ 5 - 0
core/wma/src/wma_data.c

@@ -79,6 +79,7 @@
 #include <wlan_cp_stats_mc_ucfg_api.h>
 #include <wlan_crypto_global_api.h>
 #include <wlan_mlme_main.h>
+#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,