Forráskód Böngészése

qcacld-3.0: TWT cfg params initialization

Initialize TWT psoc cfg params with the cfg.ini values.

Change-Id: I326239d4f3f146113871fb3700fa82260988d697
CRs-Fixed: 3085507
Srinivas Girigowda 3 éve
szülő
commit
0737e8caec

+ 2 - 7
components/cp_stats/dispatcher/inc/wlan_cp_stats_mc_ucfg_api.h

@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. 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
  * above copyright notice and this permission notice appear in all
@@ -40,12 +41,6 @@
 /* Max TWT sessions supported */
 #define TWT_PSOC_MAX_SESSIONS TWT_PEER_MAX_SESSIONS
 
-/* Valid dialog_id 0 to (0xFF - 1) */
-#define TWT_MAX_DIALOG_ID (0xFF - 1)
-
-/* dialog_id used to get all peer's twt session parameters */
-#define TWT_GET_ALL_PEER_PARAMS_DIALOG_ID (0xFF)
-
 /**
  * ucfg_twt_get_peer_session_params() - Retrieves peer twt session parameters
  * corresponding to a peer by using mac_addr and dialog id

+ 7 - 0
components/mlme/core/src/wlan_mlme_main.c

@@ -1253,6 +1253,7 @@ static void mlme_init_he_cap_in_cfg(struct wlan_objmgr_psoc *psoc,
 }
 #endif
 
+#ifdef WLAN_SUPPORT_TWT
 static void mlme_init_twt_cfg(struct wlan_objmgr_psoc *psoc,
 			      struct wlan_mlme_cfg_twt *twt_cfg)
 {
@@ -1264,6 +1265,12 @@ static void mlme_init_twt_cfg(struct wlan_objmgr_psoc *psoc,
 	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);
 }
+#else
+static void mlme_init_twt_cfg(struct wlan_objmgr_psoc *psoc,
+			      struct wlan_mlme_cfg_twt *twt_cfg)
+{
+}
+#endif
 
 #ifdef WLAN_FEATURE_11BE
 static void mlme_init_eht_cap_in_cfg(struct wlan_objmgr_psoc *psoc,

+ 1 - 0
components/mlme/dispatcher/inc/cfg_mlme.h

@@ -61,6 +61,7 @@
 #include "cfg_mlme_mwc.h"
 #include "cfg_mlme_reg.h"
 #include "cfg_mlme_eht_caps.h"
+#include "cfg_twt.h"
 
 /* Please Maintain Alphabetic Order here */
 #define CFG_MLME_ALL \

+ 3 - 1
components/mlme/dispatcher/inc/cfg_mlme_twt.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2011-2018, 2020-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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
@@ -22,7 +23,7 @@
 
 #ifndef __CFG_MLME_TWT_H
 #define __CFG_MLME_TWT_H
-
+#if defined(WLAN_SUPPORT_TWT) && !defined(WLAN_TWT_CONV_SUPPORTED)
 /*
  * <ini>
  * twt_requestor - twt requestor.
@@ -194,4 +195,5 @@
 	CFG(CFG_TWT_CONGESTION_TIMEOUT) \
 	CFG(CFG_BCAST_TWT_REQ_RESP) \
 	CFG(CFG_ENABLE_TWT_24GHZ)
+#endif
 #endif /* __CFG_MLME_TWT_H */

+ 105 - 1
components/mlme/dispatcher/inc/wlan_mlme_twt_ucfg_api.h

@@ -31,7 +31,111 @@
 #include <wlan_mlme_main.h>
 #include <wlan_mlme_twt_api.h>
 
