From 4aec1d63a8d676a7781901371ea24f8a46e781e6 Mon Sep 17 00:00:00 2001 From: Varun Reddy Yeturu Date: Thu, 7 Dec 2017 14:46:38 -0800 Subject: [PATCH] qcacmn: Fetch the scan cmd in active list using scan ID Loop through the active scan commands in the serialization queue and find a match based on the scan ID provided. The API wlan_serialization_get_scan_cmd_using_scan_id already exists to achieve this. Move this API to wlan_serialization_api.c so that it can be utilized by everyone as a public API. Change-Id: If7250e1c994c728cd89f5d76db0023967027f12a CRs-Fixed: 2169467 --- .../inc/wlan_serialization_api.h | 23 ++++++- .../inc/wlan_serialization_legacy_api.h | 22 +----- .../src/wlan_serialization_api.c | 68 ++++++++++++++++++- .../src/wlan_serialization_legacy_api.c | 68 +------------------ 4 files changed, 91 insertions(+), 90 deletions(-) diff --git a/umac/cmn_services/serialization/inc/wlan_serialization_api.h b/umac/cmn_services/serialization/inc/wlan_serialization_api.h index b13913c9eaa6..b02b4f4b7dd0 100644 --- a/umac/cmn_services/serialization/inc/wlan_serialization_api.h +++ b/umac/cmn_services/serialization/inc/wlan_serialization_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -486,4 +486,25 @@ bool wlan_serialization_is_cmd_present_in_pending_queue( bool wlan_serialization_is_cmd_present_in_active_queue( struct wlan_objmgr_psoc *psoc, struct wlan_serialization_command *cmd); + +/** + * wlan_serialization_get_scan_cmd_using_scan_id() - Return command which + * matches vdev_id and scan_id + * @psoc: pointer to soc + * @vdev_id: vdev id to pull vdev object + * @scan_id: scan id to match + * @is_scan_cmd_from_active_queue: to indicate active or pending queue + * + * This API fetches vdev/pdev object based on vdev_id, loops through scan + * command queue and find the command which matches scan id as well as vdev + * object. + * + * Return: pointer to serialization command + */ +struct wlan_serialization_command* +wlan_serialization_get_scan_cmd_using_scan_id( + struct wlan_objmgr_psoc *psoc, + uint8_t vdev_id, uint16_t scan_id, + uint8_t is_scan_cmd_from_active_queue); + #endif diff --git a/umac/cmn_services/serialization/inc/wlan_serialization_legacy_api.h b/umac/cmn_services/serialization/inc/wlan_serialization_legacy_api.h index 2db5c4e43b08..959865f2be03 100644 --- a/umac/cmn_services/serialization/inc/wlan_serialization_legacy_api.h +++ b/umac/cmn_services/serialization/inc/wlan_serialization_legacy_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -26,26 +26,6 @@ #include "wlan_serialization_api.h" -/** - * wlan_serialization_get_scan_cmd_using_scan_id() - Return command which - * matches vdev_id and scan_id - * @psoc: pointer to soc - * @vdev_id: vdev id to pull vdev object - * @scan_id: scan id to match - * @is_scan_cmd_from_active_queue: to indicate active or pending queue - * - * This API fetches vdev/pdev object based on vdev_id, loops through scan - * command queue and find the command which matches scan id as well as vdev - * object. - * - * Return: pointer to serialization command - */ -struct wlan_serialization_command* -wlan_serialization_get_scan_cmd_using_scan_id( - struct wlan_objmgr_psoc *psoc, - uint8_t vdev_id, uint16_t scan_id, - uint8_t is_scan_cmd_from_active_queue); - /** * wlan_serialization_peek_head_pending_cmd_using_psoc() - Return command from * scan or non-scan pending queue based on flag diff --git a/umac/cmn_services/serialization/src/wlan_serialization_api.c b/umac/cmn_services/serialization/src/wlan_serialization_api.c index 7f622cf86c9e..5fcaa338c2ef 100644 --- a/umac/cmn_services/serialization/src/wlan_serialization_api.c +++ b/umac/cmn_services/serialization/src/wlan_serialization_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -314,3 +314,69 @@ wlan_serialization_pdev_scan_status(struct wlan_objmgr_pdev *pdev) return wlan_serialization_is_cmd_in_active_pending( cmd_in_active, cmd_in_pending); } + +struct wlan_serialization_command* +wlan_serialization_get_scan_cmd_using_scan_id( + struct wlan_objmgr_psoc *psoc, + uint8_t vdev_id, uint16_t scan_id, + uint8_t is_scan_cmd_from_active_queue) +{ + uint32_t qlen; + struct wlan_objmgr_vdev *vdev; + struct wlan_objmgr_pdev *pdev; + struct wlan_serialization_pdev_priv_obj *ser_pdev_obj; + struct wlan_serialization_command_list *cmd_list = NULL; + struct wlan_serialization_command *cmd = NULL; + qdf_list_node_t *nnode = NULL; + qdf_list_t *queue; + + if (!psoc) { + serialization_err("invalid psoc"); + return cmd; + } + vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id, + WLAN_SERIALIZATION_ID); + if (!vdev) { + serialization_err("invalid vdev"); + return cmd; + } + + pdev = wlan_vdev_get_pdev(vdev); + if (!pdev) { + serialization_err("invalid pdev"); + goto release_vdev_ref; + } + + ser_pdev_obj = wlan_serialization_get_pdev_priv_obj(pdev); + if (!ser_pdev_obj) { + serialization_err("invalid ser_pdev_obj"); + goto release_vdev_ref; + } + if (is_scan_cmd_from_active_queue) + queue = &ser_pdev_obj->active_scan_list; + else + queue = &ser_pdev_obj->pending_scan_list; + qlen = qdf_list_size(queue); + if (!qlen) { + serialization_err("Empty Queue"); + goto release_vdev_ref; + } + while (qlen--) { + if (QDF_STATUS_SUCCESS != wlan_serialization_get_cmd_from_queue( + queue, &nnode)) { + serialization_err("unsuccessful attempt"); + break; + } + cmd_list = qdf_container_of(nnode, + struct wlan_serialization_command_list, node); + if ((cmd_list->cmd.cmd_id == scan_id) && + (cmd_list->cmd.vdev == vdev)) { + serialization_debug("cmd_id[%d] matched", scan_id); + cmd = &cmd_list->cmd; + break; + } + } +release_vdev_ref: + wlan_objmgr_vdev_release_ref(vdev, WLAN_SERIALIZATION_ID); + return cmd; +} diff --git a/umac/cmn_services/serialization/src/wlan_serialization_legacy_api.c b/umac/cmn_services/serialization/src/wlan_serialization_legacy_api.c index 8eb0c0536c26..a97e42e1a513 100644 --- a/umac/cmn_services/serialization/src/wlan_serialization_legacy_api.c +++ b/umac/cmn_services/serialization/src/wlan_serialization_legacy_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -308,72 +308,6 @@ wlan_serialization_get_pending_list_next_node_using_psoc( return wlan_serialization_get_list_next_node(queue, prev_cmd); } -struct wlan_serialization_command* -wlan_serialization_get_scan_cmd_using_scan_id( - struct wlan_objmgr_psoc *psoc, - uint8_t vdev_id, uint16_t scan_id, - uint8_t is_scan_cmd_from_active_queue) -{ - uint32_t qlen; - struct wlan_objmgr_vdev *vdev; - struct wlan_objmgr_pdev *pdev; - struct wlan_serialization_pdev_priv_obj *ser_pdev_obj; - struct wlan_serialization_command_list *cmd_list = NULL; - struct wlan_serialization_command *cmd = NULL; - qdf_list_node_t *nnode = NULL; - qdf_list_t *queue; - - if (!psoc) { - serialization_err("invalid psoc"); - return cmd; - } - vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id, - WLAN_SERIALIZATION_ID); - if (!vdev) { - serialization_err("invalid vdev"); - return cmd; - } - - pdev = wlan_vdev_get_pdev(vdev); - if (!pdev) { - serialization_err("invalid pdev"); - goto release_vdev_ref; - } - - ser_pdev_obj = wlan_serialization_get_pdev_priv_obj(pdev); - if (!ser_pdev_obj) { - serialization_err("invalid ser_pdev_obj"); - goto release_vdev_ref; - } - if (is_scan_cmd_from_active_queue) - queue = &ser_pdev_obj->active_scan_list; - else - queue = &ser_pdev_obj->pending_scan_list; - qlen = qdf_list_size(queue); - if (!qlen) { - serialization_err("Empty Queue"); - goto release_vdev_ref; - } - while (qlen--) { - if (QDF_STATUS_SUCCESS != wlan_serialization_get_cmd_from_queue( - queue, &nnode)) { - serialization_err("unsuccessful attempt"); - break; - } - cmd_list = qdf_container_of(nnode, - struct wlan_serialization_command_list, node); - if ((cmd_list->cmd.cmd_id == scan_id) && - (cmd_list->cmd.vdev == vdev)) { - serialization_debug("cmd_id[%d] matched", scan_id); - cmd = &cmd_list->cmd; - break; - } - } -release_vdev_ref: - wlan_objmgr_vdev_release_ref(vdev, WLAN_SERIALIZATION_ID); - return cmd; -} - void wlan_serialization_legacy_init_callback(void) { ser_legacy_cb.serialization_purge_cmd_list =