Browse Source

qcacld-3.0: Skip QOS NULL frames from monitor interface

Skip QOS NULL frames from monitor interface in
packet capture mode.

Change-Id: I132df424c6537fa0cc6f0621affae54e22a7d531
CRs-Fixed: 2644167
Dundi Raviteja 5 years ago
parent
commit
49dcd5d662

+ 11 - 0
components/pkt_capture/core/inc/wlan_pkt_capture_main.h

@@ -185,4 +185,15 @@ uint32_t pkt_capture_drop_nbuf_list(qdf_nbuf_t buf_list);
  * Return: None
  */
 void pkt_capture_record_channel(struct wlan_objmgr_vdev *vdev);
+
+/**
+ * pkt_capture_mon() - Wrapper function to invoke mon cb
+ * @cb_ctx: packet capture callback context
+ * @msdu: packet
+ *
+ * Return: None
+ */
+void pkt_capture_mon(struct pkt_capture_cb_context *cb_ctx,
+		     qdf_nbuf_t msdu);
+
 #endif /* end of _WLAN_PKT_CAPTURE_MAIN_H_ */

+ 14 - 0
components/pkt_capture/core/inc/wlan_pkt_capture_mon_thread.h

@@ -111,6 +111,20 @@ struct pkt_capture_mon_context {
 	bool is_mon_thread_suspended;
 };
 
+/**
+ * struct radiotap_header - base radiotap header
+ * @it_version: radiotap version, always 0
+ * @it_pad: padding (or alignment)
+ * @it_len: overall radiotap header length
+ * @it_present: (first) present word
+ */
+struct radiotap_header {
+	uint8_t it_version;
+	uint8_t it_pad;
+	__le16 it_len;
+	__le32 it_present;
+} __packed;
+
 /**
  * pkt_capture_suspend_mon_thread() - suspend packet capture mon thread
  * vdev: pointer to vdev object manager

+ 2 - 13
components/pkt_capture/core/src/wlan_pkt_capture_data_txrx.c

@@ -528,12 +528,7 @@ pkt_capture_rx_data_cb(
 		 */
 		headroom = qdf_nbuf_headroom(msdu);
 		qdf_nbuf_update_radiotap(&rx_status, msdu, headroom);
-
-		if (QDF_STATUS_SUCCESS !=
-		    cb_ctx->mon_cb(cb_ctx->mon_ctx, msdu)) {
-			pkt_capture_err("Frame Rx to HDD failed");
-			qdf_nbuf_free(msdu);
-		}
+		pkt_capture_mon(cb_ctx, msdu);
 		msdu = next_buf;
 	}
 
@@ -706,13 +701,7 @@ pkt_capture_tx_data_cb(
 		 */
 		headroom = qdf_nbuf_headroom(msdu);
 		qdf_nbuf_update_radiotap(&tx_status, msdu, headroom);
-
-		if (QDF_STATUS_SUCCESS !=
-		    cb_ctx->mon_cb(cb_ctx->mon_ctx, msdu)) {
-			pkt_capture_err("Frame Tx to HDD failed");
-			qdf_nbuf_free(msdu);
-		}
-
+		pkt_capture_mon(cb_ctx, msdu);
 		msdu = next_buf;
 	}
 	return;

+ 1 - 5
components/pkt_capture/core/src/wlan_pkt_capture_mgmt_txrx.c

@@ -100,11 +100,7 @@ pkt_capture_mgmtpkt_cb(void *context, void *ppdev, void *nbuf_list,
 	while (msdu) {
 		next_buf = qdf_nbuf_queue_next(msdu);
 		qdf_nbuf_set_next(msdu, NULL);   /* Add NULL terminator */
-		if (QDF_STATUS_SUCCESS !=
-		    cb_ctx->mon_cb(cb_ctx->mon_ctx, msdu)) {
-			pkt_capture_err("Frame Rx to HDD failed");
-			qdf_nbuf_free(msdu);
-		}
+		pkt_capture_mon(cb_ctx, msdu);
 		msdu = next_buf;
 	}
 

+ 26 - 1
components/pkt_capture/core/src/wlan_pkt_capture_mon_thread.c

@@ -20,8 +20,33 @@
  * DOC: Define internal APIs related to the packet capture component
  */
 
-#include "wlan_pkt_capture_priv.h"
+#include "wlan_pkt_capture_mon_thread.h"
 #include <linux/kthread.h>
+#include "cds_ieee80211_common.h"
+
+void pkt_capture_mon(struct pkt_capture_cb_context *cb_ctx,
+		     qdf_nbuf_t msdu)
+{
+	struct radiotap_header *rthdr;
+	uint8_t rtlen, type, sub_type;
+	struct ieee80211_frame *wh;
+
+	rthdr = (struct radiotap_header *)qdf_nbuf_data(msdu);
+	rtlen = rthdr->it_len;
+	wh = (struct ieee80211_frame *)(qdf_nbuf_data(msdu) + rtlen);
+	type = (wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
+	sub_type = (wh)->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
+
+	if ((type == QDF_IEEE80211_FC0_TYPE_DATA) &&
+	    (sub_type == QDF_IEEE80211_FC0_SUBTYPE_QOS_NULL)) {
+		qdf_nbuf_free(msdu);
+		return;
+	}
+	if (cb_ctx->mon_cb(cb_ctx->mon_ctx, msdu) != QDF_STATUS_SUCCESS) {
+		pkt_capture_err("Frame Rx to HDD failed");
+		qdf_nbuf_free(msdu);
+	}
+}
 
 void pkt_capture_free_mon_pkt_freeq(struct pkt_capture_mon_context *mon_ctx)
 {