From e93d2460b1a365c2fe0aa9acccf9f443e7ef908f Mon Sep 17 00:00:00 2001 From: Varun Reddy Yeturu Date: Tue, 22 May 2018 13:54:52 -0700 Subject: [PATCH] qcacld-3.0: Enable or Disable TWT services in WNI CFG Introduce new WNI items for TWT as follows: WNI_CFG_TWT_REQUESTOR WNI_CFG_TWT_RESPONDER WNI_CFG_BCAST_TWT Based on the INI configuration and target support, enable or disable the TWT services in the WNI CFG database. Change-Id: Id1b239e53f30f00220e0cefb541fc641a898e712 CRs-Fixed: 2238302 --- core/hdd/inc/wlan_hdd_twt.h | 16 ++++++++++++++++ core/hdd/src/wlan_hdd_main.c | 2 ++ core/hdd/src/wlan_hdd_twt.c | 25 +++++++++++++++++++++++++ core/mac/inc/wni_cfg.h | 15 +++++++++++++++ core/mac/src/cfg/cfg_param_name.c | 3 +++ core/mac/src/cfg/cfg_proc_msg.c | 12 ++++++++++++ core/wma/inc/wma_tgt_cfg.h | 4 ++++ 7 files changed, 77 insertions(+) diff --git a/core/hdd/inc/wlan_hdd_twt.h b/core/hdd/inc/wlan_hdd_twt.h index 3d20c1d51cf5..5040f9e4004a 100644 --- a/core/hdd/inc/wlan_hdd_twt.h +++ b/core/hdd/inc/wlan_hdd_twt.h @@ -27,6 +27,7 @@ #define WLAN_HDD_TWT_H struct hdd_context; +struct wma_tgt_cfg; #ifdef WLAN_FEATURE_TWT /** @@ -37,10 +38,25 @@ struct hdd_context; */ void hdd_twt_print_ini_config(struct hdd_context *hdd_ctx); +/** + * hdd_update_tgt_twt_cap() - Update TWT target capabilities + * @hdd_ctx: HDD Context + * @cfg: Pointer to target configuration + * + * Return: None + */ +void hdd_update_tgt_twt_cap(struct hdd_context *hdd_ctx, + struct wma_tgt_cfg *cfg); + #else static inline void hdd_twt_print_ini_config(struct hdd_context *hdd_ctx) { } +static inline void hdd_update_tgt_twt_cap(struct hdd_context *hdd_ctx, + struct wma_tgt_cfg *cfg) +{ +} + #endif #endif /* if !defined(WLAN_HDD_TWT_H)*/ diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index e85990e32b14..c8d7a314899a 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -131,6 +131,7 @@ #include #include "wlan_hdd_nud_tracking.h" #include "wlan_hdd_apf.h" +#include "wlan_hdd_twt.h" #ifdef CNSS_GENL #include @@ -2005,6 +2006,7 @@ void hdd_update_tgt_cfg(hdd_handle_t hdd_handle, struct wma_tgt_cfg *cfg) hdd_info("11AX: 11ax is enabled - update HDD config"); hdd_update_tgt_he_cap(hdd_ctx, cfg); } + hdd_update_tgt_twt_cap(hdd_ctx, cfg); hdd_update_vdev_nss(hdd_ctx); diff --git a/core/hdd/src/wlan_hdd_twt.c b/core/hdd/src/wlan_hdd_twt.c index 93665a6e8b39..0b1f1e42506a 100644 --- a/core/hdd/src/wlan_hdd_twt.c +++ b/core/hdd/src/wlan_hdd_twt.c @@ -26,6 +26,7 @@ #include "wlan_hdd_twt.h" #include "wlan_hdd_main.h" #include "wlan_hdd_cfg.h" +#include "cfg_api.h" void hdd_twt_print_ini_config(struct hdd_context *hdd_ctx) { @@ -35,3 +36,27 @@ void hdd_twt_print_ini_config(struct hdd_context *hdd_ctx) hdd_ctx->config->twt_congestion_timeout); } +void hdd_update_tgt_twt_cap(struct hdd_context *hdd_ctx, + struct wma_tgt_cfg *cfg) +{ + struct wma_tgt_services *services = &cfg->services; + + hdd_debug("TWT: enable_twt=%d, tgt Req=%d, Res=%d", + hdd_ctx->config->enable_twt, services->twt_requestor, + services->twt_responder); + + sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_TWT_REQUESTOR, + QDF_MIN(services->twt_requestor, + hdd_ctx->config->enable_twt)); + + sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_TWT_RESPONDER, + QDF_MIN(services->twt_responder, + hdd_ctx->config->enable_twt)); + + /* + * Currently broadcast TWT is not supported + */ + sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_BCAST_TWT, + QDF_MIN(0, hdd_ctx->config->enable_twt)); +} + diff --git a/core/mac/inc/wni_cfg.h b/core/mac/inc/wni_cfg.h index 50cead7f8c17..4e187e5cc54b 100644 --- a/core/mac/inc/wni_cfg.h +++ b/core/mac/inc/wni_cfg.h @@ -318,6 +318,9 @@ enum { WNI_CFG_EDCA_ETSI_ACVO, WNI_CFG_OBSS_DETECTION_OFFLOAD, WNI_CFG_OBSS_COLOR_COLLISION_OFFLOAD, + WNI_CFG_TWT_REQUESTOR, + WNI_CFG_TWT_RESPONDER, + WNI_CFG_BCAST_TWT, /* Any new items to be added should be above this strictly */ CFG_PARAM_MAX_NUM }; @@ -1639,6 +1642,18 @@ enum { #define WNI_CFG_RATE_FOR_TX_MGMT_5G_STAMAX 0xFF #define WNI_CFG_RATE_FOR_TX_MGMT_5G_STADEF 0xFF +#define WNI_CFG_TWT_REQUESTOR_STAMIN 0 +#define WNI_CFG_TWT_REQUESTOR_STAMAX 1 +#define WNI_CFG_TWT_REQUESTOR_STADEF 0 + +#define WNI_CFG_TWT_RESPONDER_STAMIN 0 +#define WNI_CFG_TWT_RESPONDER_STAMAX 1 +#define WNI_CFG_TWT_RESPONDER_STADEF 0 + +#define WNI_CFG_BCAST_TWT_STAMIN 0 +#define WNI_CFG_BCAST_TWT_STAMAX 1 +#define WNI_CFG_BCAST_TWT_STADEF 0 + #define CFG_STA_MAGIC_DWORD 0xbeefbeef #endif diff --git a/core/mac/src/cfg/cfg_param_name.c b/core/mac/src/cfg/cfg_param_name.c index da2f1e02021e..773e3c795ec7 100644 --- a/core/mac/src/cfg/cfg_param_name.c +++ b/core/mac/src/cfg/cfg_param_name.c @@ -325,6 +325,9 @@ const char *cfg_get_string(uint16_t cfg_id) CASE_RETURN_STRING(WNI_CFG_EDCA_ETSI_ACVO); CASE_RETURN_STRING(WNI_CFG_OBSS_DETECTION_OFFLOAD); CASE_RETURN_STRING(WNI_CFG_OBSS_COLOR_COLLISION_OFFLOAD); + CASE_RETURN_STRING(WNI_CFG_TWT_REQUESTOR); + CASE_RETURN_STRING(WNI_CFG_TWT_RESPONDER); + CASE_RETURN_STRING(WNI_CFG_BCAST_TWT); } return "invalid"; diff --git a/core/mac/src/cfg/cfg_proc_msg.c b/core/mac/src/cfg/cfg_proc_msg.c index a90b9e7cc281..aba566abdd2e 100644 --- a/core/mac/src/cfg/cfg_proc_msg.c +++ b/core/mac/src/cfg/cfg_proc_msg.c @@ -1432,6 +1432,18 @@ cgstatic cfg_static[CFG_PARAM_MAX_NUM] = { {WNI_CFG_OBSS_COLOR_COLLISION_OFFLOAD, CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT, 0, 1, 0}, + {WNI_CFG_TWT_REQUESTOR, + CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT, + WNI_CFG_TWT_REQUESTOR_STAMIN, WNI_CFG_TWT_REQUESTOR_STAMAX, + WNI_CFG_TWT_REQUESTOR_STADEF}, + {WNI_CFG_TWT_RESPONDER, + CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT, + WNI_CFG_TWT_RESPONDER_STAMIN, WNI_CFG_TWT_RESPONDER_STAMAX, + WNI_CFG_TWT_RESPONDER_STADEF}, + {WNI_CFG_BCAST_TWT, + CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT, + WNI_CFG_BCAST_TWT_STAMIN, WNI_CFG_BCAST_TWT_STAMAX, + WNI_CFG_BCAST_TWT_STADEF}, }; diff --git a/core/wma/inc/wma_tgt_cfg.h b/core/wma/inc/wma_tgt_cfg.h index 5c57bfb02d9b..488153827cc2 100644 --- a/core/wma/inc/wma_tgt_cfg.h +++ b/core/wma/inc/wma_tgt_cfg.h @@ -37,6 +37,8 @@ * @en_roam_offload: enable roam offload * @en_11ax: enable 11ax * @is_fw_mawc_capable: Motion Aided Wireless Connectivity feature + * @twt_requestor: TWT requestor capability + * @twt_responder: TWT responder capability */ struct wma_tgt_services { uint32_t sta_power_save; @@ -65,6 +67,8 @@ struct wma_tgt_services { bool is_fils_roaming_supported; bool is_fw_mawc_capable; bool is_11k_offload_supported; + bool twt_requestor; + bool twt_responder; }; /**