qcacmn: use spinlock before iterating

Before iterating in pending list, use spinlock to avoid possible
race condition.
Remove function wlan_serialization_get_active_list_next_node_using_psoc
as it not being used and is part of legacy flow which is suppose to be
removed eventually.

Change-Id: I9e7cbd9db8b5a1c45915bf5291cd5011c276d0e2
CRs-Fixed: 2573425
Цей коміт міститься в:
Rachit Kankane
2019-11-25 13:30:25 +05:30
зафіксовано nshrivas
джерело e131d31b8b
коміт 98ec4d132b
2 змінених файлів з 11 додано та 51 видалено

Переглянути файл

@@ -79,24 +79,6 @@ wlan_serialization_get_pending_list_next_node_using_psoc(
struct wlan_objmgr_psoc *psoc,
struct wlan_serialization_command *prev_cmd,
uint8_t is_cmd_for_pending_scan_queue);
/**
* wlan_serialization_get_active_list_next_node_using_psoc() - Return next
* scan or non-scan pending command from queue
* @psoc: pointer to psoc
* @prev_cmd: previous command given by caller, find next command after this
* @is_cmd_for_active_scan_queue: to find from active scan or non-scan queue
*
* This API finds the first active pdev, and loops through scan or non-scan
* pending queue (based on is_cmd_from_pending_scan_queue flag) and fetches
* next pending command after prev_cmd
*
* Return: pointer to serialization command
*/
struct wlan_serialization_command*
wlan_serialization_get_active_list_next_node_using_psoc(
struct wlan_objmgr_psoc *psoc,
struct wlan_serialization_command *prev_cmd,
uint8_t is_cmd_for_active_scan_queue);
/**
* wlan_serialization_get_active_list_count() - Return Active list count
* @psoc: pointer to soc

Переглянути файл

@@ -207,12 +207,15 @@ wlan_serialization_peek_head_pending_cmd_using_psoc(
goto end;
}
wlan_serialization_acquire_lock(&pdev_queue->pdev_queue_lock);
if (QDF_STATUS_SUCCESS != wlan_serialization_get_cmd_from_queue(
queue,
&nnode)) {
wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
ser_err("Can't get command from queue");
goto end;
}
wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
cmd_list = qdf_container_of(nnode,
struct wlan_serialization_command_list, pdev_node);
cmd = &cmd_list->cmd;
@@ -283,37 +286,6 @@ wlan_serialization_get_list_next_node(qdf_list_t *queue,
return ret_cmd;
}
struct wlan_serialization_command*
wlan_serialization_get_active_list_next_node_using_psoc(
struct wlan_objmgr_psoc *psoc,
struct wlan_serialization_command *prev_cmd,
uint8_t is_cmd_for_active_scan_queue)
{
struct wlan_ser_pdev_obj *ser_pdev_obj;
qdf_list_t *queue;
struct wlan_serialization_pdev_queue *pdev_queue;
if (!prev_cmd) {
ser_err("invalid prev_cmd");
return NULL;
}
ser_pdev_obj = wlan_serialization_get_pdev_priv_obj_using_psoc(psoc);
if (!ser_pdev_obj) {
ser_err("invalid ser_pdev_obj");
return NULL;
}
if (is_cmd_for_active_scan_queue)
pdev_queue = &ser_pdev_obj->pdev_q[SER_PDEV_QUEUE_COMP_SCAN];
else
pdev_queue =
&ser_pdev_obj->pdev_q[SER_PDEV_QUEUE_COMP_NON_SCAN];
queue = &pdev_queue->active_list;
return wlan_serialization_get_list_next_node(queue, prev_cmd,
ser_pdev_obj);
}
struct wlan_serialization_command*
wlan_serialization_get_pending_list_next_node_using_psoc(
struct wlan_objmgr_psoc *psoc,
@@ -323,6 +295,7 @@ wlan_serialization_get_pending_list_next_node_using_psoc(
struct wlan_ser_pdev_obj *ser_pdev_obj;
qdf_list_t *queue;
struct wlan_serialization_pdev_queue *pdev_queue;
struct wlan_serialization_command *cmd;
if (!prev_cmd) {
ser_err("invalid prev_cmd");
@@ -340,6 +313,11 @@ wlan_serialization_get_pending_list_next_node_using_psoc(
pdev_queue =
&ser_pdev_obj->pdev_q[SER_PDEV_QUEUE_COMP_NON_SCAN];
queue = &pdev_queue->pending_list;
return wlan_serialization_get_list_next_node(queue, prev_cmd,
ser_pdev_obj);
wlan_serialization_acquire_lock(&pdev_queue->pdev_queue_lock);
cmd = wlan_serialization_get_list_next_node(queue, prev_cmd,
ser_pdev_obj);
wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
return cmd;
}