ソースを参照

qcacld-3.0: r-TWT related changes

Need to add support for rTWT feature in host. Host needs to define rTWT
ini, and set rTWT bit in EHT Cap. rTWT ini will allow users to
enable/disable rTWT feature. We define rTWT ini and function to get ini
value. EHT Cap  will advertise rTWT support to peer. To populate EHT Cap
we must validate rTWT is supported in driver. To do this, we check rTWT
and bTWT params.

Changes are as follows.
1) Define rTWT ini
2) Get rTWT ini value
3) Get rTWT support
4) Set rTWT bit in EHT Cap

Change-Id: Id5676c6b7c3d4f48a0010f2e9ae369d9dfa710e9
CRs-Fixed: 3446652
David Oladunjoye 2 年 前
コミット
a89ab838b2

+ 71 - 1
components/umac/twt/core/src/wlan_twt_cfg.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 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
@@ -27,6 +27,7 @@ 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;
+	uint32_t rtwt_conf;
 
 	if (!psoc) {
 		twt_err("null psoc");
@@ -42,6 +43,8 @@ QDF_STATUS wlan_twt_cfg_init(struct wlan_objmgr_psoc *psoc)
 
 	twt_cfg = &twt_psoc->cfg_params;
 	bcast_conf = cfg_get(psoc, CFG_BCAST_TWT_REQ_RESP);
+	rtwt_conf = cfg_get(psoc, CFG_RTWT_REQ_RESP);
+
 
 	twt_cfg->enable_twt = cfg_get(psoc, CFG_ENABLE_TWT);
 	twt_cfg->twt_requestor = cfg_get(psoc, CFG_TWT_REQUESTOR);
@@ -55,6 +58,8 @@ QDF_STATUS wlan_twt_cfg_init(struct wlan_objmgr_psoc *psoc)
 	twt_cfg->is_twt_enabled_in_11n = cfg_get(psoc, CFG_TWT_ENABLE_IN_11N);
 	twt_cfg->req_flag = false;
 	twt_cfg->res_flag = false;
+	twt_cfg->rtwt_requestor_enabled = CFG_GET_RTWT_REQ(rtwt_conf);
+	twt_cfg->rtwt_responder_enabled = CFG_GET_RTWT_RES(rtwt_conf);
 
 	twt_debug("req: %d resp: %d", twt_cfg->twt_requestor,
 		  twt_cfg->twt_responder);
@@ -343,6 +348,44 @@ wlan_twt_cfg_get_bcast_responder(struct wlan_objmgr_psoc *psoc, bool *val)
 	return QDF_STATUS_SUCCESS;
 }
 
+QDF_STATUS
+wlan_twt_cfg_get_rtwt_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 rtwt_req_res;
+
+		rtwt_req_res = cfg_default(CFG_RTWT_REQ_RESP);
+		*val = CFG_GET_RTWT_REQ(rtwt_req_res);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*val = twt_psoc_obj->cfg_params.rtwt_requestor_enabled;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+wlan_twt_cfg_get_rtwt_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 rtwt_req_res;
+
+		rtwt_req_res = cfg_default(CFG_RTWT_REQ_RESP);
+		*val = CFG_GET_RTWT_RES(rtwt_req_res);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*val = twt_psoc_obj->cfg_params.rtwt_responder_enabled;
+
+	return QDF_STATUS_SUCCESS;
+}
+
 QDF_STATUS
 wlan_twt_cfg_get_support_in_11n_mode(struct wlan_objmgr_psoc *psoc,
 				     bool *val)
@@ -368,3 +411,30 @@ wlan_twt_cfg_get_support_in_11n_mode(struct wlan_objmgr_psoc *psoc,
 
 	return QDF_STATUS_SUCCESS;
 }
