Browse Source

qcacld-3.0: Add basic infra, INI, deinit path for BLM

BLM:- Blacklist Manager

Add the basic infrastructure such as target-if, tgt, init,
deinit, ini files, core and main files for the new component
Blacklist Manager.

Change-Id: I624a779ee0dd6be7cb26a911af0aefd426ca9bff
CRs-Fixed: 2460602
gaurank kathpalia 5 years ago
parent
commit
8c943b7df5

+ 229 - 0
components/blacklist_mgr/core/inc/wlan_blm_core.h

@@ -0,0 +1,229 @@
+/*
+ * Copyright (c) 2011-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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/**
+ * DOC: declare internal APIs related to the blacklist component
+ */
+
+#ifndef _WLAN_BLM_CORE_H_
+#define _WLAN_BLM_CORE_H_
+
+#include <wlan_blm_main.h>
+
+#define BLM_IS_AP_AVOIDED_BY_USERSPACE(cur_node) \
+			cur_node->userspace_avoidlist
+
+#define BLM_IS_AP_AVOIDED_BY_DRIVER(cur_node) \
+		cur_node->driver_avoidlist
+
+#define BLM_IS_AP_BLACKLISTED_BY_USERSPACE(cur_node) \
+		cur_node->userspace_blacklist
+
+#define BLM_IS_AP_BLACKLISTED_BY_DRIVER(cur_node) \
+		cur_node->driver_blacklist
+
+#define BLM_IS_AP_IN_MONITOR_LIST(cur_node) \
+		cur_node->driver_monitorlist
+
+#define BLM_IS_AP_IN_RSSI_REJECT_LIST(cur_node) \
+		cur_node->rssi_reject_list
+
+#define BLM_IS_AP_IN_BLACKLIST(cur_node) \
+		(BLM_IS_AP_BLACKLISTED_BY_USERSPACE(cur_node) | \
+		 BLM_IS_AP_BLACKLISTED_BY_DRIVER(cur_node) | \
+		 BLM_IS_AP_IN_RSSI_REJECT_LIST(cur_node))
+
+#define BLM_IS_AP_IN_AVOIDLIST(cur_node) \
+		(BLM_IS_AP_AVOIDED_BY_USERSPACE(cur_node) | \
+		 BLM_IS_AP_AVOIDED_BY_DRIVER(cur_node))
+
+#define IS_AP_IN_USERSPACE_BLACKLIST_ONLY(cur_node) \
+		(BLM_IS_AP_BLACKLISTED_BY_USERSPACE(cur_node) & \
+		!(BLM_IS_AP_IN_AVOIDLIST(cur_node) | \
+		 BLM_IS_AP_IN_MONITOR_LIST(cur_node) | \
+		 BLM_IS_AP_IN_RSSI_REJECT_LIST(cur_node) | \
+		 BLM_IS_AP_BLACKLISTED_BY_DRIVER(cur_node)))
+
+#define IS_AP_IN_MONITOR_LIST_ONLY(cur_node) \
+		(BLM_IS_AP_IN_MONITOR_LIST(cur_node) & \
+		!(BLM_IS_AP_IN_AVOIDLIST(cur_node) | \
+		 BLM_IS_AP_IN_BLACKLIST(cur_node)))
+
+#define IS_AP_IN_AVOID_LIST_ONLY(cur_node) \
+		(BLM_IS_AP_IN_AVOIDLIST(cur_node) & \
+		!(BLM_IS_AP_IN_MONITOR_LIST(cur_node) | \
+		 BLM_IS_AP_IN_BLACKLIST(cur_node)))
+
+#define IS_AP_IN_DRIVER_BLACKLIST_ONLY(cur_node) \
+		(BLM_IS_AP_BLACKLISTED_BY_DRIVER(cur_node) & \
+		!(BLM_IS_AP_IN_AVOIDLIST(cur_node) | \
+		 BLM_IS_AP_IN_MONITOR_LIST(cur_node) | \
+		 BLM_IS_AP_IN_RSSI_REJECT_LIST(cur_node) | \
+		 BLM_IS_AP_BLACKLISTED_BY_USERSPACE(cur_node)))
+
+#define IS_AP_IN_RSSI_REJECT_LIST_ONLY(cur_node) \
+		(BLM_IS_AP_IN_RSSI_REJECT_LIST(cur_node) & \
+		!(BLM_IS_AP_IN_AVOIDLIST(cur_node) | \
+		 BLM_IS_AP_IN_MONITOR_LIST(cur_node) | \
+		 BLM_IS_AP_BLACKLISTED_BY_DRIVER(cur_node) | \
+		 BLM_IS_AP_BLACKLISTED_BY_USERSPACE(cur_node)))
+
+#define IS_AP_IN_USERSPACE_AVOID_LIST_ONLY(cur_node) \
+		(BLM_IS_AP_AVOIDED_BY_USERSPACE(cur_node) & \
+		!(BLM_IS_AP_AVOIDED_BY_DRIVER(cur_node) | \
+		 BLM_IS_AP_IN_MONITOR_LIST(cur_node) | \
+		 BLM_IS_AP_IN_BLACKLIST(cur_node)))
+
+#define IS_AP_IN_DRIVER_AVOID_LIST_ONLY(cur_node) \
+		(BLM_IS_AP_AVOIDED_BY_DRIVER(cur_node) & \
+		!(BLM_IS_AP_AVOIDED_BY_USERSPACE(cur_node) | \
+		 BLM_IS_AP_IN_MONITOR_LIST(cur_node) | \
+		 BLM_IS_AP_IN_BLACKLIST(cur_node)))
+
+/**
+ * struct blm_reject_ap_timestamp - Structure to store the reject list BSSIDs
+ * entry time stamp.
+ * @userspace_avoid_timestamp: Time when userspace adds BSSID to avoid list.
+ * @driver_avoid_timestamp: Time when driver adds BSSID to avoid list.
+ * @userspace_blacklist_timestamp: Time when userspace adds BSSID to black list.
+ * @driver_blacklist_timestamp: Time when driver adds BSSID to black list.
+ * @rssi_reject_timestamp: Time when driver adds BSSID to rssi reject list.
+ * @driver_monitor_timestamp: Time when driver adds BSSID to monitor list.
+ */
+struct blm_reject_ap_timestamp {
+	qdf_time_t userspace_avoid_timestamp;
+	qdf_time_t driver_avoid_timestamp;
+	qdf_time_t userspace_blacklist_timestamp;
+	qdf_time_t driver_blacklist_timestamp;
+	qdf_time_t rssi_reject_timestamp;
+	qdf_time_t driver_monitor_timestamp;
+};
+
+/**
+ * struct blm_reject_ap - Structure of a node added to blacklist manager
+ * @node: Node of the entry
+ * @bssid: Bssid of the AP entry.
+ * @rssi_reject_params: Rssi reject params of the AP entry.
+ * @bad_bssid_counter: It represent how many times data stall happened.
+ * @ap_timestamp: Ap timestamp.
+ * @reject_ap_type: what is the type of rejection for the AP (avoid, black etc.)
+ */
+struct blm_reject_ap {
+	qdf_list_node_t node;
+	struct qdf_mac_addr bssid;
+	struct blm_rssi_disallow_params rssi_reject_params;
+	uint8_t bad_bssid_counter;
+	struct blm_reject_ap_timestamp ap_timestamp;
+	union {
+		struct {
+			uint8_t userspace_blacklist:1,
+				driver_blacklist:1,
+				userspace_avoidlist:1,
+				driver_avoidlist:1,
+				rssi_reject_list:1,
+				driver_monitorlist:1;
+		};
+		uint8_t reject_ap_type;
+	};
+};
+
+/**
+ * enum blm_bssid_action - action taken by driver for the scan results
+ * @BLM_ACTION_NOP: No operation to be taken for the BSSID in the scan list.
+ * @BLM_REMOVE_FROM_LIST: Remove the BSSID from the scan list ( Blacklisted APs)
+ * @BLM_MOVE_AT_LAST: Attach the Ap at last of the scan list (Avoided Aps)
+ */
+enum blm_bssid_action {
+	BLM_ACTION_NOP,
+	BLM_REMOVE_FROM_LIST,
+	BLM_MOVE_AT_LAST,
+};
+
+/**
+ * blm_filter_bssid() - Filter out the bad Aps from the scan list.
+ * @pdev: Pdev object
+ * @scan_list: Scan list from the caller
+ *
+ * This API will filter out the bad Aps, or add the bad APs at the last
+ * of the linked list if the APs are to be avoided.
+ *
+ * Return: QDF status
+ */
+QDF_STATUS
+blm_filter_bssid(struct wlan_objmgr_pdev *pdev, qdf_list_t *scan_list);
+
+/**
+ * blm_add_bssid_to_reject_list() - Add BSSID to the specific reject list.
+ * @pdev: Pdev object
+ * @ap_info: Ap info params such as BSSID, and the type of rejection to be done
+ *
+ * This API will add the BSSID to the reject AP list maintained by the blacklist
+ * manager.
+ *
+ * Return: QDF status
+ */
+QDF_STATUS
+blm_add_bssid_to_reject_list(struct wlan_objmgr_pdev *pdev,
+			     struct reject_ap_info *ap_info);
+
+/**
+ * blm_add_userspace_black_list() - Clear already existing userspace BSSID, and
+ * add the new ones to blacklist manager.
+ * @pdev: pdev object
+ * @bssid_black_list: BSSIDs to be blacklisted by userspace.
+ * @num_of_bssid: num of bssids to be blacklisted.
+ *
+ * This API will Clear already existing userspace BSSID, and add the new ones
+ * to blacklist manager's reject list.
+ *
+ * Return: QDF status
+ */
+QDF_STATUS
+blm_add_userspace_black_list(struct wlan_objmgr_pdev *pdev,
+			     struct qdf_mac_addr *bssid_black_list,
+			     uint8_t num_of_bssid);
+
+/**
+ * blm_delete_reject_ap_list() - Clear away BSSID and destroy the reject ap list
+ * @blm_ctx: blacklist manager pdev priv object
+ *
+ * This API will clear the BSSID info in the reject AP list maintained by the
+ * blacklist manager, and will destroy the list as well.
+ *
+ * Return: None
+ */
+void
+blm_delete_reject_ap_list(struct blm_pdev_priv_obj *blm_ctx);
+
+/**
+ * blm_get_bssid_reject_list() - Get the BSSIDs in reject list from BLM
+ * @pdev: pdev object
+ * @reject_list: reject list to be filled (passed by caller)
+ * @max_bssid_to_be_filled: num of bssids filled in reject list by BLM
+ * @reject_ap_type: reject ap type of the BSSIDs to be filled.
+ *
+ * This API will fill the reject ap list requested by caller of type given as
+ * argument reject_ap_type, and will return the number of BSSIDs filled.
+ *
+ * Return: Unsigned integer (number of BSSIDs filled by the blacklist manager)
+ */
+uint8_t
+blm_get_bssid_reject_list(struct wlan_objmgr_pdev *pdev,
+			  struct reject_ap_config_params *reject_list,
+			  uint8_t max_bssid_to_be_filled,
+			  enum blm_reject_ap_type reject_ap_type);
+#endif