-#if defined(WLAN_SUPPORT_TWT) && defined(WLAN_FEATURE_11AX)
+#if defined(WLAN_SUPPORT_TWT) && defined(WLAN_FEATURE_11AX) && \
+	defined(WLAN_TWT_CONV_SUPPORTED)
+static inline
+QDF_STATUS ucfg_mlme_init_twt_context(struct wlan_objmgr_psoc *psoc,
+				      struct qdf_mac_addr *peer_mac,
+				      uint8_t dialog_id)
+{
+	return QDF_STATUS_E_NOSUPPORT;
+}
+
+static inline bool
+ucfg_mlme_is_twt_enabled(struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_E_NOSUPPORT;
+}
+
+static inline QDF_STATUS
+ucfg_mlme_get_twt_requestor(struct wlan_objmgr_psoc *psoc,
+			    bool *val)
+{
+	*val = false;
+	return QDF_STATUS_E_NOSUPPORT;
+}
+
+static inline QDF_STATUS
+ucfg_mlme_set_twt_requestor(struct wlan_objmgr_psoc *psoc,
+			    bool val)
+{
+	return QDF_STATUS_E_NOSUPPORT;
+}
+
+static inline QDF_STATUS
+ucfg_mlme_get_twt_responder(struct wlan_objmgr_psoc *psoc,
+			    bool *val)
+{
+	*val = false;
+	return QDF_STATUS_E_NOSUPPORT;
+}
+
+static inline QDF_STATUS
+ucfg_mlme_set_twt_responder(struct wlan_objmgr_psoc *psoc,
+			    bool val)
+{
+	return QDF_STATUS_E_NOSUPPORT;
+}
+
+static inline bool
+ucfg_mlme_is_twt_setup_done(struct wlan_objmgr_psoc *psoc,
+			    struct qdf_mac_addr *peer_mac, uint8_t dialog_id)
+{
+	return 0;
+}
+
+static inline void
+ucfg_mlme_set_twt_setup_done(struct wlan_objmgr_psoc *psoc,
+			     struct qdf_mac_addr *peer_mac,
+			     uint8_t dialog_id, bool is_set)
+{}
+
+static inline
+void ucfg_mlme_set_twt_session_state(struct wlan_objmgr_psoc *psoc,
+				     struct qdf_mac_addr *peer_mac,
+				     uint8_t dialog_id,
+				     enum wlan_twt_session_state state)
+{}
+
+static inline enum wlan_twt_session_state
+ucfg_mlme_get_twt_session_state(struct wlan_objmgr_psoc *psoc,
+				struct qdf_mac_addr *peer_mac,
+				uint8_t dialog_id)
+{
+	return WLAN_TWT_SETUP_STATE_NOT_ESTABLISHED;
+}
+
+static inline QDF_STATUS
+ucfg_mlme_set_twt_res_service_cap(struct wlan_objmgr_psoc *psoc, bool val)
+{
+	return QDF_STATUS_E_NOSUPPORT;
+}
+
+static inline QDF_STATUS
+ucfg_mlme_get_twt_res_service_cap(struct wlan_objmgr_psoc *psoc, bool *val)
+{
+	*val = false;
+	return QDF_STATUS_E_NOSUPPORT;
+}
+
+static inline QDF_STATUS
+ucfg_mlme_reset_twt_active_cmd(struct wlan_objmgr_psoc *psoc,
+			       struct qdf_mac_addr *peer_mac,
+			       uint8_t dialog_id)
+{
+	return QDF_STATUS_E_NOSUPPORT;
+}
+
+static inline QDF_STATUS
+ucfg_mlme_set_twt_command_in_progress(struct wlan_objmgr_psoc *psoc,
+				      struct qdf_mac_addr *peer_mac,
+				      uint8_t dialog_id,
+				      enum wlan_twt_commands cmd)
+{
+	return QDF_STATUS_E_FAILURE;
+}
+
+#elif defined(WLAN_SUPPORT_TWT) && defined(WLAN_FEATURE_11AX)
 /**
  * ucfg_mlme_get_twt_requestor() - Get twt requestor
  * @psoc: pointer to psoc object

+ 2 - 1
components/mlme/dispatcher/src/wlan_mlme_twt_ucfg_api.c

@@ -25,7 +25,8 @@
 #include "cfg_mlme_twt.h"
 #include "wlan_mlme_twt_ucfg_api.h"
 
-#if defined(WLAN_SUPPORT_TWT) && defined(WLAN_FEATURE_11AX)
+#if defined(WLAN_SUPPORT_TWT) && defined(WLAN_FEATURE_11AX) && \
+	!defined(WLAN_TWT_CONV_SUPPORTED)
 QDF_STATUS
 ucfg_mlme_get_twt_requestor(struct wlan_objmgr_psoc *psoc,
 			    bool *val)

+ 208 - 0
components/umac/twt/core/src/wlan_twt_cfg.c

@@ -24,23 +24,133 @@
 
 QDF_STATUS wlan_twt_cfg_init(struct wlan_objmgr_psoc *psoc)
 {
+	struct twt_psoc_priv_obj *twt_psoc;
+	psoc_twt_ext_cfg_params_t *twt_cfg;
+	uint32_t bcast_conf;
+
+	if (!psoc) {
+		twt_err("null psoc");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	twt_psoc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
+							 WLAN_UMAC_COMP_TWT);
+	if (!twt_psoc) {
+		twt_err("null twt psoc priv obj");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	twt_cfg = &twt_psoc->cfg_params;
+	bcast_conf = cfg_get(psoc, CFG_BCAST_TWT_REQ_RESP);
+
+	twt_cfg->enable_twt = cfg_get(psoc, CFG_ENABLE_TWT);
+	twt_cfg->twt_requestor = cfg_get(psoc, CFG_TWT_REQUESTOR);
+	twt_cfg->twt_responder = cfg_get(psoc, CFG_TWT_RESPONDER);
+	twt_cfg->twt_congestion_timeout =
+				cfg_get(psoc, CFG_TWT_CONGESTION_TIMEOUT);
+	twt_cfg->bcast_requestor_enabled = CFG_TWT_GET_BCAST_REQ(bcast_conf);
+	twt_cfg->bcast_responder_enabled = CFG_TWT_GET_BCAST_RES(bcast_conf);
+	twt_cfg->enable_twt_24ghz = cfg_get(psoc, CFG_ENABLE_TWT_24GHZ);
+	twt_cfg->flex_twt_sched = cfg_default(CFG_HE_FLEX_TWT_SCHED);
+	twt_cfg->req_flag = false;
+	twt_cfg->res_flag = false;
+
+	twt_debug("req: %d resp: %d", twt_cfg->twt_requestor,
+		  twt_cfg->twt_responder);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS wlan_twt_cfg_deinit(struct wlan_objmgr_psoc *psoc)
+{
+	struct twt_psoc_priv_obj *twt_psoc;
+
+	if (!psoc) {
+		twt_err("null psoc");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	twt_psoc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
+							 WLAN_UMAC_COMP_TWT);
+	if (!twt_psoc) {
+		twt_err("null twt psoc priv obj");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	qdf_mem_zero(&twt_psoc->cfg_params, sizeof(twt_psoc->cfg_params));
+
 	return QDF_STATUS_SUCCESS;
 }
 
 QDF_STATUS wlan_twt_cfg_update(struct wlan_objmgr_psoc *psoc)
 {
+	struct twt_psoc_priv_obj *twt_psoc;
+	psoc_twt_ext_cfg_params_t *twt_cfg;
+	struct twt_tgt_caps *tgt_caps;
+	bool enable_twt;
+
+	if (!psoc) {
+		twt_err("null psoc");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	twt_psoc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
+							 WLAN_UMAC_COMP_TWT);
+	if (!twt_psoc) {
+		twt_err("null twt psoc priv obj");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	twt_cfg = &twt_psoc->cfg_params;
+	tgt_caps = &twt_psoc->twt_caps;
+	enable_twt = twt_cfg->enable_twt;
+
+	twt_cfg->twt_requestor = QDF_MIN(tgt_caps->twt_requestor,
+					(enable_twt && twt_cfg->twt_requestor));
+	twt_cfg->twt_responder = QDF_MIN(tgt_caps->twt_responder,
+					(enable_twt && twt_cfg->twt_responder));
+	twt_cfg->bcast_requestor_enabled =
+			QDF_MIN((tgt_caps->twt_bcast_req_support ||
+				tgt_caps->legacy_bcast_twt_support),
+				(enable_twt &&
+					twt_cfg->bcast_requestor_enabled));
+	twt_cfg->bcast_responder_enabled =
+			QDF_MIN((tgt_caps->twt_bcast_res_support ||
+				tgt_caps->legacy_bcast_twt_support),
+				(enable_twt &&
+					twt_cfg->bcast_responder_enabled));
 	return QDF_STATUS_SUCCESS;
 }
 
 QDF_STATUS
 wlan_twt_cfg_get_requestor(struct wlan_objmgr_psoc *psoc, bool *val)
 {
+	struct twt_psoc_priv_obj *twt_psoc_obj;
+
+	twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
+	if (!twt_psoc_obj) {
+		*val = cfg_default(CFG_TWT_REQUESTOR);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*val = twt_psoc_obj->cfg_params.twt_requestor;
+
 	return QDF_STATUS_SUCCESS;
 }
 
 QDF_STATUS
 wlan_twt_cfg_get_responder(struct wlan_objmgr_psoc *psoc, bool *val)
 {
+	struct twt_psoc_priv_obj *twt_psoc_obj;
+
+	twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
+	if (!twt_psoc_obj) {
+		*val = cfg_default(CFG_TWT_RESPONDER);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*val = twt_psoc_obj->cfg_params.twt_responder;
+
 	return QDF_STATUS_SUCCESS;
 }
 
@@ -48,60 +158,158 @@ QDF_STATUS
 wlan_twt_cfg_get_congestion_timeout(struct wlan_objmgr_psoc *psoc,
 				    uint32_t *val)
 {
+	struct twt_psoc_priv_obj *twt_psoc_obj;
+
+	twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
+	if (!twt_psoc_obj) {
+		*val = cfg_default(CFG_TWT_CONGESTION_TIMEOUT);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*val = twt_psoc_obj->cfg_params.twt_congestion_timeout;
+
 	return QDF_STATUS_SUCCESS;
 }
 
 QDF_STATUS
 wlan_twt_cfg_set_congestion_timeout(struct wlan_objmgr_psoc *psoc, uint32_t val)
 {
+	struct twt_psoc_priv_obj *twt_psoc_obj;
+
+	twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
+	if (!twt_psoc_obj)
+		return QDF_STATUS_E_INVAL;
+
+	twt_psoc_obj->cfg_params.twt_congestion_timeout = val;
+
 	return QDF_STATUS_SUCCESS;
 }
 
 QDF_STATUS
 wlan_twt_cfg_get_requestor_flag(struct wlan_objmgr_psoc *psoc, bool *val)
 {
+	struct twt_psoc_priv_obj *twt_psoc_obj;
+
+	twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
+	if (!twt_psoc_obj) {
+		*val = false;
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*val = twt_psoc_obj->cfg_params.req_flag;
+
 	return QDF_STATUS_SUCCESS;
 }
 
 QDF_STATUS
 wlan_twt_cfg_set_requestor_flag(struct wlan_objmgr_psoc *psoc, bool val)
 {
+	struct twt_psoc_priv_obj *twt_psoc_obj;
+
+	twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
+	if (!twt_psoc_obj)
+		return QDF_STATUS_E_INVAL;
+
+	twt_psoc_obj->cfg_params.req_flag = val;
+
 	return QDF_STATUS_SUCCESS;
 }
 
 QDF_STATUS
 wlan_twt_cfg_get_responder_flag(struct wlan_objmgr_psoc *psoc, bool *val)
 {
+	struct twt_psoc_priv_obj *twt_psoc_obj;
+
+	twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
+	if (!twt_psoc_obj)
+		return QDF_STATUS_E_INVAL;
+
+	*val = twt_psoc_obj->cfg_params.res_flag;
+
 	return QDF_STATUS_SUCCESS;
 }
 
 QDF_STATUS
 wlan_twt_cfg_set_responder_flag(struct wlan_objmgr_psoc *psoc, bool val)
 {
+	struct twt_psoc_priv_obj *twt_psoc_obj;
+
+	twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
+	if (!twt_psoc_obj)
+		return QDF_STATUS_E_INVAL;
+
+	twt_psoc_obj->cfg_params.res_flag = val;
+
 	return QDF_STATUS_SUCCESS;
 }
 
 QDF_STATUS
 wlan_twt_cfg_get_flex_sched(struct wlan_objmgr_psoc *psoc, bool *val)
 {
+	struct twt_psoc_priv_obj *twt_psoc_obj;
+
+	twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
+	if (!twt_psoc_obj) {
+		*val = cfg_default(CFG_HE_FLEX_TWT_SCHED);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*val = twt_psoc_obj->cfg_params.flex_twt_sched;
+
 	return QDF_STATUS_SUCCESS;
 }
 
 QDF_STATUS
 wlan_twt_cfg_get_24ghz_enabled(struct wlan_objmgr_psoc *psoc, bool *val)
 {
+	struct twt_psoc_priv_obj *twt_psoc_obj;
+
+	twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
+	if (!twt_psoc_obj) {
+		*val = cfg_default(CFG_ENABLE_TWT_24GHZ);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*val = twt_psoc_obj->cfg_params.enable_twt_24ghz;
+
 	return QDF_STATUS_SUCCESS;
 }
 
 QDF_STATUS
 wlan_twt_cfg_get_bcast_requestor(struct wlan_objmgr_psoc *psoc, bool *val)
 {
+	struct twt_psoc_priv_obj *twt_psoc_obj;
+
+	twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
+	if (!twt_psoc_obj) {
+		uint32_t b_req_res;
+
+		b_req_res = cfg_default(CFG_BCAST_TWT_REQ_RESP);
+		*val = CFG_TWT_GET_BCAST_REQ(b_req_res);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*val = twt_psoc_obj->cfg_params.bcast_requestor_enabled;
+
 	return QDF_STATUS_SUCCESS;
 }
 
 QDF_STATUS
 wlan_twt_cfg_get_bcast_responder(struct wlan_objmgr_psoc *psoc, bool *val)
 {
+	struct twt_psoc_priv_obj *twt_psoc_obj;
+
+	twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
+	if (!twt_psoc_obj) {
+		uint32_t b_req_res;
+
+		b_req_res = cfg_default(CFG_BCAST_TWT_REQ_RESP);
+		*val = CFG_TWT_GET_BCAST_RES(b_req_res);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*val = twt_psoc_obj->cfg_params.bcast_responder_enabled;
+
 	return QDF_STATUS_SUCCESS;
 }
 

+ 10 - 0
components/umac/twt/core/src/wlan_twt_cfg.h

@@ -28,6 +28,16 @@
  */
 QDF_STATUS wlan_twt_cfg_init(struct wlan_objmgr_psoc *psoc);
 
