Browse Source

qcacld-3.0: Converge on struct tdls_del_sta_req

During TDLS componentization the legacy typedef tSirTdlsDelStaReq was
replicated, creating struct tdls_del_sta_req. Unfortunately this left
the driver with two different data structures which serve the same
purpose. Not only is this pointless, but due to the way in which these
structures are used there is an implicit requirement that they be
exactly identical. This approach is very fragile. To align with the
converged software architecture and to improve code maintainability
exclusively use the TDLS component struct.

Note that this struct must be promoted to be a public struct since it
is now accessed from outside the component.

Change-Id: I054ee24e07062a60c4e00b935cd1bc5b4a9aef95
CRs-Fixed: 2400769
Jeff Johnson 6 years ago
parent
commit
ab797d63a8

+ 0 - 19
components/tdls/core/src/wlan_tdls_cmds_process.h

@@ -29,25 +29,6 @@
 	((TDLS_SETUP_REQUEST <= action) && \
 	(TDLS_SETUP_CONFIRM >= action))
 
-/**
- * struct tdls_del_sta_req - TDLS Request struct TDLS module --> PE
- *                           same as sSirTdlsDelStaReq
- * @message_type: message type eWNI_SME_TDLS_DEL_STA_REQ
- * @length: message length
- * @session_id: session id
- * @transaction_id: transaction id for cmd
- * @bssid: bssid
- * @peermac: MAC address of the TDLS peer
- */
-struct tdls_del_sta_req {
-	uint16_t message_type;
-	uint16_t length;
-	uint8_t session_id;
-	uint16_t transaction_id;
-	struct qdf_mac_addr bssid;
-	struct qdf_mac_addr peermac;
-};
-
 /**
  * tdls_process_add_peer() - add TDLS peer
  * @req: TDLS add peer request

+ 18 - 0
components/tdls/dispatcher/inc/wlan_tdls_public_structs.h

@@ -1288,4 +1288,22 @@ struct tdls_add_sta_req {
 	uint8_t max_sp;
 };
 
+/**
+ * struct tdls_del_sta_req - TDLS Request struct TDLS module --> PE
+ * @message_type: message type eWNI_SME_TDLS_DEL_STA_REQ
+ * @length: message length
+ * @session_id: session id
+ * @transaction_id: transaction id for cmd
+ * @bssid: bssid
+ * @peermac: MAC address of the TDLS peer
+ */
+struct tdls_del_sta_req {
+	uint16_t message_type;
+	uint16_t length;
+	uint8_t session_id;
+	uint16_t transaction_id;
+	struct qdf_mac_addr bssid;
+	struct qdf_mac_addr peermac;
+};
+
 #endif

+ 0 - 13
core/mac/inc/sir_api.h

@@ -2517,19 +2517,6 @@ struct sir_antenna_mode_resp {
 	enum set_antenna_mode_status status;
 };
 
-#ifdef FEATURE_WLAN_TDLS
-/* TDLS Request struct SME-->PE */
-typedef struct sSirTdlsDelStaReq {
-	uint16_t messageType;   /* eWNI_SME_TDLS_DISCOVERY_START_REQ */
-	uint16_t length;
-	uint8_t sessionId;      /* Session ID */
-	uint16_t transactionId; /* Transaction ID for cmd */
-	/* For multi-session, for PE to locate peSession ID */
-	struct qdf_mac_addr bssid;
-	struct qdf_mac_addr peermac;
-} tSirTdlsDelStaReq, *tpSirSmeTdlsDelStaReq;
-#endif /* FEATURE_WLAN_TDLS */
-
 /* Reset AP Caps Changed */
 typedef struct sSirResetAPCapsChange {
 	uint16_t messageType;

+ 17 - 21
core/mac/src/pe/lim/lim_process_tdls.c

@@ -3019,27 +3019,23 @@ lim_tdls_add_sta_error:
 	return QDF_STATUS_SUCCESS;
 }
 
