ソースを参照

qcacld-3.0: Cleanup CRYPTO_SET_KEY_CONVERGED for MAC layer

CRYPTO_SET_KEY_CONVERGED is a temporary flag which is used for
converged crypto component transition. The transition has already
been done, so cleanup legacy code related to the flag in MAC layer.

Change-Id: I34fb7a6a67dd6dba3fa69c98ef10a1bd51383e36
CRs-fixed: 2593525
Yue Ma 5 年 前
コミット
e5a28495ab

+ 1 - 44
components/mlme/core/inc/wlan_mlme_main.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -149,49 +149,6 @@ struct mlme_legacy_priv {
 	struct wlan_mlme_roam mlme_roam;
 };
 
-#ifndef CRYPTO_SET_KEY_CONVERGED
-/**
- * wlan_peer_set_unicast_cipher() - set unicast cipher
- * @peer: PEER object
- * @value: value to be set
- *
- * Return: void
- */
-static inline
-void wlan_peer_set_unicast_cipher(struct wlan_objmgr_peer *peer, uint32_t value)
-{
-	struct peer_mlme_priv_obj *peer_priv;
-
-	peer_priv = wlan_objmgr_peer_get_comp_private_obj(peer,
-							  WLAN_UMAC_COMP_MLME);
-	if (!peer_priv) {
-		mlme_legacy_err(" peer mlme component object is NULL");
-		return;
-	}
-	peer_priv->ucast_key_cipher  = value;
-}
-
-/**
- * wlan_peer_get_unicast_cipher() - get unicast cipher
- * @peer: PEER object
- *
- * Return: ucast_key_cipher value
- */
-static inline
-uint32_t wlan_peer_get_unicast_cipher(struct wlan_objmgr_peer *peer)
-{
-	struct peer_mlme_priv_obj *peer_priv;
-
-	peer_priv = wlan_objmgr_peer_get_comp_private_obj(peer,
-							  WLAN_UMAC_COMP_MLME);
-	if (!peer_priv) {
-		mlme_legacy_err("peer mlme component object is NULL");
-		return 0;
-	}
-
-	return peer_priv->ucast_key_cipher;
-}
-#endif
 /**
  * wma_get_peer_mic_len() - get mic hdr len and mic length for peer
  * @psoc: psoc

+ 0 - 38
components/mlme/core/src/wlan_mlme_main.c

@@ -94,7 +94,6 @@ uint8_t *mlme_get_dynamic_oce_flags(struct wlan_objmgr_vdev *vdev)
 	return &mlme_priv->sta_dynamic_oce_value;
 }
 
-#ifdef CRYPTO_SET_KEY_CONVERGED
 QDF_STATUS mlme_get_peer_mic_len(struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
 				 uint8_t *peer_mac, uint8_t *mic_len,
 				 uint8_t *mic_hdr_len)
@@ -133,43 +132,6 @@ QDF_STATUS mlme_get_peer_mic_len(struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
 	return QDF_STATUS_SUCCESS;
 }
 
-#else
-
-QDF_STATUS mlme_get_peer_mic_len(struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
-				 uint8_t *peer_mac, uint8_t *mic_len,
-				 uint8_t *mic_hdr_len)
-{
-	struct wlan_objmgr_peer *peer;
-	uint32_t key_cipher;
-
-	if (!psoc || !mic_len || !mic_hdr_len || !peer_mac) {
-		mlme_legacy_debug("psoc/mic_len/mic_hdr_len/peer_mac null");
-		return QDF_STATUS_E_NULL_VALUE;
-	}
-
-	peer = wlan_objmgr_get_peer(psoc, pdev_id,
-				    peer_mac, WLAN_LEGACY_MAC_ID);
-	if (!peer) {
-		mlme_legacy_debug("Peer of peer_mac %pM not found", peer_mac);
-		return QDF_STATUS_E_INVAL;
-	}
-	key_cipher = wlan_peer_get_unicast_cipher(peer);
-	wlan_objmgr_peer_release_ref(peer, WLAN_LEGACY_MAC_ID);
-
-	if (key_cipher == WMI_CIPHER_AES_GCM) {
-		*mic_hdr_len = WLAN_IEEE80211_GCMP_HEADERLEN;
-		*mic_len = WLAN_IEEE80211_GCMP_MICLEN;
-	} else {
-		*mic_hdr_len = IEEE80211_CCMP_HEADERLEN;
-		*mic_len = IEEE80211_CCMP_MICLEN;
-	}
-	mlme_legacy_debug("peer %pM hdr_len %d mic_len %d key_cipher %d",
-			  peer_mac, *mic_hdr_len, *mic_len, key_cipher);
-
-	return QDF_STATUS_SUCCESS;
-}
-#endif
-
 QDF_STATUS
 mlme_peer_object_created_notification(struct wlan_objmgr_peer *peer,
 				      void *arg)

+ 0 - 40
components/mlme/dispatcher/src/wlan_mlme_api.c

@@ -2468,7 +2468,6 @@ QDF_STATUS wlan_mlme_get_edca_params(struct wlan_mlme_edca_params *edca_params,
 	return QDF_STATUS_SUCCESS;
 }
 
-#ifdef CRYPTO_SET_KEY_CONVERGED
 QDF_STATUS mlme_get_wep_key(struct wlan_objmgr_vdev *vdev,
 			    struct wlan_mlme_wep_cfg *wep_params,
 			    enum wep_key_id wep_keyid, uint8_t *default_key,
@@ -2495,45 +2494,6 @@ QDF_STATUS mlme_get_wep_key(struct wlan_objmgr_vdev *vdev,
 
 	return QDF_STATUS_SUCCESS;
 }
-#else
-QDF_STATUS mlme_get_wep_key(struct wlan_objmgr_vdev *vdev,
-			    struct wlan_mlme_wep_cfg *wep_params,
-			    enum wep_key_id wep_keyid, uint8_t *default_key,
-			    qdf_size_t *key_len)
-{
-	switch (wep_keyid) {
-	case MLME_WEP_DEFAULT_KEY_1:
-		wlan_mlme_get_cfg_str(default_key,
-				      &wep_params->wep_default_key_1,
-				      key_len);
-		break;
-
-	case MLME_WEP_DEFAULT_KEY_2:
-		wlan_mlme_get_cfg_str(default_key,
-				      &wep_params->wep_default_key_2,
-				      key_len);
-		break;
-
-	case MLME_WEP_DEFAULT_KEY_3:
-		wlan_mlme_get_cfg_str(default_key,
-				      &wep_params->wep_default_key_3,
-				      key_len);
-		break;
-
-	case MLME_WEP_DEFAULT_KEY_4:
-		wlan_mlme_get_cfg_str(default_key,
-				      &wep_params->wep_default_key_4,
-				      key_len);
-		break;
-
-	default:
-		mlme_legacy_err("Invalid key id:%d", wep_keyid);
-		return QDF_STATUS_E_INVAL;
-	}
-	mlme_legacy_debug("key_id:%d key_len:%zd", wep_keyid, *key_len);
-	return QDF_STATUS_SUCCESS;
-}
-#endif /* CRYPTO_SET_KEY_CONVERGED */
 
 QDF_STATUS mlme_set_wep_key(struct wlan_mlme_wep_cfg *wep_params,
 			    enum wep_key_id wep_keyid, uint8_t *key_to_set,

+ 1 - 16
core/mac/src/pe/lim/lim_process_auth_frame.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -103,7 +103,6 @@ static inline unsigned int is_auth_valid(struct mac_context *mac,
  *
  * Return: QDF_STATUS
  */
-#ifdef CRYPTO_SET_KEY_CONVERGED
 static QDF_STATUS lim_get_wep_key_sap(struct pe_session *pe_session,
 				      struct wlan_mlme_wep_cfg *wep_params,
 				      uint8_t key_id,
@@ -116,20 +115,6 @@ static QDF_STATUS lim_get_wep_key_sap(struct pe_session *pe_session,
 				default_key,
 				key_len);
 }
-#else
-static QDF_STATUS lim_get_wep_key_sap(struct pe_session *pe_session,
-				      struct wlan_mlme_wep_cfg *wep_params,
-				      uint8_t key_id,
-				      uint8_t *default_key,
-				      qdf_size_t *key_len)
-{
-	*key_len = pe_session->WEPKeyMaterial[key_id].key[0].keyLength;
-	qdf_mem_copy(default_key, pe_session->WEPKeyMaterial[key_id].key[0].key,
-		     *key_len);
-
-	return QDF_STATUS_SUCCESS;
-}
-#endif
 
 static void lim_process_auth_shared_system_algo(struct mac_context *mac_ctx,
 		tpSirMacMgmtHdr mac_hdr,

+ 6 - 56
core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -2484,29 +2484,9 @@ void lim_process_mlm_set_sta_key_rsp(struct mac_context *mac_ctx,
 		return;
 	}
 
-	if (!lim_is_set_key_req_converged() &&
-	    (session_entry->limMlmState != eLIM_MLM_WT_SET_STA_KEY_STATE)) {
-		pe_err("Received in unexpected limMlmState %X vdev %d pe_session_id %d",
-			session_entry->limMlmState, session_entry->vdev_id,
-			session_entry->peSessionId);
-		qdf_mem_zero(msg->bodyptr, sizeof(*set_key_params));
-		qdf_mem_free(msg->bodyptr);
-		msg->bodyptr = NULL;
-		lim_send_sme_set_context_rsp(mac_ctx,
-					     mlm_set_key_cnf.peer_macaddr,
-					     0, eSIR_SME_INVALID_SESSION, NULL,
-					     vdev_id);
-		return;
-	}
 	session_id = session_entry->peSessionId;
 	pe_debug("PE session ID %d, vdev_id %d", session_id, vdev_id);
 	result_status = set_key_params->status;
-	if (!lim_is_set_key_req_converged()) {
-		mlm_set_key_cnf.resultCode = result_status;
-		/* Restore MLME state */
-		session_entry->limMlmState = session_entry->limPrevMlmState;
-	}
-
 	key_len = set_key_params->key[0].keyLength;
 
 	if (result_status == eSIR_SME_SUCCESS && key_len)
@@ -2533,9 +2513,8 @@ void lim_process_mlm_set_sta_key_rsp(struct mac_context *mac_ctx,
 			qdf_mem_free(mac_ctx->lim.gpLimMlmSetKeysReq);
 			mac_ctx->lim.gpLimMlmSetKeysReq = NULL;
 		} else {
-			lim_copy_set_key_req_mac_addr(
-					&mlm_set_key_cnf.peer_macaddr,
-					&set_key_params->macaddr);
+			qdf_copy_macaddr(&mlm_set_key_cnf.peer_macaddr,
+					 &set_key_params->macaddr);
 		}
 		mlm_set_key_cnf.sessionId = session_id;
 		lim_post_sme_message(mac_ctx, LIM_MLM_SETKEYS_CNF,
@@ -2586,21 +2565,6 @@ void lim_process_mlm_set_bss_key_rsp(struct mac_context *mac_ctx,
 					     vdev_id);
 		return;
 	}
-	if (!lim_is_set_key_req_converged() &&
-	    (session_entry->limMlmState != eLIM_MLM_WT_SET_BSS_KEY_STATE) &&
-	    (session_entry->limMlmState !=
-	     eLIM_MLM_WT_SET_STA_BCASTKEY_STATE)) {
-		pe_err("Received in unexpected limMlmState %X vdev %d pe_session_id %d",
-			session_entry->limMlmState, session_entry->vdev_id,
-			session_entry->peSessionId);
-		qdf_mem_zero(msg->bodyptr, sizeof(tSetBssKeyParams));
-		qdf_mem_free(msg->bodyptr);
-		msg->bodyptr = NULL;
-		lim_send_sme_set_context_rsp(mac_ctx, set_key_cnf.peer_macaddr,
-					     0, eSIR_SME_INVALID_SESSION, NULL,
-					     vdev_id);
-		return;
-	}
 
 	session_id = session_entry->peSessionId;
 	pe_debug("PE session ID %d, vdev_id %d", session_id, vdev_id);
@@ -2608,18 +2572,10 @@ void lim_process_mlm_set_bss_key_rsp(struct mac_context *mac_ctx,
 		result_status =
 			(uint16_t)(((tpSetBssKeyParams)msg->bodyptr)->status);
 		key_len = ((tpSetBssKeyParams)msg->bodyptr)->key[0].keyLength;
-	} else if (lim_is_set_key_req_converged()) {
+	} else {
 		result_status =
 			(uint16_t)(((tpSetBssKeyParams)msg->bodyptr)->status);
 		key_len = ((tpSetBssKeyParams)msg->bodyptr)->key[0].keyLength;
-	} else {
-		/*
-		 * BCAST key also uses tpSetStaKeyParams.
-		 * Done this way for readabilty.
-		 */
-		result_status =
-			(uint16_t)(((tpSetStaKeyParams)msg->bodyptr)->status);
-		key_len = ((tpSetStaKeyParams)msg->bodyptr)->key[0].keyLength;
 	}
 
 	pe_debug("limMlmState %d status %d key_len %d",
@@ -2630,11 +2586,6 @@ void lim_process_mlm_set_bss_key_rsp(struct mac_context *mac_ctx,
 	else
 		set_key_cnf.key_len_nonzero = false;
 
-	if (!lim_is_set_key_req_converged()) {
-		set_key_cnf.resultCode = result_status;
-		session_entry->limMlmState = session_entry->limPrevMlmState;
-	}
-
 	MTRACE(mac_trace
 		(mac_ctx, TRACE_CODE_MLM_STATE, session_entry->peSessionId,
 		session_entry->limMlmState));
@@ -2655,9 +2606,8 @@ void lim_process_mlm_set_bss_key_rsp(struct mac_context *mac_ctx,
 		qdf_mem_free(mac_ctx->lim.gpLimMlmSetKeysReq);
 		mac_ctx->lim.gpLimMlmSetKeysReq = NULL;
 	} else {
-		lim_copy_set_key_req_mac_addr(
-				&set_key_cnf.peer_macaddr,
-				&((tpSetBssKeyParams)msg->bodyptr)->macaddr);
+		qdf_copy_macaddr(&set_key_cnf.peer_macaddr,
+				 &((tpSetBssKeyParams)msg->bodyptr)->macaddr);
 	}
 	qdf_mem_zero(msg->bodyptr, sizeof(tSetBssKeyParams));
 	qdf_mem_free(msg->bodyptr);

+ 0 - 23
core/mac/src/pe/lim/lim_utils.h

@@ -1852,29 +1852,6 @@ QDF_STATUS lim_ap_mlme_vdev_start_req_failed(struct vdev_mlme_obj *vdev_mlme,
 QDF_STATUS lim_mon_mlme_vdev_start_send(struct vdev_mlme_obj *vdev_mlme,
 					uint16_t data_len, void *event);
 
-#ifdef CRYPTO_SET_KEY_CONVERGED
-static inline bool lim_is_set_key_req_converged(void)
-{
-	return true;
-}
-
-static inline void lim_copy_set_key_req_mac_addr(struct qdf_mac_addr *dst,
-						 struct qdf_mac_addr *src)
-{
-	qdf_copy_macaddr(dst, src);
-}
-#else
-static inline bool lim_is_set_key_req_converged(void)
-{
-	return false;
-}
-
-static inline void lim_copy_set_key_req_mac_addr(struct qdf_mac_addr *dst,
-						 struct qdf_mac_addr *src)
-{
-}
-#endif
-
 /**
  * lim_get_capability_info() - Get capability information
  * @mac:        pointer to mac data