Explorar el Código

qcacmn: Add support to enable/disable responder 11az ranging

Enable/Disable responder 11az ranging based on the below ini:
"enable_responder_11az_support"

With "enable_responder_11az_support" disabled, the below ext
cap advertisement will be disabled:
Non-TB Ranging Responder
TB Ranging Responder

and below vendor capabilities advertisment will be disabled:
QCA_WLAN_VENDOR_FEATURE_PROT_RANGE_NEGO_AND_MEASURE_AP
QCA_WLAN_VENDOR_FEATURE_SECURE_LTF_AP

Change-Id: I82eb70615f8daf82e98e7600418e07fad0672b76
CRs-Fixed: 3296410
Pragaspathi Thilagaraj hace 2 años
padre
commit
d95e7863cd

+ 15 - 3
os_if/linux/wifi_pos/src/wlan_cfg80211_wifi_pos.c

@@ -39,6 +39,12 @@ void
 wlan_wifi_pos_cfg80211_set_wiphy_ext_feature(struct wiphy *wiphy,
 					     struct wlan_objmgr_psoc *psoc)
 {
+	bool enable_rsta_11az_ranging;
+
+	enable_rsta_11az_ranging = ucfg_wifi_pos_get_rsta_11az_ranging_cap();
+	if (!enable_rsta_11az_ranging)
+		return;
+
 	if (wlan_psoc_nif_fw_ext_cap_get(psoc, WLAN_RTT_11AZ_NTB_SUPPORT)) {
 		wlan_extended_caps_iface[WLAN_EXT_RANGING_CAP_IDX] |=
 					WLAN_EXT_CAPA11_NTB_RANGING_RESPONDER;
@@ -82,21 +88,27 @@ wlan_wifi_pos_set_feature_flags(uint8_t *feature_flags,
 void wlan_wifi_pos_cfg80211_set_features(struct wlan_objmgr_psoc *psoc,
 					 uint8_t *feature_flags)
 {
-	bool rsta_secure_ltf_support;
+	bool rsta_secure_ltf_support, enable_rsta_11az_ranging;
 
+	enable_rsta_11az_ranging = ucfg_wifi_pos_get_rsta_11az_ranging_cap();
+	rsta_secure_ltf_support = enable_rsta_11az_ranging &&
+				wifi_pos_get_rsta_sec_ltf_cap();
 	if (wlan_psoc_nif_fw_ext2_cap_get(psoc,
 					  WLAN_RTT_11AZ_MAC_PHY_SEC_SUPPORT)) {
 		wlan_wifi_pos_set_feature_flags(feature_flags,
 						QCA_WLAN_VENDOR_FEATURE_SECURE_LTF_STA);
-		rsta_secure_ltf_support = wifi_pos_get_rsta_sec_ltf_cap();
 		if (rsta_secure_ltf_support)
 			wlan_wifi_pos_set_feature_flags(feature_flags,
 							QCA_WLAN_VENDOR_FEATURE_SECURE_LTF_AP);
 	}
 
 	if (wlan_psoc_nif_fw_ext2_cap_get(psoc,
-					  WLAN_RTT_11AZ_MAC_SEC_SUPPORT))
+					  WLAN_RTT_11AZ_MAC_SEC_SUPPORT)) {
 		wlan_wifi_pos_set_feature_flags(feature_flags,
 			QCA_WLAN_VENDOR_FEATURE_PROT_RANGE_NEGO_AND_MEASURE_STA);
+		if (rsta_secure_ltf_support)
+			wlan_wifi_pos_set_feature_flags(feature_flags,
+							QCA_WLAN_VENDOR_FEATURE_PROT_RANGE_NEGO_AND_MEASURE_AP);
+	}
 }
 #endif

+ 14 - 1
umac/wifi_pos/inc/wifi_pos_api.h

@@ -678,7 +678,7 @@ wifi_pos_get_osif_callbacks(struct wlan_objmgr_psoc *psoc);
  * Return: None
  **/
 void
-wifi_pos_set_rsta_sec_ltf_cap(uint32_t val);
+wifi_pos_set_rsta_sec_ltf_cap(bool val);
 
 /**
  * wifi_pos_get_rsta_sec_ltf_cap  - Get RSTA secure LTF capability
@@ -686,5 +686,18 @@ wifi_pos_set_rsta_sec_ltf_cap(uint32_t val);
  * Return: True or false
  */
 bool wifi_pos_get_rsta_sec_ltf_cap(void);
+
+/**
+ * wifi_pos_set_rsta_11az_ranging_cap() - Enable/Disable R-STA 11az ranging
+ * @val: Value to set
+ */
+void wifi_pos_set_rsta_11az_ranging_cap(bool val);
+
+/**
+ * wifi_pos_get_rsta_11az_ranging_cap() - Get if RSTA 11az ranging is enabled
+ *
+ * Return: True if 11az ranging is enabled
+ */
+bool wifi_pos_get_rsta_11az_ranging_cap(void);
 #endif
 #endif /* _WIFI_POS_API_H_ */

+ 6 - 0
umac/wifi_pos/inc/wifi_pos_ucfg_i.h

@@ -90,5 +90,11 @@ ucfg_wifi_pos_is_ltf_keyseed_required_for_peer(struct wlan_objmgr_peer *peer)
 {
 	return wifi_pos_is_ltf_keyseed_required_for_peer(peer);
 }
+
+static inline
+bool ucfg_wifi_pos_get_rsta_11az_ranging_cap(void)
+{
+	return wifi_pos_get_rsta_11az_ranging_cap();
+}
 #endif
 #endif /* _WIFI_POS_UCFG_H_ */

+ 2 - 0
umac/wifi_pos/inc/wifi_pos_utils_i.h

@@ -259,6 +259,7 @@ struct wifi_pos_legacy_ops {
  * @wifi_pos_lock: lock to access wifi pos priv object
  * @oem_6g_support_disable: oem target 6ghz support is disabled if set
  * @enable_rsta_secure_ltf_support: Enable RSTA secure LTF support
+ * @enable_rsta_11az_ranging: Enable RSTA 802.11 az secure ranging support
  * @wifi_pos_req_handler: function pointer to handle TLV or non-TLV
  * @wifi_pos_send_rsp: function pointer to send msg to userspace APP
  * @wifi_pos_get_phy_mode: function pointer to get wlan phymode for given
@@ -314,6 +315,7 @@ struct wifi_pos_psoc_priv_obj {
 	qdf_spinlock_t wifi_pos_lock;
 	bool oem_6g_support_disable;
 	bool enable_rsta_secure_ltf_support;
+	bool enable_rsta_11az_ranging;
 	struct wifi_pos_legacy_ops *legacy_ops;
 	QDF_STATUS (*wifi_pos_req_handler)(struct wlan_objmgr_psoc *psoc,
 				    struct wifi_pos_req_msg *req);

+ 34 - 1
umac/wifi_pos/src/wifi_pos_api.c

@@ -705,7 +705,7 @@ wifi_pos_get_osif_callbacks(struct wlan_objmgr_psoc *psoc)
 }
 
 #if defined(WIFI_POS_CONVERGED) && defined(WLAN_FEATURE_RTT_11AZ_SUPPORT)
-void wifi_pos_set_rsta_sec_ltf_cap(uint32_t val)
+void wifi_pos_set_rsta_sec_ltf_cap(bool val)
 {
 	struct wifi_pos_psoc_priv_obj *wifi_pos_psoc =
 			wifi_pos_get_psoc_priv_obj(wifi_pos_get_psoc());
@@ -737,4 +737,37 @@ bool wifi_pos_get_rsta_sec_ltf_cap(void)
 
 	return value;
 }
+
+void wifi_pos_set_rsta_11az_ranging_cap(bool val)
+{
+	struct wifi_pos_psoc_priv_obj *wifi_pos_psoc =
+			wifi_pos_get_psoc_priv_obj(wifi_pos_get_psoc());
+
+	if (!wifi_pos_psoc) {
+		wifi_pos_alert("unable to get wifi_pos psoc obj");
+		return;
+	}
+
+	qdf_spin_lock_bh(&wifi_pos_psoc->wifi_pos_lock);
+	wifi_pos_psoc->enable_rsta_11az_ranging = val;
+	qdf_spin_unlock_bh(&wifi_pos_psoc->wifi_pos_lock);
+}
+
+bool wifi_pos_get_rsta_11az_ranging_cap(void)
+{
+	bool value;
+	struct wifi_pos_psoc_priv_obj *wifi_pos_psoc =
+			wifi_pos_get_psoc_priv_obj(wifi_pos_get_psoc());
+
+	if (!wifi_pos_psoc) {
+		wifi_pos_alert("unable to get wifi_pos psoc obj");
+		return false;
+	}
+
+	qdf_spin_lock_bh(&wifi_pos_psoc->wifi_pos_lock);
+	value = wifi_pos_psoc->enable_rsta_11az_ranging;
+	qdf_spin_unlock_bh(&wifi_pos_psoc->wifi_pos_lock);
+
+	return value;
+}
 #endif