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 "lim_ft.h"
#include "wlan_mlme_main.h" #include "wlan_mlme_main.h"
#include "qdf_util.h" #include "qdf_util.h"
#include "wlan_qct_sys.h"
#define ASCII_SPACE_CHARACTER 0x20 #define ASCII_SPACE_CHARACTER 0x20

View File

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

View File

@ -36,6 +36,8 @@
#include <qdf_status.h> #include <qdf_status.h>
#include <scheduler_api.h> #include <scheduler_api.h>
struct mac_context;
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Preprocessor definitions and constants Preprocessor definitions and constants
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
@ -84,4 +86,20 @@ QDF_STATUS umac_stop(void);
QDF_STATUS sys_mc_process_handler(struct scheduler_msg *msg); 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__ */ #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); return sys_mc_process_msg(msg);
} }
/** void sys_process_mmh_msg(struct mac_context *mac, struct scheduler_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)
{ {
QDF_MODULE_ID targetMQ = QDF_MODULE_ID_SYS; QDF_MODULE_ID dest_module = QDF_MODULE_ID_SYS;
/* if (!msg) {
* 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");
QDF_ASSERT(0); QDF_ASSERT(0);
return; return;
} }
switch (pMsg->type) { switch (msg->type) {
case eWNI_SME_SYS_READY_IND: case eWNI_SME_SYS_READY_IND:
/* Forward this message to the PE module */ /* Forward this message to the PE module */
targetMQ = QDF_MODULE_ID_PE; dest_module = QDF_MODULE_ID_PE;
break; break;
default: default:
if ((pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN) if ((msg->type >= eWNI_SME_MSG_TYPES_BEGIN) &&
&& (pMsg->type <= eWNI_SME_MSG_TYPES_END)) { (msg->type <= eWNI_SME_MSG_TYPES_END)) {
targetMQ = QDF_MODULE_ID_SME; dest_module = QDF_MODULE_ID_SME;
break; break;
} }
QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_ERROR, QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_ERROR,
"Message of ID %d is not yet handled by SYS", "Message of ID %d is not yet handled by SYS",
pMsg->type); msg->type);
QDF_ASSERT(0); 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, if (QDF_STATUS_SUCCESS != scheduler_post_message(QDF_MODULE_ID_SYS,
QDF_MODULE_ID_SYS, QDF_MODULE_ID_SYS,
targetMQ, dest_module,
pMsg)) { msg))
/* qdf_mem_free(msg->bodyptr);
* 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);
} }
}

View File

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

View File

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