瀏覽代碼

qcacld-3.0: Add check for mgmt/ctrl tx packets in pkt capture

Deliver management and control tx packets to monitor interface
only if corresponding filter is set by vendor command.

Change-Id: Ifc7f0ecfce7d7a105902e8a9ce522ba0325ee9cd
CRs-Fixed: 3044855
Surabhi Vishnoi 3 年之前
父節點
當前提交
f830f1fc71
共有 1 個文件被更改,包括 49 次插入1 次删除
  1. 49 1
      components/pkt_capture/core/src/wlan_pkt_capture_mgmt_txrx.c

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

@@ -329,15 +329,39 @@ void pkt_capture_mgmt_tx(struct wlan_objmgr_pdev *pdev,
 			 uint16_t chan_freq,
 			 uint8_t preamble_type)
 {
+	struct mgmt_offload_event_params params = {0};
+	tpSirMacFrameCtl pfc = (tpSirMacFrameCtl)(qdf_nbuf_data(nbuf));
+	struct pkt_capture_vdev_priv *vdev_priv;
+	struct wlan_objmgr_vdev *vdev;
 	qdf_nbuf_t wbuf;
 	int nbuf_len;
-	struct mgmt_offload_event_params params = {0};
 
 	if (!pdev) {
 		pkt_capture_err("pdev is NULL");
 		return;
 	}
 
+	vdev = pkt_capture_get_vdev();
+	if (!vdev) {
+		pkt_capture_err("vdev is NULL");
+		return;
+	}
+
+	vdev_priv = pkt_capture_vdev_get_priv(vdev);
+	if (!vdev_priv) {
+		pkt_capture_err("packet capture vdev priv is NULL");
+		return;
+	}
+
+	if (pfc->type == IEEE80211_FC0_TYPE_MGT &&
+	    !(vdev_priv->frame_filter.mgmt_tx_frame_filter &
+	    PKT_CAPTURE_MGMT_FRAME_TYPE_ALL))
+		return;
+
+	if (pfc->type == IEEE80211_FC0_TYPE_CTL &&
+	    !vdev_priv->frame_filter.ctrl_tx_frame_filter)
+		return;
+
 	nbuf_len = qdf_nbuf_len(nbuf);
 	wbuf = qdf_nbuf_alloc(NULL, roundup(nbuf_len + RESERVE_BYTES, 4),
 			      RESERVE_BYTES, 4, false);
@@ -380,6 +404,9 @@ pkt_capture_mgmt_tx_completion(struct wlan_objmgr_pdev *pdev,
 			       uint32_t status,
 			       struct mgmt_offload_event_params *params)
 {
+	struct pkt_capture_vdev_priv *vdev_priv;
+	struct wlan_objmgr_vdev *vdev;
+	tpSirMacFrameCtl pfc;
 	qdf_nbuf_t wbuf, nbuf;
 	int nbuf_len;
 
@@ -388,9 +415,30 @@ pkt_capture_mgmt_tx_completion(struct wlan_objmgr_pdev *pdev,
 		return;
 	}
 
+	vdev = pkt_capture_get_vdev();
+	if (!vdev) {
+		pkt_capture_err("vdev is NULL");
+		return;
+	}
+
+	vdev_priv = pkt_capture_vdev_get_priv(vdev);
+	if (!vdev_priv) {
+		pkt_capture_err("packet capture vdev priv is NULL");
+		return;
+	}
+
 	nbuf = mgmt_txrx_get_nbuf(pdev, desc_id);
 	if (!nbuf)
 		return;
+	pfc = (tpSirMacFrameCtl)(qdf_nbuf_data(nbuf));
+	if (pfc->type == IEEE80211_FC0_TYPE_MGT &&
+	    !(vdev_priv->frame_filter.mgmt_tx_frame_filter &
+	    PKT_CAPTURE_MGMT_FRAME_TYPE_ALL))
+		return;
+
+	if (pfc->type == IEEE80211_FC0_TYPE_CTL &&
+	    !vdev_priv->frame_filter.ctrl_tx_frame_filter)
+		return;
 
 	nbuf_len = qdf_nbuf_len(nbuf);
 	wbuf = qdf_nbuf_alloc(NULL, roundup(nbuf_len + RESERVE_BYTES, 4),