From 622b4795a19e55979e0992753d9917cb04bcd38e Mon Sep 17 00:00:00 2001 From: sheenam monga Date: Mon, 29 Mar 2021 22:49:57 +0530 Subject: [PATCH] qcacld-3.0: Dump blacklist bssids Add dump to print blacklisted bssids with reason code and source. Change-Id: I85734ad5aea0c8088e3f8ed2bdbb31971457942d CRs-Fixed: 2849487 --- .../blacklist_mgr/core/inc/wlan_blm_core.h | 10 ++- .../blacklist_mgr/core/inc/wlan_blm_main.h | 4 +- .../blacklist_mgr/core/src/wlan_blm_core.c | 73 ++++++++++++++++++- .../dispatcher/inc/wlan_blm_api.h | 14 +++- .../dispatcher/inc/wlan_blm_public_struct.h | 4 +- .../dispatcher/inc/wlan_blm_ucfg_api.h | 14 ++++ .../dispatcher/src/wlan_blm_ucfg_api.c | 8 +- core/hdd/src/wlan_hdd_cfg80211.c | 2 + 8 files changed, 123 insertions(+), 6 deletions(-) diff --git a/components/blacklist_mgr/core/inc/wlan_blm_core.h b/components/blacklist_mgr/core/inc/wlan_blm_core.h index ebd92a34eb51..9a85fc1b951a 100644 --- a/components/blacklist_mgr/core/inc/wlan_blm_core.h +++ b/components/blacklist_mgr/core/inc/wlan_blm_core.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2021 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 @@ -281,6 +281,14 @@ blm_get_bssid_reject_list(struct wlan_objmgr_pdev *pdev, uint8_t max_bssid_to_be_filled, enum blm_reject_ap_type reject_ap_type); +/** + * blm_dump_blacklist_bssid - Dump blacklisted bssids + * @pdev: pdev object + * + * Return: None + */ +void blm_dump_blacklist_bssid(struct wlan_objmgr_pdev *pdev); + /** * blm_get_rssi_blacklist_threshold() - Get rssi blacklist threshold value * @pdev: pdev object diff --git a/components/blacklist_mgr/core/inc/wlan_blm_main.h b/components/blacklist_mgr/core/inc/wlan_blm_main.h index fdcda80b87dc..dbe318131fd0 100644 --- a/components/blacklist_mgr/core/inc/wlan_blm_main.h +++ b/components/blacklist_mgr/core/inc/wlan_blm_main.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2019-2021 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 @@ -37,6 +37,8 @@ QDF_TRACE_INFO(QDF_MODULE_ID_BLACKLIST_MGR, params) #define blm_debug(params...)\ QDF_TRACE_DEBUG(QDF_MODULE_ID_BLACKLIST_MGR, params) +#define blm_nofl_debug(params...)\ + QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_BLACKLIST_MGR, params) /** * struct blm_pdev_priv_obj - Pdev priv struct to store list of blacklist mgr. diff --git a/components/blacklist_mgr/core/src/wlan_blm_core.c b/components/blacklist_mgr/core/src/wlan_blm_core.c index afd425e524d7..462c055da4dd 100644 --- a/components/blacklist_mgr/core/src/wlan_blm_core.c +++ b/components/blacklist_mgr/core/src/wlan_blm_core.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2021 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 @@ -733,6 +733,77 @@ blm_fill_rssi_reject_params(struct blm_reject_ap *blm_entry, blm_reject_list->reject_reason); } +static enum blm_reject_ap_type +blm_get_reject_ap_type(struct blm_reject_ap *blm_entry) +{ + if (BLM_IS_AP_AVOIDED_BY_USERSPACE(blm_entry)) + return USERSPACE_AVOID_TYPE; + if (BLM_IS_AP_BLACKLISTED_BY_USERSPACE(blm_entry)) + return USERSPACE_BLACKLIST_TYPE; + if (BLM_IS_AP_AVOIDED_BY_DRIVER(blm_entry)) + return DRIVER_AVOID_TYPE; + if (BLM_IS_AP_BLACKLISTED_BY_DRIVER(blm_entry)) + return DRIVER_BLACKLIST_TYPE; + if (BLM_IS_AP_IN_RSSI_REJECT_LIST(blm_entry)) + return DRIVER_RSSI_REJECT_TYPE; + if (BLM_IS_AP_IN_MONITOR_LIST(blm_entry)) + return DRIVER_MONITOR_TYPE; + + return REJECT_REASON_UNKNOWN; +} + +void blm_dump_blacklist_bssid(struct wlan_objmgr_pdev *pdev) +{ + struct blm_reject_ap *blm_entry = NULL; + qdf_list_node_t *cur_node = NULL, *next_node = NULL; + struct blm_pdev_priv_obj *blm_ctx; + struct blm_psoc_priv_obj *blm_psoc_obj; + uint32_t reject_duration; + enum blm_reject_ap_type reject_ap_type; + qdf_list_t *reject_db_list; + QDF_STATUS status; + + blm_ctx = blm_get_pdev_obj(pdev); + blm_psoc_obj = blm_get_psoc_obj(wlan_pdev_get_psoc(pdev)); + + if (!blm_ctx || !blm_psoc_obj) { + blm_err("blm_ctx or blm_psoc_obj is NULL"); + return; + } + + status = qdf_mutex_acquire(&blm_ctx->reject_ap_list_lock); + if (QDF_IS_STATUS_ERROR(status)) { + blm_err("failed to acquire reject_ap_list_lock"); + return; + } + + reject_db_list = &blm_ctx->reject_ap_list; + qdf_list_peek_front(reject_db_list, &cur_node); + while (cur_node) { + qdf_list_peek_next(reject_db_list, cur_node, &next_node); + + blm_entry = qdf_container_of(cur_node, struct blm_reject_ap, + node); + + reject_ap_type = blm_get_reject_ap_type(blm_entry); + + reject_duration = blm_get_delta_of_bssid( + reject_ap_type, blm_entry, + &blm_psoc_obj->blm_cfg); + + blm_nofl_debug("BLACKLIST BSSID %pM type %d retry delay %d expected RSSI %d", + blm_entry->bssid.bytes, + reject_ap_type, + reject_duration, + blm_entry->rssi_reject_params.expected_rssi); + + cur_node = next_node; + next_node = NULL; + } + + qdf_mutex_release(&blm_ctx->reject_ap_list_lock); +} + static void blm_fill_reject_list(qdf_list_t *reject_db_list, struct reject_ap_config_params *reject_list, uint8_t *num_of_reject_bssid, diff --git a/components/blacklist_mgr/dispatcher/inc/wlan_blm_api.h b/components/blacklist_mgr/dispatcher/inc/wlan_blm_api.h index 1757c8d85758..73928173fdc0 100644 --- a/components/blacklist_mgr/dispatcher/inc/wlan_blm_api.h +++ b/components/blacklist_mgr/dispatcher/inc/wlan_blm_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2019-2021 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 @@ -90,6 +90,18 @@ wlan_blm_get_bssid_reject_list(struct wlan_objmgr_pdev *pdev, reject_ap_type); } +/** + * wlan_blm_dump_blcklist_bssid() - dump the blacklisted BSSIDs from BLM + * @pdev: pdev object + * + * Return: None + */ +static inline void +wlan_blm_dump_blcklist_bssid(struct wlan_objmgr_pdev *pdev) +{ + return blm_dump_blacklist_bssid(pdev); +} + /** * wlan_blm_get_rssi_blacklist_threshold() - Get the RSSI blacklist threshold * @pdev: pdev object diff --git a/components/blacklist_mgr/dispatcher/inc/wlan_blm_public_struct.h b/components/blacklist_mgr/dispatcher/inc/wlan_blm_public_struct.h index 4eb8e34c4e6f..0a0d796d0924 100644 --- a/components/blacklist_mgr/dispatcher/inc/wlan_blm_public_struct.h +++ b/components/blacklist_mgr/dispatcher/inc/wlan_blm_public_struct.h @@ -63,6 +63,7 @@ struct blm_rssi_disallow_params { * @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. + * @REJECT_REASON_UNKNOWN: Rejection reason unknown */ enum blm_reject_ap_type { USERSPACE_AVOID_TYPE = 0, @@ -70,7 +71,8 @@ enum blm_reject_ap_type { DRIVER_AVOID_TYPE = 2, DRIVER_BLACKLIST_TYPE = 3, DRIVER_RSSI_REJECT_TYPE = 4, - DRIVER_MONITOR_TYPE = 5 + DRIVER_MONITOR_TYPE = 5, + REJECT_REASON_UNKNOWN = 6, }; /** diff --git a/components/blacklist_mgr/dispatcher/inc/wlan_blm_ucfg_api.h b/components/blacklist_mgr/dispatcher/inc/wlan_blm_ucfg_api.h index e4844bf212d1..9ab1b98d277c 100644 --- a/components/blacklist_mgr/dispatcher/inc/wlan_blm_ucfg_api.h +++ b/components/blacklist_mgr/dispatcher/inc/wlan_blm_ucfg_api.h @@ -105,6 +105,16 @@ 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_dump_black_list_ap() - get blacklisted bssid. + * @pdev: pdev object + * + * This API dumps blacklist ap + * + * Return: None + */ +void ucfg_blm_dump_black_list_ap(struct wlan_objmgr_pdev *pdev); + /** * ucfg_blm_update_bssid_connect_params() - Inform the BLM about connect or * disconnect with the current AP. @@ -175,6 +185,10 @@ QDF_STATUS ucfg_blm_psoc_close(struct wlan_objmgr_psoc *psoc) return QDF_STATUS_SUCCESS; } +static inline +void ucfg_blm_dump_black_list_ap(struct wlan_objmgr_pdev *pdev) +{} + static inline QDF_STATUS ucfg_blm_add_bssid_to_reject_list(struct wlan_objmgr_pdev *pdev, diff --git a/components/blacklist_mgr/dispatcher/src/wlan_blm_ucfg_api.c b/components/blacklist_mgr/dispatcher/src/wlan_blm_ucfg_api.c index 5ce6da9b0e89..9bda6af2272d 100644 --- a/components/blacklist_mgr/dispatcher/src/wlan_blm_ucfg_api.c +++ b/components/blacklist_mgr/dispatcher/src/wlan_blm_ucfg_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2019-2021 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 @@ -203,6 +203,12 @@ ucfg_blm_add_userspace_black_list(struct wlan_objmgr_pdev *pdev, num_of_bssid); } +void +ucfg_blm_dump_black_list_ap(struct wlan_objmgr_pdev *pdev) +{ + return wlan_blm_dump_blcklist_bssid(pdev); +} + void ucfg_blm_update_bssid_connect_params(struct wlan_objmgr_pdev *pdev, struct qdf_mac_addr bssid, diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index d5a5cdc2c220..11b5cb4139e0 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -20791,6 +20791,8 @@ static int __wlan_hdd_cfg80211_connect(struct wiphy *wiphy, else if (bssid_hint) bssid = bssid_hint; + ucfg_blm_dump_black_list_ap(hdd_ctx->pdev); + if (bssid && hdd_get_adapter_by_macaddr(hdd_ctx, (uint8_t *)bssid)) { hdd_err("adapter exist with same mac address " QDF_MAC_ADDR_FMT, QDF_MAC_ADDR_REF(bssid));