From 29aa34ddea1139396452460892faa28e756cabe6 Mon Sep 17 00:00:00 2001 From: gaurank kathpalia Date: Mon, 17 Feb 2020 17:18:10 +0530 Subject: [PATCH] qcacld-3.0: Disconnect after roam fails in NUD fail case Extend ini value to disconnect from current AP if roam failure happens after the NUD failure. Change-Id: Id764c97b5c1748b1d513d85d4063868a1c77141b CRs-Fixed: 2622087 --- core/hdd/inc/hdd_dp_cfg.h | 14 +++++--------- core/hdd/inc/wlan_hdd_cfg.h | 2 -- core/hdd/src/wlan_hdd_cfg.c | 3 +-- core/hdd/src/wlan_hdd_nud_tracking.c | 3 ++- core/mac/inc/ani_global.h | 3 ++- core/mac/inc/sir_api.h | 5 +++++ core/sme/inc/csr_api.h | 1 + core/sme/inc/sme_api.h | 7 +++++++ core/sme/src/common/sme_api.c | 7 +++++++ core/sme/src/csr/csr_api_roam.c | 7 ++++--- 10 files changed, 34 insertions(+), 18 deletions(-) diff --git a/core/hdd/inc/hdd_dp_cfg.h b/core/hdd/inc/hdd_dp_cfg.h index 1756aeb70972..1fe2d77c3101 100644 --- a/core/hdd/inc/hdd_dp_cfg.h +++ b/core/hdd/inc/hdd_dp_cfg.h @@ -1251,7 +1251,7 @@ * * gEnableNUDTracking - Will enable or disable NUD tracking within driver * @Min: 0 - * @Max: 2 + * @Max: 3 * @Default: 2 * * This ini is used to specify the behaviour of the driver for NUD tracking. @@ -1261,7 +1261,7 @@ * the connected BSSID. * 2: Driver will track the NUD failures and if honoured will roam away from * the connected BSSID to a new BSSID to retain the data connectivity. - * + * 3: Driver will try to roam to a new AP but if roam fails, disconnect. * Related: None * * Supported Feature: STA @@ -1270,15 +1270,11 @@ * * */ -#define CFG_DP_ROAM_AFTER_NUD_FAIL 2 -#define CFG_DP_DISCONNECT_AFTER_NUD_FAIL 1 -#define CFG_DP_DISABLE_NUD_TRACKING 0 - #define CFG_DP_ENABLE_NUD_TRACKING \ CFG_INI_UINT("gEnableNUDTracking", \ - CFG_DP_DISABLE_NUD_TRACKING, \ - CFG_DP_ROAM_AFTER_NUD_FAIL, \ - CFG_DP_ROAM_AFTER_NUD_FAIL, \ + 0, \ + 3, \ + 2, \ CFG_VALUE_OR_DEFAULT, "Driver NUD tracking behaviour") #define CFG_DP_ENABLE_NUD_TRACKING_ALL \ diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 32f1aae9c68f..27da9abb1401 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -204,9 +204,7 @@ struct hdd_config { bool enable_dp_trace; uint8_t dp_trace_config[DP_TRACE_CONFIG_STRING_LENGTH]; #endif -#ifdef WLAN_NUD_TRACKING uint8_t enable_nud_tracking; -#endif uint32_t operating_chan_freq; uint8_t num_vdevs; uint8_t enable_concurrent_sta[CFG_CONCURRENT_IFACE_MAX_LEN]; diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index 3eaee7087d28..5fec34634362 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -853,7 +853,7 @@ QDF_STATUS hdd_set_sme_config(struct hdd_context *hdd_ctx) */ sme_config->csr_config.phyMode = hdd_cfg_xlate_to_csr_phy_mode(config->dot11Mode); - + sme_update_nud_config(mac_handle, config->enable_nud_tracking); if (config->dot11Mode == eHDD_DOT11_MODE_abg || config->dot11Mode == eHDD_DOT11_MODE_11b || config->dot11Mode == eHDD_DOT11_MODE_11g || @@ -884,7 +884,6 @@ QDF_STATUS hdd_set_sme_config(struct hdd_context *hdd_ctx) &enable_dfs_scan); sme_config->csr_config.fEnableDFSChnlScan = enable_dfs_scan; sme_config->csr_config.Csr11dinfo.Channels.numChannels = 0; - hdd_set_power_save_offload_config(hdd_ctx); #ifdef FEATURE_WLAN_ESE diff --git a/core/hdd/src/wlan_hdd_nud_tracking.c b/core/hdd/src/wlan_hdd_nud_tracking.c index 387620297223..62f46a853c59 100644 --- a/core/hdd/src/wlan_hdd_nud_tracking.c +++ b/core/hdd/src/wlan_hdd_nud_tracking.c @@ -290,7 +290,8 @@ hdd_handle_nud_fail_non_sta(struct hdd_adapter *adapter) static bool hdd_is_roam_after_nud_enabled(struct hdd_config *config) { - if (config->enable_nud_tracking == CFG_DP_ROAM_AFTER_NUD_FAIL) + if (config->enable_nud_tracking == ROAM_AFTER_NUD_FAIL || + config->enable_nud_tracking == DISCONNECT_AFTER_ROAM_FAIL) return true; return false; diff --git a/core/mac/inc/ani_global.h b/core/mac/inc/ani_global.h index b7f67e824de2..9a0ca87250bd 100644 --- a/core/mac/inc/ani_global.h +++ b/core/mac/inc/ani_global.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-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 @@ -761,6 +761,7 @@ struct mac_context { struct wlan_mlme_chain_cfg fw_chain_cfg; struct wlan_mlme_cfg *mlme_cfg; tAniSirLim lim; + uint8_t nud_fail_behaviour; struct sch_context sch; tAniSirSys sys; diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index 1032651f8e44..d29f0671a5d6 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -4429,6 +4429,11 @@ struct sir_sme_ext_cng_chan_req { uint8_t vdev_id; }; +#define IGNORE_NUD_FAIL 0 +#define DISCONNECT_AFTER_NUD_FAIL 1 +#define ROAM_AFTER_NUD_FAIL 2 +#define DISCONNECT_AFTER_ROAM_FAIL 3 + /** * struct sir_sme_ext_change_chan_ind. * @session_id: session id diff --git a/core/sme/inc/csr_api.h b/core/sme/inc/csr_api.h index d74ec82272b5..db51f9d04b17 100644 --- a/core/sme/inc/csr_api.h +++ b/core/sme/inc/csr_api.h @@ -901,6 +901,7 @@ struct csr_neighbor_report_offload_params { struct csr_config_params { /* keep this uint32_t. This gets converted to ePhyChannelBondState */ uint32_t channelBondingMode24GHz; + uint8_t nud_fail_behaviour; uint32_t channelBondingMode5GHz; eCsrPhyMode phyMode; uint32_t HeartbeatThresh50; diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 924d69a50ea4..4048ed79d194 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -412,6 +412,13 @@ void sme_cleanup_session(mac_handle_t mac_handle, uint8_t vdev_id); void sme_set_curr_device_mode(mac_handle_t mac_handle, enum QDF_OPMODE curr_device_mode); +/** + * sme_update_nud_config() - update nud config + * @mac_handle: The handle returned by mac_open. + * @nud_fail_behavior: Vlaue of nud fail behaviour + */ +void sme_update_nud_config(mac_handle_t mac_handle, uint8_t nud_fail_behavior); + QDF_STATUS sme_update_roam_params(mac_handle_t mac_handle, uint8_t session_id, struct roam_ext_params *roam_params_src, diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 48610bd953b6..f628746243fd 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -841,6 +841,13 @@ void sme_update_fine_time_measurement_capab(mac_handle_t mac_handle, } } +void sme_update_nud_config(mac_handle_t mac_handle, uint8_t nud_fail_behavior) +{ + struct mac_context *mac = MAC_CONTEXT(mac_handle); + + mac->nud_fail_behaviour = nud_fail_behavior; +} + /** * sme_update_neighbor_report_config() - Update CSR config for 11k params * @mac_handle: Pointer to MAC context diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index 0b00beff11a4..44ecd1714434 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -21167,9 +21167,10 @@ static QDF_STATUS csr_process_roam_sync_callback(struct mac_context *mac_ctx, eCSR_ROAM_NAPI_OFF, eCSR_ROAM_RESULT_SUCCESS); goto end; case SIR_ROAMING_INVOKE_FAIL: - sme_debug("Roaming triggered failed source %d", - vdev_roam_params->source); - if (vdev_roam_params->source == USERSPACE_INITIATED) { + sme_debug("Roaming triggered failed source %d nud behaviour %d", + vdev_roam_params->source, mac_ctx->nud_fail_behaviour); + if (vdev_roam_params->source == USERSPACE_INITIATED || + mac_ctx->nud_fail_behaviour == DISCONNECT_AFTER_NUD_FAIL) { /* Userspace roam req fail, disconnect with AP */ csr_roam_disconnect(mac_ctx, session_id, eCSR_DISCONNECT_REASON_DEAUTH,