diff --git a/components/tdls/core/src/wlan_tdls_mgmt.h b/components/tdls/core/src/wlan_tdls_mgmt.h index ce6f9307988f3..fae3ecc0424d0 100644 --- a/components/tdls/core/src/wlan_tdls_mgmt.h +++ b/components/tdls/core/src/wlan_tdls_mgmt.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2019 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 @@ -43,38 +43,6 @@ struct tdls_rx_mgmt_event { struct tdls_rx_mgmt_frame *rx_mgmt; }; -/* - * struct tdls_send_mgmt_request - tdls management request - * @message_type: type of pe message - * @length: length of the frame. - * @session_id: session id - * @transaction_id: transaction ID for cmd - * @req_type: type of action frame - * @dialog: dialog token used in the frame. - * @status_code: status to be incuded in the frame. - * @responder: tdls request type - * @peer_capability: peer capability information - * @bssid: bssid - * @peer_mac: mac address of the peer - * @add_ie: additional ie's to be included - */ -struct tdls_send_mgmt_request { - uint16_t message_type; - uint16_t length; - uint8_t session_id; - uint16_t transaction_id; - uint8_t req_type; - uint8_t dialog; - uint16_t status_code; - uint8_t responder; - uint32_t peer_capability; - struct qdf_mac_addr bssid; - struct qdf_mac_addr peer_mac; - enum wifi_traffic_ac ac; - /* Variable length. Dont add any field after this. */ - uint8_t add_ie[1]; -}; - /** * tdls_process_mgmt_req() - send a TDLS mgmt request to serialize module * @tdls_mgmt_req: tdls management request diff --git a/components/tdls/dispatcher/inc/wlan_tdls_public_structs.h b/components/tdls/dispatcher/inc/wlan_tdls_public_structs.h index 18cd019ce2812..d98831e5642a2 100644 --- a/components/tdls/dispatcher/inc/wlan_tdls_public_structs.h +++ b/components/tdls/dispatcher/inc/wlan_tdls_public_structs.h @@ -1216,4 +1216,36 @@ struct tdls_del_sta_rsp { struct wlan_objmgr_psoc *psoc; }; +/* + * struct tdls_send_mgmt_request - tdls management request + * @message_type: type of pe message + * @length: length of the frame. + * @session_id: session id + * @transaction_id: transaction ID for cmd + * @req_type: type of action frame + * @dialog: dialog token used in the frame. + * @status_code: status to be incuded in the frame. + * @responder: tdls request type + * @peer_capability: peer capability information + * @bssid: bssid + * @peer_mac: mac address of the peer + * @add_ie: additional ie's to be included + */ +struct tdls_send_mgmt_request { + uint16_t message_type; + uint16_t length; + uint8_t session_id; + uint16_t transaction_id; + uint8_t req_type; + uint8_t dialog; + uint16_t status_code; + uint8_t responder; + uint32_t peer_capability; + struct qdf_mac_addr bssid; + struct qdf_mac_addr peer_mac; + enum wifi_traffic_ac ac; + /* Variable length. Dont add any field after this. */ + uint8_t add_ie[1]; +}; + #endif diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index c24e8f1a75997..8fc147fe4ee75 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -2524,25 +2524,6 @@ struct sir_antenna_mode_resp { }; #ifdef FEATURE_WLAN_TDLS -/* TDLS Request struct SME-->PE */ -typedef struct sSirTdlsSendMgmtReq { - uint16_t messageType; /* eWNI_SME_TDLS_DISCOVERY_START_REQ */ - uint16_t length; - uint8_t sessionId; /* Session ID */ - uint16_t transactionId; /* Transaction ID for cmd */ - uint8_t reqType; - uint8_t dialog; - uint16_t statusCode; - uint8_t responder; - uint32_t peerCapability; - /* For multi-session, for PE to locate peSession ID */ - struct qdf_mac_addr bssid; - struct qdf_mac_addr peer_mac; - enum wifi_traffic_ac ac; - /* Variable length. Dont add any field after this. */ - uint8_t addIe[1]; -} tSirTdlsSendMgmtReq, *tpSirSmeTdlsSendMgmtReq; - /* TDLS Request struct SME-->PE */ typedef struct sSirTdlsAddStaReq { uint16_t messageType; /* eWNI_SME_TDLS_DISCOVERY_START_REQ */ diff --git a/core/mac/src/pe/lim/lim_process_tdls.c b/core/mac/src/pe/lim/lim_process_tdls.c index 6b01e6b349779..863de4857af6e 100644 --- a/core/mac/src/pe/lim/lim_process_tdls.c +++ b/core/mac/src/pe/lim/lim_process_tdls.c @@ -2794,44 +2794,35 @@ lim_send_tdls_comp_mgmt_rsp(struct mac_context *mac_ctx, uint16_t msg_type, } } -/** - * lim_process_sme_tdls_mgmt_send_req() - send out tdls management frames - * - * @mac_ctx - global mac context - * @msg - message buffer received from SME. - * - * Process Send Mgmt Request from SME and transmit to AP. - * - * Return: QDF_STATUS_SUCCESS on success, error code otherwise - */ QDF_STATUS lim_process_sme_tdls_mgmt_send_req(struct mac_context *mac_ctx, - uint32_t *msg) + void *msg) { - /* get all discovery request parameters */ - tSirTdlsSendMgmtReq *send_req = (tSirTdlsSendMgmtReq *) msg; + struct tdls_send_mgmt_request *send_req = msg; struct pe_session *session_entry; uint8_t session_id; + uint16_t ie_len; tSirResultCodes result_code = eSIR_SME_INVALID_PARAMETERS; pe_debug("Send Mgmt Received"); session_entry = pe_find_session_by_bssid(mac_ctx, - send_req->bssid.bytes, &session_id); - if (NULL == session_entry) { + send_req->bssid.bytes, + &session_id); + if (!session_entry) { pe_err("PE Session does not exist for given sme session_id %d", - send_req->sessionId); + send_req->session_id); goto lim_tdls_send_mgmt_error; } /* check if we are in proper state to work as TDLS client */ if (!LIM_IS_STA_ROLE(session_entry)) { pe_err("send mgmt received in wrong system Role: %d", - GET_LIM_SYSTEM_ROLE(session_entry)); + GET_LIM_SYSTEM_ROLE(session_entry)); goto lim_tdls_send_mgmt_error; } if (lim_is_roam_synch_in_progress(session_entry)) { pe_err("roaming in progress, reject mgmt! for session %d", - send_req->sessionId); + send_req->session_id); result_code = eSIR_SME_REFUSED; goto lim_tdls_send_mgmt_error; } @@ -2843,15 +2834,17 @@ QDF_STATUS lim_process_sme_tdls_mgmt_send_req(struct mac_context *mac_ctx, if ((session_entry->limSmeState != eLIM_SME_ASSOCIATED_STATE) && (session_entry->limSmeState != eLIM_SME_LINK_EST_STATE)) { pe_err("send mgmt received in invalid LIMsme state: %d", - session_entry->limSmeState); + session_entry->limSmeState); goto lim_tdls_send_mgmt_error; } cds_tdls_tx_rx_mgmt_event(SIR_MAC_ACTION_TDLS, SIR_MAC_ACTION_TX, SIR_MAC_MGMT_ACTION, - send_req->reqType, send_req->peer_mac.bytes); + send_req->req_type, send_req->peer_mac.bytes); - switch (send_req->reqType) { + ie_len = send_req->length - sizeof(*send_req); + + switch (send_req->req_type) { case SIR_MAC_TDLS_DIS_REQ: pe_debug("Transmit Discovery Request Frame"); /* format TDLS discovery request frame and transmit it */ @@ -2864,46 +2857,50 @@ QDF_STATUS lim_process_sme_tdls_mgmt_send_req(struct mac_context *mac_ctx, pe_debug("Transmit Discovery Response Frame"); /* Send a response mgmt action frame */ lim_send_tdls_dis_rsp_frame(mac_ctx, send_req->peer_mac, - send_req->dialog, session_entry, &send_req->addIe[0], - (send_req->length - sizeof(tSirTdlsSendMgmtReq))); + send_req->dialog, session_entry, + send_req->add_ie, ie_len); result_code = eSIR_SME_SUCCESS; break; case SIR_MAC_TDLS_SETUP_REQ: pe_debug("Transmit Setup Request Frame"); lim_send_tdls_link_setup_req_frame(mac_ctx, - send_req->peer_mac, send_req->dialog, session_entry, - &send_req->addIe[0], - (send_req->length - sizeof(tSirTdlsSendMgmtReq)), - send_req->ac); + send_req->peer_mac, + send_req->dialog, + session_entry, + send_req->add_ie, ie_len, + send_req->ac); result_code = eSIR_SME_SUCCESS; break; case SIR_MAC_TDLS_SETUP_RSP: pe_debug("Transmit Setup Response Frame"); lim_send_tdls_setup_rsp_frame(mac_ctx, - send_req->peer_mac, send_req->dialog, session_entry, - send_req->statusCode, &send_req->addIe[0], - (send_req->length - sizeof(tSirTdlsSendMgmtReq)), - send_req->ac); + send_req->peer_mac, + send_req->dialog, session_entry, + send_req->status_code, + send_req->add_ie, ie_len, + send_req->ac); result_code = eSIR_SME_SUCCESS; break; case SIR_MAC_TDLS_SETUP_CNF: pe_debug("Transmit Setup Confirm Frame"); lim_send_tdls_link_setup_cnf_frame(mac_ctx, - send_req->peer_mac, send_req->dialog, - send_req->peerCapability, session_entry, - &send_req->addIe[0], - (send_req->length - sizeof(tSirTdlsSendMgmtReq)), - send_req->ac); + send_req->peer_mac, + send_req->dialog, + send_req->peer_capability, + session_entry, + send_req->add_ie, ie_len, + send_req->ac); result_code = eSIR_SME_SUCCESS; break; case SIR_MAC_TDLS_TEARDOWN: pe_debug("Transmit Teardown Frame"); lim_send_tdls_teardown_frame(mac_ctx, - send_req->peer_mac, send_req->statusCode, - send_req->responder, session_entry, - &send_req->addIe[0], - (send_req->length - sizeof(tSirTdlsSendMgmtReq)), - send_req->ac); + send_req->peer_mac, + send_req->status_code, + send_req->responder, + session_entry, + send_req->add_ie, ie_len, + send_req->ac); result_code = eSIR_SME_SUCCESS; break; case SIR_MAC_TDLS_PEER_TRAFFIC_IND: @@ -2920,8 +2917,8 @@ QDF_STATUS lim_process_sme_tdls_mgmt_send_req(struct mac_context *mac_ctx, lim_tdls_send_mgmt_error: lim_send_tdls_comp_mgmt_rsp(mac_ctx, eWNI_SME_TDLS_SEND_MGMT_RSP, - result_code, send_req->sessionId, - send_req->transactionId); + result_code, send_req->session_id, + send_req->transaction_id); return QDF_STATUS_SUCCESS; } diff --git a/core/mac/src/pe/lim/lim_types.h b/core/mac/src/pe/lim/lim_types.h index 7f0ce3897f5db..fa962b9add196 100644 --- a/core/mac/src/pe/lim/lim_types.h +++ b/core/mac/src/pe/lim/lim_types.h @@ -592,8 +592,19 @@ lim_send_radio_measure_report_action_frame(struct mac_context *mac, #ifdef FEATURE_WLAN_TDLS void lim_init_tdls_data(struct mac_context *, struct pe_session *); -QDF_STATUS lim_process_sme_tdls_mgmt_send_req(struct mac_context *mac, - uint32_t *pMsgBuf); + +/** + * lim_process_sme_tdls_mgmt_send_req() - send out tdls management frames + * @mac_ctx: global mac context + * @msg: message buffer received from SME. + * + * Process Send Mgmt Request from SME and transmit to AP. + * + * Return: QDF_STATUS_SUCCESS on success, error code otherwise + */ +QDF_STATUS lim_process_sme_tdls_mgmt_send_req(struct mac_context *mac_ctx, + void *msg); + QDF_STATUS lim_process_sme_tdls_add_sta_req(struct mac_context *mac, uint32_t *pMsgBuf); QDF_STATUS lim_process_sme_tdls_del_sta_req(struct mac_context *mac,