+/**
+ * wlan_twt_cfg_deinit() - De-initialize twt config params
+ * @psoc: Pointer to global psoc
+ *
+ * This function de-initializes the twt private cfg params
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS wlan_twt_cfg_deinit(struct wlan_objmgr_psoc *psoc);
+
 /**
  * wlan_twt_cfg_update() - Update twt config params
  * @psoc: Pointer to global psoc

+ 5 - 0
components/umac/twt/dispatcher/src/wlan_twt_ucfg_ext_api.c

@@ -25,6 +25,11 @@ QDF_STATUS ucfg_twt_psoc_open(struct wlan_objmgr_psoc *psoc)
 	return wlan_twt_cfg_init(psoc);
 }
 
+QDF_STATUS ucfg_twt_psoc_close(struct wlan_objmgr_psoc *psoc)
+{
+	return wlan_twt_cfg_deinit(psoc);
+}
+
 QDF_STATUS ucfg_twt_update_psoc_config(struct wlan_objmgr_psoc *psoc)
 {
 	return wlan_twt_cfg_update(psoc);

+ 32 - 0
core/hdd/inc/wlan_hdd_twt.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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
@@ -331,6 +332,23 @@ void hdd_twt_del_dialog_in_ps_disable(struct hdd_context *hdd_ctx,
 			      QCA_WLAN_VENDOR_ATTR_CONFIG_TWT_MAX)       \
 },
 
+/**
+ * hdd_get_twt_requestor() - Get TWT requestor config
+ * @psoc: global psoc object
+ * @val: output variable to store the value
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS hdd_get_twt_requestor(struct wlan_objmgr_psoc *psoc, bool *val);
+
+/**
+ * hdd_get_twt_responder() - Get TWT responder config
+ * @psoc: global psoc object
+ * @val: output variable to store the value
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS hdd_get_twt_responder(struct wlan_objmgr_psoc *psoc, bool *val);
 #else
 static inline void hdd_update_tgt_twt_cap(struct hdd_context *hdd_ctx,
 					  struct wma_tgt_cfg *cfg)
@@ -426,6 +444,20 @@ void hdd_twt_del_dialog_in_ps_disable(struct hdd_context *hdd_ctx,
 {
 }
 
+static inline
+QDF_STATUS hdd_get_twt_requestor(struct wlan_objmgr_psoc *psoc, bool *val)
+{
+	*val = false;
+	return QDF_STATUS_E_NOSUPPORT;
+}
+
+static inline
+QDF_STATUS hdd_get_twt_responder(struct wlan_objmgr_psoc *psoc, bool *val)
+{
+	*val = false;
+	return QDF_STATUS_E_NOSUPPORT;
+}
+
 #define FEATURE_VENDOR_SUBCMD_WIFI_CONFIG_TWT
 
 #endif

+ 12 - 0
core/hdd/src/wlan_hdd_main.c

@@ -219,6 +219,8 @@
 #include <wlan_objmgr_vdev_obj_i.h>
 #include "osif_vdev_mgr_util.h"
 #include <son_ucfg_api.h>
+#include "osif_twt_util.h"
+#include "wlan_twt_ucfg_ext_api.h"
 
 #ifdef MODULE
 #define WLAN_MODULE_NAME  module_name(THIS_MODULE)
@@ -17552,8 +17554,14 @@ QDF_STATUS hdd_component_psoc_open(struct wlan_objmgr_psoc *psoc)
 	if (QDF_IS_STATUS_ERROR(status))
 		goto err_nan;
 
+	status = ucfg_twt_psoc_open(psoc);
+	if (QDF_IS_STATUS_ERROR(status))
+		goto err_twt;
+
 	return status;
 
+err_twt:
+	ucfg_nan_psoc_close(psoc);
 err_nan:
 	ucfg_tdls_psoc_close(psoc);
 err_tdls:
@@ -17574,6 +17582,8 @@ err_dlm:
 
 void hdd_component_psoc_close(struct wlan_objmgr_psoc *psoc)
 {
+	ucfg_twt_psoc_close(psoc);
+	ucfg_nan_psoc_close(psoc);
 	ucfg_tdls_psoc_close(psoc);
 	ucfg_p2p_psoc_close(psoc);
 	ucfg_policy_mgr_psoc_close(psoc);
@@ -19021,6 +19031,8 @@ int hdd_update_components_config(struct hdd_context *hdd_ctx)
 		return ret;
 
 	ret = hdd_update_regulatory_config(hdd_ctx);
+	if (ret)
+		return ret;
 
 	return ret;
 }

+ 36 - 0
core/hdd/src/wlan_hdd_twt.c

@@ -39,6 +39,30 @@
 #include <wlan_cp_stats_mc_ucfg_api.h>
 #include <wlan_mlme_twt_ucfg_api.h>
 #include <target_if.h>
+#include "wlan_hdd_object_manager.h"
+#include "osif_twt_ext_req.h"
+#include "wlan_twt_ucfg_ext_api.h"
+#include "wlan_twt_ucfg_ext_cfg.h"
+#include "osif_twt_internal.h"
+
+#if defined(WLAN_SUPPORT_TWT) && defined(WLAN_TWT_CONV_SUPPORTED)
+QDF_STATUS hdd_get_twt_requestor(struct wlan_objmgr_psoc *psoc, bool *val)
+{
+	return ucfg_twt_cfg_get_requestor(psoc, val);
+}
+
+QDF_STATUS hdd_get_twt_responder(struct wlan_objmgr_psoc *psoc, bool *val)
+{
+	return ucfg_twt_cfg_get_responder(psoc, val);
+}
+
+void hdd_update_tgt_twt_cap(struct hdd_context *hdd_ctx,
+			    struct wma_tgt_cfg *cfg)
+{
+	ucfg_twt_update_psoc_config(hdd_ctx->psoc);
+}
+
+#elif defined(WLAN_SUPPORT_TWT)
 
 #define TWT_DISABLE_COMPLETE_TIMEOUT 1000
 #define TWT_ENABLE_COMPLETE_TIMEOUT  1000
@@ -4727,3 +4751,15 @@ void wlan_hdd_twt_deinit(struct hdd_context *hdd_ctx)
 
 	hdd_ctx->twt_state = TWT_CLOSED;
 }
+
+QDF_STATUS hdd_get_twt_requestor(struct wlan_objmgr_psoc *psoc, bool *val)
+{
+	return ucfg_mlme_get_twt_requestor(psoc, val);
+}
+
+QDF_STATUS hdd_get_twt_responder(struct wlan_objmgr_psoc *psoc, bool *val)
+{
+	return ucfg_mlme_get_twt_responder(psoc, val);
+}
+
+#endif

+ 43 - 4
core/mac/src/sys/legacy/src/utils/src/parser_api.c

@@ -54,6 +54,11 @@
 #include <utils_mlo.h>
 #endif
 
+#if defined(WLAN_SUPPORT_TWT) && defined(WLAN_FEATURE_11AX) && \
+	defined(WLAN_TWT_CONV_SUPPORTED)
+#include "wlan_twt_cfg_ext_api.h"
+#endif
+
 #define RSN_OUI_SIZE 4
 /* ////////////////////////////////////////////////////////////////////// */
 void swap_bit_field16(uint16_t in, uint16_t *out)
