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

qcacld-3.0: Send Peer TWT caps in PEER ASSOC

Parse the association response frame to read the
peer TWT extended capabilities and fill them in
the WMI PEER ASSOC command and send it to the
firmware.

Change-Id: I07f21010abbdaa20e212abae127009dd11e6ab7d
CRs-Fixed: 2264690
Varun Reddy Yeturu 6 éve
szülő
commit
4f849e5032

+ 3 - 3
core/mac/src/include/parser_api.h

@@ -1215,7 +1215,7 @@ static inline QDF_STATUS populate_dot11f_he_bss_color_change(
  * populate_dot11f_twt_extended_caps() - populate TWT extended capabilities
  * @mac_ctx: Global MAC context.
  * @pe_session: Pointer to the PE session.
- * @p_ext_cap: Pointer to the extended capabilities of the session.
+ * @dot11f: Pointer to the extended capabilities of the session.
  *
  * Populate the TWT extended capabilities based on the target and INI support.
  *
@@ -1223,12 +1223,12 @@ static inline QDF_STATUS populate_dot11f_he_bss_color_change(
  */
 tSirRetStatus populate_dot11f_twt_extended_caps(tpAniSirGlobal mac_ctx,
 						tpPESession pe_session,
-						struct s_ext_cap *p_ext_cap);
+						tDot11fIEExtCap *dot11f);
 #else
 static inline tSirRetStatus
 populate_dot11f_twt_extended_caps(tpAniSirGlobal mac_ctx,
 				  tpPESession pe_session,
-				  struct s_ext_cap *p_ext_cap)
+				  tDot11fIEExtCap *dot11f)
 {
 	return QDF_STATUS_SUCCESS;
 }

+ 4 - 0
core/mac/src/pe/include/lim_session.h

@@ -555,6 +555,10 @@ typedef struct sPESession       /* Added to Support BT-AMP */
 	enum wmi_obss_color_collision_evt_type obss_color_collision_dec_evt;
 	bool is_session_obss_color_collision_det_enabled;
 	int8_t def_max_tx_pwr;