+
+QDF_STATUS
+wlan_twt_get_restricted_support(struct wlan_objmgr_psoc *psoc, bool *val)
+{
+	struct twt_psoc_priv_obj *twt_psoc_obj;
+	psoc_twt_ext_cfg_params_t *twt_cfg;
+	struct twt_tgt_caps *tgt_caps;
+	bool enable_twt;
+
+	twt_psoc_obj = wlan_twt_psoc_get_comp_private_obj(psoc);
+	if (!twt_psoc_obj) {
+		*val = cfg_default(CFG_RTWT_REQ_RESP);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	twt_cfg = &twt_psoc_obj->cfg_params;
+	tgt_caps = &twt_psoc_obj->twt_caps;
+	enable_twt = twt_cfg->enable_twt;
+
+	*val = QDF_MIN(tgt_caps->twt_bcast_req_support &&
+		       tgt_caps->restricted_twt_support,
+		       twt_cfg->bcast_requestor_enabled &&
+		       twt_cfg->rtwt_requestor_enabled &&
+		       enable_twt);
+
+	return QDF_STATUS_SUCCESS;
+}

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

@@ -193,6 +193,26 @@ wlan_twt_cfg_get_bcast_requestor(struct wlan_objmgr_psoc *psoc, bool *val);
 QDF_STATUS
 wlan_twt_cfg_get_bcast_responder(struct wlan_objmgr_psoc *psoc, bool *val);
 
+/**
+ * wlan_twt_cfg_get_rtwt_requestor() - get rtwt requestor
+ * @psoc: Pointer to global psoc
+ * @val: pointer to output variable
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+wlan_twt_cfg_get_rtwt_requestor(struct wlan_objmgr_psoc *psoc, bool *val);
+
+/**
+ * wlan_twt_cfg_get_rtwt_responder() - get rtwt responder
+ * @psoc: Pointer to global psoc
+ * @val: pointer to output variable
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+wlan_twt_cfg_get_rtwt_responder(struct wlan_objmgr_psoc *psoc, bool *val);
+
 /**
  * wlan_twt_cfg_get_support_in_11n_mode() - Get TWT support in 11n mode
  * @psoc: Pointer to global psoc
@@ -203,6 +223,15 @@ wlan_twt_cfg_get_bcast_responder(struct wlan_objmgr_psoc *psoc, bool *val);
 QDF_STATUS
 wlan_twt_cfg_get_support_in_11n_mode(struct wlan_objmgr_psoc *psoc,
 				     bool *val);
+/**
+ * wlan_twt_get_restricted_support() - Get rTWT support
+ * @psoc: Pointer to global psoc
+ * @val: pointer to output variable
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+wlan_twt_get_restricted_support(struct wlan_objmgr_psoc *psoc, bool *val);
 
 #else
 
@@ -313,6 +342,12 @@ wlan_twt_cfg_get_support_in_11n_mode(struct wlan_objmgr_psoc *psoc,
 {
 	return QDF_STATUS_SUCCESS;
 }
+
+static inline QDF_STATUS
+wlan_twt_get_restricted_support(struct wlan_objmgr_psoc *psoc, bool *val)
+{
+	return QDF_STATUS_SUCCESS;
+}
 #endif
 
 #endif /* End of _WLAN_TWT_CFG_H */

+ 50 - 2
components/umac/twt/dispatcher/inc/cfg_twt.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 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
@@ -164,6 +164,53 @@
 		     TWT_BCAST_RES_INDEX, \
 		     TWT_BCAST_RES_BITS)
 
+/*
+ * <ini>
+ * rtwt_req_resp_config - To enable restricted twt requestor and responder.
+ * @Min: 0 Disable the extended twt capability
+ * @Max: 3
+ * @Default: 0
+ *
+ * This cfg is used to configure the restricted TWT requestor and responder.
+ * Bitmap for enabling the restricted twt requestor and responder.
+ * BIT 0: Enable/Disable restricted twt requestor.
+ * BIT 1: Enable/Disable restricted twt responder.
+ * BIT 2-31: Reserved
+ *
+ * Related: CFG_ENABLE_TWT
+ * Related: CFG_TWT_RESPONDER
+ * Related: CFG_TWT_REQUESTOR
+ *
+ * Supported Feature: 11AX
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+/* defines to extract the requestor/responder capabilities from cfg */
+#define RTWT_REQ_INDEX    0
+#define RTWT_REQ_BITS     1
+#define RTWT_RES_INDEX    1
+#define RTWT_RES_BITS     1
+
+#define CFG_RTWT_REQ_RESP CFG_INI_UINT( \
+		"rtwt_req_resp_config", \
+		0, \
+		3, \
+		0, \
+		CFG_VALUE_OR_DEFAULT, \
+		"RESTRICTED TWT CAPABILITY")
+
+#define CFG_GET_RTWT_REQ(_rtwt_conf) \
+	QDF_GET_BITS(_rtwt_conf, \
+		     RTWT_REQ_INDEX, \
+		     RTWT_REQ_BITS)
+
+#define CFG_GET_RTWT_RES(_rtwt_conf) \
+	QDF_GET_BITS(_rtwt_conf, \
+		     RTWT_RES_INDEX, \
+		     RTWT_RES_BITS)
+
 /*
  * <ini>
  * enable_twt_24ghz - Enable Target wake time when STA is connected on 2.4Ghz
@@ -223,7 +270,8 @@
 	CFG(CFG_TWT_CONGESTION_TIMEOUT) \
 	CFG(CFG_BCAST_TWT_REQ_RESP) \
 	CFG(CFG_ENABLE_TWT_24GHZ) \
-	CFG(CFG_TWT_ENABLE_IN_11N)
+	CFG(CFG_TWT_ENABLE_IN_11N) \
+	CFG(CFG_RTWT_REQ_RESP)
 #elif !defined(WLAN_SUPPORT_TWT) && !defined(WLAN_TWT_CONV_SUPPORTED)
 #define CFG_TWT_ALL
 #endif

+ 11 - 1
components/umac/twt/dispatcher/inc/wlan_twt_cfg_ext_api.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 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
@@ -86,6 +86,16 @@ wlan_twt_get_requestor_cfg(struct wlan_objmgr_psoc *psoc, bool *val);
 QDF_STATUS
 wlan_twt_get_responder_cfg(struct wlan_objmgr_psoc *psoc, bool *val);
 
+/**
+ * wlan_twt_get_rtwt_support() - Get rTWT support
+ * @psoc: Pointer to global psoc
+ * @val: pointer to output variable
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+wlan_twt_get_rtwt_support(struct wlan_objmgr_psoc *psoc, bool *val);
+
 #ifdef FEATURE_SET
 /**
  * wlan_twt_get_feature_info() - Get TWT feature set information

+ 5 - 1
components/umac/twt/dispatcher/inc/wlan_twt_ext_defs.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 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
@@ -40,6 +40,8 @@
  * @req_flag: requestor flag enable/disable
  * @res_flag: responder flag enable/disable
  * @is_twt_enabled_in_11n: Enable TWT support in 11n mode
+ * @rtwt_requestor_enabled: Restricted TWT requestor enable or disable
+ * @rtwt_responder_enabled: Restricted TWT responder enable or disable
  */
 struct twt_mc_cfg_params {
 	bool enable_twt;
@@ -53,6 +55,8 @@ struct twt_mc_cfg_params {
 	bool req_flag;
 	bool res_flag;
 	bool is_twt_enabled_in_11n;
+	bool rtwt_requestor_enabled;
+	bool rtwt_responder_enabled;
 };
 
 #endif /* __WLAN_TWT_EXT_DEFS_H__ */

+ 6 - 0
components/umac/twt/dispatcher/src/wlan_twt_cfg_ext_api.c

@@ -55,6 +55,12 @@ wlan_twt_cfg_get_support_requestor(struct wlan_objmgr_psoc *psoc, bool *val)
 	return wlan_twt_cfg_get_requestor(psoc, val);
 }
 
