qcacld-3.0: Converge on struct tdls_send_mgmt_request

During TDLS componentization the legacy typedef tSirTdlsSendMgmtReq
was replicated, creating struct tdls_send_mgmt_request. 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: I7d304d3d211101c7227ea621f307f91ff68a5753
CRs-Fixed: 2400767
This commit is contained in:
Jeff Johnson 2019-02-14 13:06:56 -08:00 committed by nshrivas
parent 43a0654452
commit 93cf08a710
5 changed files with 86 additions and 97 deletions

View File

@ -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

View File

@ -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

View File

@ -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 */

View File

@ -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;
}

View File

@ -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,