Prechádzať zdrojové kódy

qcacld-3.0: Replace typedef tSirSmeDisassocCnf/tSirSmeDeauthCnf

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 consolidated tSirSmeDisassocCnf
and tSirSmeDeauthCnf typedefs do not meet any of those criteria, so
replace them (and the "tp" variants) with a reference to the
underlying struct. And since the Disassoc and Deauth use cases are
semantically different, create two separate structs even though they
currently have the same form.

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

Change-Id: I96806e354f79c7108166c0fc71ad6015b3d0146e
CRs-Fixed: 2395990
Jeff Johnson 6 rokov pred
rodič
commit
0837c44a52

+ 12 - 3
core/mac/inc/sir_api.h

@@ -1259,15 +1259,14 @@ struct disassoc_ind {
 
 /* / Definition for Disassociation confirm */
 /* / MAC ---> */
-typedef struct sSirSmeDisassocCnf {
+struct disassoc_cnf {
 	uint16_t messageType;   /* eWNI_SME_DISASSOC_CNF */
 	uint16_t length;
 	uint8_t sme_session_id;
 	tSirResultCodes statusCode;
 	struct qdf_mac_addr bssid;
 	struct qdf_mac_addr peer_macaddr;
-} tSirSmeDisassocCnf, *tpSirSmeDisassocCnf,
-	tSirSmeDeauthCnf, *tpSirSmeDeauthCnf;
+};
 
 /**
  * struct sir_sme_discon_done_ind  - disconnect done indiaction
@@ -1322,6 +1321,16 @@ typedef struct sSirSmeDeauthInd {
 	int8_t rssi;
 } tSirSmeDeauthInd, *tpSirSmeDeauthInd;
 
+/* / Definition for Deauthetication confirm */
+struct deauth_cnf {
+	uint16_t messageType;   /* eWNI_SME_DEAUTH_CNF */
+	uint16_t length;
+	uint8_t sme_session_id;
+	tSirResultCodes statusCode;
+	struct qdf_mac_addr bssid;
+	struct qdf_mac_addr peer_macaddr;
+};
+
 /* / Definition for stop BSS request message */
 typedef struct sSirSmeStopBssReq {
 	uint16_t messageType;   /* eWNI_SME_STOP_BSS_REQ */

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

@@ -2272,7 +2272,7 @@ sendDisassoc:
    ----------------------------------------------------------------- */
 void __lim_process_sme_disassoc_cnf(struct mac_context *mac, uint32_t *pMsgBuf)
 {
-	tSirSmeDisassocCnf smeDisassocCnf;
+	struct disassoc_cnf smeDisassocCnf;
 	uint16_t aid;
 	tpDphHashNode sta;
 	struct pe_session *pe_session;
@@ -2280,8 +2280,7 @@ void __lim_process_sme_disassoc_cnf(struct mac_context *mac, uint32_t *pMsgBuf)
 	uint32_t *msg = NULL;
 	QDF_STATUS status;
 
-	qdf_mem_copy(&smeDisassocCnf, pMsgBuf,
-			sizeof(struct sSirSmeDisassocCnf));
+	qdf_mem_copy(&smeDisassocCnf, pMsgBuf, sizeof(smeDisassocCnf));
 
 	pe_session = pe_find_session_by_bssid(mac,
 				smeDisassocCnf.bssid.bytes,
@@ -4745,12 +4744,11 @@ static void lim_process_disconnect_sta(struct pe_session *session,
 static void lim_process_sme_disassoc_cnf(struct mac_context *mac_ctx,
 					 struct scheduler_msg *msg)
 {
-	tSirSmeDisassocCnf sme_disassoc_cnf;
+	struct disassoc_cnf sme_disassoc_cnf;
 	struct pe_session *session;
 	uint8_t session_id;
 
-	qdf_mem_copy(&sme_disassoc_cnf, msg->bodyptr,
-		     sizeof(struct sSirSmeDisassocCnf));
+	qdf_mem_copy(&sme_disassoc_cnf, msg->bodyptr, sizeof(sme_disassoc_cnf));
 
 	session = pe_find_session_by_bssid(mac_ctx,
 					   sme_disassoc_cnf.bssid.bytes,

+ 4 - 26
core/mac/src/pe/lim/lim_sme_req_utils.c

@@ -520,33 +520,11 @@ bool lim_is_sme_disassoc_req_valid(struct mac_context *mac,
 	return true;
 } /*** end lim_is_sme_disassoc_req_valid() ***/
 
-/**
- * lim_is_sme_disassoc_cnf_valid()
- *
- ***FUNCTION:
- * This function is called by lim_process_sme_req_messages() upon
- * receiving SME_DISASSOC_CNF message from application.
- *
- ***LOGIC:
- * Message validity checks are performed in this function
- *
- ***ASSUMPTIONS:
- *
- ***NOTE:
- *
- * @param  mac         Pointer to Global MAC structure
- * @param  pDisassocCnf Pointer to received SME_DISASSOC_REQ message
- * @return true         When received SME_DISASSOC_CNF is formatted
- *                      correctly
- *         false        otherwise
- */
-
-uint8_t
-lim_is_sme_disassoc_cnf_valid(struct mac_context *mac,
-			      tpSirSmeDisassocCnf pDisassocCnf,
-			      struct pe_session *pe_session)
+bool lim_is_sme_disassoc_cnf_valid(struct mac_context *mac,
+				   struct disassoc_cnf *disassoc_cnf,
+				   struct pe_session *pe_session)
 {
-	if (qdf_is_macaddr_group(&pDisassocCnf->peer_macaddr))
+	if (qdf_is_macaddr_group(&disassoc_cnf->peer_macaddr))
 		return false;
 
 	return true;

+ 16 - 2
core/mac/src/pe/lim/lim_sme_req_utils.h

@@ -84,7 +84,21 @@ bool lim_is_sme_disassoc_req_valid(struct mac_context *mac,
 uint8_t lim_is_sme_deauth_req_valid(struct mac_context *, tpSirSmeDeauthReq, struct pe_session *);
 uint8_t lim_is_sme_set_context_req_valid(struct mac_context *, tpSirSmeSetContextReq);
 uint8_t lim_is_sme_stop_bss_req_valid(uint32_t *);
-uint8_t lim_is_sme_disassoc_cnf_valid(struct mac_context *, tpSirSmeDisassocCnf,
-				      struct pe_session *);
+
+/**
+ * lim_is_sme_disassoc_cnf_valid() - Validate disassoc cnf message
+ * @mac: Pointer to Global MAC structure
+ * @disassoc_cnf: Pointer to received SME_DISASSOC_CNF message
+ * @pe_session: Pointer to the PE session
+ *
+ * This function is called by lim_process_sme_req_messages() upon
+ * receiving SME_DISASSOC_CNF message from application.
+ *
+ * Return: true  When received SME_DISASSOC_CNF is formatted correctly
+ *         false otherwise
+ */
+bool lim_is_sme_disassoc_cnf_valid(struct mac_context *mac,
+				   struct disassoc_cnf *disassoc_cnf,
+				   struct pe_session *pe_session);
 
 #endif /* __LIM_SME_REQ_UTILS_H */

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

@@ -15410,10 +15410,10 @@ QDF_STATUS csr_send_mb_disassoc_cnf_msg(struct mac_context *mac,
 					struct disassoc_ind *pDisassocInd)
 {
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
-	tSirSmeDisassocCnf *pMsg;
+	struct disassoc_cnf *pMsg;
 
 	do {
-		pMsg = qdf_mem_malloc(sizeof(tSirSmeDisassocCnf));
+		pMsg = qdf_mem_malloc(sizeof(*pMsg));
 		if (NULL == pMsg)
 			status = QDF_STATUS_E_NOMEM;
 		else
@@ -15422,7 +15422,7 @@ QDF_STATUS csr_send_mb_disassoc_cnf_msg(struct mac_context *mac,
 			break;
 		pMsg->messageType = eWNI_SME_DISASSOC_CNF;
 		pMsg->statusCode = eSIR_SME_SUCCESS;
-		pMsg->length = sizeof(tSirSmeDisassocCnf);
+		pMsg->length = sizeof(*pMsg);
 		pMsg->sme_session_id = pDisassocInd->sessionId;
 		qdf_copy_macaddr(&pMsg->peer_macaddr,
 				 &pDisassocInd->peer_macaddr);
@@ -15448,10 +15448,10 @@ QDF_STATUS csr_send_mb_deauth_cnf_msg(struct mac_context *mac,
 				      tpSirSmeDeauthInd pDeauthInd)
 {
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
-	tSirSmeDeauthCnf *pMsg;
+	struct deauth_cnf *pMsg;
 
 	do {
-		pMsg = qdf_mem_malloc(sizeof(tSirSmeDeauthCnf));
+		pMsg = qdf_mem_malloc(sizeof(*pMsg));
 		if (NULL == pMsg)
 			status = QDF_STATUS_E_NOMEM;
 		else
@@ -15460,7 +15460,7 @@ QDF_STATUS csr_send_mb_deauth_cnf_msg(struct mac_context *mac,
 			break;
 		pMsg->messageType = eWNI_SME_DEAUTH_CNF;
 		pMsg->statusCode = eSIR_SME_SUCCESS;
-		pMsg->length = sizeof(tSirSmeDeauthCnf);
+		pMsg->length = sizeof(*pMsg);
 		pMsg->sme_session_id = pDeauthInd->sessionId;
 		qdf_copy_macaddr(&pMsg->bssid, &pDeauthInd->bssid);
 		status = QDF_STATUS_SUCCESS;