-/*
- * Process Del Sta Request from SME .
- */
 QDF_STATUS lim_process_sme_tdls_del_sta_req(struct mac_context *mac,
-					       uint32_t *pMsgBuf)
+					    void *msg)
 {
-	/* get all discovery request parameters */
-	tSirTdlsDelStaReq *pDelStaReq = (tSirTdlsDelStaReq *) pMsgBuf;
+	struct tdls_del_sta_req *del_sta_req = msg;
 	struct pe_session *pe_session;
-	uint8_t sessionId;
+	uint8_t session_id;
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
 
 	pe_debug("TDLS Delete STA Request Received");
 	pe_session =
-		pe_find_session_by_bssid(mac, pDelStaReq->bssid.bytes,
-					 &sessionId);
+		pe_find_session_by_bssid(mac, del_sta_req->bssid.bytes,
+					 &session_id);
 	if (pe_session == NULL) {
-		pe_err("PE Session does not exist for given sme sessionId: %d",
-			pDelStaReq->sessionId);
-		lim_send_sme_tdls_del_sta_rsp(mac, pDelStaReq->sessionId,
-					      pDelStaReq->peermac, NULL,
+		pe_err("PE Session does not exist for given vdev id: %d",
+		       del_sta_req->session_id);
+		lim_send_sme_tdls_del_sta_rsp(mac, del_sta_req->session_id,
+					      del_sta_req->peermac, NULL,
 					      QDF_STATUS_E_FAILURE);
 		return QDF_STATUS_E_FAILURE;
 	}
@@ -3047,15 +3043,15 @@ QDF_STATUS lim_process_sme_tdls_del_sta_req(struct mac_context *mac,
 	/* check if we are in proper state to work as TDLS client */
 	if (!LIM_IS_STA_ROLE(pe_session)) {
 		pe_err("Del sta received in wrong system Role %d",
-			  GET_LIM_SYSTEM_ROLE(pe_session));
+		       GET_LIM_SYSTEM_ROLE(pe_session));
 		goto lim_tdls_del_sta_error;
 	}
 
 	if (lim_is_roam_synch_in_progress(pe_session)) {
 		pe_err("roaming in progress, reject del sta! for session %d",
-		       pDelStaReq->sessionId);
-		lim_send_sme_tdls_del_sta_rsp(mac, pDelStaReq->sessionId,
-					      pDelStaReq->peermac, NULL,
+		       del_sta_req->session_id);
+		lim_send_sme_tdls_del_sta_rsp(mac, del_sta_req->session_id,
+					      del_sta_req->peermac, NULL,
 					      QDF_STATUS_E_FAILURE);
 		return QDF_STATUS_E_FAILURE;
 	}
@@ -3067,19 +3063,19 @@ QDF_STATUS lim_process_sme_tdls_del_sta_req(struct mac_context *mac,
 	if ((pe_session->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
 	    (pe_session->limSmeState != eLIM_SME_LINK_EST_STATE)) {
 
-		pe_err("Del Sta received in invalid LIMsme state: (%d",
-			pe_session->limSmeState);
+		pe_err("Del Sta received in invalid LIMsme state: %d",
+		       pe_session->limSmeState);
 		goto lim_tdls_del_sta_error;
 	}
 
-	status = lim_tdls_del_sta(mac, pDelStaReq->peermac,
+	status = lim_tdls_del_sta(mac, del_sta_req->peermac,
 				  pe_session, true);
 	if (status == QDF_STATUS_SUCCESS)
 		return status;
 
 lim_tdls_del_sta_error:
 	lim_send_sme_tdls_del_sta_rsp(mac, pe_session->smeSessionId,
-				      pDelStaReq->peermac, NULL, QDF_STATUS_E_FAILURE);
+				      del_sta_req->peermac, NULL, QDF_STATUS_E_FAILURE);
 
 	return status;
 }

+ 11 - 1
core/mac/src/pe/lim/lim_types.h

@@ -618,8 +618,18 @@ QDF_STATUS lim_process_sme_tdls_mgmt_send_req(struct mac_context *mac_ctx,
 QDF_STATUS lim_process_sme_tdls_add_sta_req(struct mac_context *mac,
 					    void *msg);
 
+/**
+ * lim_process_sme_tdls_del_sta_req() - process TDLS Del STA
+ * @mac_ctx: global mac context
+ * @msg: message buffer received from SME.
+ *
+ * Process TDLS Delete Station request
+ *
+ * Return: QDF_STATUS_SUCCESS on success, error code otherwise
+ */
 QDF_STATUS lim_process_sme_tdls_del_sta_req(struct mac_context *mac,
-					       uint32_t *pMsgBuf);
+					    void *msg);
+
 void lim_send_sme_mgmt_tx_completion(
 		struct mac_context *mac,
 		uint32_t sme_session_id,