diff --git a/components/blacklist_mgr/core/inc/wlan_blm_core.h b/components/blacklist_mgr/core/inc/wlan_blm_core.h
index 0f3a071995fb..697c56f4b518 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-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2020 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
@@ -247,4 +247,15 @@ 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);
+
+/**
+ * blm_get_rssi_blacklist_threshold() - Get rssi blacklist threshold value
+ * @pdev: pdev object
+ *
+ * This API will get the RSSI blacklist threshold info.
+ *
+ * Return: rssi theshold value
+ */
+int32_t
+blm_get_rssi_blacklist_threshold(struct wlan_objmgr_pdev *pdev);
#endif
diff --git a/components/blacklist_mgr/core/inc/wlan_blm_main.h b/components/blacklist_mgr/core/inc/wlan_blm_main.h
index 7f3b43267a0b..7a290c06ecab 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 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-2020 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
@@ -61,12 +61,16 @@ struct blm_pdev_priv_obj {
* @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.
+ * @delta_rssi: This is the rssi threshold, only when rssi
+ * improves by this value the entry for BSSID should be removed from black
+ * list manager list.
*/
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;
+ uint32_t delta_rssi;
};
/**
diff --git a/components/blacklist_mgr/core/src/wlan_blm_core.c b/components/blacklist_mgr/core/src/wlan_blm_core.c
index f12eddd0b01b..40d28424bbc8 100644
--- a/components/blacklist_mgr/core/src/wlan_blm_core.c
+++ b/components/blacklist_mgr/core/src/wlan_blm_core.c
@@ -28,6 +28,7 @@
#define SECONDS_TO_MS(params) (params * 1000)
#define MINUTES_TO_MS(params) (SECONDS_TO_MS(params) * 60)
+#define RSSI_TIMEOUT_VALUE 60
static void
blm_update_ap_info(struct blm_reject_ap *blm_entry, struct blm_config *cfg,
@@ -94,7 +95,8 @@ blm_update_ap_info(struct blm_reject_ap *blm_entry, struct blm_config *cfg,
qdf_time_t entry_age = cur_timestamp -
blm_entry->ap_timestamp.rssi_reject_timestamp;
- if ((entry_age > blm_entry->rssi_reject_params.retry_delay) ||
+ if ((blm_entry->rssi_reject_params.retry_delay &&
+ entry_age > blm_entry->rssi_reject_params.retry_delay) ||
(scan_entry && (scan_entry->rssi_raw > blm_entry->
rssi_reject_params.expected_rssi))) {
/*
@@ -421,7 +423,7 @@ blm_get_delta_of_bssid(enum blm_reject_ap_type list_type,
struct blm_config *cfg)
{
qdf_time_t cur_timestamp = qdf_mc_timer_get_system_time();
-
+ int32_t disallowed_time;
/*
* For all the list types, delta would be the entry age only. Hence the
* oldest entry would be removed first in case of list is full, and the
@@ -451,9 +453,16 @@ blm_get_delta_of_bssid(enum blm_reject_ap_type list_type,
* de-blacklisting the AP from rssi reject list.
*/
case DRIVER_RSSI_REJECT_TYPE:
- return blm_entry->rssi_reject_params.retry_delay -
- (cur_timestamp -
- blm_entry->ap_timestamp.rssi_reject_timestamp);
+ if (blm_entry->rssi_reject_params.retry_delay) {
+ return blm_entry->rssi_reject_params.retry_delay -
+ (cur_timestamp -
+ blm_entry->ap_timestamp.rssi_reject_timestamp);
+ } else {
+ disallowed_time = (int32_t)(MINUTES_TO_MS(RSSI_TIMEOUT_VALUE) -
+ (cur_timestamp -
+ blm_entry->ap_timestamp.rssi_reject_timestamp));
+ return ((disallowed_time < 0) ? 0 : disallowed_time);
+ }
case DRIVER_MONITOR_TYPE:
return cur_timestamp -
blm_entry->ap_timestamp.driver_monitor_timestamp;
@@ -1054,3 +1063,22 @@ blm_update_bssid_connect_params(struct wlan_objmgr_pdev *pdev,
qdf_mutex_release(&blm_ctx->reject_ap_list_lock);
}
+
+int32_t blm_get_rssi_blacklist_threshold(struct wlan_objmgr_pdev *pdev)
+{
+ struct blm_pdev_priv_obj *blm_ctx;
+ struct blm_psoc_priv_obj *blm_psoc_obj;
+ struct blm_config *cfg;
+
+ 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 0;
+ }
+
+ cfg = &blm_psoc_obj->blm_cfg;
+ return cfg->delta_rssi;
+}
+
diff --git a/components/blacklist_mgr/core/src/wlan_blm_main.c b/components/blacklist_mgr/core/src/wlan_blm_main.c
index 003150b5c149..f965683c29d4 100644
--- a/components/blacklist_mgr/core/src/wlan_blm_main.c
+++ b/components/blacklist_mgr/core/src/wlan_blm_main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-2020 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
@@ -167,6 +167,8 @@ blm_init_cfg(struct wlan_objmgr_psoc *psoc, struct blm_config *blm_cfg)
cfg_get(psoc, CFG_BAD_BSSID_RESET_TIME);
blm_cfg->bad_bssid_counter_thresh =
cfg_get(psoc, CFG_BAD_BSSID_COUNTER_THRESHOLD);
+ blm_cfg->delta_rssi =
+ cfg_get(psoc, CFG_BLACKLIST_RSSI_THRESHOLD);
}
QDF_STATUS
diff --git a/components/blacklist_mgr/dispatcher/inc/wlan_cfg_blm.h b/components/blacklist_mgr/dispatcher/inc/wlan_cfg_blm.h
index bf7abac33cad..47de605e12a9 100644
--- a/components/blacklist_mgr/dispatcher/inc/wlan_cfg_blm.h
+++ b/components/blacklist_mgr/dispatcher/inc/wlan_cfg_blm.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-2020 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
@@ -132,11 +132,39 @@
CFG_VALUE_OR_DEFAULT, \
"bad bssid reset time")
+/*
+ *
+ * delta_rssi - RSSI threshold value, only when AP rssi improves
+ * by threshold value entry would be removed from blacklist manager and assoc
+ * req would be sent by FW.
+ * @Min: 0
+ * @Max: 10
+ * @Default: 5
+ *
+ * This ini is used to specify the rssi threshold value, after rssi improves
+ * by threshold the BSSID which is in the blacklist manager list should be
+ * removed from the respective list.
+ *
+ * Supported Feature: Customer requirement
+ *
+ * Usage: Internal/External
+ *
+ *
+ */
+#define CFG_BLACKLIST_RSSI_THRESHOLD CFG_INI_INT( \
+ "delta_rssi", \
+ 0, \
+ 10, \
+ 5, \
+ CFG_VALUE_OR_DEFAULT, \
+ "Configure delta RSSI")
+
#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)
+ CFG(CFG_BAD_BSSID_RESET_TIME) \
+ CFG(CFG_BLACKLIST_RSSI_THRESHOLD)
#else
diff --git a/core/mac/inc/sir_mac_prot_def.h b/core/mac/inc/sir_mac_prot_def.h
index d2569ed4fcf2..a0efa2d71d3f 100644
--- a/core/mac/inc/sir_mac_prot_def.h
+++ b/core/mac/inc/sir_mac_prot_def.h
@@ -479,6 +479,8 @@ typedef enum eSirMacReasonCodes {
eSIR_MAC_PEER_TIMEDOUT_REASON = 39, /* Requested from peer STA due to timeout */
eSIR_MAC_CIPHER_NOT_SUPPORTED_REASON = 45, /* Peer STA does not support the requested cipher suite */
eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON = 46, /* FT reason */
+ eSIR_MAC_POOR_RSSI_CONDITIONS = 71, /* Disassociated due to poor RSSI conditions */
+
/* reserved 47 - 65535. */
/*
diff --git a/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c b/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c
index 6702cf756953..9e2a70172124 100644
--- a/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c
+++ b/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c
@@ -41,6 +41,7 @@
#include "lim_ser_des_utils.h"
#include "lim_send_messages.h"
#include "lim_process_fils.h"
+#include "wlan_blm_core.h"
/**
* lim_update_stads_htcap() - Updates station Descriptor HT capability
@@ -795,11 +796,17 @@ lim_process_assoc_rsp_frame(struct mac_context *mac_ctx,
assoc_rsp->rssi_assoc_rej.present) {
struct sir_rssi_disallow_lst ap_info = {{0}};
+ if (!assoc_rsp->rssi_assoc_rej.retry_delay)
+ ap_info.expected_rssi = assoc_rsp->rssi_assoc_rej.delta_rssi +
+ WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info) +
+ blm_get_rssi_blacklist_threshold(mac_ctx->pdev);
+ else
+ ap_info.expected_rssi = assoc_rsp->rssi_assoc_rej.delta_rssi +
+ WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info);
+
ap_info.retry_delay = assoc_rsp->rssi_assoc_rej.retry_delay *
QDF_MC_TIMER_TO_MS_UNIT;
qdf_mem_copy(ap_info.bssid.bytes, hdr->sa, QDF_MAC_ADDR_SIZE);
- ap_info.expected_rssi = assoc_rsp->rssi_assoc_rej.delta_rssi +
- WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info);
lim_add_bssid_to_reject_list(mac_ctx->pdev, &ap_info);
}
if (assoc_rsp->status_code != eSIR_MAC_SUCCESS_STATUS) {
diff --git a/core/mac/src/pe/lim/lim_process_disassoc_frame.c b/core/mac/src/pe/lim/lim_process_disassoc_frame.c
index d6afd50d76bf..e31088395baf 100644
--- a/core/mac/src/pe/lim/lim_process_disassoc_frame.c
+++ b/core/mac/src/pe/lim/lim_process_disassoc_frame.c
@@ -41,6 +41,7 @@
#include "lim_ser_des_utils.h"
#include "lim_send_messages.h"
#include "sch_api.h"
+#include "wlan_blm_core.h"
/**
* lim_process_disassoc_frame
@@ -246,6 +247,7 @@ lim_process_disassoc_frame(struct mac_context *mac, uint8_t *pRxPacketInfo,
switch (reasonCode) {
case eSIR_MAC_DEAUTH_LEAVING_BSS_REASON:
case eSIR_MAC_DISASSOC_LEAVING_BSS_REASON:
+ case eSIR_MAC_POOR_RSSI_CONDITIONS:
/* Valid reasonCode in received Disassociation frame */
/* as long as we're not about to channel switch */
if (pe_session->gLimChannelSwitch.state !=
@@ -299,6 +301,15 @@ lim_process_disassoc_frame(struct mac_context *mac, uint8_t *pRxPacketInfo,
} /* if (sta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE) */
+ if (reasonCode == eSIR_MAC_POOR_RSSI_CONDITIONS) {
+ struct sir_rssi_disallow_lst ap_info = {{0}};
+
+ ap_info.retry_delay = 0;
+ ap_info.expected_rssi = frame_rssi +
+ blm_get_rssi_blacklist_threshold(mac->pdev);
+ qdf_mem_copy(ap_info.bssid.bytes, pHdr->sa, QDF_MAC_ADDR_SIZE);
+ lim_add_bssid_to_reject_list(mac->pdev, &ap_info);
+ }
lim_extract_ies_from_deauth_disassoc(pe_session, (uint8_t *)pHdr,
WMA_GET_RX_MPDU_LEN(pRxPacketInfo));
lim_perform_disassoc(mac, frame_rssi, reasonCode,
diff --git a/core/mac/src/pe/lim/lim_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c
index 0f779744fd82..c919ebe8176e 100644
--- a/core/mac/src/pe/lim/lim_process_sme_req_messages.c
+++ b/core/mac/src/pe/lim/lim_process_sme_req_messages.c
@@ -6199,10 +6199,19 @@ void lim_add_roam_blacklist_ap(struct mac_context *mac_ctx,
for (i = 0; i < src_lst->num_entries; i++) {
entry.bssid = blacklist->bssid;
- entry.retry_delay = blacklist->timeout;
entry.time_during_rejection = blacklist->received_time;
- /* set 0dbm as expected rssi for btm blaclisted entries */
- entry.expected_rssi = LIM_MIN_RSSI;
+ /* If timeout = 0 and rssi = 0 ignore the entry */
+ if (!blacklist->timeout && !blacklist->rssi) {
+ continue;
+ } else if (blacklist->timeout) {
+ entry.retry_delay = blacklist->timeout;
+ /* set 0dbm as expected rssi */
+ entry.expected_rssi = LIM_MIN_RSSI;
+ } else {
+ /* blacklist timeout as 0 */
+ entry.retry_delay = blacklist->timeout;
+ entry.expected_rssi = blacklist->rssi;
+ }
/* Add this bssid to the rssi reject ap type in blacklist mgr */
lim_add_bssid_to_reject_list(mac_ctx->pdev, &entry);
diff --git a/core/wma/inc/wma_if.h b/core/wma/inc/wma_if.h
index 293debaf4b4e..f506eefd52b1 100644
--- a/core/wma/inc/wma_if.h
+++ b/core/wma/inc/wma_if.h
@@ -774,11 +774,13 @@ typedef struct sStatsExtRequest {
* @bssid - bssid that is to be blacklisted
* @timeout - time duration for which the bssid is blacklisted
* @received_time - boot timestamp at which the firmware event was received
+ * @rssi - rssi value for which the bssid is blacklisted
*/
struct roam_blacklist_timeout {
struct qdf_mac_addr bssid;
uint32_t timeout;
qdf_time_t received_time;
+ int32_t rssi;
};
/*
diff --git a/core/wma/src/wma_scan_roam.c b/core/wma/src/wma_scan_roam.c
index 80f2f98e316e..c649fc17e209 100644
--- a/core/wma/src/wma_scan_roam.c
+++ b/core/wma/src/wma_scan_roam.c
@@ -80,6 +80,7 @@
#include
#include
#include
+#include "wlan_blm_core.h"
#ifdef FEATURE_WLAN_DIAG_SUPPORT /* FEATURE_WLAN_DIAG_SUPPORT */
#include "host_diag_core_log.h"
@@ -1426,6 +1427,7 @@ static QDF_STATUS wma_roam_scan_filter(tp_wma_handle wma_handle,
params->num_ssid_white_list = num_ssid_white_list;
params->num_bssid_preferred_list = num_bssid_preferred_list;
params->num_rssi_rejection_ap = num_rssi_rejection_ap;
+ params->delta_rssi = blm_get_rssi_blacklist_threshold(wma_handle->pdev);
qdf_mem_copy(params->bssid_avoid_list, roam_params->bssid_avoid_list,
MAX_BSSID_AVOID_LIST * sizeof(struct qdf_mac_addr));