qcacmn: Make API's generic for moving cmds from pending to active

The movement of serialization non scan commands from pending to active
could be one or multiple commands, and it could be done by looking up
the vdev or pdev serialization non scan queues.

There were separate API's implemented for these movement
and activating the commands, moved to active queue as
part of the movement.

Implement a generic API for the movement of non scan commands from
pending to active, instead of having multiple API's either for either
single or multiple commands and do the lookup either from pdev
or vdev queues based on required checks.

Change-Id: I39864611cf019757e44f35d1e267458d35243cc2
CRs-Fixed: 2327461
This commit is contained in:
Vivek
2018-10-12 15:51:17 +05:30
committed by nshrivas
parent 4d51e9bb73
commit b2af62b892
6 changed files with 148 additions and 378 deletions

View File

@@ -229,92 +229,16 @@ error:
return status; return status;
} }
QDF_STATUS
wlan_serialization_activate_multiple_cmd(
struct wlan_ser_pdev_obj *ser_pdev_obj)
{
struct wlan_serialization_pdev_queue *pdev_queue;
qdf_list_t *active_queue;
QDF_STATUS peek_status = QDF_STATUS_E_FAILURE;
struct wlan_serialization_command_list *active_cmd_list;
uint32_t qsize;
uint32_t vdev_id;
qdf_list_node_t *nnode = NULL;
QDF_STATUS status = QDF_STATUS_SUCCESS;
struct wlan_objmgr_psoc *psoc = NULL;
pdev_queue = &ser_pdev_obj->pdev_q[SER_PDEV_QUEUE_COMP_NON_SCAN];
wlan_serialization_acquire_lock(&pdev_queue->pdev_queue_lock);
active_queue = &pdev_queue->active_list;
qsize = wlan_serialization_list_size(active_queue);
while (qsize--) {
peek_status = wlan_serialization_get_cmd_from_queue(
active_queue, &nnode);
if (peek_status != QDF_STATUS_SUCCESS) {
ser_err("can't peek cmd");
break;
}
active_cmd_list = qdf_container_of(
nnode, struct wlan_serialization_command_list,
pdev_node);
if (!qdf_atomic_test_bit(CMD_MARKED_FOR_ACTIVATION,
&active_cmd_list->cmd_in_use)) {
continue;
}
qdf_atomic_clear_bit(CMD_MARKED_FOR_ACTIVATION,
&active_cmd_list->cmd_in_use);
qdf_atomic_set_bit(CMD_IS_ACTIVE,
&active_cmd_list->cmd_in_use);
vdev_id = wlan_vdev_get_id(active_cmd_list->cmd.vdev);
pdev_queue->vdev_active_cmd_bitmap |= (1 << vdev_id);
if (active_cmd_list->cmd.is_blocking)
pdev_queue->blocking_cmd_active = 1;
/*
* Command is already pushed to active queue.
* Now start the timer.
*/
psoc = wlan_vdev_get_psoc(active_cmd_list->cmd.vdev);
wlan_serialization_find_and_start_timer(psoc,
&active_cmd_list->cmd);
ser_debug("cmd cb: type[%d] id[%d] : reason: %s",
active_cmd_list->cmd.cmd_type,
active_cmd_list->cmd.cmd_id,
"WLAN_SER_CB_ACTIVATE_CMD");
wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
status = active_cmd_list->cmd.cmd_cb(&active_cmd_list->cmd,
WLAN_SER_CB_ACTIVATE_CMD);
if (QDF_IS_STATUS_ERROR(status))
wlan_serialization_dequeue_cmd(&active_cmd_list->cmd,
true);
wlan_serialization_acquire_lock(&pdev_queue->pdev_queue_lock);
}
wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
return status;
}
QDF_STATUS wlan_serialization_activate_cmd( QDF_STATUS wlan_serialization_activate_cmd(
struct wlan_serialization_command_list *cmd_list, struct wlan_serialization_command_list *cmd_list,
struct wlan_ser_pdev_obj *ser_pdev_obj) struct wlan_ser_pdev_obj *ser_pdev_obj)
{ {
QDF_STATUS status = QDF_STATUS_E_FAILURE; QDF_STATUS status = QDF_STATUS_E_FAILURE;
struct wlan_objmgr_psoc *psoc = NULL; struct wlan_objmgr_psoc *psoc = NULL;
struct wlan_serialization_pdev_queue *pdev_queue;
pdev_queue = wlan_serialization_get_pdev_queue_obj(
ser_pdev_obj, cmd_list->cmd.cmd_type);
psoc = wlan_vdev_get_psoc(cmd_list->cmd.vdev); psoc = wlan_vdev_get_psoc(cmd_list->cmd.vdev);
if (!psoc) { if (!psoc) {
@@ -343,11 +267,15 @@ QDF_STATUS wlan_serialization_activate_cmd(
status = cmd_list->cmd.cmd_cb(&cmd_list->cmd, status = cmd_list->cmd.cmd_cb(&cmd_list->cmd,
WLAN_SER_CB_ACTIVATE_CMD); WLAN_SER_CB_ACTIVATE_CMD);
wlan_serialization_acquire_lock(&pdev_queue->pdev_queue_lock);
qdf_atomic_clear_bit(CMD_MARKED_FOR_ACTIVATION, qdf_atomic_clear_bit(CMD_MARKED_FOR_ACTIVATION,
&cmd_list->cmd_in_use); &cmd_list->cmd_in_use);
qdf_atomic_set_bit(CMD_IS_ACTIVE, qdf_atomic_set_bit(CMD_IS_ACTIVE,
&cmd_list->cmd_in_use); &cmd_list->cmd_in_use);
wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
if (QDF_IS_STATUS_ERROR(status)) if (QDF_IS_STATUS_ERROR(status))
wlan_serialization_dequeue_cmd(&cmd_list->cmd, true); wlan_serialization_dequeue_cmd(&cmd_list->cmd, true);
@@ -386,34 +314,22 @@ error:
enum wlan_serialization_status enum wlan_serialization_status
wlan_serialization_move_pending_to_active( wlan_serialization_move_pending_to_active(
enum wlan_serialization_cmd_type cmd_type, enum wlan_serialization_cmd_type cmd_type,
struct wlan_serialization_command_list **pcmd_list,
struct wlan_ser_pdev_obj *ser_pdev_obj, struct wlan_ser_pdev_obj *ser_pdev_obj,
struct wlan_objmgr_vdev *vdev, struct wlan_objmgr_vdev *vdev,
bool blocking_cmd_removed, bool blocking_cmd_removed)
bool blocking_cmd_waiting)
{ {
enum wlan_serialization_status status; enum wlan_serialization_status status;
struct wlan_serialization_pdev_queue *pdev_queue;
if (cmd_type < WLAN_SER_CMD_NONSCAN) { if (cmd_type < WLAN_SER_CMD_NONSCAN) {
status = status =
wlan_ser_move_scan_pending_to_active( wlan_ser_move_scan_pending_to_active(
pcmd_list,
ser_pdev_obj); ser_pdev_obj);
} else { } else {
pdev_queue = status =
&ser_pdev_obj->pdev_q[SER_PDEV_QUEUE_COMP_NON_SCAN]; wlan_ser_move_non_scan_pending_to_active(
if (!blocking_cmd_removed && !blocking_cmd_waiting)
status =
wlan_ser_move_non_scan_pending_to_active(
pcmd_list,
ser_pdev_obj, ser_pdev_obj,
vdev); vdev,
else blocking_cmd_removed);
status =
wlan_ser_move_multiple_non_scan_pending_to_active(
ser_pdev_obj);
} }
return status; return status;
@@ -434,10 +350,8 @@ wlan_serialization_dequeue_cmd(struct wlan_serialization_command *cmd,
struct wlan_ser_pdev_obj *ser_pdev_obj; struct wlan_ser_pdev_obj *ser_pdev_obj;
struct wlan_serialization_command cmd_bkup; struct wlan_serialization_command cmd_bkup;
struct wlan_serialization_command_list *cmd_list; struct wlan_serialization_command_list *cmd_list;
struct wlan_serialization_command_list *pcmd_list;
struct wlan_serialization_pdev_queue *pdev_queue; struct wlan_serialization_pdev_queue *pdev_queue;
bool blocking_cmd_removed = 0; bool blocking_cmd_removed = 0;
bool blocking_cmd_waiting = 0;
ser_enter(); ser_enter();
@@ -490,12 +404,13 @@ wlan_serialization_dequeue_cmd(struct wlan_serialization_command *cmd,
} }
if (active_cmd) { if (active_cmd) {
wlan_serialization_find_and_stop_timer(psoc, &cmd_list->cmd);
if (cmd_list->cmd.cmd_type >= WLAN_SER_CMD_NONSCAN) if (cmd_list->cmd.cmd_type >= WLAN_SER_CMD_NONSCAN)
blocking_cmd_removed = cmd_list->cmd.is_blocking; blocking_cmd_removed = cmd_list->cmd.is_blocking;
} }
if (active_cmd)
wlan_serialization_find_and_stop_timer(psoc, &cmd_list->cmd);
qdf_mem_copy(&cmd_bkup, &cmd_list->cmd, qdf_mem_copy(&cmd_bkup, &cmd_list->cmd,
sizeof(struct wlan_serialization_command)); sizeof(struct wlan_serialization_command));
qdf_mem_zero(&cmd_list->cmd, qdf_mem_zero(&cmd_list->cmd,
@@ -504,32 +419,6 @@ wlan_serialization_dequeue_cmd(struct wlan_serialization_command *cmd,
&pdev_queue->cmd_pool_list, &pdev_queue->cmd_pool_list,
&cmd_list->pdev_node); &cmd_list->pdev_node);
/*
* For NON SCAN commands, the following is possible:
*
* If the remove is for non blocking command,
* and there is no blocking command waiting,
* look at vdev pending queue and
* only one command moves from pending
* to active
*
* If the remove is for blocking comamnd,
* look at the pdev queue and
* either single blocking command
* or multiple non blocking commands moves
* from pending to active
*/
blocking_cmd_waiting = pdev_queue->blocking_cmd_waiting;
if (active_cmd) {
ser_status = wlan_serialization_move_pending_to_active(
cmd_bkup.cmd_type, &pcmd_list, ser_pdev_obj,
cmd_bkup.vdev,
blocking_cmd_removed,
blocking_cmd_waiting);
}
wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock); wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
/* Call cmd cb for remove request*/ /* Call cmd cb for remove request*/
@@ -543,31 +432,13 @@ wlan_serialization_dequeue_cmd(struct wlan_serialization_command *cmd,
WLAN_SER_CB_RELEASE_MEM_CMD); WLAN_SER_CB_RELEASE_MEM_CMD);
} }
/* if (active_cmd) {
* If the remove is for non blocking command, ser_status = wlan_serialization_move_pending_to_active(
* and there is no blocking command waiting, cmd_bkup.cmd_type, ser_pdev_obj,
* look at vdev pending queue and cmd_bkup.vdev,
* only one command moves from pending blocking_cmd_removed);
* to active and gets activated
*/
if (WLAN_SER_CMD_ACTIVE == ser_status && !blocking_cmd_removed &&
!blocking_cmd_waiting) {
ser_debug("cmd type[%d] id[%d] moved from pending to active",
pcmd_list->cmd.cmd_type,
pcmd_list->cmd.cmd_id);
wlan_serialization_activate_cmd(pcmd_list,
ser_pdev_obj);
} else if (ser_status == WLAN_SER_CMD_ACTIVE) {
/* If the remove is for blocking command
* either one or multiple commands can move
* from pending to active and gets activated
*/
wlan_serialization_activate_multiple_cmd(ser_pdev_obj);
} else {
goto exit;
} }
exit:
if (active_cmd) if (active_cmd)
status = WLAN_SER_CMD_IN_ACTIVE_LIST; status = WLAN_SER_CMD_IN_ACTIVE_LIST;
else else
@@ -665,7 +536,7 @@ wlan_serialization_find_and_stop_timer(struct wlan_objmgr_psoc *psoc,
if (!psoc || !cmd) { if (!psoc || !cmd) {
ser_err("invalid param"); ser_err("invalid param");
goto error; goto exit;
} }
if (cmd->cmd_timeout_duration == 0) { if (cmd->cmd_timeout_duration == 0) {
@@ -680,9 +551,7 @@ wlan_serialization_find_and_stop_timer(struct wlan_objmgr_psoc *psoc,
psoc_ser_obj = wlan_serialization_get_psoc_obj(psoc); psoc_ser_obj = wlan_serialization_get_psoc_obj(psoc);
/* /*
* Here cmd_id and cmd_type are used to locate the timer being * Here cmd_id and cmd_type are used to locate the timer being
* associated with command. For scan command, cmd_id is expected to * associated with command.
* be unique and For non-scan command, there should be only one active
* command per pdev
*/ */
wlan_serialization_acquire_lock(&psoc_ser_obj->timer_lock); wlan_serialization_acquire_lock(&psoc_ser_obj->timer_lock);
@@ -708,10 +577,7 @@ wlan_serialization_find_and_stop_timer(struct wlan_objmgr_psoc *psoc,
ser_err("Can't find timer for cmd_type[%d]", cmd->cmd_type); ser_err("Can't find timer for cmd_type[%d]", cmd->cmd_type);
} }
error:
exit: exit:
return status; return status;
} }

View File

@@ -83,17 +83,6 @@ wlan_serialization_activate_cmd(
struct wlan_serialization_command_list *cmd_list, struct wlan_serialization_command_list *cmd_list,
struct wlan_ser_pdev_obj *ser_pdev_obj); struct wlan_ser_pdev_obj *ser_pdev_obj);
/**
* wlan_serialization_activate_multiple_cmd() - Activate multiple cmd in
* active queue
* @ser_pdev_obj: Serialization private pdev object
*
* Return: Status of activation of the command
*/
QDF_STATUS
wlan_serialization_activate_multiple_cmd(
struct wlan_ser_pdev_obj *ser_pdev_obj);
/** /**
* wlan_serialization_move_pending_to_active() - Move a cmd from pending * wlan_serialization_move_pending_to_active() - Move a cmd from pending
* queue to active queue * queue to active queue
@@ -109,11 +98,9 @@ wlan_serialization_activate_multiple_cmd(
enum wlan_serialization_status enum wlan_serialization_status
wlan_serialization_move_pending_to_active( wlan_serialization_move_pending_to_active(
enum wlan_serialization_cmd_type cmd_type, enum wlan_serialization_cmd_type cmd_type,
struct wlan_serialization_command_list **pcmd_list,
struct wlan_ser_pdev_obj *ser_pdev_obj, struct wlan_ser_pdev_obj *ser_pdev_obj,
struct wlan_objmgr_vdev *vdev, struct wlan_objmgr_vdev *vdev,
bool blocking_cmd_removed, bool blocking_cmd_removed);
bool blocking_cmd_waiting);
/** /**
* wlan_serialization_dequeue_cmd() - dequeue the cmd to pending/active Queue * wlan_serialization_dequeue_cmd() - dequeue the cmd to pending/active Queue

View File

@@ -182,106 +182,105 @@ vdev_error:
return status; return status;
} }
static
struct wlan_serialization_command_list*
wlan_serialization_get_next_non_scan_active_cmd(
struct wlan_ser_pdev_obj *ser_pdev_obj,
struct wlan_objmgr_vdev *vdev)
{
qdf_list_t *pending_queue;
qdf_list_node_t *pending_node = NULL;
struct wlan_serialization_command_list *pending_cmd_list = NULL;
struct wlan_ser_vdev_obj *ser_vdev_obj;
struct wlan_serialization_vdev_queue *vdev_q_obj;
QDF_STATUS status;
ser_vdev_obj = wlan_serialization_get_vdev_obj(vdev);
vdev_q_obj = &ser_vdev_obj->vdev_q[SER_VDEV_QUEUE_COMP_NON_SCAN];
pending_queue = &vdev_q_obj->pending_list;
if (wlan_serialization_list_empty(pending_queue)) {
ser_debug("nothing to move from pending to active queue");
goto error;
}
status = wlan_serialization_get_cmd_from_queue(pending_queue,
&pending_node);
if (status != QDF_STATUS_SUCCESS) {
ser_err("can't read cmd from queue");
pending_cmd_list = NULL;
goto error;
}
pending_cmd_list =
qdf_container_of(pending_node,
struct wlan_serialization_command_list,
vdev_node);
if (pending_cmd_list)
ser_debug("next non scan active cmd found from pending queue");
error:
return pending_cmd_list;
}
enum wlan_serialization_status enum wlan_serialization_status
wlan_ser_move_multiple_non_scan_pending_to_active( wlan_ser_move_non_scan_pending_to_active(
struct wlan_ser_pdev_obj *ser_pdev_obj) struct wlan_ser_pdev_obj *ser_pdev_obj,
struct wlan_objmgr_vdev *vdev,
bool blocking_cmd_removed)
{ {
struct wlan_serialization_pdev_queue *pdev_queue; struct wlan_serialization_command_list *pending_cmd_list = NULL;
qdf_list_t *active_queue;
qdf_list_t *pending_queue;
qdf_list_node_t *nnode = NULL;
struct wlan_serialization_command_list *pending_cmd_list;
struct wlan_serialization_command_list *active_cmd_list; struct wlan_serialization_command_list *active_cmd_list;
struct wlan_serialization_command cmd_to_remove; struct wlan_serialization_command cmd_to_remove;
uint32_t blocking_cmd_waiting; enum wlan_serialization_status status = WLAN_SER_CMD_DENIED_UNSPECIFIED;
struct wlan_serialization_pdev_queue *pdev_queue;
struct wlan_serialization_vdev_queue *vdev_queue;
struct wlan_ser_vdev_obj *ser_vdev_obj;
qdf_list_t *pending_queue;
qdf_list_node_t *pending_node = NULL;
QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE;
uint32_t blocking_cmd_waiting = 0;
uint32_t vdev_id; uint32_t vdev_id;
uint32_t qsize; uint32_t qsize;
bool vdev_cmd_active = 0; bool vdev_cmd_active = 0;
bool vdev_queue_lookup = false;
enum wlan_serialization_status status = WLAN_SER_CMD_DENIED_UNSPECIFIED;
QDF_STATUS peek_status = QDF_STATUS_E_FAILURE;
QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE;
pdev_queue = &ser_pdev_obj->pdev_q[SER_PDEV_QUEUE_COMP_NON_SCAN]; pdev_queue = &ser_pdev_obj->pdev_q[SER_PDEV_QUEUE_COMP_NON_SCAN];
active_queue = &pdev_queue->active_list;
pending_queue = &pdev_queue->pending_list; ser_vdev_obj = wlan_serialization_get_vdev_obj(vdev);
vdev_queue = &ser_vdev_obj->vdev_q[SER_VDEV_QUEUE_COMP_NON_SCAN];
ser_enter();
if (!ser_pdev_obj) {
ser_err("Can't find ser_pdev_obj");
goto error;
}
wlan_serialization_acquire_lock(&pdev_queue->pdev_queue_lock);
blocking_cmd_waiting = pdev_queue->blocking_cmd_waiting; blocking_cmd_waiting = pdev_queue->blocking_cmd_waiting;
if (!blocking_cmd_removed && !blocking_cmd_waiting) {
pending_queue = &vdev_queue->pending_list;
vdev_queue_lookup = true;
} else {
pending_queue = &pdev_queue->pending_list;
}
qsize = wlan_serialization_list_size(pending_queue); qsize = wlan_serialization_list_size(pending_queue);
if (!qsize) {
wlan_serialization_release_lock(
&pdev_queue->pdev_queue_lock);
ser_err("Pending Queue is empty");
goto error;
}
while (qsize--) { while (qsize--) {
peek_status = wlan_serialization_get_cmd_from_queue( qdf_status = wlan_serialization_get_cmd_from_queue(
pending_queue, &nnode); pending_queue, &pending_node);
if (peek_status != QDF_STATUS_SUCCESS) { if (qdf_status != QDF_STATUS_SUCCESS) {
ser_err("can't peek cmd"); ser_err("can't peek cmd");
break; break;
} }
pending_cmd_list = qdf_container_of( if (vdev_queue_lookup) {
nnode, struct wlan_serialization_command_list, pending_cmd_list =
qdf_container_of(
pending_node,
struct wlan_serialization_command_list,
vdev_node);
} else {
pending_cmd_list =
qdf_container_of(
pending_node,
struct wlan_serialization_command_list,
pdev_node); pdev_node);
}
if (!pending_cmd_list) { if (!pending_cmd_list) {
wlan_serialization_release_lock(
&pdev_queue->pdev_queue_lock);
ser_debug( ser_debug(
"non scan cmd cannot move from pending to active"); "non scan cmd cannot move frm pendin to actv");
goto error; goto error;
} }
if (pending_cmd_list->cmd.is_blocking && if (!vdev_queue_lookup) {
pdev_queue->vdev_active_cmd_bitmap) { if (pending_cmd_list->cmd.is_blocking &&
break; pdev_queue->vdev_active_cmd_bitmap) {
break;
}
vdev_id = wlan_vdev_get_id(pending_cmd_list->cmd.vdev);
vdev_cmd_active =
pdev_queue->vdev_active_cmd_bitmap &
(1 << vdev_id);
if (vdev_cmd_active)
continue;
} }
vdev_id = wlan_vdev_get_id(pending_cmd_list->cmd.vdev);
vdev_cmd_active =
pdev_queue->vdev_active_cmd_bitmap & (1 << vdev_id);
if (vdev_cmd_active)
continue;
status = WLAN_SER_CMD_ACTIVE;
qdf_mem_copy(&cmd_to_remove, &pending_cmd_list->cmd, qdf_mem_copy(&cmd_to_remove, &pending_cmd_list->cmd,
sizeof(struct wlan_serialization_command)); sizeof(struct wlan_serialization_command));
@@ -291,6 +290,8 @@ wlan_ser_move_multiple_non_scan_pending_to_active(
false); false);
if (QDF_STATUS_SUCCESS != qdf_status) { if (QDF_STATUS_SUCCESS != qdf_status) {
wlan_serialization_release_lock(
&pdev_queue->pdev_queue_lock);
ser_err("Can't remove cmd from pendingQ id-%d type-%d", ser_err("Can't remove cmd from pendingQ id-%d type-%d",
pending_cmd_list->cmd.cmd_id, pending_cmd_list->cmd.cmd_id,
pending_cmd_list->cmd.cmd_type); pending_cmd_list->cmd.cmd_type);
@@ -305,6 +306,8 @@ wlan_ser_move_multiple_non_scan_pending_to_active(
ser_pdev_obj, active_cmd_list, true); ser_pdev_obj, active_cmd_list, true);
if (WLAN_SER_CMD_ACTIVE != status) { if (WLAN_SER_CMD_ACTIVE != status) {
wlan_serialization_release_lock(
&pdev_queue->pdev_queue_lock);
ser_err("Can't move cmd to activeQ id-%d type-%d", ser_err("Can't move cmd to activeQ id-%d type-%d",
pending_cmd_list->cmd.cmd_id, pending_cmd_list->cmd.cmd_id,
pending_cmd_list->cmd.cmd_type); pending_cmd_list->cmd.cmd_type);
@@ -318,86 +321,24 @@ wlan_ser_move_multiple_non_scan_pending_to_active(
qdf_atomic_set_bit(CMD_MARKED_FOR_ACTIVATION, qdf_atomic_set_bit(CMD_MARKED_FOR_ACTIVATION,
&active_cmd_list->cmd_in_use); &active_cmd_list->cmd_in_use);
nnode = NULL; wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
if (active_cmd_list->cmd.is_blocking)
pdev_queue->blocking_cmd_waiting--;
if (pending_cmd_list->cmd.is_blocking) wlan_serialization_activate_cmd(active_cmd_list, ser_pdev_obj);
wlan_serialization_acquire_lock(&pdev_queue->pdev_queue_lock);
if (vdev_queue_lookup)
break; break;
pending_node = NULL;
if (active_cmd_list->cmd.is_blocking) {
pdev_queue->blocking_cmd_waiting--;
break;
}
} }
error: wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
return status;
}
enum wlan_serialization_status
wlan_ser_move_non_scan_pending_to_active(
struct wlan_serialization_command_list **pcmd_list,
struct wlan_ser_pdev_obj *ser_pdev_obj,
struct wlan_objmgr_vdev *vdev)
{
struct wlan_serialization_command_list *pending_cmd_list;
struct wlan_serialization_command_list *active_cmd_list;
struct wlan_serialization_command cmd_to_remove;
enum wlan_serialization_status status = WLAN_SER_CMD_DENIED_UNSPECIFIED;
QDF_STATUS qdf_status;
struct wlan_serialization_pdev_queue *pdev_queue;
pdev_queue = &ser_pdev_obj->pdev_q[SER_PDEV_QUEUE_COMP_NON_SCAN];
ser_enter();
if (!ser_pdev_obj) {
ser_err("Can't find ser_pdev_obj");
goto error;
}
pending_cmd_list =
wlan_serialization_get_next_non_scan_active_cmd(
ser_pdev_obj,
vdev);
if (!pending_cmd_list) {
ser_debug("non scan cmd cannot move from pending to active");
goto error;
}
qdf_mem_copy(&cmd_to_remove, &pending_cmd_list->cmd,
sizeof(struct wlan_serialization_command));
qdf_status = wlan_ser_remove_non_scan_cmd(ser_pdev_obj,
&pending_cmd_list,
&cmd_to_remove, false);
if (QDF_STATUS_SUCCESS != qdf_status) {
ser_err("Can't remove cmd from pendingQ id-%d type-%d",
pending_cmd_list->cmd.cmd_id,
pending_cmd_list->cmd.cmd_type);
QDF_ASSERT(0);
status = WLAN_SER_CMD_DENIED_UNSPECIFIED;
goto error;
}
active_cmd_list = pending_cmd_list;
status = wlan_ser_add_non_scan_cmd(
ser_pdev_obj, active_cmd_list, true);
if (WLAN_SER_CMD_ACTIVE != status) {
ser_err("Can't move cmd to activeQ id-%d type-%d",
pending_cmd_list->cmd.cmd_id,
pending_cmd_list->cmd.cmd_type);
wlan_serialization_insert_back(
&pdev_queue->cmd_pool_list,
&active_cmd_list->pdev_node);
goto error;
}
qdf_atomic_set_bit(CMD_MARKED_FOR_ACTIVATION,
&active_cmd_list->cmd_in_use);
*pcmd_list = active_cmd_list;
error: error:
ser_exit(); ser_exit();
return status; return status;

View File

@@ -73,20 +73,9 @@ wlan_ser_add_non_scan_cmd(
*/ */
enum wlan_serialization_status enum wlan_serialization_status
wlan_ser_move_non_scan_pending_to_active( wlan_ser_move_non_scan_pending_to_active(
struct wlan_serialization_command_list **pcmd_list,
struct wlan_ser_pdev_obj *ser_pdev_obj, struct wlan_ser_pdev_obj *ser_pdev_obj,
struct wlan_objmgr_vdev *vdev); struct wlan_objmgr_vdev *vdev,
bool blocking_cmd_removed);
/**
* wlan_ser_move_multiple_non_scan_pending_to_active() - Move multiple non-scan
* cmd from pending queue to active queue
* @ser_pdev_obj: Serialization private pdev object
*
* Return: Status of the cmd's serialization request
*/
enum wlan_serialization_status
wlan_ser_move_multiple_non_scan_pending_to_active(
struct wlan_ser_pdev_obj *ser_pdev_obj);
/** /**
* wlan_ser_remove_non_scan_cmd() - Remove a non-scan cmd from the given queue * wlan_ser_remove_non_scan_cmd() - Remove a non-scan cmd from the given queue

View File

@@ -317,28 +317,41 @@ error:
return status; return status;
} }
static struct wlan_serialization_command_list* enum wlan_serialization_status wlan_ser_move_scan_pending_to_active(
wlan_serialization_get_next_scan_active_cmd(
struct wlan_ser_pdev_obj *ser_pdev_obj) struct wlan_ser_pdev_obj *ser_pdev_obj)
{ {
struct wlan_serialization_command_list *pending_cmd_list = NULL;
struct wlan_serialization_command_list *active_cmd_list;
struct wlan_serialization_command cmd_to_remove;
enum wlan_serialization_status status = WLAN_SER_CMD_DENIED_UNSPECIFIED;
QDF_STATUS qdf_status;
struct wlan_serialization_pdev_queue *pdev_queue;
qdf_list_t *pending_queue; qdf_list_t *pending_queue;
qdf_list_node_t *pending_node = NULL; qdf_list_node_t *pending_node = NULL;
struct wlan_serialization_command_list *pending_cmd_list = NULL;
struct wlan_serialization_pdev_queue *pdev_q;
QDF_STATUS status;
pdev_q = &ser_pdev_obj->pdev_q[SER_PDEV_QUEUE_COMP_SCAN]; pdev_queue = &ser_pdev_obj->pdev_q[SER_PDEV_QUEUE_COMP_SCAN];
pending_queue = &pdev_q->pending_list; ser_enter();
if (!ser_pdev_obj) {
ser_err("Can't find ser_pdev_obj");
goto error;
}
wlan_serialization_acquire_lock(&pdev_queue->pdev_queue_lock);
pending_queue = &pdev_queue->pending_list;
if (wlan_serialization_list_empty(pending_queue)) { if (wlan_serialization_list_empty(pending_queue)) {
wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
ser_debug("nothing to move from pend to active que"); ser_debug("nothing to move from pend to active que");
goto error; goto error;
} }
status = wlan_serialization_peek_front(pending_queue, qdf_status = wlan_serialization_peek_front(pending_queue,
&pending_node); &pending_node);
if (QDF_STATUS_SUCCESS != status) { if (QDF_STATUS_SUCCESS != qdf_status) {
wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
ser_err("can't read from pending queue"); ser_err("can't read from pending queue");
goto error; goto error;
} }
@@ -348,37 +361,11 @@ wlan_serialization_get_next_scan_active_cmd(
struct wlan_serialization_command_list, struct wlan_serialization_command_list,
pdev_node); pdev_node);
ser_debug("next active scan cmd found from pending queue"); if (!pending_cmd_list) {
error: wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
return pending_cmd_list;
}
enum wlan_serialization_status wlan_ser_move_scan_pending_to_active(
struct wlan_serialization_command_list **pcmd_list,
struct wlan_ser_pdev_obj *ser_pdev_obj)
{
struct wlan_serialization_command_list *pending_cmd_list;
struct wlan_serialization_command_list *active_cmd_list;
struct wlan_serialization_command cmd_to_remove;
enum wlan_serialization_status status = WLAN_SER_CMD_DENIED_UNSPECIFIED;
QDF_STATUS qdf_status;
struct wlan_serialization_pdev_queue *pdev_q;
pdev_q = &ser_pdev_obj->pdev_q[SER_PDEV_QUEUE_COMP_SCAN];
ser_enter();
if (!ser_pdev_obj) {
ser_err("Can't find ser_pdev_obj");
goto error; goto error;
} }
pending_cmd_list =
wlan_serialization_get_next_scan_active_cmd(ser_pdev_obj);
if (!pending_cmd_list)
goto error;
qdf_mem_copy(&cmd_to_remove, &pending_cmd_list->cmd, qdf_mem_copy(&cmd_to_remove, &pending_cmd_list->cmd,
sizeof(struct wlan_serialization_command)); sizeof(struct wlan_serialization_command));
@@ -388,6 +375,7 @@ enum wlan_serialization_status wlan_ser_move_scan_pending_to_active(
&cmd_to_remove, false); &cmd_to_remove, false);
if (QDF_STATUS_SUCCESS != qdf_status) { if (QDF_STATUS_SUCCESS != qdf_status) {
wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
ser_err("Can't remove cmd from pendingQ id-%d type-%d", ser_err("Can't remove cmd from pendingQ id-%d type-%d",
pending_cmd_list->cmd.cmd_id, pending_cmd_list->cmd.cmd_id,
pending_cmd_list->cmd.cmd_type); pending_cmd_list->cmd.cmd_type);
@@ -403,9 +391,9 @@ enum wlan_serialization_status wlan_ser_move_scan_pending_to_active(
if (WLAN_SER_CMD_ACTIVE != status) { if (WLAN_SER_CMD_ACTIVE != status) {
wlan_serialization_insert_back( wlan_serialization_insert_back(
&pdev_q->cmd_pool_list, &pdev_queue->cmd_pool_list,
&active_cmd_list->pdev_node); &active_cmd_list->pdev_node);
wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
status = WLAN_SER_CMD_DENIED_UNSPECIFIED; status = WLAN_SER_CMD_DENIED_UNSPECIFIED;
ser_err("Can't add cmd to activeQ id-%d type-%d", ser_err("Can't add cmd to activeQ id-%d type-%d",
active_cmd_list->cmd.cmd_id, active_cmd_list->cmd.cmd_id,
@@ -417,8 +405,9 @@ enum wlan_serialization_status wlan_ser_move_scan_pending_to_active(
qdf_atomic_set_bit(CMD_MARKED_FOR_ACTIVATION, qdf_atomic_set_bit(CMD_MARKED_FOR_ACTIVATION,
&active_cmd_list->cmd_in_use); &active_cmd_list->cmd_in_use);
*pcmd_list = active_cmd_list; wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
wlan_serialization_activate_cmd(active_cmd_list, ser_pdev_obj);
error: error:
ser_exit(); ser_exit();
return status; return status;

View File

@@ -134,14 +134,12 @@ wlan_ser_cancel_scan_cmd(struct wlan_ser_pdev_obj *ser_obj,
/** /**
* wlan_ser_move_scan_pending_to_active() - Move a scan cmd from pending * wlan_ser_move_scan_pending_to_active() - Move a scan cmd from pending
* queue to active queue * queue to active queue
* @pcmd_list: Pointer to command list containing the command
* @ser_pdev_obj: Serialization private pdev object * @ser_pdev_obj: Serialization private pdev object
* *
* Return: Status of the cmd's serialization request * Return: Status of the cmd's serialization request
*/ */
enum wlan_serialization_status enum wlan_serialization_status
wlan_ser_move_scan_pending_to_active( wlan_ser_move_scan_pending_to_active(
struct wlan_serialization_command_list **pcmd_list,
struct wlan_ser_pdev_obj *ser_pdev_obj); struct wlan_ser_pdev_obj *ser_pdev_obj);
#endif #endif