+#ifdef WLAN_SUPPORT_TWT
+	uint8_t peer_twt_requestor;
+	uint8_t peer_twt_responder;
+#endif
 } tPESession, *tpPESession;
 
 /*-------------------------------------------------------------------------

+ 21 - 0
core/mac/src/pe/lim/lim_assoc_utils.c

@@ -3554,6 +3554,26 @@ static void lim_update_vht_oper_assoc_resp(tpAniSirGlobal mac_ctx,
 	pe_debug("Updating VHT Operation in assoc Response");
 }
 
+#ifdef WLAN_SUPPORT_TWT
+/**
+ * lim_set_sta_ctx_twt() - Save the TWT settings in STA context
+ * @sta_ctx: Pointer to Station Context
+ * @session: Pointer to PE session
+ *
+ * Return: None
+ */
+static void lim_set_sta_ctx_twt(tAddStaParams *sta_ctx, tpPESession session)
+{
+	sta_ctx->twt_requestor = session->peer_twt_requestor;
+	sta_ctx->twt_responder = session->peer_twt_responder;
+}
+#else
+static inline void lim_set_sta_ctx_twt(tAddStaParams *sta_ctx,
+				       tpPESession session)
+{
+}
+#endif
+
 /**
  * limSendAddBss()
  *
@@ -4098,6 +4118,7 @@ tSirRetStatus lim_sta_send_add_bss(tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp,
 		pAddBssParams->ch_width = CH_WIDTH_10MHZ;
 		pAddBssParams->staContext.ch_width = CH_WIDTH_10MHZ;
 	}
+	lim_set_sta_ctx_twt(&pAddBssParams->staContext, psessionEntry);
 
 	msgQ.type = WMA_ADD_BSS_REQ;
 	/** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/

+ 1 - 0
core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c

@@ -454,6 +454,7 @@ static void lim_update_stads_ext_cap(tpAniSirGlobal mac_ctx,
 		ext_cap->tdls_prohibited,
 		ext_cap->tdls_chan_swit_prohibited);
 #endif
+	lim_set_peer_twt_cap(session_entry, ext_cap);
 }
 
 /**

+ 8 - 0
core/mac/src/pe/lim/lim_send_management_frames.c

@@ -1955,6 +1955,14 @@ lim_send_assoc_req_mgmt_frame(tpAniSirGlobal mac_ctx,
 			lim_merge_extcap_struct(&frm->ExtCap, &bcn_ext_cap,
 							false);
 		}
+		/*
+		 * TWT extended capabilities should be populated after the
+		 * intersection of beacon caps and self caps is done because
+		 * the bits for TWT are unique to STA and AP and cannot be
+		 * intersected.
+		 */
+		populate_dot11f_twt_extended_caps(mac_ctx, pe_session,
+						  &frm->ExtCap);
 	}
 
 	if (eSIR_SUCCESS != lim_strip_supp_op_class_update_struct(mac_ctx,

+ 12 - 0
core/mac/src/pe/lim/lim_utils.c

@@ -6308,6 +6308,18 @@ void lim_set_stads_rtt_cap(tpDphHashNode sta_ds, struct s_ext_cap *ext_cap,
 	    ext_cap->fine_time_meas_responder);
 }
 
+#ifdef WLAN_SUPPORT_TWT
+void lim_set_peer_twt_cap(tpPESession session, struct s_ext_cap *ext_cap)
+{
+	session->peer_twt_requestor = ext_cap->twt_requestor_support;
+	session->peer_twt_responder = ext_cap->twt_responder_support;
+
+	pe_debug("Ext Cap peer TWT requestor: %d, responder: %d",
+		 ext_cap->twt_requestor_support,
+		 ext_cap->twt_responder_support);
+}
+#endif
+
 /**
  * lim_send_ie() - sends IE to wma
  * @mac_ctx: global MAC context

+ 9 - 0
core/mac/src/pe/lim/lim_utils.h

@@ -1413,4 +1413,13 @@ QDF_STATUS lim_obss_generate_detection_config(tpAniSirGlobal mac_ctx,
 void lim_enable_obss_detection_config(tpAniSirGlobal mac_ctx,
 				      tpPESession session);
 
+#ifdef WLAN_SUPPORT_TWT
+void lim_set_peer_twt_cap(tpPESession session, struct s_ext_cap *ext_cap);
+#else
+static inline void lim_set_peer_twt_cap(tpPESession session,
+					struct s_ext_cap *ext_cap)
+{
+}
+#endif
+
 #endif /* __LIM_UTILS_H */

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

@@ -1215,10 +1215,6 @@ populate_dot11f_ext_cap(tpAniSirGlobal pMac,
 	if (psessionEntry && psessionEntry->enable_bcast_probe_rsp)
 		p_ext_cap->fils_capability = 1;
 
-	if (psessionEntry)
-		populate_dot11f_twt_extended_caps(pMac, psessionEntry,
-						  p_ext_cap);
-
 	/* Need to calculate the num_bytes based on bits set */
 	if (pDot11f->present)
 		pDot11f->num_bytes = lim_compute_ext_cap_ie_length(pDot11f);
@@ -6411,10 +6407,14 @@ QDF_STATUS populate_dot11f_he_bss_color_change(tpAniSirGlobal mac_ctx,
 #ifdef WLAN_SUPPORT_TWT
 tSirRetStatus populate_dot11f_twt_extended_caps(tpAniSirGlobal mac_ctx,
 						tpPESession pe_session,
-						struct s_ext_cap *p_ext_cap)
+						tDot11fIEExtCap *dot11f)
 {
 	uint32_t value = 0;
 	tSirRetStatus status;
+	struct s_ext_cap *p_ext_cap;
+
+	dot11f->num_bytes = DOT11F_IE_EXTCAP_MAX_LEN;
+	p_ext_cap = (struct s_ext_cap *)dot11f->bytes;
 
 	if (pe_session->pePersona == QDF_STA_MODE) {
 		CFG_GET_INT(status, mac_ctx, WNI_CFG_TWT_REQUESTOR, value);
@@ -6424,6 +6424,7 @@ tSirRetStatus populate_dot11f_twt_extended_caps(tpAniSirGlobal mac_ctx,
 		CFG_GET_INT(status, mac_ctx, WNI_CFG_TWT_RESPONDER, value);
 		p_ext_cap->twt_responder_support = value;
 	}
+	dot11f->num_bytes = lim_compute_ext_cap_ie_length(dot11f);
 
 	return status;
 }

+ 4 - 0
core/wma/inc/wma_if.h

@@ -309,6 +309,10 @@ typedef struct {
 #endif
 	uint8_t stbc_capable;
 	uint8_t max_amsdu_num;
+#ifdef WLAN_SUPPORT_TWT
+	uint8_t twt_requestor;
+	uint8_t twt_responder;
+#endif
 } tAddStaParams, *tpAddStaParams;
 
 /**

+ 15 - 0
core/wma/inc/wma_twt.h

@@ -30,12 +30,27 @@
  * Return: None
  */
 void wma_send_twt_enable_cmd(uint32_t pdev_id, uint32_t congestion_timeout);
+
+/**
+ * wma_set_twt_peer_caps() - Fill the peer TWT capabilities
+ * @params: STA context params which will store the capabilities
+ * @cmd: Command in which the capabilities should be populated
+ *
+ * Return: None
+ */
+void wma_set_twt_peer_caps(tpAddStaParams params,
+			   struct peer_assoc_params *cmd);
 #else
 static inline void wma_send_twt_enable_cmd(uint32_t pdev_id,
 					   uint32_t congestion_timeout)
 {
 	WMA_LOGD(FL("TWT not supported as WLAN_SUPPORT_TWT is disabled"));
 }
+
+static inline void wma_set_twt_peer_caps(tpAddStaParams params,
+					 struct peer_assoc_params *cmd)
+{
+}
 #endif
 
 #endif /* __WMA_HE_H */

+ 2 - 0
core/wma/src/wma_mgmt.c

@@ -71,6 +71,7 @@
 #include <cdp_txrx_handle.h>
 #include "wma_he.h"
 #include <qdf_crypto.h>
+#include "wma_twt.h"
 
 /**
  * wma_send_bcn_buf_ll() - prepare and send beacon buffer to fw for LL
@@ -1373,6 +1374,7 @@ QDF_STATUS wma_send_peer_assoc(tp_wma_handle wma,
 		break;
 	}
 
+	wma_set_twt_peer_caps(params, cmd);
 #ifdef FEATURE_WLAN_TDLS
 	if (STA_ENTRY_TDLS_PEER == params->staType)
 		cmd->peer_flags |= WMI_PEER_AUTH;

+ 8 - 0
core/wma/src/wma_twt.c

@@ -72,3 +72,11 @@ int wma_twt_en_complete_event_handler(void *handle,
 	return status;
 }
 
+void wma_set_twt_peer_caps(tpAddStaParams params, struct peer_assoc_params *cmd)
+{
+	if (params->twt_requestor)
+		cmd->peer_flags |= WMI_PEER_TWT_REQ;
+	if (params->twt_responder)
+		cmd->peer_flags |= WMI_PEER_TWT_RESP;
+}
+