qcacld-3.0: Refine sys_process_mmh_msg()

There are currently a multitude of issues with sys_process_mmh_msg()
so update both the interface and the implementation to align with good
software engineering practices and the Linux Coding Style.

Change-Id: I76e53772dd72426cc4245756457e2a8140937571
CRs-Fixed: 2411714
This commit is contained in:
Jeff Johnson 2019-02-19 17:47:39 -08:00 committed by nshrivas
parent 6aacf6a0d1
commit b07230f434
6 changed files with 34 additions and 40 deletions

View File

@ -66,6 +66,7 @@
#include "lim_ft.h"
#include "wlan_mlme_main.h"
#include "qdf_util.h"
#include "wlan_qct_sys.h"
#define ASCII_SPACE_CHARACTER 0x20

View File

@ -37,6 +37,7 @@
#include "lim_trace.h"
#include "include/wlan_vdev_mlme.h"
#include "wlan_mlme_vdev_mgr_interface.h"
#include "wlan_qct_sys.h"
typedef enum {
ONE_BYTE = 1,

View File

@ -36,6 +36,8 @@
#include <qdf_status.h>
#include <scheduler_api.h>
struct mac_context;
/*---------------------------------------------------------------------------
Preprocessor definitions and constants
-------------------------------------------------------------------------*/
@ -84,4 +86,20 @@ QDF_STATUS umac_stop(void);
QDF_STATUS sys_mc_process_handler(struct scheduler_msg *msg);
/**
* sys_process_mmh_msg() - api to process an mmh message
* @mac: pointer to mac context
* @msg: pointer to message
*
* This API is used to process an mmh message.
*
* NOTE WELL: Ownership of the @msg bodyptr, if present, is always
* transferred, and the caller must not attempt to dereference or free
* the bodyptr after invoking this API.
*
* Return: none
*/
void sys_process_mmh_msg(struct mac_context *mac,
struct scheduler_msg *msg);
#endif /* WLAN_QCT_SYS_H__ */

View File

@ -194,46 +194,30 @@ QDF_STATUS sys_mc_process_handler(struct scheduler_msg *msg)
return sys_mc_process_msg(msg);
}
/**
* sys_process_mmh_msg() - this api to process mmh message
* @mac: pointer to mac context
* @pMsg: pointer to message
*
* This API is used to process mmh message
*
* Return: none
*/
void sys_process_mmh_msg(struct mac_context *mac, struct scheduler_msg *pMsg)
void sys_process_mmh_msg(struct mac_context *mac, struct scheduler_msg *msg)
{
QDF_MODULE_ID targetMQ = QDF_MODULE_ID_SYS;
QDF_MODULE_ID dest_module = QDF_MODULE_ID_SYS;
/*
* The body of this pMsg is a tSirMbMsg
* Contrary to previous generation, we cannot free it here!
* It is up to the callee to free it
*/
if (NULL == pMsg) {
QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_ERROR,
"NULL Message Pointer");
if (!msg) {
QDF_ASSERT(0);
return;
}
switch (pMsg->type) {
switch (msg->type) {
case eWNI_SME_SYS_READY_IND:
/* Forward this message to the PE module */
targetMQ = QDF_MODULE_ID_PE;
dest_module = QDF_MODULE_ID_PE;
break;
default:
if ((pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN)
&& (pMsg->type <= eWNI_SME_MSG_TYPES_END)) {
targetMQ = QDF_MODULE_ID_SME;
if ((msg->type >= eWNI_SME_MSG_TYPES_BEGIN) &&
(msg->type <= eWNI_SME_MSG_TYPES_END)) {
dest_module = QDF_MODULE_ID_SME;
break;
}
QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_ERROR,
"Message of ID %d is not yet handled by SYS",
pMsg->type);
"Message of ID %d is not yet handled by SYS",
msg->type);
QDF_ASSERT(0);
}
@ -242,15 +226,7 @@ void sys_process_mmh_msg(struct mac_context *mac, struct scheduler_msg *pMsg)
*/
if (QDF_STATUS_SUCCESS != scheduler_post_message(QDF_MODULE_ID_SYS,
QDF_MODULE_ID_SYS,
targetMQ,
pMsg)) {
/*
* Caller doesn't allocate memory for the pMsg.
* It allocate memory for bodyptr free the mem and return
*/
if (pMsg->bodyptr)
qdf_mem_free(pMsg->bodyptr);
}
dest_module,
msg))
qdf_mem_free(msg->bodyptr);
}

View File

@ -61,6 +61,7 @@
#include "wlan_mlme_api.h"
#include "wlan_mlme_public_struct.h"
#include <wlan_crypto_global_api.h>
#include "wlan_qct_sys.h"
#define RSN_AUTH_KEY_MGMT_SAE WLAN_RSN_SEL(WLAN_AKM_SAE)
#define MAX_PWR_FCC_CHAN_12 8

View File

@ -1017,9 +1017,6 @@ typedef struct tHalHiddenSsidVdevRestart {
} tHalHiddenSsidVdevRestart, *tpHalHiddenSsidVdevRestart;
extern void sys_process_mmh_msg(struct mac_context *mac,
struct scheduler_msg *pMsg);
/**
* struct tDisableIntraBssFwd - intra bss forward parameters
* @sessionId: session id