qcacld-3.0: wma to target_if migration of btm_blacklist_event

Currently, wmi_roam_blacklist_event_id data is extracted and
processing is also done in wma. This is not inline with component
model where target_if takes care of data extraction and handover
the extracted data to corresponding component(connection mgr in
this case). Add changes to support the same.

Change-Id: I41d2ef6c228acd8f86f24107c02d11f1a8ac6dea
CRs-Fixed: 2990369
This commit is contained in:
Srinivas Dasari
2021-07-19 16:33:44 +05:30
committed by Madan Koyyalamudi
parent a3c80b5790
commit cb5b2dde46
15 changed files with 338 additions and 6 deletions

View File

@@ -57,6 +57,7 @@ target_if_cm_roam_register_rx_ops(struct wlan_cm_roam_rx_ops *rx_ops)
rx_ops->roam_sync_event = cm_roam_sync_event_handler;
rx_ops->roam_sync_frame_event = cm_roam_sync_frame_event_handler;
rx_ops->roam_event_rx = cm_roam_event_handler;
rx_ops->btm_blacklist_event = cm_btm_blacklist_event_handler;
#endif
}
@@ -209,6 +210,48 @@ err:
return status;
}
static int
target_if_cm_btm_blacklist_event(ol_scn_t scn, uint8_t *event, uint32_t len)
{
QDF_STATUS qdf_status;
int status = 0;
struct roam_blacklist_event *dst_list = NULL;
struct wmi_unified *wmi_handle;
struct wlan_objmgr_psoc *psoc;
struct wlan_cm_roam_rx_ops *roam_rx_ops;
psoc = target_if_get_psoc_from_scn_hdl(scn);
if (!psoc) {
target_if_err("psoc is null");
return -EINVAL;
}
wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle) {
target_if_err("wmi_handle is null");
return -EINVAL;
}
qdf_status = wmi_extract_btm_blacklist_event(wmi_handle, event, len,
&dst_list);
if (QDF_IS_STATUS_ERROR(qdf_status)) {
target_if_err("parsing of event failed, %d", qdf_status);
return -EINVAL;
}
roam_rx_ops = target_if_cm_get_roam_rx_ops(psoc);
if (!roam_rx_ops || !roam_rx_ops->btm_blacklist_event) {
target_if_err("No valid roam rx ops");
qdf_mem_free(dst_list);
return -EINVAL;
}
qdf_status = roam_rx_ops->btm_blacklist_event(psoc, dst_list);
if (QDF_IS_STATUS_ERROR(qdf_status))
status = -EINVAL;
return status;
}
QDF_STATUS
target_if_roam_offload_register_events(struct wlan_objmgr_psoc *psoc)
{
@@ -247,6 +290,16 @@ target_if_roam_offload_register_events(struct wlan_objmgr_psoc *psoc)
return QDF_STATUS_E_FAILURE;
}
ret = wmi_unified_register_event_handler(handle,
wmi_roam_blacklist_event_id,
target_if_cm_btm_blacklist_event,
WMI_RX_SERIALIZER_CTX);
if (QDF_IS_STATUS_ERROR(ret)) {
target_if_err("wmi event(%u) registration failed, ret: %d",
wmi_roam_blacklist_event_id, ret);
return QDF_STATUS_E_FAILURE;
}
return QDF_STATUS_SUCCESS;
}
#endif

View File

@@ -1128,5 +1128,16 @@ void cm_handle_roam_reason_suitable_ap(uint8_t vdev_id, uint32_t rssi);
*/
QDF_STATUS
cm_roam_event_handler(struct roam_offload_roam_event roam_event);
/**
* cm_btm_blacklist_event_handler() - Black list the given BSSID due to btm
* @psoc: PSOC pointer
* @list: Roam blacklist info
*
* Return: QDF_STATUS
*/
QDF_STATUS
cm_btm_blacklist_event_handler(struct wlan_objmgr_psoc *psoc,
struct roam_blacklist_event *list);
#endif
#endif /* WLAN_CM_ROAM_API_H__ */

View File

