mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 23:24:22 -04:00
qcacmn: Implement Dynamic serialization rules framework
Add dynamic rules registration callbacks which needs to be registered by each component during its initialization phase. These callbacks are used for serialization component to determine whether serialization request can or can't be honored. Change-Id: I02000426527bc7611cb9bb1d0ee26f3c03d9f2d1
This commit is contained in:
parent
a36843cd5b
commit
089fd7c9da
5 changed files with 113 additions and 67 deletions
|
|
@ -339,7 +339,7 @@ wlan_serialization_request(struct wlan_serialization_command *cmd);
|
|||
* callback
|
||||
* @psoc: PSOC object information
|
||||
* @comp_id: Component ID
|
||||
* @cmd_id: Command ID
|
||||
* @cmd_type: Command Type
|
||||
* @cb: Callback
|
||||
*
|
||||
* This is called from component during its initialization.It initializes
|
||||
|
|
@ -350,15 +350,15 @@ wlan_serialization_request(struct wlan_serialization_command *cmd);
|
|||
QDF_STATUS
|
||||
wlan_serialization_register_comp_info_cb(struct wlan_objmgr_psoc *psoc,
|
||||
enum wlan_umac_comp_id comp_id,
|
||||
enum wlan_serialization_cmd_type cmd_id,
|
||||
enum wlan_serialization_cmd_type cmd_type,
|
||||
wlan_serialization_comp_info_cb cb);
|
||||
|
||||
/**
|
||||
* wlan_serialization_deregister_comp_info_cb() - Deregister component's info
|
||||
* callback
|
||||
* callback
|
||||
* @psoc: PSOC object information
|
||||
* @comp_id: Component ID
|
||||
* @cmd_id: Command ID
|
||||
* @cmd_type: Command Type
|
||||
*
|
||||
* This routine is called from other component during its de-initialization.
|
||||
*
|
||||
|
|
@ -367,7 +367,38 @@ wlan_serialization_register_comp_info_cb(struct wlan_objmgr_psoc *psoc,
|
|||
QDF_STATUS
|
||||
wlan_serialization_deregister_comp_info_cb(struct wlan_objmgr_psoc *psoc,
|
||||
enum wlan_umac_comp_id comp_id,
|
||||
enum wlan_serialization_cmd_type cmd_id);
|
||||
enum wlan_serialization_cmd_type cmd_type);
|
||||
|
||||
/**
|
||||
* wlan_serialization_register_apply_rules_cb() - Register component's rules
|
||||
* callback
|
||||
* @psoc: PSOC object information
|
||||
* @cmd_type: Command Type
|
||||
* @cb: Callback
|
||||
*
|
||||
* This is called from component during its initialization.It initializes
|
||||
* callback handler for given cmd_type in a 1-D array.
|
||||
*
|
||||
* Return: QDF Status
|
||||
*/
|
||||
QDF_STATUS
|
||||
wlan_serialization_register_apply_rules_cb(struct wlan_objmgr_psoc *psoc,
|
||||
enum wlan_serialization_cmd_type cmd_type,
|
||||
wlan_serialization_apply_rules_cb apply_rules_cb);
|
||||
|
||||
/**
|
||||
* wlan_serialization_deregister_apply_rules_cb() - Deregister component's rules
|
||||
* callback
|
||||
* @psoc: PSOC object information
|
||||
* @cmd_type: Command Type
|
||||
*
|
||||
* This routine is called from other component during its de-initialization.
|
||||
*
|
||||
* Return: QDF Status
|
||||
*/
|
||||
QDF_STATUS
|
||||
wlan_serialization_deregister_apply_rules_cb(struct wlan_objmgr_psoc *psoc,
|
||||
enum wlan_serialization_cmd_type cmd_type);
|
||||
|
||||
/**
|
||||
* @wlan_serialization_init() - Serialization component initialization routine
|
||||
|
|
|
|||
|
|
@ -51,6 +51,53 @@ bool wlan_serialization_is_cmd_present_in_active_queue(
|
|||
return wlan_serialization_is_cmd_present_queue(cmd, true);
|
||||
}
|
||||
|
||||
QDF_STATUS
|
||||
wlan_serialization_register_apply_rules_cb(struct wlan_objmgr_psoc *psoc,
|
||||
enum wlan_serialization_cmd_type cmd_type,
|
||||
wlan_serialization_apply_rules_cb cb)
|
||||
{
|
||||
struct wlan_serialization_psoc_priv_obj *ser_soc_obj;
|
||||
QDF_STATUS status;
|
||||
|
||||
status = wlan_serialization_validate_cmdtype(cmd_type);
|
||||
if (status != QDF_STATUS_SUCCESS) {
|
||||
serialization_err("invalid cmd_type %d",
|
||||
cmd_type);
|
||||
return status;
|
||||
}
|
||||
ser_soc_obj = wlan_serialization_get_psoc_priv_obj(psoc);
|
||||
if (!ser_soc_obj) {
|
||||
serialization_err("invalid ser_soc_obj");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
ser_soc_obj->apply_rules_cb[cmd_type] = cb;
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
QDF_STATUS
|
||||
wlan_serialization_deregister_apply_rules_cb(struct wlan_objmgr_psoc *psoc,
|
||||
enum wlan_serialization_cmd_type cmd_type)
|
||||
{
|
||||
struct wlan_serialization_psoc_priv_obj *ser_soc_obj;
|
||||
QDF_STATUS status;
|
||||
|
||||
status = wlan_serialization_validate_cmdtype(cmd_type);
|
||||
if (status != QDF_STATUS_SUCCESS) {
|
||||
serialization_err("invalid cmd_type %d",
|
||||
cmd_type);
|
||||
return status;
|
||||
}
|
||||
ser_soc_obj = wlan_serialization_get_psoc_priv_obj(psoc);
|
||||
if (!ser_soc_obj) {
|
||||
serialization_err("invalid ser_soc_obj");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
ser_soc_obj->apply_rules_cb[cmd_type] = NULL;
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
QDF_STATUS
|
||||
wlan_serialization_register_comp_info_cb(struct wlan_objmgr_psoc *psoc,
|
||||
enum wlan_umac_comp_id comp_id,
|
||||
|
|
@ -61,8 +108,11 @@ wlan_serialization_register_comp_info_cb(struct wlan_objmgr_psoc *psoc,
|
|||
QDF_STATUS status;
|
||||
|
||||
status = wlan_serialization_validate_cmd(comp_id, cmd_type);
|
||||
if (status != QDF_STATUS_SUCCESS)
|
||||
if (status != QDF_STATUS_SUCCESS) {
|
||||
serialization_err("invalid comp_id %d or cmd_type %d",
|
||||
comp_id, cmd_type);
|
||||
return status;
|
||||
}
|
||||
ser_soc_obj = wlan_serialization_get_psoc_priv_obj(psoc);
|
||||
if (!ser_soc_obj) {
|
||||
serialization_err("invalid ser_soc_obj");
|
||||
|
|
@ -82,8 +132,11 @@ wlan_serialization_deregister_comp_info_cb(struct wlan_objmgr_psoc *psoc,
|
|||
QDF_STATUS status;
|
||||
|
||||
status = wlan_serialization_validate_cmd(comp_id, cmd_type);
|
||||
if (status != QDF_STATUS_SUCCESS)
|
||||
if (status != QDF_STATUS_SUCCESS) {
|
||||
serialization_err("invalid comp_id %d or cmd_type %d",
|
||||
comp_id, cmd_type);
|
||||
return status;
|
||||
}
|
||||
ser_soc_obj = wlan_serialization_get_psoc_priv_obj(psoc);
|
||||
if (!ser_soc_obj) {
|
||||
serialization_err("invalid ser_soc_obj");
|
||||
|
|
|
|||
|
|
@ -31,62 +31,6 @@
|
|||
#include "wlan_serialization_rules_i.h"
|
||||
#include "wlan_serialization_utils_i.h"
|
||||
|
||||
/**
|
||||
* wlan_serialization_apply_rules_cb_init() - Apply rule callback init
|
||||
* @psoc: PSOC object
|
||||
*
|
||||
* Apply rules Command callback registration function is
|
||||
* called from component during its initialization
|
||||
* It initializes all cmd callback handler for given CMDIDX in
|
||||
* 1-D Array
|
||||
*
|
||||
* Return: QDF Status
|
||||
*/
|
||||
static QDF_STATUS
|
||||
wlan_serialization_apply_rules_cb_init(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
struct wlan_serialization_psoc_priv_obj *ser_soc_obj =
|
||||
wlan_serialization_get_psoc_priv_obj(psoc);
|
||||
|
||||
if (ser_soc_obj == NULL) {
|
||||
serialization_err("invalid ser_soc_obj");
|
||||
return QDF_STATUS_E_PERM;
|
||||
}
|
||||
ser_soc_obj->apply_rules_cb[WLAN_SER_CMD_SCAN] =
|
||||
wlan_serialization_apply_scan_rules;
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wlan_serialization_apply_rules_cb_deinit() - Apply rule callback deinit
|
||||
* @psoc: PSOC object
|
||||
*
|
||||
* Apply rules Command callback De-registration function
|
||||
* called from component during its initialization
|
||||
* It initializes all cmd callback handler for given CMDIDX in
|
||||
* 1-D Array
|
||||
*
|
||||
* Return: QDF Status
|
||||
*/
|
||||
static QDF_STATUS
|
||||
wlan_serialization_apply_rules_cb_deinit(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
struct wlan_serialization_psoc_priv_obj *ser_soc_obj =
|
||||
wlan_serialization_get_psoc_priv_obj(psoc);
|
||||
uint8_t i;
|
||||
|
||||
if (ser_soc_obj == NULL) {
|
||||
serialization_err("invalid ser_soc_obj");
|
||||
return QDF_STATUS_E_PERM;
|
||||
}
|
||||
for (i = 0; i < WLAN_SER_CMD_MAX; i++)
|
||||
ser_soc_obj->apply_rules_cb[i] = NULL;
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
QDF_STATUS wlan_serialization_psoc_close(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
QDF_STATUS status;
|
||||
|
|
@ -105,7 +49,6 @@ QDF_STATUS wlan_serialization_psoc_close(struct wlan_objmgr_psoc *psoc)
|
|||
qdf_mem_free(ser_soc_obj->timers);
|
||||
ser_soc_obj->timers = NULL;
|
||||
ser_soc_obj->max_active_cmds = 0;
|
||||
status = wlan_serialization_apply_rules_cb_deinit(psoc);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
@ -113,7 +56,6 @@ QDF_STATUS wlan_serialization_psoc_close(struct wlan_objmgr_psoc *psoc)
|
|||
QDF_STATUS wlan_serialization_psoc_open(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
uint8_t pdev_count;
|
||||
QDF_STATUS status;
|
||||
struct wlan_serialization_psoc_priv_obj *ser_soc_obj =
|
||||
wlan_serialization_get_psoc_priv_obj(psoc);
|
||||
|
||||
|
|
@ -132,9 +74,8 @@ QDF_STATUS wlan_serialization_psoc_open(struct wlan_objmgr_psoc *psoc)
|
|||
serialization_alert("Mem alloc failed for ser timers");
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
}
|
||||
status = wlan_serialization_apply_rules_cb_init(psoc);
|
||||
|
||||
return status;
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
QDF_STATUS wlan_serialization_psoc_obj_create_notification(
|
||||
|
|
|
|||
|
|
@ -437,6 +437,19 @@ wlan_serialization_is_active_cmd_allowed(struct wlan_serialization_command *cmd)
|
|||
return wlan_serialization_is_active_nonscan_cmd_allowed(pdev);
|
||||
}
|
||||
|
||||
QDF_STATUS wlan_serialization_validate_cmdtype(
|
||||
enum wlan_serialization_cmd_type cmd_type)
|
||||
{
|
||||
serialization_info("validate cmd_type:%d", cmd_type);
|
||||
|
||||
if (cmd_type < 0 || cmd_type >= WLAN_SER_CMD_MAX) {
|
||||
serialization_err("Invalid cmd or comp passed");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
QDF_STATUS wlan_serialization_validate_cmd(
|
||||
enum wlan_umac_comp_id comp_id,
|
||||
enum wlan_serialization_cmd_type cmd_type)
|
||||
|
|
|
|||
|
|
@ -268,6 +268,14 @@ QDF_STATUS wlan_serialization_validate_cmd(
|
|||
enum wlan_umac_comp_id comp_id,
|
||||
enum wlan_serialization_cmd_type cmd_type);
|
||||
|
||||
/**
|
||||
* wlan_serialization_validate_cmdtype() - Validate the command type
|
||||
* @cmd_type: Command Type
|
||||
*
|
||||
* Return: QDF Status
|
||||
*/
|
||||
QDF_STATUS wlan_serialization_validate_cmdtype(
|
||||
enum wlan_serialization_cmd_type cmd_type);
|
||||
|
||||
/**
|
||||
* wlan_serialization_release_list_cmds() - Release the list cmds to global pool
|
||||
|
|
|
|||
Loading…
Reference in a new issue