@@ -6602,6 +6607,40 @@ populate_dot11f_timing_advert_frame(struct mac_context *mac_ctx,
 	return QDF_STATUS_SUCCESS;
 }
 
+#if defined(WLAN_SUPPORT_TWT) && defined(WLAN_FEATURE_11AX)
+#ifdef WLAN_TWT_CONV_SUPPORTED
+static bool
+twt_get_requestor_flag(struct mac_context *mac)
+{
+	bool req_flag = false;
+
+	wlan_twt_cfg_get_req_flag(mac->psoc, &req_flag);
+	return req_flag;
+}
+
+static bool
+twt_get_responder_flag(struct mac_context *mac)
+{
+	bool res_flag = false;
+
+	wlan_twt_cfg_get_res_flag(mac->psoc, &res_flag);
+	return res_flag;
+}
+#else
+static bool
+twt_get_requestor_flag(struct mac_context *mac)
+{
+	return mac->mlme_cfg->twt_cfg.req_flag;
+}
+
+static bool
+twt_get_responder_flag(struct mac_context *mac)
+{
+	return mac->mlme_cfg->twt_cfg.res_flag;
+}
+#endif
+#endif
+
 #ifdef WLAN_FEATURE_11AX
 #ifdef WLAN_SUPPORT_TWT
 static void
