qcacmn: Fix bugs in serialization module reported by reviewer
Few issues are observed and reported in serialization module, fix them. Change-Id: I11929f086a5f7ef227b8b8fa62d0cf8c1b5f0b9c CRs-Fixed: 2000032
This commit is contained in:
@@ -42,16 +42,18 @@
|
||||
|
||||
/**
|
||||
* enum wlan_serialization_cb_reason - reason for calling the callback
|
||||
* WLAN_SERIALIZATION_REASON_ACTIVATE_CMD: activate the cmd by sending it to FW
|
||||
* WLAN_SERIALIZATION_REASON_CANCEL_CMD: Cancel the cmd in the pending list
|
||||
* WLAN_SERIALIZATION_REASON_RELEASE_MEM_CMD:cmd execution complete. Release
|
||||
* @WLAN_SERIALIZATION_REASON_ACTIVATE_CMD: activate the cmd by sending it to FW
|
||||
* @WLAN_SERIALIZATION_REASON_CANCEL_CMD: Cancel the cmd in the pending list
|
||||
* @WLAN_SERIALIZATION_REASON_RELEASE_MEM_CMD:cmd execution complete. Release
|
||||
* the memory allocated while
|
||||
* building the command
|
||||
* @WLAN_SER_CB_ACTIVE_CMD_TIMEOUT: active cmd has been timeout.
|
||||
*/
|
||||
enum wlan_serialization_cb_reason {
|
||||
WLAN_SER_CB_ACTIVATE_CMD,
|
||||
WLAN_SER_CB_CANCEL_CMD,
|
||||
WLAN_SER_CB_RELEASE_MEM_CMD,
|
||||
WLAN_SER_CB_ACTIVE_CMD_TIMEOUT,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -78,21 +80,15 @@ union wlan_serialization_rules_info {
|
||||
* @wlan_cmd: Command passed by the component for serialization
|
||||
* @reason: Reason code for which the callback is being called
|
||||
*
|
||||
* Reason specifies the reason for which the callback is being called
|
||||
* Reason specifies the reason for which the callback is being called. callback
|
||||
* should return success or failure based up on overall success of callback.
|
||||
* if callback returns failure then serialization will remove the command from
|
||||
* active queue and proceed for next pending command.
|
||||
*
|
||||
* Return: None
|
||||
* Return: QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE
|
||||
*/
|
||||
typedef void (*wlan_serialization_cmd_callback)(
|
||||
void *wlan_cmd, enum wlan_serialization_cb_reason reason);
|
||||
|
||||
/**
|
||||
* wlan_serialization_active_cmd_timeout_callback() - callback for cmd timeout
|
||||
* @wlan_cmd: Command that has timed out
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
typedef void (*wlan_serialization_active_cmd_timeout_callback)(
|
||||
void *wlan_cmd);
|
||||
typedef QDF_STATUS (*wlan_serialization_cmd_callback) (void *wlan_cmd,
|
||||
enum wlan_serialization_cb_reason reason);
|
||||
|
||||
/**
|
||||
* wlan_serialization_comp_info_cb() - callback to fill the rules information
|
||||
@@ -176,23 +172,6 @@ enum wlan_serialization_cmd_status {
|
||||
WLAN_SER_CMD_NOT_FOUND,
|
||||
};
|
||||
|
||||
/**
|
||||
* union wlan_serialization_obj_context - Object associated to the command
|
||||
* @pdev: PDEV object associated to the command
|
||||
* @vdev: VDEV object associated to the command
|
||||
*
|
||||
* Object passed for the command
|
||||
* This is an agreement between the component and serialization as to which
|
||||
* object is being passed. A copy of this command is maintained by
|
||||
* serialization as part of queuing the command. So, the object ref count has
|
||||
* to be maintained while queuing and released during cancellation/dequeuing/
|
||||
* flushing the command.
|
||||
*/
|
||||
union wlan_serialization_obj_context {
|
||||
struct wlan_objmgr_pdev *pdev;
|
||||
struct wlan_objmgr_vdev *vdev;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct wlan_serialization_command - Command to be serialized
|
||||
* @wlan_serialization_cmd_type: Type of command
|
||||
@@ -202,18 +181,23 @@ union wlan_serialization_obj_context {
|
||||
* @is_high_priority: Normal/High Priority at which the cmd has to be queued
|
||||
* @cmd_timeout_cb: Command timeout callback
|
||||
* @cmd_timeout_duration: Timeout duration in milliseconds
|
||||
* @obj_ctxt: Object passed for the command
|
||||
* @vdev: VDEV object associated to the command
|
||||
* @umac_cmd: Actual command that needs to be sent to WMI/firmware
|
||||
*
|
||||
* Note: Unnamed union has been used in this structure, so that in future if
|
||||
* somebody wants to add pdev or psoc structure then that person can add without
|
||||
* modifying existing code.
|
||||
*/
|
||||
struct wlan_serialization_command {
|
||||
enum wlan_serialization_cmd_type cmd_type;
|
||||
uint16_t cmd_id;
|
||||
wlan_serialization_cmd_callback cmd_cb;
|
||||
uint8_t source;
|
||||
uint8_t is_high_priority;
|
||||
wlan_serialization_active_cmd_timeout_callback cmd_timeout_cb;
|
||||
bool is_high_priority;
|
||||
uint16_t cmd_timeout_duration;
|
||||
union wlan_serialization_obj_context obj_ctxt;
|
||||
union {
|
||||
struct wlan_objmgr_vdev *vdev;
|
||||
};
|
||||
void *umac_cmd;
|
||||
};
|
||||
|
||||
@@ -223,7 +207,7 @@ struct wlan_serialization_command {
|
||||
* @cmd_type: Command type
|
||||
* @cmd_id: Command ID
|
||||
* @req_type: Commands that need to be cancelled
|
||||
* @obj_ctxt: PDEV/VDEV object on which the commands need to be cancelled
|
||||
* @vdev: VDEV object associated to the command
|
||||
* @queue_type: Queues from which the command to be cancelled
|
||||
*/
|
||||
struct wlan_serialization_queued_cmd_info {
|
||||
@@ -231,7 +215,9 @@ struct wlan_serialization_queued_cmd_info {
|
||||
enum wlan_serialization_cmd_type cmd_type;
|
||||
uint16_t cmd_id;
|
||||
enum wlan_serialization_cancel_type req_type;
|
||||
union wlan_serialization_obj_context obj_ctxt;
|
||||
union {
|
||||
struct wlan_objmgr_vdev *vdev;
|
||||
};
|
||||
uint8_t queue_type;
|
||||
};
|
||||
|
||||
|
@@ -40,6 +40,10 @@ wlan_serialization_register_comp_info_cb(struct wlan_objmgr_psoc *psoc,
|
||||
if (status != QDF_STATUS_SUCCESS)
|
||||
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->comp_info_cb[cmd_type][comp_id] = cb;
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
@@ -57,6 +61,10 @@ wlan_serialization_deregister_comp_info_cb(struct wlan_objmgr_psoc *psoc,
|
||||
if (status != QDF_STATUS_SUCCESS)
|
||||
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->comp_info_cb[cmd_type][comp_id] = NULL;
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
|
@@ -48,7 +48,7 @@ wlan_serialization_apply_rules_cb_init(struct wlan_objmgr_psoc *psoc)
|
||||
wlan_serialization_get_psoc_priv_obj(psoc);
|
||||
|
||||
if (ser_soc_obj == NULL) {
|
||||
serialization_alert("Serialization PSOC private obj is NULL");
|
||||
serialization_err("invalid ser_soc_obj");
|
||||
return QDF_STATUS_E_PERM;
|
||||
}
|
||||
ser_soc_obj->apply_rules_cb[WLAN_SER_CMD_SCAN] = wlan_apply_scan_rules;
|
||||
@@ -76,7 +76,7 @@ wlan_serialization_apply_rules_cb_deinit(struct wlan_objmgr_psoc *psoc)
|
||||
uint8_t i;
|
||||
|
||||
if (ser_soc_obj == NULL) {
|
||||
serialization_alert("Serialization PSOC private obj is NULL");
|
||||
serialization_err("invalid ser_soc_obj");
|
||||
return QDF_STATUS_E_PERM;
|
||||
}
|
||||
for (i = 0; i < WLAN_SER_CMD_MAX; i++)
|
||||
@@ -91,6 +91,10 @@ QDF_STATUS wlan_serialization_psoc_close(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) {
|
||||
serialization_err("invalid ser_soc_obj");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
qdf_mem_free(ser_soc_obj->timers);
|
||||
ser_soc_obj->timers = NULL;
|
||||
ser_soc_obj->max_active_cmds = 0;
|
||||
@@ -106,6 +110,10 @@ QDF_STATUS wlan_serialization_psoc_open(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) {
|
||||
serialization_err("invalid ser_soc_obj");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
/* TODO:Get WLAN_SERIALIZATION_MAX_ACTIVE_SCAN_CMDS frm service ready */
|
||||
pdev_count = wlan_psoc_get_pdev_count(psoc);
|
||||
ser_soc_obj->max_active_cmds = WLAN_SERIALIZATION_MAX_ACTIVE_SCAN_CMDS +
|
||||
@@ -134,7 +142,7 @@ QDF_STATUS wlan_serialization_psoc_obj_create_notification(
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
}
|
||||
wlan_objmgr_psoc_component_obj_attach(psoc,
|
||||
WLAN_UMAC_COMP_SERIALIZATION, (void *)soc_ser_obj,
|
||||
WLAN_UMAC_COMP_SERIALIZATION, soc_ser_obj,
|
||||
QDF_STATUS_SUCCESS);
|
||||
serialization_info("ser psoc obj created");
|
||||
|
||||
@@ -233,7 +241,7 @@ QDF_STATUS wlan_serialization_pdev_obj_create_notification(
|
||||
return status;
|
||||
}
|
||||
status = wlan_objmgr_pdev_component_obj_attach(pdev,
|
||||
WLAN_UMAC_COMP_SERIALIZATION, (void *)ser_pdev_obj,
|
||||
WLAN_UMAC_COMP_SERIALIZATION, ser_pdev_obj,
|
||||
QDF_STATUS_SUCCESS);
|
||||
if (status != QDF_STATUS_SUCCESS) {
|
||||
serialization_err("serialization pdev obj attach failed");
|
||||
@@ -251,7 +259,7 @@ QDF_STATUS wlan_serialization_psoc_obj_destroy_notification(
|
||||
wlan_serialization_get_psoc_priv_obj(psoc);
|
||||
|
||||
if (NULL == ser_soc_obj) {
|
||||
serialization_err("ser psoc private obj is NULL");
|
||||
serialization_err("invalid ser_soc_obj");
|
||||
return QDF_STATUS_E_FAULT;
|
||||
}
|
||||
status = wlan_objmgr_psoc_component_obj_detach(psoc,
|
||||
@@ -273,8 +281,7 @@ QDF_STATUS wlan_serialization_pdev_obj_destroy_notification(
|
||||
wlan_serialization_get_pdev_priv_obj(pdev);
|
||||
|
||||
status = wlan_objmgr_pdev_component_obj_detach(pdev,
|
||||
WLAN_UMAC_COMP_SERIALIZATION,
|
||||
(void *)ser_pdev_obj);
|
||||
WLAN_UMAC_COMP_SERIALIZATION, ser_pdev_obj);
|
||||
wlan_serialization_destroy_list(ser_pdev_obj,
|
||||
&ser_pdev_obj->active_list);
|
||||
wlan_serialization_destroy_list(ser_pdev_obj,
|
||||
|
@@ -65,8 +65,7 @@ struct wlan_serialization_psoc_priv_obj *wlan_serialization_get_psoc_priv_obj(
|
||||
{
|
||||
struct wlan_serialization_psoc_priv_obj *ser_soc_obj;
|
||||
wlan_psoc_obj_lock(psoc);
|
||||
ser_soc_obj = (struct wlan_serialization_psoc_priv_obj *)
|
||||
wlan_objmgr_psoc_get_comp_private_obj(psoc,
|
||||
ser_soc_obj = wlan_objmgr_psoc_get_comp_private_obj(psoc,
|
||||
WLAN_UMAC_COMP_SERIALIZATION);
|
||||
wlan_psoc_obj_unlock(psoc);
|
||||
|
||||
@@ -78,8 +77,7 @@ struct wlan_serialization_pdev_priv_obj *wlan_serialization_get_pdev_priv_obj(
|
||||
{
|
||||
struct wlan_serialization_pdev_priv_obj *obj;
|
||||
wlan_pdev_obj_lock(pdev);
|
||||
obj = (struct wlan_serialization_pdev_priv_obj *)
|
||||
wlan_objmgr_pdev_get_comp_private_obj(pdev,
|
||||
obj = wlan_objmgr_pdev_get_comp_private_obj(pdev,
|
||||
WLAN_UMAC_COMP_SERIALIZATION);
|
||||
wlan_pdev_obj_unlock(pdev);
|
||||
|
||||
|
Reference in New Issue
Block a user