diff --git a/umac/cmn_services/crypto/inc/wlan_crypto_global_api.h b/umac/cmn_services/crypto/inc/wlan_crypto_global_api.h index b44b30baa0..44239d9dac 100644 --- a/umac/cmn_services/crypto/inc/wlan_crypto_global_api.h +++ b/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 diff --git a/umac/cmn_services/crypto/inc/wlan_crypto_global_def.h b/umac/cmn_services/crypto/inc/wlan_crypto_global_def.h index d771577baa..7832c7a534 100644 --- a/umac/cmn_services/crypto/inc/wlan_crypto_global_def.h +++ b/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 diff --git a/umac/cmn_services/crypto/src/wlan_crypto_def_i.h b/umac/cmn_services/crypto/src/wlan_crypto_def_i.h index ac0a748226..f503dd8d64 100644 --- a/umac/cmn_services/crypto/src/wlan_crypto_def_i.h +++ b/umac/cmn_services/crypto/src/wlan_crypto_def_i.h @@ -24,11 +24,12 @@ #define _WLAN_CRYPTO_DEF_I_H_ #include +#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; diff --git a/umac/cmn_services/crypto/src/wlan_crypto_obj_mgr.c b/umac/cmn_services/crypto/src/wlan_crypto_obj_mgr.c index 85c4bdeda2..ce9ed6dc88 100644 --- a/umac/cmn_services/crypto/src/wlan_crypto_obj_mgr.c +++ b/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; diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index 7a31cab411..32f6a20b5d 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/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 diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index 1f22bfbe8d..2baffd68fe 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/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, diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index d5ab92e3e5..0e5939d043 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/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;