Эх сурвалжийг харах

qcacmn: Add peer filter support for tx monitor

Add peer filter support for tx monitor. Add changes to filter frames
in SW

Change-Id: Ie4f2f261976d3b173a417942e36a6aaccea18e47
CRs-Fixed: 3300747
Nandha Kishore Easwaran 2 жил өмнө
parent
commit
9f3dd70ae9

+ 72 - 17
dp/wifi3.0/monitor/2.0/dp_tx_mon_2.0.c

@@ -695,21 +695,46 @@ dp_lite_mon_filter_ppdu(uint8_t mpdu_count, uint8_t level)
 	return QDF_STATUS_SUCCESS;
 }
 
+/**
+ * dp_lite_mon_filter_peer() - filter frames with peer
+ * @config: Lite monitor configuration
+ * @wh: Pointer to ieee80211_frame
+ *
+ * Return: QDF_STATUS
+ */
+static inline QDF_STATUS
+dp_lite_mon_filter_peer(struct dp_lite_mon_tx_config *config,
+			struct ieee80211_frame_min_one *wh)
+{
+	struct dp_lite_mon_peer *peer;
+
+	/* Return here if peer filtering is not required */
+	if (!config->tx_config.peer_count)
+		return QDF_STATUS_SUCCESS;
+
+	TAILQ_FOREACH(peer, &config->tx_config.peer_list, peer_list_elem) {
+		if (!qdf_mem_cmp(&peer->peer_mac.raw[0],
+				 &wh->i_addr1[0], QDF_MAC_ADDR_SIZE)) {
+			return QDF_STATUS_SUCCESS;
+		}
+	}
+
+	return QDF_STATUS_E_ABORTED;
+}
+
 /**
  * dp_lite_mon_filter_subtype() - filter frames with subtype
- * @tx_ppdu_info: pointer to dp_tx_ppdu_info structure
  * @config: Lite monitor configuration
+ * @wh: Pointer to ieee80211_frame
  *
  * Return: QDF_STATUS
  */
 static inline QDF_STATUS
-dp_lite_mon_filter_subtype(struct dp_tx_ppdu_info *tx_ppdu_info,
-			   struct dp_lite_mon_tx_config *config, qdf_nbuf_t buf)
+dp_lite_mon_filter_subtype(struct dp_lite_mon_tx_config *config,
+			   struct ieee80211_frame_min_one *wh)
 {
 	uint16_t mgmt_filter, ctrl_filter, data_filter, type, subtype;
-	struct ieee80211_frame_min_one *wh;
 	uint8_t is_mcast = 0;
-	qdf_nbuf_t nbuf;
 
 	/* Return here if subtype filtering is not required */
 	if (!config->subtype_filtering)
@@ -719,16 +744,6 @@ dp_lite_mon_filter_subtype(struct dp_tx_ppdu_info *tx_ppdu_info,
 	ctrl_filter = config->tx_config.ctrl_filter[DP_MON_FRM_FILTER_MODE_FP];
 	data_filter = config->tx_config.data_filter[DP_MON_FRM_FILTER_MODE_FP];
 
-	if (dp_tx_mon_nbuf_get_num_frag(buf)) {
-		wh = (struct ieee80211_frame_min_one *)qdf_nbuf_get_frag_addr(buf, 0);
-	} else {
-		nbuf = qdf_nbuf_get_ext_list(buf);
-		if (nbuf)
-			wh = (struct ieee80211_frame_min_one *)qdf_nbuf_data(nbuf);
-		else
-			return QDF_STATUS_E_INVAL;
-	}
-
 	type = (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK);
 	subtype = ((wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) >>
 		IEEE80211_FC0_SUBTYPE_SHIFT);
@@ -755,6 +770,46 @@ dp_lite_mon_filter_subtype(struct dp_tx_ppdu_info *tx_ppdu_info,
 	}
 }
 
+/**
+ * dp_lite_mon_filter_peer_subtype() - filter frames with subtype and peer
+ * @config: Lite monitor configuration
+ * @buf: Pointer to nbuf
+ *
+ * Return: QDF_STATUS
+ */
+static inline QDF_STATUS
+dp_lite_mon_filter_peer_subtype(struct dp_lite_mon_tx_config *config,
+				qdf_nbuf_t buf)
+{
+	struct ieee80211_frame_min_one *wh;
+	qdf_nbuf_t nbuf;
+	QDF_STATUS ret;
+
+	/* Return here if subtype and peer filtering is not required */
+	if (!config->subtype_filtering && !config->tx_config.peer_count)
+		return QDF_STATUS_SUCCESS;
+
+	if (dp_tx_mon_nbuf_get_num_frag(buf)) {
+		wh = (struct ieee80211_frame_min_one *)qdf_nbuf_get_frag_addr(buf, 0);
+	} else {
+		nbuf = qdf_nbuf_get_ext_list(buf);
+		if (nbuf)
+			wh = (struct ieee80211_frame_min_one *)qdf_nbuf_data(nbuf);
+		else
+			return QDF_STATUS_E_INVAL;
+	}
+
+	ret = dp_lite_mon_filter_subtype(config, wh);
+	if (ret)
+		return ret;
+
+	ret = dp_lite_mon_filter_peer(config, wh);
+	if (ret)
+		return ret;
+
+	return QDF_STATUS_SUCCESS;
+}
+
 /**
  * dp_tx_lite_mon_filtering() - Additional filtering for lite monitor
  * @pdev: Pointer to physical device
@@ -784,8 +839,8 @@ dp_tx_lite_mon_filtering(struct dp_pdev *pdev,
 	if (ret)
 		return ret;
 
-	/* Subtype filtering */
-	ret = dp_lite_mon_filter_subtype(tx_ppdu_info, config, buf);
+	/* Subtype and peer filtering */
+	ret = dp_lite_mon_filter_peer_subtype(config, buf);
 	if (ret)
 		return ret;