@@ -6617,12 +6656,12 @@ populate_dot11f_twt_he_cap(struct mac_context *mac,
 
 	he_cap->broadcast_twt = 0;
 	if (session->opmode == QDF_STA_MODE &&
-	    !(mac->mlme_cfg->twt_cfg.req_flag)) {
+	    !twt_get_requestor_flag(mac)) {
 		/* Set twt_request as 0 if any SCC/MCC concurrency exist */
 		he_cap->twt_request = 0;
 		return;
 	} else if (session->opmode == QDF_SAP_MODE &&
-		   !(mac->mlme_cfg->twt_cfg.res_flag)) {
+		   !twt_get_responder_flag(mac)) {
 		/** Set twt_responder as 0 if any SCC/MCC concurrency exist */
 		he_cap->twt_responder = 0;
 		return;
@@ -7712,12 +7751,12 @@ 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->he_caps.dot11_he_cap.twt_request &&
-			mac_ctx->mlme_cfg->twt_cfg.req_flag;
+			twt_get_requestor_flag(mac_ctx);
 
 	if (pe_session->opmode == QDF_SAP_MODE)
 		p_ext_cap->twt_responder_support =
 			mac_ctx->mlme_cfg->he_caps.dot11_he_cap.twt_responder &&
-			mac_ctx->mlme_cfg->twt_cfg.res_flag;
+			twt_get_responder_flag(mac_ctx);
 
 	dot11f->num_bytes = lim_compute_ext_cap_ie_length(dot11f);
 	if (!dot11f->num_bytes) {