Forráskód Böngészése

qcacmn: Handle htt peer map/unmap v3

Add the handler for processing the htt
peer map/unamp v3 and MLO peer map/unmap msgs.

Change-Id: Ie2ab0b76e7aee566ca3b9637b83fd7a14718ab01
CRs-Fixed: 3039326
Rakesh Pillai 4 éve
szülő
commit
2069fa6cdd
4 módosított fájl, 254 hozzáadás és 0 törlés
  1. 116 0
      dp/wifi3.0/dp_htt.c
  2. 91 0
      dp/wifi3.0/dp_peer.c
  3. 29 0
      dp/wifi3.0/dp_peer.h
  4. 18 0
      dp/wifi3.0/dp_types.h

+ 116 - 0
dp/wifi3.0/dp_htt.c

@@ -2502,6 +2502,83 @@ dp_offload_ind_handler(struct htt_soc *soc, uint32_t *msg_word)
 }
 #endif
 
+#ifdef WLAN_FEATURE_11BE_MLO
+static void dp_htt_mlo_peer_map_handler(struct htt_soc *soc,
+					uint32_t *msg_word)
+{
+	uint8_t mac_addr_deswizzle_buf[QDF_MAC_ADDR_SIZE];
+	uint8_t *mlo_peer_mac_addr;
+	uint16_t mlo_peer_id;
+	uint8_t num_links;
+	struct dp_mlo_flow_override_info mlo_flow_info[DP_MLO_FLOW_INFO_MAX];
+
+	mlo_peer_id = HTT_RX_MLO_PEER_MAP_MLO_PEER_ID_GET(*msg_word);
+	num_links =
+		HTT_RX_MLO_PEER_MAP_NUM_LOGICAL_LINKS_GET(*msg_word);
+	mlo_peer_mac_addr =
+	htt_t2h_mac_addr_deswizzle((u_int8_t *)(msg_word + 1),
+				   &mac_addr_deswizzle_buf[0]);
+
+	mlo_flow_info[0].ast_idx =
+		HTT_RX_MLO_PEER_MAP_PRIMARY_AST_INDEX_GET(*(msg_word + 3));
+	mlo_flow_info[0].ast_idx_valid =
+		HTT_RX_MLO_PEER_MAP_AST_INDEX_VALID_FLAG_GET(*(msg_word + 3));
+	mlo_flow_info[0].chip_id =
+		HTT_RX_MLO_PEER_MAP_CHIP_ID_AST_INDEX_GET(*(msg_word + 3));
+	mlo_flow_info[0].tidmask =
+		HTT_RX_MLO_PEER_MAP_TIDMASK_AST_INDEX_GET(*(msg_word + 3));
+	mlo_flow_info[0].cache_set_num =
+	HTT_RX_MLO_PEER_MAP_CACHE_SET_NUM_AST_INDEX_GET(*(msg_word + 3));
+
+	mlo_flow_info[1].ast_idx =
+		HTT_RX_MLO_PEER_MAP_PRIMARY_AST_INDEX_GET(*(msg_word + 3));
+	mlo_flow_info[1].ast_idx_valid =
+		HTT_RX_MLO_PEER_MAP_AST_INDEX_VALID_FLAG_GET(*(msg_word + 3));
+	mlo_flow_info[1].chip_id =
+		HTT_RX_MLO_PEER_MAP_CHIP_ID_AST_INDEX_GET(*(msg_word + 3));
+	mlo_flow_info[1].tidmask =
+		HTT_RX_MLO_PEER_MAP_TIDMASK_AST_INDEX_GET(*(msg_word + 3));
+	mlo_flow_info[1].cache_set_num =
+	HTT_RX_MLO_PEER_MAP_CACHE_SET_NUM_AST_INDEX_GET(*(msg_word + 3));
+
+	mlo_flow_info[2].ast_idx =
+		HTT_RX_MLO_PEER_MAP_PRIMARY_AST_INDEX_GET(*(msg_word + 3));
+	mlo_flow_info[2].ast_idx_valid =
+		HTT_RX_MLO_PEER_MAP_AST_INDEX_VALID_FLAG_GET(*(msg_word + 3));
+	mlo_flow_info[2].chip_id =
+		HTT_RX_MLO_PEER_MAP_CHIP_ID_AST_INDEX_GET(*(msg_word + 3));
+	mlo_flow_info[2].tidmask =
+		HTT_RX_MLO_PEER_MAP_TIDMASK_AST_INDEX_GET(*(msg_word + 3));
+	mlo_flow_info[2].cache_set_num =
+	HTT_RX_MLO_PEER_MAP_CACHE_SET_NUM_AST_INDEX_GET(*(msg_word + 3));
+
+	dp_rx_mlo_peer_map_handler(soc->dp_soc, mlo_peer_id,
+				   mlo_peer_mac_addr,
+				   mlo_flow_info);
+}
+
+static void dp_htt_mlo_peer_unmap_handler(struct htt_soc *soc,
+					  uint32_t *msg_word)
+{
+	uint16_t mlo_peer_id;
+
+	mlo_peer_id = HTT_RX_MLO_PEER_UNMAP_MLO_PEER_ID_GET(*msg_word);
+	dp_rx_mlo_peer_unmap_handler(soc->dp_soc, mlo_peer_id);
+}
+#else
+static void dp_htt_mlo_peer_map_handler(struct htt_soc *soc,
+					uint32_t *msg_word)
+{
+	qdf_assert_always(0);
+}
+
+static void dp_htt_mlo_peer_unmap_handler(struct htt_soc *soc,
+					 uint32_t *msg_word)
+{
+	qdf_assert_always(0);
+}
+#endif
+
 /*
  * dp_htt_t2h_msg_handler() - Generic Target to host Msg/event handler
  * @context:	Opaque context (HTT SOC handle)
@@ -2867,6 +2944,45 @@ static void dp_htt_t2h_msg_handler(void *context, HTC_PACKET *pkt)
 			dp_offload_ind_handler(soc, msg_word);
 			break;
 		}
+	case HTT_T2H_MSG_TYPE_PEER_MAP_V3:
+	{
+		u_int8_t mac_addr_deswizzle_buf[QDF_MAC_ADDR_SIZE];
+		u_int8_t *peer_mac_addr;
+		u_int16_t peer_id;
+		u_int16_t hw_peer_id;
+		u_int8_t vdev_id;
+		uint8_t is_wds;
+		u_int16_t ast_hash = 0;
+
+		peer_id = HTT_RX_PEER_MAP_V3_SW_PEER_ID_GET(*msg_word);
+		vdev_id = HTT_RX_PEER_MAP_V3_VDEV_ID_GET(*msg_word);
+		peer_mac_addr =
+		htt_t2h_mac_addr_deswizzle((u_int8_t *)(msg_word + 1),
+					   &mac_addr_deswizzle_buf[0]);
+		hw_peer_id = HTT_RX_PEER_MAP_V3_HW_PEER_ID_GET(*(msg_word + 3));
+		ast_hash = HTT_RX_PEER_MAP_V3_CACHE_SET_NUM_GET(*(msg_word + 3));
+		is_wds = HTT_RX_PEER_MAP_V3_NEXT_HOP_GET(*(msg_word + 4));
+
+		dp_htt_info("HTT_T2H_MSG_TYPE_PEER_MAP_V3 msg for peer id %d vdev id %d n",
+			    peer_id, vdev_id);
+
+		dp_rx_peer_map_handler(soc->dp_soc, peer_id,
+				       hw_peer_id, vdev_id,
+				       peer_mac_addr, ast_hash,
+				       is_wds);
+
+		break;
+	}
+	case HTT_T2H_MSG_TYPE_MLO_RX_PEER_MAP:
+	{
+		dp_htt_mlo_peer_map_handler(soc, msg_word);
+		break;
+	}
+	case HTT_T2H_MSG_TYPE_MLO_RX_PEER_UNMAP:
+	{
+		dp_htt_mlo_peer_unmap_handler(soc, msg_word);
+		break;
+	}
 	default:
 		break;
 	};

+ 91 - 0
dp/wifi3.0/dp_peer.c

@@ -2601,6 +2601,80 @@ static inline struct dp_peer *dp_peer_find_add_id(struct dp_soc *soc,
 	return NULL;
 }
 
+#ifdef WLAN_FEATURE_11BE_MLO
+#ifdef DP_USE_REDUCED_PEER_ID_FIELD_WIDTH
+static inline uint16_t dp_gen_ml_peer_id(struct dp_soc *soc,
+					 uint16_t peer_id)
+{
+	return ((peer_id & soc->peer_id_mask) | (1 << soc->peer_id_shift));
+}
+#else
+static inline uint16_t dp_gen_ml_peer_id(struct dp_soc *soc,
+					 uint16_t peer_id)
+{
+	return (peer_id | (1 << HTT_RX_PEER_META_DATA_V1_ML_PEER_VALID_S));
+}
+#endif
+
+QDF_STATUS
+dp_rx_mlo_peer_map_handler(struct dp_soc *soc, uint16_t peer_id,
+			   uint8_t *peer_mac_addr,
+			   struct dp_mlo_flow_override_info *mlo_flow_info)
+{
+	struct dp_peer *peer = NULL;
+	uint16_t hw_peer_id = mlo_flow_info[0].ast_idx;
+	uint16_t ast_hash = mlo_flow_info[0].cache_set_num;
+	uint8_t vdev_id = DP_VDEV_ALL;
+	uint8_t is_wds = 0;
+	uint16_t ml_peer_id = dp_gen_ml_peer_id(soc, peer_id);
+	enum cdp_txrx_ast_entry_type type = CDP_TXRX_AST_TYPE_STATIC;
+	QDF_STATUS err = QDF_STATUS_SUCCESS;
+
+	dp_info("mlo_peer_map_event (soc:%pK): peer_id %d ml_peer_id %d, peer_mac "QDF_MAC_ADDR_FMT,
+		soc, peer_id, ml_peer_id,
+		QDF_MAC_ADDR_REF(peer_mac_addr));
+
+	peer = dp_peer_find_add_id(soc, peer_mac_addr, ml_peer_id,
+				   hw_peer_id, vdev_id);
+
+	if (peer) {
+		if (wlan_op_mode_sta == peer->vdev->opmode &&
+		    qdf_mem_cmp(peer->mac_addr.raw,
+				peer->vdev->mld_mac_addr.raw,
+				QDF_MAC_ADDR_SIZE) != 0) {
+			dp_peer_info("%pK: STA vdev bss_peer!!!!", soc);
+			peer->bss_peer = 1;
+		}
+
+		if (peer->vdev->opmode == wlan_op_mode_sta) {
+			peer->vdev->bss_ast_hash = ast_hash;
+			peer->vdev->bss_ast_idx = hw_peer_id;
+		}
+
+		/* Add ast entry incase self ast entry is
+		 * deleted due to DP CP sync issue
+		 *
+		 * self_ast_entry is modified in peer create
+		 * and peer unmap path which cannot run in
+		 * parllel with peer map, no lock need before
+		 * referring it
+		 */
+		if (!peer->self_ast_entry) {
+			dp_info("Add self ast from map "QDF_MAC_ADDR_FMT,
+				QDF_MAC_ADDR_REF(peer_mac_addr));
+			dp_peer_add_ast(soc, peer,
+					peer_mac_addr,
+					type, 0);
+		}
+	}
+
+	err = dp_peer_map_ast(soc, peer, peer_mac_addr, hw_peer_id,
+			      vdev_id, ast_hash, is_wds);
+
+	return err;
+}
+#endif
+
 /**
  * dp_rx_peer_map_handler() - handle peer map event from firmware
  * @soc_handle - genereic soc handle
@@ -2786,6 +2860,23 @@ dp_rx_peer_unmap_handler(struct dp_soc *soc, uint16_t peer_id,
 	dp_peer_unref_delete(peer, DP_MOD_ID_CONFIG);
 }
 
+#ifdef WLAN_FEATURE_11BE_MLO
+void dp_rx_mlo_peer_unmap_handler(struct dp_soc *soc, uint16_t peer_id)
+{
+	uint16_t ml_peer_id = dp_gen_ml_peer_id(soc, peer_id);
+	uint8_t mac_addr[QDF_MAC_ADDR_SIZE] = {0};
+	uint8_t vdev_id = DP_VDEV_ALL;
+	uint8_t is_wds = 0;
+
+	dp_info("MLO peer_unmap_event (soc:%pK) peer_id %d",
+		soc, peer_id);
+
+	dp_rx_peer_unmap_handler(soc, ml_peer_id, vdev_id,
+				 mac_addr, is_wds,
+				 DP_PEER_WDS_COUNT_INVALID);
+}
+#endif
+
 #ifndef AST_OFFLOAD_ENABLE
 void
 dp_peer_find_detach(struct dp_soc *soc)

+ 29 - 0
dp/wifi3.0/dp_peer.h

@@ -569,6 +569,35 @@ QDF_STATUS dp_rx_peer_map_handler(struct dp_soc *soc, uint16_t peer_id,
 void dp_rx_peer_unmap_handler(struct dp_soc *soc, uint16_t peer_id,
 			      uint8_t vdev_id, uint8_t *peer_mac_addr,
 			      uint8_t is_wds, uint32_t free_wds_count);
+
+#ifdef WLAN_FEATURE_11BE_MLO
+/**
+ * dp_rx_mlo_peer_map_handler() - handle MLO peer map event from firmware
+ * @soc_handle - genereic soc handle
+ * @peer_id - ML peer_id from firmware
+ * @peer_mac_addr - mac address of the peer
+ * @mlo_ast_flow_info: MLO AST flow info
+ *
+ * associate the ML peer_id that firmware provided with peer entry
+ * and update the ast table in the host with the hw_peer_id.
+ *
+ * Return: QDF_STATUS code
+ */
+QDF_STATUS
+dp_rx_mlo_peer_map_handler(struct dp_soc *soc, uint16_t peer_id,
+			   uint8_t *peer_mac_addr,
+			   struct dp_mlo_flow_override_info *mlo_flow_info);
+
+/**
+ * dp_rx_mlo_peer_unmap_handler() - handle MLO peer unmap event from firmware
+ * @soc_handle - genereic soc handle
+ * @peeri_id - peer_id from firmware
+ *
+ * Return: none
+ */
+void dp_rx_mlo_peer_unmap_handler(struct dp_soc *soc, uint16_t peer_id);
+#endif
+
 void dp_rx_sec_ind_handler(struct dp_soc *soc, uint16_t peer_id,
 			   enum cdp_sec_type sec_type, int is_unicast,
 			   u_int32_t *michael_key, u_int32_t *rx_pn);

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

@@ -3075,6 +3075,24 @@ struct dp_peer_ast_params {
 #define IEEE80211_SCS_MAX_NO_OF_ELEM 10
 #endif
 
+#define DP_MLO_FLOW_INFO_MAX	3
+
+/**
+ * struct dp_mlo_flow_override_info - Flow override info
+ * @ast_idx: Primary TCL AST Index
+ * @ast_idx_valid: Is AST index valid
+ * @chip_id: CHIP ID
+ * @tidmask: tidmask
+ * @cache_set_num: Cache set number
+ */
+struct dp_mlo_flow_override_info {
+	uint16_t ast_idx;
+	uint8_t ast_idx_valid;
+	uint8_t chip_id;
+	uint8_t tidmask;
+	uint8_t cache_set_num;
+};
+
 #ifdef WLAN_SUPPORT_MSCS
 /*MSCS Procedure based macros */
 #define IEEE80211_MSCS_MAX_ELEM_SIZE    5