Kaynağa Gözat

qcacld-3.0: Replace typedef tSirSmeSetContextReq

The Linux Coding Style enumerates a few special cases where typedefs
are useful, but stresses "NEVER EVER use a typedef unless you can
clearly match one of those rules." The tSirSmeSetContextReq typedef
does not meet any of those criteria, so replace it (and the "tp"
variant) with a reference to the underlying struct.

Further note the Linux Coding Style frowns upon mixed-case names and
so-called Hungarian notation, so in conjunction rename the underlying
struct to be in compliance.

Change-Id: I9613adcb4d9da60787f7cc7169193bb3e6c9e9ea
CRs-Fixed: 2396051
Jeff Johnson 6 yıl önce
ebeveyn
işleme
b9a9a7d023

+ 2 - 2
core/mac/inc/sir_api.h

@@ -1380,7 +1380,7 @@ struct missed_beacon_ind {
 
 /* / Definition for Set Context request */
 /* / ---> MAC */
-typedef struct sSirSmeSetContextReq {
+struct set_context_req {
 	uint16_t messageType;   /* eWNI_SME_SET_CONTEXT_REQ */
 	uint16_t length;
 	uint8_t sessionId;      /* Session ID */
@@ -1388,7 +1388,7 @@ typedef struct sSirSmeSetContextReq {
 	struct qdf_mac_addr peer_macaddr;
 	struct qdf_mac_addr bssid;      /* BSSID */
 	tSirKeyMaterial keyMaterial;
-} tSirSmeSetContextReq, *tpSirSmeSetContextReq;
+};
 
 /* / Definition for Set Context response */
 /* / MAC ---> */

+ 5 - 4
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -2625,9 +2625,10 @@ send_deauth:
  */
 
 static void
-__lim_process_sme_set_context_req(struct mac_context *mac_ctx, uint32_t *msg_buf)
+__lim_process_sme_set_context_req(struct mac_context *mac_ctx,
+				  uint32_t *msg_buf)
 {
-	tpSirSmeSetContextReq set_context_req;
+	struct set_context_req *set_context_req;
 	tLimMlmSetKeysReq *mlm_set_key_req;
 	struct pe_session *session_entry;
 	uint8_t session_id;      /* PE sessionID */
@@ -2639,11 +2640,11 @@ __lim_process_sme_set_context_req(struct mac_context *mac_ctx, uint32_t *msg_buf
 		return;
 	}
 
-	set_context_req = qdf_mem_malloc(sizeof(struct sSirSmeSetContextReq));
+	set_context_req = qdf_mem_malloc(sizeof(*set_context_req));
 	if (!set_context_req)
 		return;
 	qdf_mem_copy(set_context_req, msg_buf,
-			sizeof(struct sSirSmeSetContextReq));
+			sizeof(*set_context_req));
 	sme_session_id = set_context_req->sessionId;
 	sme_transaction_id = set_context_req->transactionId;
 

+ 34 - 54
core/mac/src/pe/lim/lim_sme_req_utils.c

@@ -541,75 +541,55 @@ bool lim_is_sme_deauth_req_valid(struct mac_context *mac,
 	return true;
 } /*** end lim_is_sme_deauth_req_valid() ***/
 
-/**
- * lim_is_sme_set_context_req_valid()
- *
- ***FUNCTION:
- * This function is called by lim_process_sme_req_messages() upon
- * receiving SME_SET_CONTEXT_REQ message from application.
- *
- ***LOGIC:
- * Message validity checks are performed in this function
- *
- ***ASSUMPTIONS:
- *
- ***NOTE:
- *
- * @param  pMsg - Pointer to received SME_SET_CONTEXT_REQ message
- * @return true  when received SME_SET_CONTEXT_REQ is formatted correctly
- *         false otherwise
- */
-
-uint8_t
-lim_is_sme_set_context_req_valid(struct mac_context *mac,
-				 tpSirSmeSetContextReq pSetContextReq)
+bool lim_is_sme_set_context_req_valid(struct mac_context *mac,
+				      struct set_context_req *set_context_req)
 {
 	uint8_t i = 0;
 	uint8_t valid = true;
-	tpSirKeys pKey = pSetContextReq->keyMaterial.key;
+	tpSirKeys key = set_context_req->keyMaterial.key;
 
-	if ((pSetContextReq->keyMaterial.edType != eSIR_ED_WEP40) &&
-	    (pSetContextReq->keyMaterial.edType != eSIR_ED_WEP104) &&
-	    (pSetContextReq->keyMaterial.edType != eSIR_ED_NONE) &&
+	if ((set_context_req->keyMaterial.edType != eSIR_ED_WEP40) &&
+	    (set_context_req->keyMaterial.edType != eSIR_ED_WEP104) &&
+	    (set_context_req->keyMaterial.edType != eSIR_ED_NONE) &&
 #ifdef FEATURE_WLAN_WAPI
-	    (pSetContextReq->keyMaterial.edType != eSIR_ED_WPI) &&
+	    (set_context_req->keyMaterial.edType != eSIR_ED_WPI) &&
 #endif
-	    !pSetContextReq->keyMaterial.numKeys) {
+	    !set_context_req->keyMaterial.numKeys) {
 		/**
 		 * No keys present in case of TKIP or CCMP
 		 * Log error.
 		 */
 		pe_warn("No keys present in SME_SETCONTEXT_REQ for edType: %d",
-			pSetContextReq->keyMaterial.edType);
+			set_context_req->keyMaterial.edType);
 
 		valid = false;
 		goto end;
 	}
 
-	if (pSetContextReq->keyMaterial.numKeys &&
-	    (pSetContextReq->keyMaterial.edType == eSIR_ED_NONE)) {
+	if (set_context_req->keyMaterial.numKeys &&
+	    (set_context_req->keyMaterial.edType == eSIR_ED_NONE)) {
 		/**
 		 * Keys present in case of no ED policy
 		 * Log error.
 		 */
 		pe_warn("Keys present in SME_SETCONTEXT_REQ for edType: %d",
-			pSetContextReq->keyMaterial.edType);
+			set_context_req->keyMaterial.edType);
 
 		valid = false;
 		goto end;
 	}
 
-	if (pSetContextReq->keyMaterial.edType >= eSIR_ED_NOT_IMPLEMENTED) {
+	if (set_context_req->keyMaterial.edType >= eSIR_ED_NOT_IMPLEMENTED) {
 		/**
 		 * Invalid edType in the message
 		 * Log error.
 		 */
 		pe_warn("Invalid edType: %d in SME_SETCONTEXT_REQ",
-			pSetContextReq->keyMaterial.edType);
+			set_context_req->keyMaterial.edType);
 
 		valid = false;
 		goto end;
-	} else if (pSetContextReq->keyMaterial.edType > eSIR_ED_NONE) {
+	} else if (set_context_req->keyMaterial.edType > eSIR_ED_NONE) {
 		bool privacy;
 
 		privacy = mac->mlme_cfg->wep_params.is_privacy_enabled;
@@ -622,39 +602,39 @@ lim_is_sme_set_context_req_valid(struct mac_context *mac,
 			 * yet advertising WPA IE
 			 */
 			pe_debug("Privacy is not enabled, yet non-None EDtype: %d in SME_SETCONTEXT_REQ",
-				       pSetContextReq->keyMaterial.edType);
+				       set_context_req->keyMaterial.edType);
 		}
 	}
 
-	for (i = 0; i < pSetContextReq->keyMaterial.numKeys; i++) {
-		if (((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) &&
-		     (pKey->keyLength != 5)) ||
-		    ((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104) &&
-		     (pKey->keyLength != 13)) ||
-		    ((pSetContextReq->keyMaterial.edType == eSIR_ED_TKIP) &&
-		     (pKey->keyLength != 32)) ||
+	for (i = 0; i < set_context_req->keyMaterial.numKeys; i++) {
+		if (((set_context_req->keyMaterial.edType == eSIR_ED_WEP40) &&
+		     (key->keyLength != 5)) ||
+		    ((set_context_req->keyMaterial.edType == eSIR_ED_WEP104) &&
+		     (key->keyLength != 13)) ||
+		    ((set_context_req->keyMaterial.edType == eSIR_ED_TKIP) &&
+		     (key->keyLength != 32)) ||
 #ifdef FEATURE_WLAN_WAPI
-		    ((pSetContextReq->keyMaterial.edType == eSIR_ED_WPI) &&
-		     (pKey->keyLength != 32)) ||
+		    ((set_context_req->keyMaterial.edType == eSIR_ED_WPI) &&
+		     (key->keyLength != 32)) ||
 #endif
-		    ((pSetContextReq->keyMaterial.edType == eSIR_ED_GCMP) &&
-		     (pKey->keyLength != 16)) ||
-		    ((pSetContextReq->keyMaterial.edType == eSIR_ED_GCMP_256) &&
-		     (pKey->keyLength != 32)) ||
-		    ((pSetContextReq->keyMaterial.edType == eSIR_ED_CCMP) &&
-		     (pKey->keyLength != 16))) {
+		    ((set_context_req->keyMaterial.edType == eSIR_ED_GCMP) &&
+		     (key->keyLength != 16)) ||
+		    ((set_context_req->keyMaterial.edType == eSIR_ED_GCMP_256) &&
+		     (key->keyLength != 32)) ||
+		    ((set_context_req->keyMaterial.edType == eSIR_ED_CCMP) &&
+		     (key->keyLength != 16))) {
 			/**
 			 * Invalid key length for a given ED type
 			 * Log error.
 			 */
 			pe_warn("Invalid keyLength: %d for edType: %d in SME_SETCONTEXT_REQ",
-				pKey->keyLength,
-				pSetContextReq->keyMaterial.edType);
+				key->keyLength,
+				set_context_req->keyMaterial.edType);
 
 			valid = false;
 			goto end;
 		}
-		pKey++;
+		key++;
 	}
 
 end:

+ 14 - 1
core/mac/src/pe/lim/lim_sme_req_utils.h

@@ -97,7 +97,20 @@ bool lim_is_sme_deauth_req_valid(struct mac_context *mac,
 				 struct deauth_req *deauth_req,
 				 struct pe_session *pe_session);
 
-uint8_t lim_is_sme_set_context_req_valid(struct mac_context *, tpSirSmeSetContextReq);
+/**
+ * lim_is_sme_set_context_req_valid() - Validate set context req message
+ * @mac: Pointer to Global MAC structure
+ * @dset_context_req: Pointer to received SME_SET_CONTEXT_REQ message
+ *
+ * This function is called by lim_process_sme_req_messages() upon
+ * receiving SME_SET_CONTEXT_REQ message from application.
+ *
+ * Return: true  when received SME_SET_CONTEXT_REQ is formatted correctly
+ *         false otherwise
+ */
+bool lim_is_sme_set_context_req_valid(struct mac_context *,
+				      struct set_context_req *set_context_req);
+
 uint8_t lim_is_sme_stop_bss_req_valid(uint32_t *);
 
 /**

+ 2 - 2
core/sme/src/csr/csr_api_roam.c

@@ -15646,7 +15646,7 @@ QDF_STATUS csr_send_mb_set_context_req_msg(struct mac_context *mac,
 					   uint8_t *pKey, uint8_t paeRole,
 					   uint8_t *pKeyRsc)
 {
-	tSirSmeSetContextReq *pMsg;
+	struct set_context_req *pMsg;
 	struct scheduler_msg msg = {0};
 	uint16_t msgLen;
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
@@ -15661,7 +15661,7 @@ QDF_STATUS csr_send_mb_set_context_req_msg(struct mac_context *mac,
 		 * Below we'll add in the size for each key set. Since we only
 		 * support up to one key, we always allocate memory for 1 key.
 		 */
-		msgLen = sizeof(struct sSirSmeSetContextReq);
+		msgLen = sizeof(*pMsg);
 
 		pMsg = qdf_mem_malloc(msgLen);
 		if (NULL == pMsg)