Browse Source

qcacmn: add set/get APIs for max active scans

Add set/get API for max parallel active scans supported.
Max active scans allowed is set from ext service ready event
handler(8 as of now). Once FW announces this capability, FW
announce value must be used instead of hardcoded value 8.

Change-Id: I2af3a34c9f55f92c47aebbd12838a8d8fc6e3ba7
CRs-Fixed: 1095299
Om Prakash Tripathi 8 years ago
parent
commit
0078b78f06

+ 1 - 0
target_if/init_deinit/inc/service_ready_event_handler.h

@@ -36,6 +36,7 @@
 #include "wmi_unified_param.h"
 #include "wlan_objmgr_psoc_obj.h"
 #include "target_if.h"
+#include "target_if_scan.h"
 
 /**
  * init_deinit_service_ready_event_handler() - service ready handler

+ 2 - 0
target_if/init_deinit/src/service_ready_event_handler.c

@@ -319,6 +319,8 @@ int init_deinit_service_ext_ready_event_handler(ol_scn_t scn_handle,
 
 	wlan_objmgr_populate_ext_service_ready_data(psoc, service_param);
 
+	target_if_scan_set_max_active_scans(psoc,
+			WLAN_MAX_ACTIVE_SCANS_ALLOWED);
 free_param_and_exit:
 	qdf_mem_free(service_param);
 

+ 14 - 0
target_if/scan/inc/target_if_scan.h

@@ -28,6 +28,8 @@ struct scan_req_params;
 struct scan_cancel_param;
 struct wlan_objmgr_psoc;
 
+#define WLAN_MAX_ACTIVE_SCANS_ALLOWED   8
+
 #ifdef FEATURE_WLAN_SCAN_PNO
 /**
  * target_if_nlo_match_event_handler() - nlo match event handler
@@ -115,4 +117,16 @@ target_if_scan_cancel(struct wlan_objmgr_psoc *psoc,
 
 QDF_STATUS
 target_if_register_scan_tx_ops(struct wlan_lmac_if_scan_tx_ops *scan);
+
+/**
+ * target_if_scan_set_max_active_scans() - lmac handler to set max active scans
+ * @psoc: psoc object
+ * @max_active_scans: maximum active scans allowed on underlying psoc
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+target_if_scan_set_max_active_scans(struct wlan_objmgr_psoc *psoc,
+		uint32_t max_active_scans);
+
 #endif

+ 19 - 0
target_if/scan/src/target_if_scan.c

@@ -343,3 +343,22 @@ target_if_register_scan_tx_ops(struct wlan_lmac_if_scan_tx_ops *scan)
 
 	return QDF_STATUS_SUCCESS;
 }
+
+QDF_STATUS
+target_if_scan_set_max_active_scans(struct wlan_objmgr_psoc *psoc,
+		uint32_t max_active_scans)
+{
+	struct wlan_lmac_if_scan_rx_ops *scan_rx_ops;
+	QDF_STATUS status;
+
+	scan_rx_ops = target_if_scan_get_rx_ops(psoc);
+	if (scan_rx_ops->scan_set_max_active_scans) {
+		status = scan_rx_ops->scan_set_max_active_scans(psoc,
+				max_active_scans);
+	} else {
+		target_if_err("scan_set_max_active_scans uninitialized");
+		status = QDF_STATUS_E_FAULT;
+	}
+
+	return status;
+}

+ 3 - 0
umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h

@@ -98,12 +98,15 @@ struct wlan_lmac_if_scan_tx_ops {
 /**
  * struct wlan_lmac_if_scan_rx_ops  - south bound rx function pointers for scan
  * @scan_ev_handler: scan event handler
+ * @scan_set_max_active_scans: set max active scans allowed
  *
  * lmac modules uses this API to post scan events to scan module
  */
 struct wlan_lmac_if_scan_rx_ops {
 	QDF_STATUS (*scan_ev_handler)(struct wlan_objmgr_psoc *psoc,
 		struct scan_event_info *event_info);
+	QDF_STATUS (*scan_set_max_active_scans)(struct wlan_objmgr_psoc *psoc,
+			uint32_t max_active_scans);
 };
 
 #ifdef WLAN_PMO_ENABLE

+ 1 - 0
umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c

@@ -258,6 +258,7 @@ wlan_lmac_if_umac_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
 
 	/* scan rx ops */
 	rx_ops->scan.scan_ev_handler = tgt_scan_event_handler;
+	rx_ops->scan.scan_set_max_active_scans = tgt_scan_set_max_active_scans;
 
 	wlan_lmac_if_atf_rx_ops_register(rx_ops);
 

+ 37 - 6
umac/scan/core/src/wlan_scan_main.h

@@ -94,7 +94,6 @@
 /* scan age time in millisec */
 #define SCAN_CACHE_AGING_TIME (300*1000)
 #define SCAN_MAX_BSS_PDEV 100
