Selaa lähdekoodia

qcacmn: target_if support for spatial reuse feature

Add target_if support for spatial reuse feature

Change-Id: If0ad6e459e7b7d215d5016c8c7c0e94df5d36649
CRs-Fixed: 3213486
Jayachandran Sreekumaran 3 vuotta sitten
vanhempi
sitoutus
1b244cfcb0

+ 20 - 0
target_if/core/src/target_if_main.c

@@ -63,6 +63,9 @@
 #if defined(QCA_SUPPORT_SON) || defined(WLAN_FEATURE_SON)
 #include <target_if_son.h>
 #endif
+#if defined WLAN_FEATURE_11AX
+#include <target_if_spatial_reuse.h>
+#endif
 #ifdef WLAN_OFFCHAN_TXRX_ENABLE
 #include <target_if_offchan_txrx_api.h>
 #endif
@@ -295,6 +298,21 @@ static void target_if_son_tx_ops_register(
 }
 #endif
 
+#if defined WLAN_FEATURE_11AX
+static void target_if_spatial_reuse_tx_ops_register(
+			struct wlan_lmac_if_tx_ops *tx_ops)
+{
+	target_if_spatial_reuse_register_tx_ops(tx_ops);
+}
+
+#else
+static void target_if_spatial_reuse_tx_ops_register(
+			struct wlan_lmac_if_tx_ops *tx_ops)
+{
+}
+
+#endif
+
 #ifdef FEATURE_WLAN_TDLS
 static void target_if_tdls_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
 {
@@ -567,6 +585,8 @@ QDF_STATUS target_if_register_umac_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
 
 	target_if_son_tx_ops_register(tx_ops);
 
+	target_if_spatial_reuse_tx_ops_register(tx_ops);
+
 	target_if_tdls_tx_ops_register(tx_ops);
 
 	target_if_fd_tx_ops_register(tx_ops);

+ 59 - 0
target_if/spatial_reuse/inc/target_if_spatial_reuse.h

@@ -0,0 +1,59 @@
+/*
+ * 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: target_if_spatial_reuse.h
+ */
+
+#ifndef _TARGET_IF_SPATIAL_REUSE_H_
+#define _TARGET_IF_SPATIAL_REUSE_H_
+
+#include <wlan_lmac_if_def.h>
+#include <target_if.h>
+
+#if defined WLAN_FEATURE_11AX
+
+#define NON_SRG_PD_SR_DISALLOWED 0x02
+#define NON_SRG_OFFSET_PRESENT 0x04
+#define NON_SRG_SPR_ENABLE 1
+#define NON_SRG_SPR_ENABLE_POS 31
+#define NON_SRG_SPR_ENABLE_SIZE 1
+#define NON_SRG_PARAM_VAL_DBM_UNIT 1
+#define NON_SRG_PARAM_VAL_DBM_POS 29
+#define NON_SRG_PARAM_VAL_DBM_SIZE 1
+#define NON_SRG_MAX_PD_OFFSET_POS 0
+#define NON_SRG_MAX_PD_OFFSET_SIZE 8
+#define WILDCARD_PDEV_ID 0x0
+
+/**
+ * target_if_spatial_reuse_register_tx_ops  - tx_ops registration
+ * @tx_ops: wlan_lmac_if_tx_ops
+ *
+ * Return: void
+ */
+void
+target_if_spatial_reuse_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops);
+#else
+
+static inline void target_if_spatial_reuse_register_tx_ops(
+					struct wlan_lmac_if_tx_ops *tx_ops)
+{}
+
+#endif
+
+#endif /* _TARGET_IF_SPATIAL_REUSE_H_ */

+ 60 - 0
target_if/spatial_reuse/src/target_if_spatial_reuse.c

@@ -0,0 +1,60 @@
+/*
+ * 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <target_if_spatial_reuse.h>
+#include <wlan_lmac_if_def.h>
+#include <wmi_unified_api.h>
+#include <target_if_vdev_mgr_tx_ops.h>
+
+static QDF_STATUS spatial_reuse_send_cfg(struct wlan_objmgr_vdev *vdev,
+					 uint8_t sr_ctrl,
+					 uint8_t non_srg_max_pd_offset)
+{
+	struct pdev_params pparam;
+	wmi_unified_t wmi_handle;
+
+	wmi_handle = target_if_vdev_mgr_wmi_handle_get(vdev);
+	if (!wmi_handle) {
+		mlme_err("Failed to get WMI handle!");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	qdf_mem_zero(&pparam, sizeof(pparam));
+	pparam.param_id = WMI_PDEV_PARAM_SET_CMD_OBSS_PD_THRESHOLD;
+	if (!(sr_ctrl & NON_SRG_PD_SR_DISALLOWED) &&
+	    (sr_ctrl & NON_SRG_OFFSET_PRESENT)) {
+		QDF_SET_BITS(pparam.param_value, NON_SRG_SPR_ENABLE_POS,
+			     NON_SRG_SPR_ENABLE_SIZE, NON_SRG_SPR_ENABLE);
+		QDF_SET_BITS(pparam.param_value, NON_SRG_PARAM_VAL_DBM_POS,
+			     NON_SRG_PARAM_VAL_DBM_SIZE,
+			     NON_SRG_PARAM_VAL_DBM_UNIT);
+		QDF_SET_BITS(pparam.param_value, NON_SRG_MAX_PD_OFFSET_POS,
+			     NON_SRG_MAX_PD_OFFSET_SIZE,
+			     non_srg_max_pd_offset);
+	}
+
+	return wmi_unified_pdev_param_send(wmi_handle, &pparam,
+					   WILDCARD_PDEV_ID);
+}
+
+void target_if_spatial_reuse_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
+{
+	tx_ops->spatial_reuse_tx_ops.send_cfg = spatial_reuse_send_cfg;
+}
+

+ 11 - 0
umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h

@@ -1439,6 +1439,13 @@ struct wlan_lmac_if_twt_rx_ops {
 };
 #endif
 
+#if defined WLAN_FEATURE_11AX
+struct wlan_lmac_if_spatial_reuse_tx_ops {
+	QDF_STATUS (*send_cfg)(struct wlan_objmgr_vdev *vdev, uint8_t sr_ctrl,
+			       uint8_t non_srg_max_pd_offset);
+};
+#endif
+
 /**
  * struct wlan_lmac_if_tx_ops - south bound tx function pointers
  * @mgmt_txrx_tx_ops: mgmt txrx tx ops
@@ -1542,6 +1549,10 @@ struct wlan_lmac_if_tx_ops {
 #if defined(WLAN_SUPPORT_TWT) && defined(WLAN_TWT_CONV_SUPPORTED)
 	struct wlan_lmac_if_twt_tx_ops twt_tx_ops;
 #endif
+
+#if defined WLAN_FEATURE_11AX
+	struct wlan_lmac_if_spatial_reuse_tx_ops spatial_reuse_tx_ops;
+#endif
 };
 
 /**