Sfoglia il codice sorgente

qcacmn: Add support for WMI_ROAM_SYNCH_KEY_EVENTID

Add support to handle WMI_ROAM_SYNCH_KEY_EVENTID.
WMI_ROAM_SYNCH_KEY_EVENTID is received after roaming to 3 Link
MLO AP when standby link is supported.

Add changes to register handler function pointers and parse
the event.

Change-Id: Iee17560f9f1f3242ef512a550764a9c64319b67f
CRs-Fixed: 3571673
Pragaspathi Thilagaraj 1 anno fa
parent
commit
cbefdcb9f0

+ 10 - 0
umac/cmn_services/crypto/inc/wlan_crypto_global_api.h

@@ -977,6 +977,16 @@ QDF_STATUS wlan_crypto_set_key_req(struct wlan_objmgr_vdev *vdev,
 				   struct wlan_crypto_key *req,
 				   enum wlan_crypto_key_type key_type);
 
+/**
+ * wlan_crypto_free_key() - Free the given key
+ * @crypto_key: pointer to the key
+ *
+ * This function frees keys stored in vdev crypto object.
+ *
+ * Return: None
+ */
+void wlan_crypto_free_key(struct wlan_crypto_keys *crypto_key);
+
 /**
  * wlan_crypto_free_vdev_key() - Free keys for vdev
  * @vdev: vdev object

+ 58 - 0
umac/cmn_services/crypto/inc/wlan_crypto_global_def.h

@@ -476,6 +476,64 @@ struct wlan_crypto_key {
 				+ WLAN_CRYPTO_RXMIC_OFFSET)
 };
 
+/**
+ * struct wlan_crypto_keys - crypto keys structure
+ * @key:              key buffers for this peer
+ * @igtk_key:         igtk key buffer for this peer
+ * @bigtk_key:        bigtk key buffer for this peer
+ * @ltf_key_seed:     LTF Key Seed buffer
+ * @igtk_key_type:    igtk key type
+ * @def_tx_keyid:     default key used for this peer
+ * @def_igtk_tx_keyid: default igtk key used for this peer
+ * @def_bigtk_tx_keyid: default bigtk key used for this peer
+ */
+struct wlan_crypto_keys {
+	struct wlan_crypto_key *key[WLAN_CRYPTO_MAX_VLANKEYIX];
+	struct wlan_crypto_key *igtk_key[WLAN_CRYPTO_MAXIGTKKEYIDX];
+	struct wlan_crypto_key *bigtk_key[WLAN_CRYPTO_MAXBIGTKKEYIDX];
+	struct wlan_crypto_ltf_keyseed_data ltf_key_seed;
+	enum wlan_crypto_cipher_type igtk_key_type;
+	uint8_t def_tx_keyid;
+	uint8_t def_igtk_tx_keyid;
+	uint8_t def_bigtk_tx_keyid;
+};
+
+union crypto_align_mac_addr {
+	uint8_t raw[QDF_MAC_ADDR_SIZE];
+	struct {
+		uint16_t bytes_ab;
+		uint16_t bytes_cd;
+		uint16_t bytes_ef;
+	} align2;
+	struct {
+		uint32_t bytes_abcd;
+		uint16_t bytes_ef;
+	} align4;
+	struct __packed {
+		uint16_t bytes_ab;
+		uint32_t bytes_cdef;
+	} align4_2;
+};
+
+/**
+ * struct wlan_crypto_key_entry - crypto key entry structure
+ * @mac_addr: mac addr
+ * @is_active: active key entry
+ * @link_id: link id
+ * @vdev_id: vdev id
+ * @keys: crypto keys
+ * @hash_list_elem: hash list element
+ */
+struct wlan_crypto_key_entry {
+	union crypto_align_mac_addr mac_addr;
+	bool is_active;
+	uint8_t link_id;
+	uint8_t vdev_id;
+	struct wlan_crypto_keys keys;
+
+	TAILQ_ENTRY(wlan_crypto_key_entry) hash_list_elem;
+};
+
 /**
  * struct wlan_crypto_req_key - key request structure
  * @type:                       key/cipher type

+ 2 - 60
umac/cmn_services/crypto/src/wlan_crypto_def_i.h

@@ -24,11 +24,12 @@
 #define _WLAN_CRYPTO_DEF_I_H_
 
 #include <wlan_cmn_ieee80211.h>
+#include "wlan_objmgr_pdev_obj.h"
+#include "wlan_crypto_global_def.h"
 #ifdef WLAN_CRYPTO_AES
 #include "wlan_crypto_aes_i.h"
 #endif
 
-
 /* Number of bits per byte */
 #define CRYPTO_NBBY  8
 /* Default link id for legacy connection */