@@ -1777,6 +1777,40 @@ enum roam_reason {
ROAM_REASON_DEAUTH,
};
#ifdef ROAM_TARGET_IF_CONVERGENCE
/*
* struct roam_blacklist_timeout - BTM blacklist entry
* @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
* @reject_reason: reason to add the BSSID to BLM
* @original_timeout: original timeout sent by the AP
* @source: Source of adding the BSSID to BLM
*/
struct roam_blacklist_timeout {
struct qdf_mac_addr bssid;
uint32_t timeout;
qdf_time_t received_time;
int32_t rssi;
enum blm_reject_ap_reason reject_reason;
uint32_t original_timeout;
enum blm_reject_ap_source source;
};
/*
* struct roam_blacklist_event - Blacklist event entries destination structure
* @vdev_id: vdev id
* @num_entries: total entries sent over the event
* @roam_blacklist: blacklist details
*/
struct roam_blacklist_event {
uint8_t vdev_id;
uint32_t num_entries;
struct roam_blacklist_timeout roam_blacklist[];
};
#endif
/**
* struct roam_offload_roam_event: Data carried by roam event
* @vdev_id: vdev id
@@ -1848,6 +1882,7 @@ struct wlan_cm_roam_tx_ops {
* @roam_sync_event: RX ops function pointer for roam sync event
* @roam_sync_frame_event: Rx ops function pointer for roam sync frame event
* @roam_event_rx: Rx ops function pointer for roam info event
* @btm_blacklist_event: Rx ops function pointer for btm blacklist event
*/
struct wlan_cm_roam_rx_ops {
QDF_STATUS (*roam_sync_event)(struct wlan_objmgr_psoc *psoc,
@@ -1857,6 +1892,10 @@ struct wlan_cm_roam_rx_ops {
QDF_STATUS (*roam_sync_frame_event)(struct wlan_objmgr_psoc *psoc,
struct roam_synch_frame_ind *frm);
QDF_STATUS (*roam_event_rx)(struct roam_offload_roam_event roam_event);
#ifdef ROAM_TARGET_IF_CONVERGENCE
QDF_STATUS (*btm_blacklist_event)(struct wlan_objmgr_psoc *psoc,
struct roam_blacklist_event *list);
#endif
};
/**

View File

@@ -30,9 +30,13 @@
#include <wlan_cm_api.h>
#include "connection_mgr/core/src/wlan_cm_roam.h"
#include "wlan_cm_roam_api.h"
#include "wlan_blm_api.h"
/* Support for "Fast roaming" (i.e., ESE, LFR, or 802.11r.) */
#define BG_SCAN_OCCUPIED_CHANNEL_LIST_LEN 15
#ifdef ROAM_TARGET_IF_CONVERGENCE
#define CM_MIN_RSSI 0 /* 0dbm */
#endif
#if defined(WLAN_FEATURE_HOST_ROAM) || defined(WLAN_FEATURE_ROAM_OFFLOAD)
QDF_STATUS
@@ -2049,4 +2053,78 @@ cm_roam_event_handler(struct roam_offload_roam_event roam_event)
return QDF_STATUS_SUCCESS;
}
static void
cm_add_bssid_to_reject_list(struct wlan_objmgr_pdev *pdev,
struct sir_rssi_disallow_lst *entry)
{
struct reject_ap_info ap_info = {0};
ap_info.bssid = entry->bssid;
ap_info.reject_ap_type = DRIVER_RSSI_REJECT_TYPE;
ap_info.rssi_reject_params.expected_rssi = entry->expected_rssi;
ap_info.rssi_reject_params.retry_delay = entry->retry_delay;
ap_info.reject_reason = entry->reject_reason;
ap_info.source = entry->source;
ap_info.rssi_reject_params.received_time = entry->received_time;
ap_info.rssi_reject_params.original_timeout = entry->original_timeout;
/* Add this ap info to the rssi reject ap type in blacklist manager */
wlan_blm_add_bssid_to_reject_list(pdev, &ap_info);
}
QDF_STATUS
cm_btm_blacklist_event_handler(struct wlan_objmgr_psoc *psoc,
struct roam_blacklist_event *list)
{
uint32_t i, pdev_id;
struct sir_rssi_disallow_lst entry;
struct roam_blacklist_timeout *blacklist;
struct wlan_objmgr_pdev *pdev;
pdev_id = wlan_get_pdev_id_from_vdev_id(psoc, list->vdev_id,
WLAN_MLME_CM_ID);
if (pdev_id == WLAN_INVALID_PDEV_ID) {
mlme_err("Invalid pdev id");
return QDF_STATUS_E_INVAL;
}
pdev = wlan_objmgr_get_pdev_by_id(psoc, pdev_id, WLAN_MLME_CM_ID);
if (!pdev) {
mlme_err("Invalid pdev");
return QDF_STATUS_E_INVAL;
}
mlme_debug("Received Blacklist event from FW num entries %d",
list->num_entries);
blacklist = &list->roam_blacklist[0];
for (i = 0; i < list->num_entries; i++) {
qdf_mem_zero(&entry, sizeof(struct sir_rssi_disallow_lst));
entry.bssid = blacklist->bssid;
entry.time_during_rejection = blacklist->received_time;
entry.reject_reason = blacklist->reject_reason;
entry.source = blacklist->source ? blacklist->source :
ADDED_BY_TARGET;
entry.original_timeout = blacklist->original_timeout;
entry.received_time = blacklist->received_time;
/* 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 = CM_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 */
cm_add_bssid_to_reject_list(pdev, &entry);
blacklist++;
}
wlan_objmgr_pdev_release_ref(pdev, WLAN_MLME_CM_ID);
return QDF_STATUS_SUCCESS;
}
#endif

View File

@@ -278,6 +278,20 @@ QDF_STATUS
wmi_extract_roam_event(wmi_unified_t wmi_handle, uint8_t *event,
uint32_t data_len,
struct roam_offload_roam_event *roam_event);
/**
* wmi_extract_btm_blacklist_event - Extract btm blacklist event
* @wmi_handle: WMI handle
* @event: Event data received from firmware
* @data_len: Event data length received from firmware
* @dst_list: Extract the event and fill in dst_list
*
* Return: QDF_STATUS
*/
QDF_STATUS
wmi_extract_btm_blacklist_event(wmi_unified_t wmi_handle,
uint8_t *event, uint32_t data_len,
struct roam_blacklist_event **dst_list);
#endif /* ROAM_TARGET_IF_CONVERGENCE */
#endif /* WLAN_FEATURE_ROAM_OFFLOAD */

View File

@@ -378,5 +378,18 @@ wmi_extract_roam_event(wmi_unified_t wmi_handle, uint8_t *event,
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS
wmi_extract_btm_blacklist_event(wmi_unified_t wmi_handle,
uint8_t *event, uint32_t data_len,
struct roam_blacklist_event **dst_list)
{
if (wmi_handle->ops->extract_btm_bl_event)
return wmi_handle->ops->extract_btm_bl_event(wmi_handle,
event,
data_len,
dst_list);
return QDF_STATUS_E_FAILURE;
}
#endif /* ROAM_TARGET_IF_CONVERGENCE */
#endif

View File

@@ -2068,6 +2068,115 @@ end:
}
#endif
#ifdef ROAM_TARGET_IF_CONVERGENCE
static enum blm_reject_ap_reason wmi_get_reject_reason(uint32_t reason)
{
switch (reason) {
case WMI_BL_REASON_NUD_FAILURE:
return REASON_NUD_FAILURE;
case WMI_BL_REASON_STA_KICKOUT:
return REASON_STA_KICKOUT;
case WMI_BL_REASON_ROAM_HO_FAILURE:
return REASON_ROAM_HO_FAILURE;
case WMI_BL_REASON_ASSOC_REJECT_POOR_RSSI:
return REASON_ASSOC_REJECT_POOR_RSSI;
case WMI_BL_REASON_ASSOC_REJECT_OCE:
return REASON_ASSOC_REJECT_OCE;
case WMI_BL_REASON_USERSPACE_BL:
return REASON_USERSPACE_BL;
case WMI_BL_REASON_USERSPACE_AVOID_LIST:
return REASON_USERSPACE_AVOID_LIST;
case WMI_BL_REASON_BTM_DIASSOC_IMMINENT:
return REASON_BTM_DISASSOC_IMMINENT;
case WMI_BL_REASON_BTM_BSS_TERMINATION:
return REASON_BTM_BSS_TERMINATION;
case WMI_BL_REASON_BTM_MBO_RETRY:
return REASON_BTM_MBO_RETRY;
case WMI_BL_REASON_REASSOC_RSSI_REJECT:
return REASON_REASSOC_RSSI_REJECT;
case WMI_BL_REASON_REASSOC_NO_MORE_STAS:
return REASON_REASSOC_NO_MORE_STAS;
default:
return REASON_UNKNOWN;
}
}
static QDF_STATUS
extract_btm_blacklist_event(wmi_unified_t wmi_handle,
uint8_t *event, uint32_t len,
struct roam_blacklist_event **list)
{
WMI_ROAM_BLACKLIST_EVENTID_param_tlvs *param_buf;
wmi_roam_blacklist_event_fixed_param *resp_event;
wmi_roam_blacklist_with_timeout_tlv_param *src_list;
struct roam_blacklist_timeout *roam_blacklist;
struct roam_blacklist_event *dst_list;
uint32_t num_entries, i;
param_buf = (WMI_ROAM_BLACKLIST_EVENTID_param_tlvs *)event;
if (!param_buf) {
wmi_err("Invalid event buffer");
return QDF_STATUS_E_INVAL;
}
resp_event = param_buf->fixed_param;
if (!resp_event) {
wmi_err("received null event data from target");
return QDF_STATUS_E_INVAL;
}
if (resp_event->vdev_id >= WLAN_MAX_VDEVS) {
wmi_err("received invalid vdev_id %d", resp_event->vdev_id);
return QDF_STATUS_E_INVAL;
}
num_entries = param_buf->num_blacklist_with_timeout;
if (num_entries == 0) {
/* no aps to blacklist just return*/
wmi_err("No APs in blacklist received");
return QDF_STATUS_SUCCESS;
}
if (num_entries > MAX_RSSI_AVOID_BSSID_LIST) {
wmi_err("num blacklist entries:%d exceeds maximum value",
num_entries);
return QDF_STATUS_E_INVAL;
}
src_list = param_buf->blacklist_with_timeout;
if (len < (sizeof(*resp_event) + (num_entries * sizeof(*src_list)))) {
wmi_err("Invalid length:%d", len);
return QDF_STATUS_E_INVAL;
}
dst_list = qdf_mem_malloc(sizeof(struct roam_blacklist_event) +
(sizeof(struct roam_blacklist_timeout) *
num_entries));
if (!dst_list)
return QDF_STATUS_E_NOMEM;
dst_list->vdev_id = resp_event->vdev_id;
roam_blacklist = &dst_list->roam_blacklist[0];
for (i = 0; i < num_entries; i++) {
WMI_MAC_ADDR_TO_CHAR_ARRAY(&src_list->bssid,
roam_blacklist->bssid.bytes);
roam_blacklist->timeout = src_list->timeout;
roam_blacklist->received_time = src_list->timestamp;
roam_blacklist->original_timeout = src_list->original_timeout;
roam_blacklist->reject_reason =
wmi_get_reject_reason(src_list->reason);
roam_blacklist->source = src_list->source;
roam_blacklist++;
src_list++;
}
dst_list->num_entries = num_entries;
*list = dst_list;
return QDF_STATUS_SUCCESS;
}
#endif
void wmi_roam_offload_attach_tlv(wmi_unified_t wmi_handle)
{
struct wmi_ops *ops = wmi_handle->ops;
@@ -2080,6 +2189,7 @@ void wmi_roam_offload_attach_tlv(wmi_unified_t wmi_handle)
ops->extract_roam_sync_event = extract_roam_sync_event_tlv;
ops->extract_roam_sync_frame_event = extract_roam_sync_frame_event_tlv;
ops->extract_roam_event = extract_roam_event_tlv;
ops->extract_btm_bl_event = extract_btm_blacklist_event;
#endif /* ROAM_TARGET_IF_CONVERGENCE */
ops->send_set_ric_req_cmd = send_set_ric_req_cmd_tlv;
ops->send_process_roam_synch_complete_cmd =

View File

@@ -617,7 +617,9 @@ enum halmsgtype {
SIR_HAL_SEND_BCN_RSP = (SIR_HAL_ITC_MSG_TYPES_BEGIN + 401),
SIR_HAL_CFG_VENDOR_ACTION_TB_PPDU = (SIR_HAL_ITC_MSG_TYPES_BEGIN + 402),
SIR_HAL_BEACON_DEBUG_STATS_REQ = (SIR_HAL_ITC_MSG_TYPES_BEGIN + 403),
#ifndef ROAM_TARGET_IF_CONVERGENCE
SIR_HAL_ROAM_BLACKLIST_MSG = (SIR_HAL_ITC_MSG_TYPES_BEGIN + 404),
#endif
#ifdef WLAN_FEATURE_MOTION_DETECTION
SIR_HAL_SET_MOTION_DET_CONFIG = (SIR_HAL_ITC_MSG_TYPES_BEGIN + 405),

View File

@@ -2086,6 +2086,7 @@ static void lim_process_messages(struct mac_context *mac_ctx,
qdf_mem_free((void *)msg->bodyptr);
msg->bodyptr = NULL;
break;
#ifndef ROAM_TARGET_IF_CONVERGENCE
case WMA_ROAM_BLACKLIST_MSG:
lim_add_roam_blacklist_ap(mac_ctx,
(struct roam_blacklist_event *)
@@ -2093,6 +2094,7 @@ static void lim_process_messages(struct mac_context *mac_ctx,
qdf_mem_free((void *)msg->bodyptr);
msg->bodyptr = NULL;
break;
#endif
case SIR_LIM_PROCESS_DEFERRED_QUEUE:
break;
case CM_BSS_PEER_CREATE_REQ:

View File

@@ -8994,6 +8994,7 @@ void lim_continue_sta_csa_req(struct mac_context *mac_ctx, uint8_t vdev_id)
lim_process_channel_switch(mac_ctx, vdev_id);
}
#ifndef ROAM_TARGET_IF_CONVERGENCE
void lim_add_roam_blacklist_ap(struct mac_context *mac_ctx,
struct roam_blacklist_event *src_lst)
{
@@ -9031,3 +9032,4 @@ void lim_add_roam_blacklist_ap(struct mac_context *mac_ctx,
blacklist++;
}
}
#endif

View File

@@ -120,7 +120,9 @@ enum mlmmsgtype {
#define MGMT_TX_USE_INCORRECT_KEY BIT(0)
#define LIM_DOS_PROTECTION_TIME 1000 //1000ms
#ifndef ROAM_TARGET_IF_CONVERGENCE
#define LIM_MIN_RSSI 0 /* 0dbm */
#endif
/* enums used by LIM are as follows */
enum eLimDisassocTrigger {
@@ -1237,6 +1239,7 @@ QDF_STATUS lim_process_sme_del_all_tdls_peers(struct mac_context *p_mac,
*/
void lim_send_bcn_rsp(struct mac_context *mac_ctx, tpSendbeaconParams rsp);
#ifndef ROAM_TARGET_IF_CONVERGENCE
/**
* lim_add_roam_blacklist_ap() - handle the blacklist bssid list received from
* firmware
@@ -1247,6 +1250,7 @@ void lim_send_bcn_rsp(struct mac_context *mac_ctx, tpSendbeaconParams rsp);
*/
void lim_add_roam_blacklist_ap(struct mac_context *mac_ctx,
struct roam_blacklist_event *src_lst);
#endif
/**
* lim_process_rx_channel_status_event() - processes

View File

@@ -772,6 +772,7 @@ typedef struct sStatsExtRequest {
} tStatsExtRequest, *tpStatsExtRequest;
#endif /* WLAN_FEATURE_STATS_EXT */
#ifndef ROAM_TARGET_IF_CONVERGENCE
/*
* struct roam_blacklist_timeout - BTM blacklist entry
* @bssid - bssid that is to be blacklisted
@@ -801,4 +802,5 @@ struct roam_blacklist_event {
uint32_t num_entries;
struct roam_blacklist_timeout roam_blacklist[];
};
#endif
#endif /* _HALMSGAPI_H_ */

View File

@@ -131,7 +131,6 @@ enum wmamsgtype {
WMA_SEND_BEACON_REQ = SIR_HAL_SEND_BEACON_REQ,
WMA_SEND_BCN_RSP = SIR_HAL_SEND_BCN_RSP,
WMA_SEND_PROBE_RSP_TMPL = SIR_HAL_SEND_PROBE_RSP_TMPL,
WMA_ROAM_BLACLIST_MSG = SIR_HAL_ROAM_BLACKLIST_MSG,
WMA_SEND_PEER_UNMAP_CONF = SIR_HAL_SEND_PEER_UNMAP_CONF,
WMA_SET_BSSKEY_RSP = SIR_HAL_SET_BSSKEY_RSP,
@@ -397,7 +396,9 @@ enum wmamsgtype {
WMA_POWER_DEBUG_STATS_REQ = SIR_HAL_POWER_DEBUG_STATS_REQ,
WMA_BEACON_DEBUG_STATS_REQ = SIR_HAL_BEACON_DEBUG_STATS_REQ,
WMA_GET_RCPI_REQ = SIR_HAL_GET_RCPI_REQ,
#ifndef ROAM_TARGET_IF_CONVERGENCE
WMA_ROAM_BLACKLIST_MSG = SIR_HAL_ROAM_BLACKLIST_MSG,
#endif
WMA_SET_DBS_SCAN_SEL_CONF_PARAMS = SIR_HAL_SET_DBS_SCAN_SEL_PARAMS,
WMA_SET_WOW_PULSE_CMD = SIR_HAL_SET_WOW_PULSE_CMD,

View File

@@ -3348,6 +3348,10 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc,
wmi_roam_synch_frame_event_id,
wma_roam_synch_frame_event_handler,
WMA_RX_SERIALIZER_CTX);
wmi_unified_register_event_handler(wma_handle->wmi_handle,
wmi_roam_blacklist_event_id,
wma_handle_btm_blacklist_event,
WMA_RX_SERIALIZER_CTX);
#endif /* ROAM_TARGET_IF_CONVERGENCE */
wmi_unified_register_event_handler(wma_handle->wmi_handle,
wmi_roam_auth_offload_event_id,
@@ -3364,11 +3368,6 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc,
wma_roam_scan_chan_list_event_handler,
WMA_RX_SERIALIZER_CTX);
wmi_unified_register_event_handler(wma_handle->wmi_handle,
wmi_roam_blacklist_event_id,
wma_handle_btm_blacklist_event,
WMA_RX_SERIALIZER_CTX);
wma_register_pmkid_req_event_handler(wma_handle);
wmi_unified_register_event_handler(wma_handle->wmi_handle,

View File

@@ -4682,6 +4682,7 @@ QDF_STATUS wma_send_ht40_obss_scanind(tp_wma_handle wma,
return status;
}
#ifndef ROAM_TARGET_IF_CONVERGENCE
static enum blm_reject_ap_reason wma_get_reject_reason(uint32_t reason)
{
switch(reason) {
@@ -4785,6 +4786,7 @@ int wma_handle_btm_blacklist_event(void *handle, uint8_t *cmd_param_info,
wma_send_msg(wma, WMA_ROAM_BLACKLIST_MSG, (void *)dst_list, 0);
return 0;
}
#endif
#if defined(WLAN_FEATURE_ROAM_OFFLOAD) && defined(WLAN_FEATURE_FIPS)
void wma_register_pmkid_req_event_handler(tp_wma_handle wma_handle)