Kaynağa Gözat

qcacmn: Add peer isolation support per vap

Configure the client as isolated peer if part of isolation
list while creating/associating the node or adding the peer
to the isolation list.
Do not forward the packets to and from clients in isolation
list instead accelerate to upper stack.

CRs-Fixed: 2689868

Change-Id: I67fd4dee0fb76c993746cdd66c70c241d407239a
Balaganapathy Palanisamy 5 yıl önce
ebeveyn
işleme
a497ea80aa

+ 4 - 0
dp/inc/cdp_txrx_cmn_struct.h

@@ -978,10 +978,12 @@ struct cdp_soc_t {
  *			to set values in peer
  * @CDP_CONFIG_NAWDS: Enable nawds mode
  * @CDP_CONFIG_NAC: Enable nac
+ * @CDP_CONFIG_ISOLATION : Enable isolation
  */
 enum cdp_peer_param_type {
 	CDP_CONFIG_NAWDS,
 	CDP_CONFIG_NAC,
+	CDP_CONFIG_ISOLATION,
 };
 
 /*
@@ -1050,6 +1052,7 @@ enum cdp_pdev_param_type {
  *			to set values into dp handles.
  *
  * @cdp_peer_param_nawds: Enable nawds mode
+ * @cdp_peer_param_isolation: Enable isolation
  * @cdp_peer_param_nac: Enable nac
  *
  * @cdp_vdev_param_nawds: set nawds enable/disable
@@ -1104,6 +1107,7 @@ enum cdp_pdev_param_type {
 typedef union cdp_config_param_t {
 	/* peer params */
 	bool cdp_peer_param_nawds;
+	bool cdp_peer_param_isolation;
 	uint8_t cdp_peer_param_nac;
 
 	/* vdev params */

+ 19 - 0
dp/wifi3.0/dp_internal.h

@@ -340,6 +340,25 @@ while (0)
 #define DP_TX_HIST_STATS_PER_PDEV()
 #endif /* DISABLE_DP_STATS */
 
+#ifdef QCA_SUPPORT_PEER_ISOLATION
+#define dp_get_peer_isolation(_peer) ((_peer)->isolation)
+
+static inline void dp_set_peer_isolation(struct dp_peer *peer, bool val)
+{
+	peer->isolation = val;
+	QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO,
+		  "peer:%pM isolation:%d",
+		  peer->mac_addr.raw, peer->isolation);
+}
+
+#else
+#define dp_get_peer_isolation(_peer) (0)
+
+static inline void dp_set_peer_isolation(struct dp_peer *peer, bool val)
+{
+}
+#endif /* QCA_SUPPORT_PEER_ISOLATION */
+
 #ifdef FEATURE_TSO_STATS
 /**
  * dp_init_tso_stats() - Clear tso stats

+ 8 - 0
dp/wifi3.0/dp_main.c

@@ -5227,6 +5227,9 @@ dp_peer_create_wifi3(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
 		 * update tx_cap_enabled flag to support peer filter.
 		 */
 		dp_peer_tx_capture_filter_check(pdev, peer);
+
+		dp_set_peer_isolation(peer, false);
+
 		return QDF_STATUS_SUCCESS;
 	} else {
 		/*
@@ -5354,6 +5357,8 @@ dp_peer_create_wifi3(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
 	 */
 	dp_peer_tx_capture_filter_check(pdev, peer);
 
+	dp_set_peer_isolation(peer, false);
+
 	return QDF_STATUS_SUCCESS;
 }
 
@@ -7688,6 +7693,9 @@ static QDF_STATUS dp_set_peer_param(struct cdp_soc_t *cdp_soc,  uint8_t vdev_id,
 	case CDP_CONFIG_NAC:
 		peer->nac = !!(val.cdp_peer_param_nac);
 		break;
+	case CDP_CONFIG_ISOLATION:
+		dp_set_peer_isolation(peer, val.cdp_peer_param_isolation);
+		break;
 	default:
 		break;
 	}

+ 13 - 0
dp/wifi3.0/dp_rx.c

@@ -495,6 +495,13 @@ dp_rx_intrabss_fwd(struct dp_soc *soc,
 			is_frag = qdf_nbuf_is_frag(nbuf);
 			memset(nbuf->cb, 0x0, sizeof(nbuf->cb));
 
+			/* If the source or destination peer in the isolation
+			 * list then dont forward instead push to bridge stack.
+			 */
+			if (dp_get_peer_isolation(ta_peer) ||
+			    dp_get_peer_isolation(da_peer))
+				return false;
+
 			/* linearize the nbuf just before we send to
 			 * dp_tx_send()
 			 */
@@ -544,6 +551,12 @@ dp_rx_intrabss_fwd(struct dp_soc *soc,
 		if (!dp_rx_check_ndi_mdns_fwding(ta_peer, nbuf))
 			goto end;
 
+		/* If the source peer in the isolation list
+		 * then dont forward instead push to bridge stack
+		 */
+		if (dp_get_peer_isolation(ta_peer))
+			goto end;
+
 		nbuf_copy = qdf_nbuf_copy(nbuf);
 		if (!nbuf_copy)
 			goto end;

+ 4 - 0
dp/wifi3.0/dp_types.h

@@ -2240,6 +2240,10 @@ struct dp_peer {
 		rx_cap_enabled:1, /* Peer's rx-capture is enabled */
 		valid:1; /* valid bit */
 
+#ifdef QCA_SUPPORT_PEER_ISOLATION
+	bool isolation; /* enable peer isolation for this peer */
+#endif
+
 	/* MCL specific peer local id */
 	uint16_t local_id;
 	enum ol_txrx_peer_state state;