+QDF_STATUS
+wlan_twt_get_rtwt_support(struct wlan_objmgr_psoc *psoc, bool *val)
+{
+	return wlan_twt_get_restricted_support(psoc, val);
+}
+
 #ifdef FEATURE_SET
 void wlan_twt_get_feature_info(struct wlan_objmgr_psoc *psoc,
 			       struct wlan_twt_features *twt_feature_set)

+ 13 - 1
components/umac/twt/dispatcher/src/wlan_twt_ucfg_ext_api.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 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
@@ -143,6 +143,18 @@ ucfg_twt_cfg_get_bcast_requestor(struct wlan_objmgr_psoc *psoc, bool *val)
 	return wlan_twt_cfg_get_bcast_requestor(psoc, val);
 }
 
+QDF_STATUS
+ucfg_twt_cfg_get_bcast_responder(struct wlan_objmgr_psoc *psoc, bool *val)
+{
+	return wlan_twt_cfg_get_bcast_responder(psoc, val);
+}
+
+QDF_STATUS
+ucfg_twt_cfg_get_rtwt_requestor(struct wlan_objmgr_psoc *psoc, bool *val)
+{
+	return wlan_twt_cfg_get_rtwt_requestor(psoc, val);
+}
+
 QDF_STATUS
 ucfg_twt_cfg_get_flex_sched(struct wlan_objmgr_psoc *psoc, bool *val)
 {

+ 22 - 5
core/mac/src/sys/legacy/src/utils/src/parser_api.c

@@ -59,11 +59,6 @@
 #include <wlan_mlo_t2lm.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)
@@ -9165,6 +9160,27 @@ void lim_ieee80211_pack_ehtcap(uint8_t *ie, tDot11fIEeht_cap dot11f_eht_cap,
 	ehtcaplen = ehtcap->elem_len + WLAN_IE_HDR_LEN;
 }
 
+#ifdef WLAN_SUPPORT_TWT
+static void
+populate_dot11f_twt_eht_cap(struct mac_context *mac,
+			    tDot11fIEeht_cap *eht_cap)
+{
+	bool restricted_support = false;
+
+	wlan_twt_get_rtwt_support(mac->psoc, &restricted_support);
+
+	pe_debug("rTWT support: %d", restricted_support);
+
+	eht_cap->restricted_twt = restricted_support;
+}
+#else
+static inline void
+populate_dot11f_twt_eht_cap(struct mac_context *mac_ctx,
+			    tDot11fIEhe_cap *eht_cap)
+{
+	eht_cap->restricted_twt = false;
+}
+#endif
 QDF_STATUS populate_dot11f_eht_caps(struct mac_context *mac_ctx,
 				    struct pe_session *session,
 				    tDot11fIEeht_cap *eht_cap)
@@ -9183,6 +9199,7 @@ QDF_STATUS populate_dot11f_eht_caps(struct mac_context *mac_ctx,
 	if (session->ch_width != CH_WIDTH_320MHZ)
 		eht_cap->support_320mhz_6ghz = 0;
 
+	populate_dot11f_twt_eht_cap(mac_ctx, eht_cap);
 	return QDF_STATUS_SUCCESS;
 }