-#define SCAN_MAX_NUM_SCAN_ALLOWED 8
 #define SCAN_PRIORITY SCAN_PRIORITY_LOW
 
 /**
@@ -200,7 +199,8 @@ struct pno_def_config {
  * @num_probes: default maximum number of probes to sent
  * @cache_aging_time: default scan cache aging time
  * @max_bss_per_pdev: maximum number of bss entries to be maintained per pdev
- * @max_num_scan_allowed: maximum number of parallel scan allowed per psoc
+ * @max_active_scans_allowed: maximum number of active parallel scan allowed
+ *                            per psoc
  * @scan_priority: default scan priority
  * @scan_f_passive: passively scan all channels including active channels
  * @scan_f_bcast_probe: add wild card ssid prbreq even if ssid_list is specified
@@ -260,7 +260,7 @@ struct scan_default_params {
 	uint32_t num_probes;
 	uint32_t scan_cache_aging_time;
 	uint16_t max_bss_per_pdev;
-	uint8_t max_num_scan_allowed;
+	uint32_t max_active_scans_allowed;
 	enum scan_priority scan_priority;
 	enum scan_dwelltime_adaptive_mode adaptive_dwell_time_mode;
 	union {
@@ -485,18 +485,49 @@ wlan_vdev_get_pdev_scan_ev_handlers(struct wlan_objmgr_vdev *vdev)
 	return wlan_pdev_get_pdev_scan_ev_handlers(pdev);
 }
 
+/**
+ * wlan_scan_psoc_get_def_params() - private API to get scan defaults
+ * @psoc: psoc object
+ *
+ * Return: scan defaults
+ */
+static inline struct scan_default_params*
+wlan_scan_psoc_get_def_params(struct wlan_objmgr_psoc *psoc)
+{
+	struct wlan_scan_obj *scan = NULL;
+
+	if (!psoc) {
+		scm_err("null psoc");
+		return NULL;
+	}
+	scan = wlan_psoc_get_scan_obj(psoc);
+
+	if (!scan)
+		return NULL;
+
+	return &scan->scan_def;
+}
+
 /**
  * wlan_vdev_get_def_scan_params() - private API to get scan defaults
- * @psoc: vdev object
+ * @vdev: vdev object
  *
  * Return: scan defaults
  */
 static inline struct scan_default_params*
 wlan_vdev_get_def_scan_params(struct wlan_objmgr_vdev *vdev)
 {
-	struct wlan_scan_obj *scan = wlan_vdev_get_scan_obj(vdev);
+	struct wlan_objmgr_psoc *psoc = NULL;
 
-	return &scan->scan_def;
+	if (!vdev) {
+		scm_err("null vdev");
+		return NULL;
+	}
+	wlan_vdev_obj_lock(vdev);
+	psoc = wlan_vdev_get_psoc(vdev);
+	wlan_vdev_obj_unlock(vdev);
+
+	return wlan_scan_psoc_get_def_params(psoc);
 }
 
 /**

+ 12 - 0
umac/scan/dispatcher/inc/wlan_scan_tgt_api.h

@@ -130,4 +130,16 @@ tgt_scan_register_ev_handler(struct wlan_objmgr_psoc *psoc);
  */
 QDF_STATUS
 tgt_scan_unregister_ev_handler(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * tgt_scan_set_max_active_scans() - lmac handler to set max active scans
+ * @psoc: psoc object
+ * @max_active_scans: maximum active scans allowed on underlying psoc
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+tgt_scan_set_max_active_scans(struct wlan_objmgr_psoc *psoc,
+		uint32_t max_active_scans);
+
 #endif

+ 9 - 0
umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h

@@ -433,4 +433,13 @@ QDF_STATUS ucfg_scan_psoc_open(struct wlan_objmgr_psoc *psoc);
  */
 QDF_STATUS ucfg_scan_psoc_close(struct wlan_objmgr_psoc *psoc);
 
+/**
+ * ucfg_scan_get_max_active_scans() - API to get max active scans
+ * supported on this psoc
+ * @psoc: psoc object
+ *
+ * Return: uint32_t
+ */
+uint32_t ucfg_scan_get_max_active_scans(struct wlan_objmgr_psoc *psoc);
+
 #endif

+ 17 - 0
umac/scan/dispatcher/src/wlan_scan_tgt_api.c

@@ -281,3 +281,20 @@ QDF_STATUS tgt_scan_bcn_probe_rx_callback(struct wlan_objmgr_psoc *psoc,
 	}
 	return status;
 }
+
+QDF_STATUS
+tgt_scan_set_max_active_scans(struct wlan_objmgr_psoc *psoc,
+		uint32_t max_active_scans)
+{
+	struct scan_default_params *scan_params = NULL;
+
+	if (!psoc) {
+		scm_err("null psoc");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+	scan_params = wlan_scan_psoc_get_def_params(psoc);
+
+	scan_params->max_active_scans_allowed = max_active_scans;
+
+	return QDF_STATUS_SUCCESS;
+}

+ 14 - 1
umac/scan/dispatcher/src/wlan_scan_ucfg_api.c

@@ -598,7 +598,6 @@ wlan_scan_global_init(struct wlan_scan_obj *scan_obj)
 	scan_obj->scan_def.num_probes = SCAN_NUM_PROBES;
 	scan_obj->scan_def.scan_cache_aging_time = SCAN_CACHE_AGING_TIME;
 	scan_obj->scan_def.max_bss_per_pdev = SCAN_MAX_BSS_PDEV;
-	scan_obj->scan_def.max_num_scan_allowed = SCAN_MAX_NUM_SCAN_ALLOWED;
 	scan_obj->scan_def.scan_priority = SCAN_PRIORITY;
 	scan_obj->scan_def.idle_time = SCAN_NETWORK_IDLE_TIMEOUT;
 	scan_obj->scan_def.adaptive_dwell_time_mode = SCAN_DWELL_MODE_DEFAULT;
@@ -1039,3 +1038,17 @@ ucfg_scan_psoc_disable(struct wlan_objmgr_psoc *psoc)
 
 	return status;
 }
+
+uint32_t
+ucfg_scan_get_max_active_scans(struct wlan_objmgr_psoc *psoc)
+{
+	struct scan_default_params *scan_params = NULL;
+
+	if (!psoc) {
+		scm_err("null psoc");
+		return 0;
+	}
+	scan_params = wlan_scan_psoc_get_def_params(psoc);
+
+	return scan_params->max_active_scans_allowed;
+}