diff --git a/components/mlme/core/src/wlan_mlme_main.c b/components/mlme/core/src/wlan_mlme_main.c
index ae5306f8cc..426c918807 100644
--- a/components/mlme/core/src/wlan_mlme_main.c
+++ b/components/mlme/core/src/wlan_mlme_main.c
@@ -1001,9 +1001,14 @@ static void mlme_init_he_cap_in_cfg(struct wlan_objmgr_psoc *psoc,
struct wlan_mlme_he_caps *he_caps = &mlme_cfg->he_caps;
he_caps->dot11_he_cap.htc_he = cfg_default(CFG_HE_CONTROL);
- he_caps->dot11_he_cap.twt_request = cfg_get(psoc, CFG_HE_TWT_REQUESTOR);
+ he_caps->dot11_he_cap.twt_request =
+ cfg_get(psoc, CFG_TWT_REQUESTOR);
he_caps->dot11_he_cap.twt_responder =
- cfg_get(psoc, CFG_HE_TWT_RESPONDER);
+ cfg_get(psoc, CFG_TWT_RESPONDER);
+ he_caps->dot11_he_cap.broadcast_twt = cfg_get(psoc, CFG_BCAST_TWT);
+ if (mlme_is_twt_enabled(psoc))
+ he_caps->dot11_he_cap.flex_twt_sched =
+ cfg_default(CFG_HE_FLEX_TWT_SCHED);
he_caps->dot11_he_cap.fragmentation =
cfg_default(CFG_HE_FRAGMENTATION);
he_caps->dot11_he_cap.max_num_frag_msdu_amsdu_exp =
@@ -1019,7 +1024,6 @@ static void mlme_init_he_cap_in_cfg(struct wlan_objmgr_psoc *psoc,
he_caps->dot11_he_cap.trigd_rsp_sched =
cfg_default(CFG_HE_TRIGD_RSP_SCHEDULING);
he_caps->dot11_he_cap.a_bsr = cfg_default(CFG_HE_BUFFER_STATUS_RPT);
- he_caps->dot11_he_cap.broadcast_twt = cfg_default(CFG_HE_BCAST_TWT);
he_caps->dot11_he_cap.ba_32bit_bitmap = cfg_default(CFG_HE_BA_32BIT);
he_caps->dot11_he_cap.mu_cascade = cfg_default(CFG_HE_MU_CASCADING);
he_caps->dot11_he_cap.ack_enabled_multitid =
@@ -1029,8 +1033,7 @@ static void mlme_init_he_cap_in_cfg(struct wlan_objmgr_psoc *psoc,
he_caps->dot11_he_cap.max_ampdu_len_exp_ext =
cfg_default(CFG_HE_MAX_AMPDU_LEN);
he_caps->dot11_he_cap.amsdu_frag = cfg_default(CFG_HE_AMSDU_FRAG);
- he_caps->dot11_he_cap.flex_twt_sched =
- cfg_default(CFG_HE_FLEX_TWT_SCHED);
+
he_caps->dot11_he_cap.rx_ctrl_frame = cfg_default(CFG_HE_RX_CTRL);
he_caps->dot11_he_cap.bsrp_ampdu_aggr =
cfg_default(CFG_HE_BSRP_AMPDU_AGGR);
@@ -1195,10 +1198,7 @@ static void mlme_init_twt_cfg(struct wlan_objmgr_psoc *psoc,
{
uint32_t bcast_conf = cfg_get(psoc, CFG_BCAST_TWT_REQ_RESP);
- twt_cfg->is_twt_bcast_enabled = cfg_get(psoc, CFG_BCAST_TWT);
twt_cfg->is_twt_enabled = cfg_get(psoc, CFG_ENABLE_TWT);
- twt_cfg->is_twt_responder_enabled = cfg_get(psoc, CFG_TWT_RESPONDER);
- twt_cfg->is_twt_requestor_enabled = cfg_get(psoc, CFG_TWT_REQUESTOR);
twt_cfg->twt_congestion_timeout = cfg_get(psoc, CFG_TWT_CONGESTION_TIMEOUT);
twt_cfg->is_bcast_requestor_enabled = CFG_TWT_GET_BCAST_REQ(bcast_conf);
twt_cfg->is_bcast_responder_enabled = CFG_TWT_GET_BCAST_RES(bcast_conf);
@@ -2328,13 +2328,13 @@ QDF_STATUS mlme_cfg_on_psoc_enable(struct wlan_objmgr_psoc *psoc)
mlme_init_chainmask_cfg(psoc, &mlme_cfg->chainmask_cfg);
mlme_init_sap_cfg(psoc, &mlme_cfg->sap_cfg);
mlme_init_nss_chains(psoc, &mlme_cfg->nss_chains_ini_cfg);
+ mlme_init_twt_cfg(psoc, &mlme_cfg->twt_cfg);
mlme_init_he_cap_in_cfg(psoc, mlme_cfg);
mlme_init_obss_ht40_cfg(psoc, &mlme_cfg->obss_ht40);
mlme_init_product_details_cfg(&mlme_cfg->product_details);
mlme_init_powersave_params(psoc, &mlme_cfg->ps_params);
mlme_init_sta_cfg(psoc, &mlme_cfg->sta);
mlme_init_stats_cfg(psoc, &mlme_cfg->stats);
- mlme_init_twt_cfg(psoc, &mlme_cfg->twt_cfg);
mlme_init_lfr_cfg(psoc, &mlme_cfg->lfr);
mlme_init_feature_flag_in_cfg(psoc, &mlme_cfg->feature_flags);
mlme_init_roam_scoring_cfg(psoc, &mlme_cfg->roam_scoring);
diff --git a/components/mlme/dispatcher/inc/cfg_mlme_he_caps.h b/components/mlme/dispatcher/inc/cfg_mlme_he_caps.h
index 29631c8584..94177c024c 100644
--- a/components/mlme/dispatcher/inc/cfg_mlme_he_caps.h
+++ b/components/mlme/dispatcher/inc/cfg_mlme_he_caps.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-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
@@ -28,50 +28,6 @@
0, \
"HE Control")
-/*
- *
- * he_twt_requestor- Enable HE TWT requestor.
- * @Min: 0
- * @Max: 1
- * @Default: 1
- *
- * This ini is used to enable or disable HE TWT requestor.
- *
- * Related: NA
- *
- * Supported Feature: 11AX
- *
- * Usage: External
- *
- *
- */
-#define CFG_HE_TWT_REQUESTOR CFG_INI_BOOL( \
- "he_twt_requestor", \
- 1, \
- "HE Twt Requestor")
-
-/*
- *
- * he_twt_responder- Enable HE TWT responder.
- * @Min: 0
- * @Max: 1
- * @Default: 1
- *
- * This ini is used to enable or disable HE TWT responder.
- *
- * Related: NA
- *
- * Supported Feature: 11AX
- *
- * Usage: External
- *
- *
- */
-#define CFG_HE_TWT_RESPONDER CFG_INI_BOOL( \
- "he_twt_responder", \
- 1, \
- "HE Twt Responder")
-
#define CFG_HE_FRAGMENTATION CFG_UINT( \
"he_fragmentation", \
0, \
@@ -135,11 +91,6 @@
0, \
"HE Buffer Status Rpt")
-#define CFG_HE_BCAST_TWT CFG_BOOL( \
- "he_bcast_twt", \
- 0, \
- "HE Bcast twt")
-
#define CFG_HE_BA_32BIT CFG_BOOL( \
"he_ba_32bit", \
0, \
@@ -782,8 +733,6 @@
#define CFG_HE_CAPS_ALL \
CFG(CFG_HE_CONTROL) \
- CFG(CFG_HE_TWT_REQUESTOR) \
- CFG(CFG_HE_TWT_RESPONDER) \
CFG(CFG_HE_FRAGMENTATION) \
CFG(CFG_HE_MAX_FRAG_MSDU) \
CFG(CFG_HE_MIN_FRAG_SIZE) \
@@ -793,7 +742,6 @@
CFG(CFG_HE_ALL_ACK) \
CFG(CFG_HE_TRIGD_RSP_SCHEDULING) \
CFG(CFG_HE_BUFFER_STATUS_RPT) \
- CFG(CFG_HE_BCAST_TWT) \
CFG(CFG_HE_BA_32BIT) \
CFG(CFG_HE_MU_CASCADING) \
CFG(CFG_HE_MULTI_TID) \
diff --git a/components/mlme/dispatcher/inc/wlan_mlme_api.h b/components/mlme/dispatcher/inc/wlan_mlme_api.h
index 5bbf3cadb6..426316d831 100644
--- a/components/mlme/dispatcher/inc/wlan_mlme_api.h
+++ b/components/mlme/dispatcher/inc/wlan_mlme_api.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-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
@@ -3050,4 +3050,22 @@ QDF_STATUS mlme_set_ext_opr_rate(struct wlan_objmgr_vdev *vdev, uint8_t *src,
* Return: True if supported
*/
bool wlan_mlme_is_sta_mon_conc_supported(struct wlan_objmgr_psoc *psoc);
+
+#ifdef WLAN_SUPPORT_TWT
+/**
+ * mlme_is_twt_enabled() - Get if TWT is enabled via ini.
+ * @psoc: pointer to psoc object
+ * @val: pointer to the value to be filled
+ *
+ * Return: True if TWT is enabled else false.
+ */
+bool
+mlme_is_twt_enabled(struct wlan_objmgr_psoc *psoc);
+#else
+static inline bool
+mlme_is_twt_enabled(struct wlan_objmgr_psoc *psoc)
+{
+ return false;
+}
+#endif /* WLAN_SUPPORT_TWT */
#endif /* _WLAN_MLME_API_H_ */
diff --git a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h
index 54eb14e0a8..c2e244773a 100644
--- a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h
+++ b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h
@@ -1399,21 +1399,19 @@ struct wlan_mlme_acs {
/*
* struct wlan_mlme_cfg_twt - All twt related cfg items
- * @is_twt_bcast_enabled: twt capability for the session
* @is_twt_enabled: global twt configuration
- * @is_twt_responder_enabled: twt responder
- * @is_twt_requestor_enabled: twt requestor
+ * @bcast_requestor_tgt_cap: Broadcast requestor target capability
+ * @bcast_responder_tgt_cap: Broadcast responder target capability
* @is_bcast_responder_enabled: bcast responder enable/disable
* @is_bcast_requestor_enabled: bcast requestor enable/disable
* @twt_congestion_timeout: congestion timeout value
*/
struct wlan_mlme_cfg_twt {
- bool is_twt_bcast_enabled;
bool is_twt_enabled;
- bool is_twt_responder_enabled;
- bool is_twt_requestor_enabled;
bool is_bcast_responder_enabled;
bool is_bcast_requestor_enabled;
+ bool bcast_requestor_tgt_cap;
+ bool bcast_responder_tgt_cap;
uint32_t twt_congestion_timeout;
};
diff --git a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h
index 4af557bce6..8d739a4e40 100644
--- a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h
+++ b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-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
@@ -889,7 +889,7 @@ QDF_STATUS
ucfg_mlme_set_pmkid_modes(struct wlan_objmgr_psoc *psoc,
uint32_t val);
-#ifdef WLAN_SUPPORT_TWT
+#if defined(WLAN_SUPPORT_TWT) && defined(WLAN_FEATURE_11AX)
/**
* ucfg_mlme_get_twt_requestor() - Get twt requestor
* @psoc: pointer to psoc object
@@ -979,15 +979,16 @@ ucfg_mlme_set_twt_congestion_timeout(struct wlan_objmgr_psoc *psoc,
uint32_t val);
/**
- * ucfg_mlme_get_enable_twt() - Get global twt config support
+ * ucfg_mlme_is_twt_enabled() - Get global twt config support
* @psoc: pointer to psoc object
- * @val: Pointer to the value which will be filled for the caller
*
- * Return: QDF Status
+ * Return: True if TWT is enabled else false.
*/
-QDF_STATUS
-ucfg_mlme_get_enable_twt(struct wlan_objmgr_psoc *psoc,
- bool *val);
+static inline bool
+ucfg_mlme_is_twt_enabled(struct wlan_objmgr_psoc *psoc)
+{
+ return mlme_is_twt_enabled(psoc);
+}
/**
* ucfg_mlme_set_enable_twt() - Set global twt config support
@@ -1042,6 +1043,30 @@ ucfg_mlme_get_twt_bcast_responder(struct wlan_objmgr_psoc *psoc,
QDF_STATUS
ucfg_mlme_set_twt_bcast_responder(struct wlan_objmgr_psoc *psoc,
bool val);
+
+/**
+ * ucfg_mlme_set_twt_bcast_requestor_tgt_cap() - Update the broadast requestor
+ * target capability
+ * @psoc: pointer to psoc object
+ * @val: Value to be set to config
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+ucfg_mlme_set_twt_bcast_requestor_tgt_cap(struct wlan_objmgr_psoc *psoc,
+ bool val);
+
+/**
+ * ucfg_mlme_set_twt_bcast_responder_tgt_cap() - Update the broadast responder
+ * target capability
+ * @psoc: pointer to psoc object
+ * @val: Value to be set to config
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+ucfg_mlme_set_twt_bcast_responder_tgt_cap(struct wlan_objmgr_psoc *psoc,
+ bool val);
#else
static inline QDF_STATUS
ucfg_mlme_get_twt_requestor(struct wlan_objmgr_psoc *psoc,
@@ -1103,11 +1128,9 @@ ucfg_mlme_set_twt_congestion_timeout(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_E_NOSUPPORT;
}
-static inline QDF_STATUS
-ucfg_mlme_get_enable_twt(struct wlan_objmgr_psoc *psoc,
- bool *val)
+static inline bool
+ucfg_mlme_is_twt_enabled(struct wlan_objmgr_psoc *psoc)
{
- *val = false;
return QDF_STATUS_E_NOSUPPORT;
}
@@ -1147,7 +1170,22 @@ ucfg_mlme_set_twt_bcast_responder(struct wlan_objmgr_psoc *psoc,
{
return QDF_STATUS_E_NOSUPPORT;
}
+
+static inline QDF_STATUS
+ucfg_mlme_set_twt_bcast_requestor_tgt_cap(struct wlan_objmgr_psoc *psoc,
+ bool val)
+{
+ return QDF_STATUS_E_NOSUPPORT;
+}
+
+static inline QDF_STATUS
+ucfg_mlme_set_twt_bcast_responder_tgt_cap(struct wlan_objmgr_psoc *psoc,
+ bool val)
+{
+ return QDF_STATUS_E_NOSUPPORT;
+}
#endif
+
/**
* ucfg_mlme_get_dot11p_mode() - Get the setting about 802.11p mode
* @psoc: pointer to psoc object
diff --git a/components/mlme/dispatcher/src/wlan_mlme_api.c b/components/mlme/dispatcher/src/wlan_mlme_api.c
index f85fa10661..ee3f1af588 100644
--- a/components/mlme/dispatcher/src/wlan_mlme_api.c
+++ b/components/mlme/dispatcher/src/wlan_mlme_api.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-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
@@ -591,10 +591,6 @@ QDF_STATUS mlme_update_tgt_he_caps_in_cfg(struct wlan_objmgr_psoc *psoc,
mlme_obj->cfg.he_caps.dot11_he_cap.twt_request);
mlme_obj->cfg.he_caps.dot11_he_cap.twt_request = value;
- value = QDF_MIN(he_cap->twt_responder,
- mlme_obj->cfg.he_caps.dot11_he_cap.twt_responder);
- mlme_obj->cfg.he_caps.dot11_he_cap.twt_responder = value;
-
value = QDF_MIN(he_cap->fragmentation,
mlme_obj->cfg.he_caps.he_dynamic_fragmentation);
@@ -625,8 +621,15 @@ QDF_STATUS mlme_update_tgt_he_caps_in_cfg(struct wlan_objmgr_psoc *psoc,
mlme_obj->cfg.he_caps.dot11_he_cap.trigd_rsp_sched =
he_cap->trigd_rsp_sched;
mlme_obj->cfg.he_caps.dot11_he_cap.a_bsr = he_cap->a_bsr;
- mlme_obj->cfg.he_caps.dot11_he_cap.broadcast_twt =
- he_cap->broadcast_twt;
+
+ value = QDF_MIN(he_cap->broadcast_twt,
+ mlme_obj->cfg.he_caps.dot11_he_cap.broadcast_twt);
+ mlme_obj->cfg.he_caps.dot11_he_cap.broadcast_twt = value;
+
+ value = QDF_MIN(he_cap->flex_twt_sched,
+ mlme_obj->cfg.he_caps.dot11_he_cap.flex_twt_sched);
+ mlme_obj->cfg.he_caps.dot11_he_cap.flex_twt_sched = value;
+
mlme_obj->cfg.he_caps.dot11_he_cap.ba_32bit_bitmap =
he_cap->ba_32bit_bitmap;
mlme_obj->cfg.he_caps.dot11_he_cap.mu_cascade = he_cap->mu_cascade;
@@ -638,8 +641,6 @@ QDF_STATUS mlme_update_tgt_he_caps_in_cfg(struct wlan_objmgr_psoc *psoc,
mlme_obj->cfg.he_caps.dot11_he_cap.max_ampdu_len_exp_ext =
he_cap->max_ampdu_len_exp_ext;
mlme_obj->cfg.he_caps.dot11_he_cap.amsdu_frag = he_cap->amsdu_frag;
- mlme_obj->cfg.he_caps.dot11_he_cap.flex_twt_sched =
- he_cap->flex_twt_sched;
mlme_obj->cfg.he_caps.dot11_he_cap.rx_ctrl_frame =
he_cap->rx_ctrl_frame;
mlme_obj->cfg.he_caps.dot11_he_cap.bsrp_ampdu_aggr =
@@ -4707,3 +4708,16 @@ bool wlan_mlme_is_sta_mon_conc_supported(struct wlan_objmgr_psoc *psoc)
return false;
}
+
+#ifdef WLAN_SUPPORT_TWT
+bool mlme_is_twt_enabled(struct wlan_objmgr_psoc *psoc)
+{
+ struct wlan_mlme_psoc_ext_obj *mlme_obj;
+
+ mlme_obj = mlme_get_psoc_ext_obj(psoc);
+ if (!mlme_obj)
+ return cfg_default(CFG_ENABLE_TWT);
+
+ return mlme_obj->cfg.twt_cfg.is_twt_enabled;
+}
+#endif
diff --git a/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c b/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c
index 0ff011da25..1a73fd0924 100644
--- a/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c
+++ b/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-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
@@ -508,7 +508,7 @@ ucfg_mlme_set_pmkid_modes(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_SUCCESS;
}
-#ifdef WLAN_SUPPORT_TWT
+#if defined(WLAN_SUPPORT_TWT) && defined(WLAN_FEATURE_11AX)
QDF_STATUS
ucfg_mlme_get_twt_requestor(struct wlan_objmgr_psoc *psoc,
bool *val)
@@ -521,7 +521,7 @@ ucfg_mlme_get_twt_requestor(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_E_INVAL;
}
- *val = mlme_obj->cfg.twt_cfg.is_twt_requestor_enabled;
+ *val = mlme_obj->cfg.he_caps.dot11_he_cap.twt_request;
return QDF_STATUS_SUCCESS;
}
@@ -536,7 +536,7 @@ ucfg_mlme_set_twt_requestor(struct wlan_objmgr_psoc *psoc,
if (!mlme_obj)
return QDF_STATUS_E_INVAL;
- mlme_obj->cfg.twt_cfg.is_twt_requestor_enabled = val;
+ mlme_obj->cfg.he_caps.dot11_he_cap.twt_request = val;
return QDF_STATUS_SUCCESS;
}
@@ -553,7 +553,7 @@ ucfg_mlme_get_twt_responder(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_E_INVAL;
}
- *val = mlme_obj->cfg.twt_cfg.is_twt_responder_enabled;
+ *val = mlme_obj->cfg.he_caps.dot11_he_cap.twt_responder;
return QDF_STATUS_SUCCESS;
}
@@ -568,7 +568,7 @@ ucfg_mlme_set_twt_responder(struct wlan_objmgr_psoc *psoc,
if (!mlme_obj)
return QDF_STATUS_E_INVAL;
- mlme_obj->cfg.twt_cfg.is_twt_responder_enabled = val;
+ mlme_obj->cfg.he_caps.dot11_he_cap.twt_responder = val;
return QDF_STATUS_SUCCESS;
}
@@ -585,7 +585,7 @@ ucfg_mlme_get_bcast_twt(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_E_INVAL;
}
- *val = mlme_obj->cfg.twt_cfg.is_twt_bcast_enabled;
+ *val = mlme_obj->cfg.he_caps.dot11_he_cap.broadcast_twt;
return QDF_STATUS_SUCCESS;
}
@@ -600,7 +600,7 @@ ucfg_mlme_set_bcast_twt(struct wlan_objmgr_psoc *psoc,
if (!mlme_obj)
return QDF_STATUS_E_INVAL;
- mlme_obj->cfg.twt_cfg.is_twt_bcast_enabled = val;
+ mlme_obj->cfg.he_caps.dot11_he_cap.broadcast_twt = val;
return QDF_STATUS_SUCCESS;
}
@@ -637,23 +637,6 @@ ucfg_mlme_set_twt_congestion_timeout(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_SUCCESS;
}
-QDF_STATUS
-ucfg_mlme_get_enable_twt(struct wlan_objmgr_psoc *psoc,
- bool *val)
-{
- struct wlan_mlme_psoc_ext_obj *mlme_obj;
-
- mlme_obj = mlme_get_psoc_ext_obj(psoc);
- if (!mlme_obj) {
- *val = cfg_default(CFG_ENABLE_TWT);
- return QDF_STATUS_E_INVAL;
- }
-
- *val = mlme_obj->cfg.twt_cfg.is_twt_enabled;
-
- return QDF_STATUS_SUCCESS;
-}
-
QDF_STATUS
ucfg_mlme_set_enable_twt(struct wlan_objmgr_psoc *psoc,
bool val)
@@ -738,6 +721,36 @@ ucfg_mlme_set_twt_bcast_responder(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_SUCCESS;
}
+
+QDF_STATUS
+ucfg_mlme_set_twt_bcast_requestor_tgt_cap(struct wlan_objmgr_psoc *psoc,
+ bool val)
+{
+ struct wlan_mlme_psoc_ext_obj *mlme_obj;
+
+ mlme_obj = mlme_get_psoc_ext_obj(psoc);
+ if (!mlme_obj)
+ return QDF_STATUS_E_INVAL;
+
+ mlme_obj->cfg.twt_cfg.bcast_requestor_tgt_cap = val;
+
+ return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+ucfg_mlme_set_twt_bcast_responder_tgt_cap(struct wlan_objmgr_psoc *psoc,
+ bool val)
+{
+ struct wlan_mlme_psoc_ext_obj *mlme_obj;
+
+ mlme_obj = mlme_get_psoc_ext_obj(psoc);
+ if (!mlme_obj)
+ return QDF_STATUS_E_INVAL;
+
+ mlme_obj->cfg.twt_cfg.bcast_responder_tgt_cap = val;
+
+ return QDF_STATUS_SUCCESS;
+}
#endif
QDF_STATUS
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 72d648ac22..d58167b2ff 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -2612,13 +2612,6 @@ int hdd_update_tgt_cfg(hdd_handle_t hdd_handle, struct wma_tgt_cfg *cfg)
if (QDF_IS_STATUS_ERROR(status))
hdd_err("Failed to set WNI_CFG_OBSS_COLOR_COLLISION_OFFLOAD");
- ucfg_mlme_get_bcast_twt(hdd_ctx->psoc, &bval);
- if (bval)
- ucfg_mlme_set_bcast_twt(hdd_ctx->psoc, cfg->bcast_twt_support);
- else
- hdd_debug("bcast twt is disable in ini, fw cap %d",
- cfg->bcast_twt_support);
-
hdd_update_score_config(hdd_ctx);
hdd_update_multi_client_thermal_support(hdd_ctx);
diff --git a/core/hdd/src/wlan_hdd_twt.c b/core/hdd/src/wlan_hdd_twt.c
index c492f4fb47..3cd60de51e 100644
--- a/core/hdd/src/wlan_hdd_twt.c
+++ b/core/hdd/src/wlan_hdd_twt.c
@@ -2234,10 +2234,11 @@ void hdd_update_tgt_twt_cap(struct hdd_context *hdd_ctx,
bool twt_bcast_req;
bool twt_bcast_res;
bool enable_twt;
+ bool bcast_twt;
bool twt_req;
bool twt_res;
- ucfg_mlme_get_enable_twt(hdd_ctx->psoc, &enable_twt);
+ enable_twt = ucfg_mlme_is_twt_enabled(hdd_ctx->psoc);
ucfg_mlme_get_twt_requestor(hdd_ctx->psoc, &twt_req);
@@ -2249,6 +2250,15 @@ void hdd_update_tgt_twt_cap(struct hdd_context *hdd_ctx,
ucfg_mlme_get_twt_bcast_responder(hdd_ctx->psoc,
&twt_bcast_res);
+ ucfg_mlme_get_bcast_twt(hdd_ctx->psoc, &bcast_twt);
+ if (bcast_twt)
+ ucfg_mlme_set_bcast_twt(hdd_ctx->psoc,
+ QDF_MIN(cfg->bcast_twt_support,
+ enable_twt));
+ else
+ hdd_debug("bcast twt is disable in ini, fw cap %d",
+ cfg->bcast_twt_support);
+
hdd_debug("ini: enable_twt=%d, bcast_req=%d, bcast_res=%d",
enable_twt, twt_bcast_req, twt_bcast_res);
hdd_debug("ini: twt_req=%d, twt_res=%d", twt_req, twt_res);
@@ -2265,11 +2275,15 @@ void hdd_update_tgt_twt_cap(struct hdd_context *hdd_ctx,
(enable_twt && twt_res)));
twt_req = enable_twt && twt_bcast_req;
+ ucfg_mlme_set_twt_bcast_requestor_tgt_cap(hdd_ctx->psoc,
+ cfg->twt_bcast_req_support);
ucfg_mlme_set_twt_bcast_requestor(hdd_ctx->psoc,
QDF_MIN(cfg->twt_bcast_req_support,
twt_req));
twt_res = enable_twt && twt_bcast_res;
+ ucfg_mlme_set_twt_bcast_responder_tgt_cap(hdd_ctx->psoc,
+ cfg->twt_bcast_res_support);
ucfg_mlme_set_twt_bcast_responder(hdd_ctx->psoc,
QDF_MIN(cfg->twt_bcast_res_support,
twt_res));
diff --git a/core/mac/src/include/parser_api.h b/core/mac/src/include/parser_api.h
index ce8438f028..7ea94bd68d 100644
--- a/core/mac/src/include/parser_api.h
+++ b/core/mac/src/include/parser_api.h
@@ -1212,7 +1212,7 @@ static inline QDF_STATUS populate_dot11f_he_bss_color_change(
}
#endif
-#ifdef WLAN_SUPPORT_TWT
+#if defined(WLAN_FEATURE_11AX) && defined(WLAN_SUPPORT_TWT)
/**
* populate_dot11f_twt_extended_caps() - populate TWT extended capabilities
* @mac_ctx: Global MAC context.
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 d88b9c61cc..9d38054660 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
@@ -2576,18 +2576,26 @@ static ePhyChanBondState lim_get_cb_mode(struct mac_context *mac,
return cb_mode;
}
+#ifdef WLAN_FEATURE_11AX
static bool lim_enable_twt(struct mac_context *mac_ctx, tDot11fBeaconIEs *ie)
{
- if (mac_ctx->mlme_cfg->twt_cfg.is_twt_requestor_enabled && ie &&
+ if (mac_ctx->mlme_cfg->he_caps.dot11_he_cap.twt_request && ie &&
(ie->qcn_ie.present || ie->he_cap.twt_responder)) {
pe_debug("TWT is supported, hence disable UAPSD; twt req supp: %d,twt respon supp: %d, QCN_IE: %d",
- mac_ctx->mlme_cfg->twt_cfg.is_twt_requestor_enabled,
+ mac_ctx->mlme_cfg->he_caps.dot11_he_cap.twt_request,
ie->he_cap.twt_responder,
ie->qcn_ie.present);
return true;
}
return false;
}
+#else
+static inline bool
+lim_enable_twt(struct mac_context *mac_ctx, tDot11fBeaconIEs *ie)
+{
+ return false;
+}
+#endif
static int8_t lim_get_cfg_max_tx_power(struct mac_context *mac,
uint32_t ch_freq)
diff --git a/core/mac/src/sys/legacy/src/utils/src/parser_api.c b/core/mac/src/sys/legacy/src/utils/src/parser_api.c
index f94df6c652..0f787465cc 100644
--- a/core/mac/src/sys/legacy/src/utils/src/parser_api.c
+++ b/core/mac/src/sys/legacy/src/utils/src/parser_api.c
@@ -6061,6 +6061,45 @@ populate_dot11f_timing_advert_frame(struct mac_context *mac_ctx,
}
#ifdef WLAN_FEATURE_11AX
+#ifdef WLAN_SUPPORT_TWT
+static void
+populate_dot11f_broadcast_twt_he_cap(struct mac_context *mac,
+ struct pe_session *session,
+ tDot11fIEhe_cap *he_cap)
+{
+ bool enable_bcast_twt =
+ mac->mlme_cfg->he_caps.dot11_he_cap.broadcast_twt;
+ bool requestor_tgt_cap =
+ mac->mlme_cfg->twt_cfg.bcast_requestor_tgt_cap;
+ bool responder_tgt_cap =
+ mac->mlme_cfg->twt_cfg.bcast_responder_tgt_cap;
+ bool requestor_cfg =
+ mac->mlme_cfg->twt_cfg.is_bcast_requestor_enabled;
+ bool responder_cfg =
+ mac->mlme_cfg->twt_cfg.is_bcast_responder_enabled;
+ he_cap->broadcast_twt = 0;
+ if (session->opmode == QDF_STA_MODE) {
+ if (enable_bcast_twt && requestor_tgt_cap)
+ he_cap->broadcast_twt = requestor_cfg;
+ else if (enable_bcast_twt)
+ he_cap->broadcast_twt = 1;
+ } else if (session->opmode == QDF_SAP_MODE) {
+ if (enable_bcast_twt && responder_tgt_cap)
+ he_cap->broadcast_twt = responder_cfg;
+ else if (enable_bcast_twt)
+ he_cap->broadcast_twt = 1;
+ }
+}
+#else
+static inline void
+populate_dot11f_broadcast_twt_he_cap(struct mac_context *mac_ctx,
+ struct pe_session *session,
+ tDot11fIEhe_cap *he_cap)
+{
+ he_cap->broadcast_twt = 0;
+}
+#endif
+
/**
* populate_dot11f_he_caps() - pouldate HE Capability IE
* @mac_ctx: Global MAC context
@@ -6082,6 +6121,7 @@ QDF_STATUS populate_dot11f_he_caps(struct mac_context *mac_ctx, struct pe_sessio
sizeof(tDot11fIEhe_cap));
return QDF_STATUS_SUCCESS;
}
+
/** TODO: String items needs attention. **/
qdf_mem_copy(he_cap, &session->he_config, sizeof(*he_cap));
if (he_cap->ppet_present) {
@@ -6102,6 +6142,7 @@ QDF_STATUS populate_dot11f_he_caps(struct mac_context *mac_ctx, struct pe_sessio
} else {
he_cap->ppet.ppe_threshold.num_ppe_th = 0;
}
+ populate_dot11f_broadcast_twt_he_cap(mac_ctx, session, he_cap);
return QDF_STATUS_SUCCESS;
}
@@ -6210,7 +6251,7 @@ populate_dot11f_he_bss_color_change(struct mac_context *mac_ctx,
#endif /* WLAN_FEATURE_11AX_BSS_COLOR */
#endif /* WLAN_FEATURE_11AX */
-#ifdef WLAN_SUPPORT_TWT
+#if defined(WLAN_FEATURE_11AX) && defined(WLAN_SUPPORT_TWT)
QDF_STATUS populate_dot11f_twt_extended_caps(struct mac_context *mac_ctx,
struct pe_session *pe_session,
tDot11fIEExtCap *dot11f)
@@ -6225,10 +6266,11 @@ QDF_STATUS populate_dot11f_twt_extended_caps(struct mac_context *mac_ctx,
if (pe_session->opmode == QDF_STA_MODE)
p_ext_cap->twt_requestor_support =
- mac_ctx->mlme_cfg->twt_cfg.is_twt_requestor_enabled;
+ mac_ctx->mlme_cfg->he_caps.dot11_he_cap.twt_request;
+
if (pe_session->opmode == QDF_SAP_MODE)
p_ext_cap->twt_responder_support =
- mac_ctx->mlme_cfg->twt_cfg.is_twt_responder_enabled;
+ mac_ctx->mlme_cfg->he_caps.dot11_he_cap.twt_responder;
dot11f->num_bytes = lim_compute_ext_cap_ie_length(dot11f);
diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c
index bcd6aa2b62..0953446954 100644
--- a/core/sme/src/csr/csr_api_roam.c
+++ b/core/sme/src/csr/csr_api_roam.c
@@ -14602,6 +14602,7 @@ static inline void csr_update_sae_config(struct join_req *csr_join_req,
{ }
#endif
+#if defined(WLAN_FEATURE_11AX) && defined(WLAN_SUPPORT_TWT)
/**
* csr_enable_twt() - Check if its allowed to enable twt for this session
* @ie: pointer to beacon/probe resp ie's
@@ -14614,16 +14615,21 @@ static inline void csr_update_sae_config(struct join_req *csr_join_req,
static bool csr_enable_twt(struct mac_context *mac_ctx, tDot11fBeaconIEs *ie)
{
- if (mac_ctx->mlme_cfg->twt_cfg.is_twt_requestor_enabled && ie &&
+ if (mac_ctx->mlme_cfg->he_caps.dot11_he_cap.twt_request && ie &&
(ie->qcn_ie.present || ie->he_cap.twt_responder)) {
sme_debug("TWT is supported, hence disable UAPSD; twt req supp: %d,twt respon supp: %d, QCN_IE: %d",
- mac_ctx->mlme_cfg->twt_cfg.is_twt_requestor_enabled,
- ie->he_cap.twt_responder,
- ie->qcn_ie.present);
+ mac_ctx->mlme_cfg->he_caps.dot11_he_cap.twt_request,
+ ie->he_cap.twt_responder, ie->qcn_ie.present);
return true;
}
return false;
}
+#else
+static bool csr_enable_twt(struct mac_context *mac_ctx, tDot11fBeaconIEs *ie)
+{
+ return false;
+}
+#endif
#ifdef WLAN_ADAPTIVE_11R
/**