@@ -393,29 +394,6 @@ struct crypto_add_key_result {
 typedef void (*crypto_add_key_callback)(void *context,
 					struct crypto_add_key_result *result);
 
-/**
- * struct wlan_crypto_keys - crypto keys structure
- * @key:              key buffers for this peer
- * @igtk_key:         igtk key buffer for this peer
- * @bigtk_key:        bigtk key buffer for this peer
- * @ltf_key_seed:     LTF Key Seed buffer
- * @igtk_key_type:    igtk key type
- * @def_tx_keyid:     default key used for this peer
- * @def_igtk_tx_keyid: default igtk key used for this peer
- * @def_bigtk_tx_keyid: default bigtk key used for this peer
- *
- */
-struct wlan_crypto_keys {
-	struct wlan_crypto_key *key[WLAN_CRYPTO_MAX_VLANKEYIX];
-	struct wlan_crypto_key *igtk_key[WLAN_CRYPTO_MAXIGTKKEYIDX];
-	struct wlan_crypto_key *bigtk_key[WLAN_CRYPTO_MAXBIGTKKEYIDX];
-	struct wlan_crypto_ltf_keyseed_data ltf_key_seed;
-	enum wlan_crypto_cipher_type igtk_key_type;
-	uint8_t def_tx_keyid;
-	uint8_t def_igtk_tx_keyid;
-	uint8_t def_bigtk_tx_keyid;
-};
-
 /**
  * struct wlan_crypto_comp_priv - crypto component private structure
  * @crypto_params:    crypto params for the peer
@@ -567,42 +545,6 @@ static inline int wlan_get_tid(const void *data)
 		return WLAN_NONQOS_SEQ;
 }
 
-union crypto_align_mac_addr {
-	uint8_t raw[QDF_MAC_ADDR_SIZE];
-	struct {
-		uint16_t bytes_ab;
-		uint16_t bytes_cd;
-		uint16_t bytes_ef;
-	} align2;
-	struct {
-		uint32_t bytes_abcd;
-		uint16_t bytes_ef;
-	} align4;
-	struct __packed {
-		uint16_t bytes_ab;
-		uint32_t bytes_cdef;
-	} align4_2;
-};
-
-/**
- * struct wlan_crypto_key_entry - crypto key entry structure
- * @mac_addr: mac addr
- * @is_active: active key entry
- * @link_id: link id
- * @vdev_id: vdev id
- * @keys: crypto keys
- * @hash_list_elem: hash list element
- */
-struct wlan_crypto_key_entry {
-	union crypto_align_mac_addr mac_addr;
-	bool is_active;
-	uint8_t link_id;
-	uint8_t vdev_id;
-	struct wlan_crypto_keys keys;
-
-	TAILQ_ENTRY(wlan_crypto_key_entry) hash_list_elem;
-};
-
 struct crypto_psoc_priv_obj {
 	/** @crypto_key_lock: lock for crypto key table */
 	qdf_mutex_t crypto_key_lock;

+ 29 - 23
umac/cmn_services/crypto/src/wlan_crypto_obj_mgr.c

@@ -205,9 +205,15 @@ QDF_STATUS wlan_crypto_add_key_entry(struct wlan_objmgr_psoc *psoc,
 						(struct qdf_mac_addr *)new_entry->mac_addr.raw,
 						link_id);
 
-	crypto_hash_add(crypto_psoc_obj, new_entry, link_id);
+	crypto_entry = qdf_mem_malloc(sizeof(*crypto_entry));
+	if (!crypto_entry)
+		return QDF_STATUS_E_NOMEM;
+
+	*crypto_entry = *new_entry;
+
+	crypto_hash_add(crypto_psoc_obj, crypto_entry, link_id);
 	qdf_atomic_inc(&crypto_psoc_obj->crypto_key_cnt);
-	new_entry->is_active = 1;
+	crypto_entry->is_active = 1;
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -280,9 +286,8 @@ static void crypto_remove_entry(struct crypto_psoc_priv_obj *psoc,
 					   crypto_entry->link_id);
 	TAILQ_HEAD(, wlan_crypto_key_entry) * free_list = ptr;
 
-	crypto_debug("crypto remove entry key index %d link id %d crypto_entry %pK ",
-		     index, crypto_entry->link_id,
-		     crypto_entry);
+	crypto_info("crypto remove entry key index %d link id %d",
+		    index, crypto_entry->link_id);
 
 	for (i = 0; i < WLAN_CRYPTO_MAX_VLANKEYIX; i++) {
 		if (crypto_entry->keys.key[i]) {
@@ -617,39 +622,40 @@ static QDF_STATUS wlan_crypto_peer_obj_create_handler(
 	return status;
 }
 
-static void wlan_crypto_free_key(struct wlan_crypto_comp_priv *crypto_priv)
+void wlan_crypto_free_key(struct wlan_crypto_keys *crypto_key)
 {
 	uint8_t i;
 
-	if (!crypto_priv) {
-		crypto_err("crypto_priv NULL");
+	if (!crypto_key) {
+		crypto_err("given key ptr is NULL");
 		return;
 	}
 
 	for (i = 0; i < WLAN_CRYPTO_MAX_VLANKEYIX; i++) {
-		if (crypto_priv->crypto_key.key[i]) {
-			qdf_mem_free(crypto_priv->crypto_key.key[i]);
-			crypto_priv->crypto_key.key[i] = NULL;
+		if (crypto_key->key[i]) {
+			qdf_mem_free(crypto_key->key[i]);
+			crypto_key->key[i] = NULL;
 		}
 	}
 
 	for (i = 0; i < WLAN_CRYPTO_MAXIGTKKEYIDX; i++) {
-		if (crypto_priv->crypto_key.igtk_key[i]) {
-			qdf_mem_free(crypto_priv->crypto_key.igtk_key[i]);
-			crypto_priv->crypto_key.igtk_key[i] = NULL;
+		if (crypto_key->igtk_key[i]) {
+			qdf_mem_free(crypto_key->igtk_key[i]);
+			crypto_key->igtk_key[i] = NULL;
 		}
 	}
 
 	for (i = 0; i < WLAN_CRYPTO_MAXBIGTKKEYIDX; i++) {
-		if (crypto_priv->crypto_key.bigtk_key[i]) {
-			qdf_mem_free(crypto_priv->crypto_key.bigtk_key[i]);
-			crypto_priv->crypto_key.bigtk_key[i] = NULL;
+		if (crypto_key->bigtk_key[i]) {
+			qdf_mem_free(crypto_key->bigtk_key[i]);
+			crypto_key->bigtk_key[i] = NULL;
 		}
 	}
+
 	/* Reset All key index as well */
-	crypto_priv->crypto_key.def_tx_keyid = 0;
-	crypto_priv->crypto_key.def_igtk_tx_keyid = 0;
-	crypto_priv->crypto_key.def_bigtk_tx_keyid = 0;
+	crypto_key->def_tx_keyid = 0;
+	crypto_key->def_igtk_tx_keyid = 0;
+	crypto_key->def_bigtk_tx_keyid = 0;
 }
 
 #ifdef CRYPTO_SET_KEY_CONVERGED
@@ -663,7 +669,7 @@ void wlan_crypto_free_vdev_key(struct wlan_objmgr_vdev *vdev)
 		return;
 	}
 
-	wlan_crypto_free_key(crypto_priv);
+	wlan_crypto_free_key(&crypto_priv->crypto_key);
 }
 #endif
 
@@ -732,7 +738,7 @@ static QDF_STATUS wlan_crypto_vdev_obj_destroy_handler(
 						(void *)crypto_priv);
 
 	wlan_crypto_pmksa_flush(&crypto_priv->crypto_params);
-	wlan_crypto_free_key(crypto_priv);
+	wlan_crypto_free_key(&crypto_priv->crypto_key);
 	qdf_mem_free(crypto_priv);
 
 	return QDF_STATUS_SUCCESS;
@@ -758,7 +764,7 @@ static QDF_STATUS wlan_crypto_peer_obj_destroy_handler(
 	wlan_objmgr_peer_component_obj_detach(peer,
 						WLAN_UMAC_COMP_CRYPTO,
 						(void *)crypto_priv);
-	wlan_crypto_free_key(crypto_priv);
+	wlan_crypto_free_key(&crypto_priv->crypto_key);
 	qdf_mem_free(crypto_priv);
 
 	return QDF_STATUS_SUCCESS;

+ 3 - 0
wmi/inc/wmi_unified_param.h

@@ -5343,6 +5343,9 @@ typedef enum {
 #ifdef WLAN_FEATURE_11BE_MLO
 	wmi_mlo_link_state_info_eventid,
 #endif
+#if defined(WLAN_FEATURE_ROAM_OFFLOAD) && defined(WLAN_FEATURE_11BE_MLO)
+	wmi_roam_synch_key_event_id,
+#endif
 #ifdef QCA_SUPPORT_PRIMARY_LINK_MIGRATE
 	wmi_peer_ptqm_migration_response_eventid,
 #endif

+ 22 - 0
wmi/inc/wmi_unified_priv.h

@@ -402,6 +402,7 @@ QDF_STATUS
 (*extract_roam_event)(wmi_unified_t wmi_handle, void *evt_buf, uint32_t len,
 		      struct roam_offload_roam_event *roam_event);
 #endif
+
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 QDF_STATUS
 (*extract_roam_btm_response_stats)(wmi_unified_t wmi_handle, void *evt_buf,
@@ -487,7 +488,28 @@ QDF_STATUS
 		uint8_t *event, uint32_t data_len,
 		struct roam_vendor_handoff_params **vendor_handoff_params);
 #endif
+
+#ifdef WLAN_FEATURE_11BE_MLO
+/**
+ * extract_roam_synch_key_event() - Extract Roam synch key event
+ * @wmi_handle: WMI Handle
+ * @event: Event buffer
+ * @data_len: Event data length
+ * @keys: Destination buffer to fill the keys
+ * @num_keys: Number of keys
+ * @mld_addr: Peer MLD address
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+(*extract_roam_synch_key_event) (wmi_unified_t wmi_handle, uint8_t *event,
+				 uint32_t data_len,
+				 struct wlan_crypto_key_entry **keys,
+				 uint8_t *num_keys,
+				 struct qdf_mac_addr *mld_addr);
 #endif
+#endif
+
 #ifdef FEATURE_MEC_OFFLOAD
 QDF_STATUS
 (*send_pdev_set_mec_timer_cmd)(struct wmi_unified *wmi_handle,

+ 4 - 3
wmi/src/wmi_unified_tlv.c

@@ -22139,9 +22139,10 @@ static void populate_tlv_events_id(WMI_EVT_ID *event_ids)
 	event_ids[wmi_vdev_standalone_sound_complete_eventid] =
 		WMI_VDEV_STANDALONE_SOUND_COMPLETE_EVENTID;
 #endif
-	event_ids[wmi_csa_ie_received_event_id] =
-		WMI_CSA_IE_RECEIVED_EVENTID;
-
+	event_ids[wmi_csa_ie_received_event_id] = WMI_CSA_IE_RECEIVED_EVENTID;
+#if defined(WLAN_FEATURE_ROAM_OFFLOAD) && defined(WLAN_FEATURE_11BE_MLO)
+	event_ids[wmi_roam_synch_key_event_id] = WMI_ROAM_SYNCH_KEY_EVENTID;
+#endif
 #ifdef QCA_SUPPORT_PRIMARY_LINK_MIGRATE
 	event_ids[wmi_peer_ptqm_migration_response_eventid] =
 			WMI_MLO_PRIMARY_LINK_PEER_MIGRATION_EVENTID;