+ 167 - 0
components/blacklist_mgr/core/inc/wlan_blm_main.h

@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/**
+ * DOC: declare internal APIs related to the blacklist manager component
+ */
+
+#ifndef _WLAN_BLM_MAIN_H_
+#define _WLAN_BLM_MAIN_H_
+
+#include <qdf_time.h>
+#include <wlan_objmgr_cmn.h>
+#include <wlan_objmgr_global_obj.h>
+#include <wlan_blm_ucfg_api.h>
+
+#define blm_fatal(params...)\
+		QDF_TRACE_FATAL(QDF_MODULE_ID_BLACKLIST_MGR, params)
+#define blm_err(params...)\
+		QDF_TRACE_ERROR(QDF_MODULE_ID_BLACKLIST_MGR, params)
+#define blm_warn(params...)\
+		QDF_TRACE_WARN(QDF_MODULE_ID_BLACKLIST_MGR, params)
+#define blm_info(params...)\
+		QDF_TRACE_INFO(QDF_MODULE_ID_BLACKLIST_MGR, params)
+#define blm_debug(params...)\
+		QDF_TRACE_DEBUG(QDF_MODULE_ID_BLACKLIST_MGR, params)
+
+/**
+ * struct blm_pdev_priv_obj - Pdev priv struct to store list of blacklist mgr.
+ * @reject_ap_list_lock: Mutex needed to restrict two threads updating the list.
+ * @reject_ap_list: The reject Ap list which would contain the list of bad APs.
+ * @blm_tx_ops: tx ops to send reject ap list to FW
+ */
+struct blm_pdev_priv_obj {
+	qdf_mutex_t reject_ap_list_lock;
+	qdf_list_t reject_ap_list;
+	struct wlan_blm_tx_ops blm_tx_ops;
+};
+
+/**
+ * struct blm_config - Structure to define the config params for blacklist mgr.
+ * @avoid_list_exipry_time: Timer after which transition from avoid->monitor
+ * would happen for the BSSID which is in avoid list.
+ * @black_list_exipry_time: Timer after which transition from black->monitor
+ * would happen for the BSSID which is in black list.
+ * @bad_bssid_counter_reset_time: Timer after which the bssid would be removed
+ * from the reject list when connected, and data stall is not seen with the AP.
+ * @bad_bssid_counter_thresh: This is the threshold count which is incremented
+ * after every NUD fail, and after this much count, the BSSID would be moved to
+ * blacklist.
+ */
+struct blm_config {
+	qdf_time_t avoid_list_exipry_time;
+	qdf_time_t black_list_exipry_time;
+	qdf_time_t bad_bssid_counter_reset_time;
+	uint8_t bad_bssid_counter_thresh;
+};
+
+/**
+ * struct blm_psoc_priv_obj - Psoc priv structure of the blacklist manager.
+ * @blm_cfg: These are the config ini params that the user can configure.
+ */
+struct blm_psoc_priv_obj {
+	struct blm_config blm_cfg;
+};
+
+/**
+ * blm_pdev_object_created_notification() - blacklist mgr pdev create
+ * handler
+ * @pdev: pdev which is going to be created by objmgr
+ * @arg: argument for pdev create handler
+ *
+ * Register this api with objmgr to detect if pdev is created.
+ *
+ * Return: QDF_STATUS status in case of success else return error
+ */
+QDF_STATUS
+blm_pdev_object_created_notification(struct wlan_objmgr_pdev *pdev,
+				     void *arg);
+
+/**
+ * blm_pdev_object_destroyed_notification() - blacklist mgr pdev delete handler
+ * @pdev: pdev which is going to be deleted by objmgr
+ * @arg: argument for pdev delete handler
+ *
+ * Register this api with objmgr to detect if pdev is deleted.
+ *
+ * Return: QDF_STATUS status in case of success else return error
+ */
+QDF_STATUS
+blm_pdev_object_destroyed_notification(struct wlan_objmgr_pdev *pdev,
+				       void *arg);
+
+/**
+ * blm_psoc_object_created_notification() - blacklist mgr psoc create handler
+ * @psoc: psoc which is going to be created by objmgr
+ * @arg: argument for psoc create handler
+ *
+ * Register this api with objmgr to detect if psoc is created.
+ *
+ * Return: QDF_STATUS status in case of success else return error
+ */
+QDF_STATUS
+blm_psoc_object_created_notification(struct wlan_objmgr_psoc *psoc,
+				     void *arg);
+
+/**
+ * blm_psoc_object_destroyed_notification() - blacklist mgr psoc delete handler
+ * @psoc: psoc which is going to be deleted by objmgr
+ * @arg: argument for psoc delete handler.
+ *
+ * Register this api with objmgr to detect if psoc is deleted.
+ *
+ * Return: QDF_STATUS status in case of success else return error
+ */
+QDF_STATUS
+blm_psoc_object_destroyed_notification(struct wlan_objmgr_psoc *psoc,
+				       void *arg);
+
+/**
+ * blm_cfg_psoc_open() - blacklist mgr psoc open handler
+ * @psoc: psoc which is initialized by objmgr
+ *
+ * This API will initialize the config file, and store the config while in the
+ * psoc priv object of the blacklist manager.
+ *
+ * Return: QDF_STATUS status in case of success else return error
+ */
+QDF_STATUS
+blm_cfg_psoc_open(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * blm_get_pdev_obj() - Get the pdev priv object of the blacklist manager
+ * @pdev: pdev object
+ *
+ * Get the pdev priv object of the blacklist manager
+ *
+ * Return: Pdev priv object if present, else NULL.
+ */
+struct blm_pdev_priv_obj *
+blm_get_pdev_obj(struct wlan_objmgr_pdev *pdev);
+
+/**
+ * blm_get_psoc_obj() - Get the psoc priv object of the blacklist manager
+ * @psoc: psoc object
+ *
+ * Get the psoc priv object of the blacklist manager
+ *
+ * Return: Psoc priv object if present, else NULL.
+ */
+struct blm_psoc_priv_obj *
+blm_get_psoc_obj(struct wlan_objmgr_psoc *psoc);
+
+#endif

+ 60 - 0
components/blacklist_mgr/core/src/wlan_blm_core.c

@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2011-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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/**
+ * DOC: declare internal APIs related to the blacklist component
+ */
+
+#include <wlan_objmgr_pdev_obj.h>
+#include <wlan_blm_core.h>
+#include <qdf_mc_timer.h>
+#include <wlan_scan_public_structs.h>
+#include "wlan_blm_tgt_api.h"
+
+#define SECONDS_TO_MS(params)       (params * 60)
+#define MINUTES_TO_MS(params)       (SECONDS_TO_MS(params) * 1000)
+
+QDF_STATUS
+blm_filter_bssid(struct wlan_objmgr_pdev *pdev,
+		 qdf_list_t *scan_list)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+blm_add_bssid_to_reject_list(struct wlan_objmgr_pdev *pdev,
+			     struct reject_ap_info *ap_info)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+blm_add_userspace_black_list(struct wlan_objmgr_pdev *pdev,
+			     struct qdf_mac_addr *bssid_black_list,
+			     uint8_t num_of_bssid)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+uint8_t
+blm_get_bssid_reject_list(struct wlan_objmgr_pdev *pdev,
+			  struct reject_ap_config_params *reject_list,
+			  uint8_t max_bssid_to_be_filled,
+			  enum blm_reject_ap_type reject_ap_type)
+{
+	return 0;
+}

+ 186 - 0
components/blacklist_mgr/core/src/wlan_blm_main.c

@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: wlan_blm_main.c
+ *
+ * WLAN Blacklist Mgr related APIs
+ *
+ */
+
+/* Include files */
+
+#include "target_if_blm.h"
+#include <wlan_blm_ucfg_api.h>
+#include "cfg_ucfg_api.h"
+#include <wlan_blm_core.h>
+
+struct blm_pdev_priv_obj *
+blm_get_pdev_obj(struct wlan_objmgr_pdev *pdev)
+{
+	struct blm_pdev_priv_obj *blm_pdev_obj;
+
+	blm_pdev_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev,
+						  WLAN_UMAC_COMP_BLACKLIST_MGR);
+
+	return blm_pdev_obj;
+}
+
+struct blm_psoc_priv_obj *
+blm_get_psoc_obj(struct wlan_objmgr_psoc *psoc)
+{
+	struct blm_psoc_priv_obj *blm_psoc_obj;
+
+	blm_psoc_obj = wlan_objmgr_psoc_get_comp_private_obj(psoc,
+						  WLAN_UMAC_COMP_BLACKLIST_MGR);
+
+	return blm_psoc_obj;
+}
+
+QDF_STATUS
+blm_pdev_object_created_notification(struct wlan_objmgr_pdev *pdev,
+				     void *arg)
+{
+	struct blm_pdev_priv_obj *blm_ctx;
+	QDF_STATUS status;
+
+	blm_ctx = qdf_mem_malloc(sizeof(*blm_ctx));
+
+	if (!blm_ctx)
+		return QDF_STATUS_E_FAILURE;
+
+	status = qdf_mutex_create(&blm_ctx->reject_ap_list_lock);
+
+	if (QDF_IS_STATUS_ERROR(status)) {
+		blm_err("Failed to create mutex");
+		qdf_mem_free(blm_ctx);
+		return status;
+	}
+	qdf_list_create(&blm_ctx->reject_ap_list, MAX_BAD_AP_LIST_SIZE);
+
+	target_if_blm_register_tx_ops(&blm_ctx->blm_tx_ops);
+	status = wlan_objmgr_pdev_component_obj_attach(pdev,
+						   WLAN_UMAC_COMP_BLACKLIST_MGR,
+						   blm_ctx,
+						   QDF_STATUS_SUCCESS);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		blm_err("Failed to attach pdev_ctx with pdev");
+		qdf_list_destroy(&blm_ctx->reject_ap_list);
+		qdf_mutex_destroy(&blm_ctx->reject_ap_list_lock);
+		qdf_mem_free(blm_ctx);
+	}
+
+	return status;
+}
+
+QDF_STATUS
+blm_pdev_object_destroyed_notification(struct wlan_objmgr_pdev *pdev,
+				       void *arg)
+{
+	struct blm_pdev_priv_obj *blm_ctx;
+
+	blm_ctx = blm_get_pdev_obj(pdev);
+
+	if (!blm_ctx) {
+		blm_err("BLM Pdev obj is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+	/* Clear away the memory allocated for the bad BSSIDs */
+	blm_delete_reject_ap_list(blm_ctx);
+	qdf_mutex_destroy(&blm_ctx->reject_ap_list_lock);
+
+	wlan_objmgr_pdev_component_obj_detach(pdev,
+					      WLAN_UMAC_COMP_BLACKLIST_MGR,
+					      blm_ctx);
+	qdf_mem_free(blm_ctx);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+blm_psoc_object_created_notification(struct wlan_objmgr_psoc *psoc,
+				     void *arg)
+{
+	struct blm_psoc_priv_obj *blm_psoc_obj;
+	QDF_STATUS status;
+
+	blm_psoc_obj = qdf_mem_malloc(sizeof(*blm_psoc_obj));
+
+	if (!blm_psoc_obj)
+		return QDF_STATUS_E_FAILURE;
+
+	status = wlan_objmgr_psoc_component_obj_attach(psoc,
+						   WLAN_UMAC_COMP_BLACKLIST_MGR,
+						   blm_psoc_obj,
+						   QDF_STATUS_SUCCESS);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		blm_err("Failed to attach psoc_ctx with psoc");
+		qdf_mem_free(blm_psoc_obj);
+	}
+
+	return status;
+}
+
+QDF_STATUS
+blm_psoc_object_destroyed_notification(struct wlan_objmgr_psoc *psoc, void *arg)
+{
+	struct blm_psoc_priv_obj *blm_psoc_obj;
+
+	blm_psoc_obj = blm_get_psoc_obj(psoc);
+
+	if (!blm_psoc_obj) {
+		blm_err("BLM psoc obj NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+	wlan_objmgr_psoc_component_obj_detach(psoc,
+					      WLAN_UMAC_COMP_BLACKLIST_MGR,
+					      blm_psoc_obj);
+	qdf_mem_free(blm_psoc_obj);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+static void
+blm_init_cfg(struct wlan_objmgr_psoc *psoc, struct blm_config *blm_cfg)
+{
+	blm_cfg->avoid_list_exipry_time =
+				cfg_get(psoc, CFG_AVOID_LIST_EXPIRY_TIME);
+	blm_cfg->black_list_exipry_time =
+				cfg_get(psoc, CFG_BLACK_LIST_EXPIRY_TIME);
+	blm_cfg->bad_bssid_counter_reset_time =
+				cfg_get(psoc, CFG_BAD_BSSID_RESET_TIME);
+	blm_cfg->bad_bssid_counter_thresh =
+				cfg_get(psoc, CFG_BAD_BSSID_COUNTER_THRESHOLD);
+}
+
+QDF_STATUS
+blm_cfg_psoc_open(struct wlan_objmgr_psoc *psoc)
+{
+	struct blm_psoc_priv_obj *blm_psoc_obj;
+
+	blm_psoc_obj = blm_get_psoc_obj(psoc);
+
+	if (!blm_psoc_obj) {
+		blm_err("BLM psoc obj NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	blm_init_cfg(psoc, &blm_psoc_obj->blm_cfg);
+
+	return QDF_STATUS_SUCCESS;
+}

+ 108 - 0
components/blacklist_mgr/dispatcher/inc/wlan_blm_api.h

@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/**
+ * DOC: declare public APIs exposed by the blacklist manager component
+ */
+
+#ifndef _WLAN_BLM_API_H_
+#define _WLAN_BLM_API_H_
+
+#include "qdf_types.h"
+#include "wlan_objmgr_pdev_obj.h"
+#include <wlan_blm_public_struct.h>
+
+#ifdef FEATURE_BLACKLIST_MGR
+#include "wlan_blm_core.h"
+
+/**
+ * wlan_blm_filter_bssid() - Wrapper API to blm_filter_bssid
+ * @pdev: pdev object
+ * @scan_list: scan list whose results are to filtered out.
+ *
+ * This API is a wrapper to blm_filter_bssid.
+ */
+static inline QDF_STATUS
+wlan_blm_filter_bssid(struct wlan_objmgr_pdev *pdev, qdf_list_t *scan_list)
+{
+	return blm_filter_bssid(pdev, scan_list);
+}
+
+/**
+ * wlan_blm_add_bssid_to_reject_list() - Add BSSID to the specific reject list.
+ * @pdev: Pdev object
+ * @ap_info: Ap info params such as BSSID, and the type of rejection to be done
+ *
+ * This API will add the BSSID to the reject AP list maintained by the blacklist
+ * manager.
+ */
+static inline QDF_STATUS
+wlan_blm_add_bssid_to_reject_list(struct wlan_objmgr_pdev *pdev,
+				  struct reject_ap_info *ap_info)
+{
+	return blm_add_bssid_to_reject_list(pdev, ap_info);
+}
+
+/**
+ * wlan_blm_get_bssid_reject_list() - Get the BSSIDs in reject list from BLM
+ * @pdev: pdev object
+ * @reject_list: reject list to be filled (passed by caller)
+ * @max_bssid_to_be_filled: num of bssids filled in reject list by BLM
+ * @reject_ap_type: reject ap type of the BSSIDs to be filled.
+ *
+ * This API is a wrapper to an API of blacklist manager which will fill the
+ * reject ap list requested by caller of type given as argument reject_ap_type,
+ * and will return the number of BSSIDs filled.
+ *
+ * Return: Unsigned integer (number of BSSIDs filled by the blacklist manager)
+ */
+static inline uint8_t
+wlan_blm_get_bssid_reject_list(struct wlan_objmgr_pdev *pdev,
+			       struct reject_ap_config_params *reject_list,
+			       uint8_t max_bssid_to_be_filled,
+			       enum blm_reject_ap_type reject_ap_type)
+{
+	return blm_get_bssid_reject_list(pdev, reject_list,
+					 max_bssid_to_be_filled,
+					 reject_ap_type);
+}
+
+#else
+static inline QDF_STATUS
+wlan_blm_filter_bssid(struct wlan_objmgr_pdev *pdev, qdf_list_t *scan_list)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline QDF_STATUS
+wlan_blm_add_bssid_to_reject_list(struct wlan_objmgr_pdev *pdev,
+				  struct reject_ap_info *ap_info)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline uint8_t
+wlan_blm_get_bssid_reject_list(struct wlan_objmgr_pdev *pdev,
+			       struct reject_ap_config_params *reject_list,
+			       uint8_t max_bssid_to_be_filled,
+			       enum blm_reject_ap_type reject_ap_type)
+{
+	return 0;
+}
+
+#endif
+#endif

+ 96 - 0
components/blacklist_mgr/dispatcher/inc/wlan_blm_public_struct.h

@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/**
+ * DOC: define public structures of blacklist mgr.
+ */
+
+#ifndef _WLAN_BLM_PUBLIC_STRUCT_H
+#define _WLAN_BLM_PUBLIC_STRUCT_H
+
+#include <qdf_types.h>
+#include "wlan_objmgr_pdev_obj.h"
+
+#define MAX_BAD_AP_LIST_SIZE               28
+#define MAX_RSSI_AVOID_BSSID_LIST    10
+#define PDEV_MAX_NUM_BSSID_DISALLOW_LIST  28
+/**
+ * struct blm_rssi_disallow_params - structure to specify params for RSSI reject
+ * @retry_delay: Time before which the AP doesn't expect a connection.
+ * @expected_rssi: RSSI less than which only the STA should try association.
+ */
+struct blm_rssi_disallow_params {
+	uint32_t retry_delay;
+	int8_t expected_rssi;
+};
+
+/**
+ * enum blm_reject_ap_type - Rejection type of the AP
+ * @USERSPACE_AVOID_TYPE: userspace wants the AP to be avoided.
+ * @USERSPACE_BLACKLIST_TYPE: userspace wants the AP to be blacklisted.
+ * @DRIVER_AVOID_TYPE: driver wants the AP to be avoided.
+ * @DRIVER_BLACKLIST_TYPE: driver wants the AP to be blacklisted.
+ * @DRIVER_RSSI_REJECT_TYPE: driver wants the AP to be in driver rssi reject.
+ * @DRIVER_MONITOR_TYPE: driver wants the AP to be in monitor list.
+ */
+enum blm_reject_ap_type {
+	USERSPACE_AVOID_TYPE =     0,
+	USERSPACE_BLACKLIST_TYPE = 1,
+	DRIVER_AVOID_TYPE    =     2,
+	DRIVER_BLACKLIST_TYPE    = 3,
+	DRIVER_RSSI_REJECT_TYPE =  4,
+	DRIVER_MONITOR_TYPE =      5
+};
+
+/**
+ * struct reject_ap_config_params - Structure to send reject ap list to FW
+ * @bssid: BSSID of the AP
+ * @reject_ap_type: Type of the rejection done with the BSSID
+ * @reject_duration: time left till the AP is in the reject list.
+ * @expected_rssi: expected RSSI when the AP expects the connection to be made.
+ */
+struct reject_ap_config_params {
+	struct qdf_mac_addr bssid;
+	enum blm_reject_ap_type reject_ap_type;
+	uint32_t reject_duration;
+	int32_t expected_rssi;
+};
+
+/**
+ * struct wlan_blm_tx_ops - structure of tx operation function
+ * pointers for blacklist manager component
+ * @blm_send_reject_ap_list: send reject ap list to fw
+ */
+struct wlan_blm_tx_ops {
+	QDF_STATUS (*blm_send_reject_ap_list)(struct wlan_objmgr_pdev *pdev,
+				  struct reject_ap_config_params *reject_list,
+				  uint8_t num_of_reject_bssid);
+};
+
+/**
+ * struct reject_ap_info - structure to specify the reject ap info.
+ * @bssid: BSSID of the AP.
+ * @rssi_reject_params: RSSI reject params of the AP is of type RSSI reject
+ * @reject_ap_type: Reject type of AP (eg. avoid, blacklist, rssi reject etc.)
+ */
+struct reject_ap_info {
+	struct qdf_mac_addr bssid;
+	struct blm_rssi_disallow_params rssi_reject_params;
+	enum blm_reject_ap_type reject_ap_type;
+};
+
+#endif

+ 43 - 0
components/blacklist_mgr/dispatcher/inc/wlan_blm_tgt_api.h

@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/**
+ * DOC: Declare public API for blacklist manager to interact with target/WMI
+ */
+
+#ifndef _WLAN_BLM_TGT_API_H
+#define _WLAN_BLM_TGT_API_H
+
+#include "wlan_blm_main.h"
+
+/**
+ * tgt_blm_send_reject_list_to_fw() - API to send the reject ap list to FW.
+ * @pdev: pdev object
+ * @reject_list: rejct ap list pointer
+ * @num_of_reject_bssid: num of reject bssids
+ *
+ * This API will send the reject AP list maintained by the blacklist manager
+ * to the target.
+ *
+ * Return: QDF status
+ */
+QDF_STATUS
+tgt_blm_send_reject_list_to_fw(struct wlan_objmgr_pdev *pdev,
+			       struct reject_ap_config_params *reject_list,
+			       uint8_t num_of_reject_bssid);
+
+#endif

+ 141 - 0
components/blacklist_mgr/dispatcher/inc/wlan_blm_ucfg_api.h

@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/**
+ * DOC: declare UCFG APIs exposed by the blacklist manager component
+ */
+
+#ifndef _WLAN_BLM_UCFG_H_
+#define _WLAN_BLM_UCFG_H_
+
+#include "qdf_types.h"
+#include "wlan_objmgr_psoc_obj.h"
+#include <wlan_blm_public_struct.h>
+
+#ifdef FEATURE_BLACKLIST_MGR
+
+/**
+ * ucfg_blm_init() - initialize blacklist mgr context
+ *
+ * This function initializes the blacklist mgr context
+ *
+ * Return: QDF_STATUS_SUCCESS - in case of success else return error
+ */
+QDF_STATUS ucfg_blm_init(void);
+
+/**
+ * ucfg_blm_deinit() - De initialize blacklist mgr context
+ *
+ * This function De initializes blacklist mgr context
+ *
+ * Return: QDF_STATUS_SUCCESS - in case of success else return error
+ */
+QDF_STATUS ucfg_blm_deinit(void);
+
+/**
+ * ucfg_blm_psoc_open() - API to initialize the cfg when psoc is initialized.
+ * @psoc: psoc object
+ *
+ * This function initializes the config of blacklist mgr.
+ *
+ * Return: QDF_STATUS_SUCCESS - in case of success else return error
+ */
+QDF_STATUS ucfg_blm_psoc_open(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * ucfg_blm_psoc_close() - API to deinit the blm when psoc is deinitialized.
+ * @psoc: psoc object
+ *
+ * This function deinits the blm psoc object.
+ *
+ * Return: QDF_STATUS_SUCCESS - in case of success else return error
+ */
+QDF_STATUS ucfg_blm_psoc_close(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * ucfg_blm_add_userspace_black_list() - Clear already existing userspace BSSID,
+ * and add the new ones to blacklist manager.
+ * @pdev: pdev object
+ * @bssid_black_list: BSSIDs to be blacklisted by userspace.
+ * @num_of_bssid: num of bssids to be blacklisted.
+ *
+ * This API clear already existing userspace BSSID, and add the new ones to
+ * blacklist manager
+ *
+ * Return: QDF_STATUS_SUCCESS - in case of success else return error.
+ */
+QDF_STATUS
+ucfg_blm_add_userspace_black_list(struct wlan_objmgr_pdev *pdev,
+				  struct qdf_mac_addr *bssid_black_list,
+				  uint8_t num_of_bssid);
+
+/**
+ * ucfg_blm_add_bssid_to_reject_list() - Add BSSID to the specific reject list.
+ * @pdev: Pdev object
+ * @ap_info: Ap info params such as BSSID, and the type of rejection to be done
+ *
+ * This API will add the BSSID to the reject AP list maintained by the blacklist
+ * manager.
+ *
+ * Return: QDF_STATUS_SUCCESS - in case of success else return error.
+ */
+QDF_STATUS
+ucfg_blm_add_bssid_to_reject_list(struct wlan_objmgr_pdev *pdev,
+				  struct reject_ap_info *ap_info);
+
+#else
+static inline
+QDF_STATUS ucfg_blm_init(void)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline
+QDF_STATUS ucfg_blm_deinit(void)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline
+QDF_STATUS ucfg_blm_psoc_open(struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline
+QDF_STATUS ucfg_blm_psoc_close(struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline
+QDF_STATUS
+ucfg_blm_add_bssid_to_reject_list(struct wlan_objmgr_pdev *pdev,
+				  struct reject_ap_info *ap_info)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline QDF_STATUS
+ucfg_blm_add_userspace_black_list(struct wlan_objmgr_pdev *pdev,
+				  struct qdf_mac_addr *bssid_black_list,
+				  uint8_t num_of_bssid)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+#endif /* _WLAN_BLM_UCFG_H_ */

+ 147 - 0
components/blacklist_mgr/dispatcher/inc/wlan_cfg_blm.h

@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: This file contains ini params for blacklist mgr component
+ */
+
+#ifndef __CFG_BLM_H_
+#define __CFG_BLM_H_
+
+#ifdef FEATURE_BLACKLIST_MGR
+
+/*
+ * <ini>
+ * avoid_list_expiry_time - Config Param to move AP from avoid to monitor list.
+ * @Min: 1 minutes
+ * @Max: 300 minutes
+ * @Default: 5 minutes
+ *
+ * This ini is used to specify the time after which the BSSID which is in the
+ * avoid list should be moved to monitor list, assuming that the AP or the
+ * gateway with which the data stall happenend might have recovered, and now
+ * the STA can give another chance to connect to the AP.
+ *
+ * Supported Feature: Data Stall Recovery
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_AVOID_LIST_EXPIRY_TIME CFG_INI_UINT( \
+				"avoid_list_expiry_time", \
+				1, \
+				300, \
+				5, \
+				CFG_VALUE_OR_DEFAULT, \
+				"avoid list expiry")
+
+/*
+ * <ini>
+ * bad_bssid_counter_thresh - Threshold to move the Ap from avoid to blacklist.
+ * @Min: 2
+ * @Max: 10
+ * @Default: 3
+ *
+ * This ini is used to specify the threshld after which the BSSID which is in
+ * the avoid list should be moved to black list, assuming that the AP or the
+ * gateway with which the data stall happenend has no recovered, and now
+ * the STA got the NUD failure again with the BSSID
+ *
+ * Supported Feature: Data Stall Recovery
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_BAD_BSSID_COUNTER_THRESHOLD CFG_INI_UINT( \
+				"bad_bssid_counter_thresh", \
+				2, \
+				10, \
+				3, \
+				CFG_VALUE_OR_DEFAULT, \
+				"bad bssid counter thresh")
+
+/*
+ * <ini>
+ * black_list_expiry_time - Config Param to move AP from blacklist to monitor
+ * list.
+ * @Min: 1 minutes
+ * @Max: 600 minutes
+ * @Default: 10 minutes
+ *
+ * This ini is used to specify the time after which the BSSID which is in the
+ * black list should be moved to monitor list, assuming that the AP or the
+ * gateway with which the data stall happenend might have recovered, and now
+ * the STA can give another chance to connect to the AP.
+ *
+ * Supported Feature: Data Stall Recovery
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_BLACK_LIST_EXPIRY_TIME CFG_INI_UINT( \
+				"black_list_expiry_time", \
+				1, \
+				600, \
+				10, \
+				CFG_VALUE_OR_DEFAULT, \
+				"black list expiry")
+
+/*
+ * <ini>
+ * bad_bssid_reset_time - Config Param to specify time after which AP would be
+ * removed from monitor/avoid when connected.
+ * @Min: 30 seconds
+ * @Max: 1 minute
+ * @Default: 30 seconds
+ *
+ * This ini is used to specify the time after which the BSSID which is in the
+ * avoid or monitor list should be removed from the respective list, if the
+ * data stall has not happened till the mentioned time after connection to the
+ * AP. That means that the AP has recovered from the previous state where
+ * data stall was observed with it, and was moved to avoid list.
+ *
+ * Supported Feature: Data Stall Recovery
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_BAD_BSSID_RESET_TIME CFG_INI_UINT( \
+				"bad_bssid_reset_time", \
+				30, \
+				60, \
+				30, \
+				CFG_VALUE_OR_DEFAULT, \
+				"bad bssid reset time")
+
+#define CFG_BLACKLIST_MGR_ALL \
+	CFG(CFG_AVOID_LIST_EXPIRY_TIME) \
+	CFG(CFG_BAD_BSSID_COUNTER_THRESHOLD) \
+	CFG(CFG_BLACK_LIST_EXPIRY_TIME) \
+	CFG(CFG_BAD_BSSID_RESET_TIME)
+
+#else
+
+#define CFG_BLACKLIST_MGR_ALL
+
+#endif /* FEATURE_BLACKLIST_MGR */
+
+#endif /* __CFG_BLACKLIST_MGR */

+ 30 - 0
components/blacklist_mgr/dispatcher/src/wlan_blm_tgt_api.c

@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/**
+ * DOC: Implements public API for blacklist manager to interact with target/WMI
+ */
+
+#include "wlan_blm_tgt_api.h"
+
+QDF_STATUS
+tgt_blm_send_reject_list_to_fw(struct wlan_objmgr_pdev *pdev,
+			       struct reject_ap_config_params *reject_list,
+			       uint8_t num_of_reject_bssid)
+{
+	return QDF_STATUS_SUCCESS;
+}

+ 132 - 0
components/blacklist_mgr/dispatcher/src/wlan_blm_ucfg_api.c

@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/**
+ * DOC: define UCFG APIs exposed by the blacklist mgr component
+ */
+
+#include <wlan_blm_ucfg_api.h>
+#include <wlan_blm_core.h>
+
+QDF_STATUS ucfg_blm_init(void)
+{
+	QDF_STATUS status;
+
+	status = wlan_objmgr_register_pdev_create_handler(
+			WLAN_UMAC_COMP_BLACKLIST_MGR,
+			blm_pdev_object_created_notification,
+			NULL);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		blm_err("pdev create register notification failed");
+		goto fail_create_pdev;
+	}
+
+	status = wlan_objmgr_register_pdev_destroy_handler(
+			WLAN_UMAC_COMP_BLACKLIST_MGR,
+			blm_pdev_object_destroyed_notification,
+			NULL);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		blm_err("pdev destroy register notification failed");
+		goto fail_destroy_pdev;
+	}
+
+	status = wlan_objmgr_register_psoc_create_handler(
+			WLAN_UMAC_COMP_BLACKLIST_MGR,
+			blm_psoc_object_created_notification,
+			NULL);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		blm_err("psoc create register notification failed");
+		goto fail_create_psoc;
+	}
+
+	status = wlan_objmgr_register_psoc_destroy_handler(
+			WLAN_UMAC_COMP_BLACKLIST_MGR,
+			blm_psoc_object_destroyed_notification,
+			NULL);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		blm_err("psoc destroy register notification failed");
+		goto fail_destroy_psoc;
+	}
+
+	return QDF_STATUS_SUCCESS;
+
+fail_destroy_psoc:
+	wlan_objmgr_unregister_psoc_create_handler(WLAN_UMAC_COMP_BLACKLIST_MGR,
+				   blm_psoc_object_created_notification, NULL);
+fail_create_psoc:
+	wlan_objmgr_unregister_pdev_destroy_handler(
+				 WLAN_UMAC_COMP_BLACKLIST_MGR,
+				 blm_pdev_object_destroyed_notification, NULL);
+fail_destroy_pdev:
+	wlan_objmgr_unregister_pdev_create_handler(WLAN_UMAC_COMP_BLACKLIST_MGR,
+				   blm_pdev_object_created_notification, NULL);
+fail_create_pdev:
+	return status;
+}
+
+QDF_STATUS ucfg_blm_deinit(void)
+{
+	QDF_STATUS status;
+
+	status = wlan_objmgr_unregister_psoc_destroy_handler(
+			WLAN_UMAC_COMP_BLACKLIST_MGR,
+			blm_psoc_object_destroyed_notification,
+			NULL);
+
+	status = wlan_objmgr_unregister_psoc_create_handler(
+			WLAN_UMAC_COMP_BLACKLIST_MGR,
+			blm_psoc_object_created_notification,
+			NULL);
+
+	status = wlan_objmgr_unregister_pdev_destroy_handler(
+			WLAN_UMAC_COMP_BLACKLIST_MGR,
+			blm_pdev_object_destroyed_notification,
+			NULL);
+
+	status = wlan_objmgr_unregister_pdev_create_handler(
+			WLAN_UMAC_COMP_BLACKLIST_MGR,
+			blm_pdev_object_created_notification,
+			NULL);
+
+	return status;
+}
+
+QDF_STATUS ucfg_blm_psoc_open(struct wlan_objmgr_psoc *psoc)
+{
+	return blm_cfg_psoc_open(psoc);
+}
+
+QDF_STATUS ucfg_blm_psoc_close(struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+ucfg_blm_add_bssid_to_reject_list(struct wlan_objmgr_pdev *pdev,
+				  struct reject_ap_info *ap_info)
+{
+	return wlan_blm_add_bssid_to_reject_list(pdev, ap_info);
+}
+
+QDF_STATUS
+ucfg_blm_add_userspace_black_list(struct wlan_objmgr_pdev *pdev,
+				  struct qdf_mac_addr *bssid_black_list,
+				  uint8_t num_of_bssid)
+{
+	return blm_add_userspace_black_list(pdev, bssid_black_list,
+					    num_of_bssid);
+}

+ 56 - 0
components/target_if/blacklist_mgr/inc/target_if_blm.h

@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/**
+ * DOC: Target interface file for blacklist manager component to
+ * declare api's which shall be used by blacklist manager component
+ * in target if internally.
+ */
+
+#ifndef __TARGET_IF_BLM_H
+#define __TARGET_IF_BLM_H
+
+#include "wlan_blm_public_struct.h"
+
+/**
+ * target_if_blm_send_reject_ap_list() - API to send reject ap list to FW
+ * @pdev: pdev object
+ * @reject_list: reject ap list
+ * @num_of_reject_bssid: num of bssids in reject ap list.
+ *
+ * This API will send the reject ap list to the target for it to handle roaming
+ * case scenarios.
+ *
+ * Return: Qdf status
+ */
+QDF_STATUS
+target_if_blm_send_reject_ap_list(struct wlan_objmgr_pdev *pdev,
+				  struct reject_ap_config_params *reject_list,
+				  uint8_t num_of_reject_bssid);
+
+/**
+ * target_if_blm_register_tx_ops() - Register blm tx ops
+ * @blm_tx_ops: BLM tx ops
+ *
+ * This API will register the tx ops used by the BLM to send commands to the
+ * target.
+ *
+ * Return: void
+ */
+void target_if_blm_register_tx_ops(struct wlan_blm_tx_ops *blm_tx_ops);
+
+#endif

+ 37 - 0
components/target_if/blacklist_mgr/src/target_if_blm.c

@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/**
+ * DOC: Target interface file for blacklist manager component to
+ * Implement api's which shall be used by blacklist manager component
+ * in target if internally.
+ */
+
+#include <target_if_blm.h>
+#include "target_if.h"
+
+QDF_STATUS
+target_if_blm_send_reject_ap_list(struct wlan_objmgr_pdev *pdev,
+				  struct reject_ap_config_params *reject_list,
+				  uint8_t num_of_reject_bssid)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+void target_if_blm_register_tx_ops(struct wlan_blm_tx_ops *blm_tx_ops)
+{
+}