qcacmn: Move legacy serialization flush cmds to common api
Move legacy serialization flush cmds to common api
Change-Id: I7a1a46a615c90e112c91efc4aec1461023b6ad5c
CRs-Fixed: 2452518
diff --git a/umac/cmn_services/serialization/inc/wlan_serialization_api.h b/umac/cmn_services/serialization/inc/wlan_serialization_api.h
index a7e19d0..4d592e0 100644
--- a/umac/cmn_services/serialization/inc/wlan_serialization_api.h
+++ b/umac/cmn_services/serialization/inc/wlan_serialization_api.h
@@ -620,4 +620,28 @@
* Return: void
*/
void wlan_serialization_purge_all_cmd(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * wlan_serialization_purge_all_pending_cmd_by_vdev_id() - Purge all pending
+ * scan and non scan commands for vdev id
+ * @pdev: pointer to pdev
+ * @vdev_id: vdev_id variable
+ *
+ * Return: none
+ */
+void wlan_serialization_purge_all_pending_cmd_by_vdev_id(
+ struct wlan_objmgr_pdev *pdev,
+ uint8_t vdev_id);
+
+/**
+ * wlan_serialization_purge_all_scan_cmd_by_vdev_id() - Purge all pending/active
+ * scan commands for vdev id
+ * @pdev: pointer to pdev
+ * @vdev_id: vdev_id variable
+ *
+ * Return: none
+ */
+void wlan_serialization_purge_all_scan_cmd_by_vdev_id(
+ struct wlan_objmgr_pdev *pdev,
+ uint8_t vdev_id);
#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 051f260..71fd176 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-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2019 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
@@ -123,74 +123,4 @@
uint32_t wlan_serialization_get_pending_list_count(
struct wlan_objmgr_psoc *psoc,
uint8_t is_cmd_from_pending_scan_queue);
-
-/**
- * wlan_serialization_purge_cmd_list_by_vdev_id() - Purge given list
- * @psoc: pointer to soc
- * @vdev_id: vdev_id variable
- * @purge_scan_active_queue: whether to purge active scan queue
- * @purge_scan_pending_queue: whether to purge pending scan queue
- * @purge_nonscan_active_queue: whether to purge active nonscan queue
- * @purge_nonscan_pending_queue: whether to purge pending nonscan queue
- * @purge_all_queues: whether to purge all queues.
- *
- * This API will purge queue based given flags and vdev_id. If vdev
- * is invalid then it will return immediately. If correct vdev_id is given then
- * it will purge the queues per vdev.
- *
- * Example:
- * 1) If you want to purge scan active queue for particular vdev then
- * provide correct vdev_id value and purge_scan_active_queue flag set to
- * TRUE and rest of the flags set to false.
- * 2) If you want to purge all queues for particular vdev then provide
- * correct vdev_id value and set purge_all_queues flag set to TRUE and rest
- * of the flags set to false.
- * 3) If you want to purge active scan and active non-scan queues to be flushed
- * then set purge_scan_active_queue and purge_nonscan_active_queue flags to
- * be set TRUE and rest of the flags to be FALSE
- *
- * Return: none
- */
-void wlan_serialization_purge_cmd_list_by_vdev_id(struct wlan_objmgr_psoc *psoc,
- uint8_t vdev_id,
- bool purge_scan_active_queue,
- bool purge_scan_pending_queue,
- bool purge_nonscan_active_queue,
- bool purge_nonscan_pending_queue,
- bool purge_all_queues);
-/**
- * wlan_serialization_purge_cmd_list() - Purge given list
- * @psoc: pointer to soc
- * @vdev: pointer to vdev object
- * @purge_scan_active_queue: whether to purge active scan queue
- * @purge_scan_pending_queue: whether to purge pending scan queue
- * @purge_nonscan_active_queue: whether to purge active nonscan queue
- * @purge_nonscan_pending_queue: whether to purge pending nonscan queue
- * @purge_all_queues: whether to purge all queues.
- *
- * This API will purge queue based given flags and vdev object. If vdev
- * is null then it will purge the queues per pdev by default.
- * If vdev is given then it will purge the queues per vdev.
- *
- * Example:
- * 1) If you want to purge scan active queue for particular vdev then
- * provide correct vdev object and purge_scan_active_queue flag set to
- * TRUE and rest of the flags set to false.
- * 2) If you want to purge all queues for particular vdev then provide
- * correct vdev object value & set purge_all_queues flag set to TRUE and rest
- * of the flags set to false.
- * 3) If you want to purge active scan and active non-scan queues to be flushed
- * for pdev then set purge_scan_active_queue and purge_nonscan_active_queue
- * flags to be set TRUE and rest of the flags to be FALSE with vdev object
- * passed as NULL.
- *
- * Return: none
- */
-void wlan_serialization_purge_cmd_list(struct wlan_objmgr_psoc *psoc,
- struct wlan_objmgr_vdev *vdev,
- bool purge_scan_active_queue,
- bool purge_scan_pending_queue,
- bool purge_nonscan_active_queue,
- bool purge_nonscan_pending_queue,
- bool purge_all_queues);
#endif
diff --git a/umac/cmn_services/serialization/src/wlan_serialization_api.c b/umac/cmn_services/serialization/src/wlan_serialization_api.c
index bebc087..77481da 100644
--- a/umac/cmn_services/serialization/src/wlan_serialization_api.c
+++ b/umac/cmn_services/serialization/src/wlan_serialization_api.c
@@ -822,3 +822,69 @@
wlan_ser_purge_pdev_cmd_cb, NULL, 1,
WLAN_SERIALIZATION_ID);
}
+
+void wlan_serialization_purge_all_pending_cmd_by_vdev_id(
+ struct wlan_objmgr_pdev *pdev,
+ uint8_t vdev_id)
+{
+ struct wlan_objmgr_vdev *vdev;
+ struct wlan_ser_pdev_obj *ser_pdev_obj;
+
+ if (!pdev) {
+ ser_err("Invalid pdev");
+ return;
+ }
+
+ ser_pdev_obj = wlan_serialization_get_pdev_obj(pdev);
+ if (!ser_pdev_obj) {
+ ser_err("invalid ser_pdev_obj");
+ return;
+ }
+
+ vdev = wlan_objmgr_get_vdev_by_id_from_pdev(pdev, vdev_id,
+ WLAN_SERIALIZATION_ID);
+ if (!vdev) {
+ ser_err("Invalid vdev");
+ return;
+ }
+
+ wlan_ser_cancel_scan_cmd(ser_pdev_obj, pdev, vdev, NULL,
+ WLAN_SER_CMD_SCAN, false);
+ wlan_ser_cancel_non_scan_cmd(ser_pdev_obj, pdev, vdev, NULL,
+ WLAN_SER_CMD_NONSCAN, false);
+
+ wlan_objmgr_vdev_release_ref(vdev, WLAN_SERIALIZATION_ID);
+}
+
+void wlan_serialization_purge_all_scan_cmd_by_vdev_id(
+ struct wlan_objmgr_pdev *pdev,
+ uint8_t vdev_id)
+{
+ struct wlan_objmgr_vdev *vdev;
+ struct wlan_ser_pdev_obj *ser_pdev_obj;
+
+ if (!pdev) {
+ ser_err("Invalid pdev");
+ return;
+ }
+
+ ser_pdev_obj = wlan_serialization_get_pdev_obj(pdev);
+ if (!ser_pdev_obj) {
+ ser_err("invalid ser_pdev_obj");
+ return;
+ }
+
+ vdev = wlan_objmgr_get_vdev_by_id_from_pdev(pdev, vdev_id,
+ WLAN_SERIALIZATION_ID);
+ if (!vdev) {
+ ser_err("Invalid vdev");
+ return;
+ }
+
+ wlan_ser_cancel_scan_cmd(ser_pdev_obj, pdev, vdev, NULL,
+ WLAN_SER_CMD_SCAN, false);
+ wlan_ser_cancel_scan_cmd(ser_pdev_obj, pdev, vdev, NULL,
+ WLAN_SER_CMD_SCAN, true);
+
+ wlan_objmgr_vdev_release_ref(vdev, WLAN_SERIALIZATION_ID);
+}
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 328126f..7e17103 100644
--- a/umac/cmn_services/serialization/src/wlan_serialization_legacy_api.c
+++ b/umac/cmn_services/serialization/src/wlan_serialization_legacy_api.c
@@ -343,94 +343,3 @@
return wlan_serialization_get_list_next_node(queue, prev_cmd,
ser_pdev_obj);
}
-
-void wlan_serialization_purge_cmd_list_by_vdev_id(
- struct wlan_objmgr_psoc *psoc,
- uint8_t vdev_id, bool purge_scan_active_queue,
- bool purge_scan_pending_queue,
- bool purge_nonscan_active_queue,
- bool purge_nonscan_pending_queue,
- bool purge_all_queues)
-{
- struct wlan_objmgr_vdev *vdev;
-
- vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
- WLAN_SERIALIZATION_ID);
- if (!vdev) {
- ser_err("Invalid vdev");
- return;
- }
- wlan_serialization_purge_cmd_list(
- psoc, vdev, purge_scan_active_queue,
- purge_scan_pending_queue,
- purge_nonscan_active_queue,
- purge_nonscan_pending_queue,
- purge_all_queues);
- wlan_objmgr_vdev_release_ref(vdev, WLAN_SERIALIZATION_ID);
-}
-
-void wlan_serialization_purge_cmd_list(
- struct wlan_objmgr_psoc *psoc,
- struct wlan_objmgr_vdev *vdev,
- bool purge_scan_active_queue,
- bool purge_scan_pending_queue,
- bool purge_nonscan_active_queue,
- bool purge_nonscan_pending_queue,
- bool purge_all_queues)
-{
- struct wlan_ser_pdev_obj *ser_pdev_obj;
- struct wlan_objmgr_pdev *pdev = NULL;
-
- if (!psoc) {
- ser_err("Invalid psoc");
- return;
- }
- ser_pdev_obj = wlan_serialization_get_pdev_priv_obj_using_psoc(psoc);
- if (!ser_pdev_obj) {
- ser_err("Invalid ser_pdev_obj");
- return;
- }
-
- pdev = wlan_serialization_get_first_pdev(psoc);
- if (!pdev) {
- ser_err("Invalid pdev");
- return;
- }
-
- if (purge_all_queues || purge_scan_active_queue) {
- wlan_ser_cancel_scan_cmd(ser_pdev_obj,
- pdev,
- vdev,
- NULL,
- WLAN_SER_CMD_SCAN,
- true);
- }
- if (purge_all_queues || purge_scan_pending_queue) {
- wlan_ser_cancel_scan_cmd(ser_pdev_obj,
- pdev,
- vdev,
- NULL,
- WLAN_SER_CMD_SCAN,
- false);
- }
- if (purge_all_queues || purge_nonscan_active_queue) {
- wlan_ser_cancel_non_scan_cmd(
- ser_pdev_obj,
- pdev, vdev,
- NULL,
- WLAN_SER_CMD_NONSCAN,
- true);
- }
- if (purge_all_queues || purge_nonscan_pending_queue) {
- wlan_ser_cancel_non_scan_cmd(
- ser_pdev_obj,
- pdev, vdev,
- NULL,
- WLAN_SER_CMD_NONSCAN,
- false);
- }
- wlan_objmgr_pdev_release_ref(pdev, WLAN_SERIALIZATION_ID);
-
- return;
-}
-