Selaa lähdekoodia

qcacmn: Add ini for Green AP low latency power save mode

Introduce  ini gGAPLowBeaconMult for Low beacon
multiplier for Green AP low latency power save mode.

Change-Id: Ifc03e1acaf640bb55e0ae3465b38762f54f0eeea
CRs-Fixed: 3264938
VIJAY RAJ 2 vuotta sitten
vanhempi
sitoutus
8c6ace7bdb

+ 21 - 11
umac/green_ap/core/src/wlan_green_ap_main_i.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2017-2019 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
@@ -101,18 +102,22 @@ enum wlan_green_ap_ps_event {
 
 /**
  * struct wlan_pdev_green_ap_ctx - green ap context
- * @pdev - Pdev pointer
- * @ps_enable  - Enable PS
- * @ps_mode - No sta or Multistream sta mode
- * @ps_on_time - PS on time, once enabled
- * @ps_trans_time - PS transition time
- * @num_nodes - Number of nodes associated to radio
- * @num_nodes_multistream - Multistream nodes associated to radio
- * @ps_state - PS state
- * @ps_event - PS event
- * @ps_timer - Timer
+ * @pdev: Pdev pointer
+ * @ps_enable: Enable PS
+ * @ps_mode: No sta or Multistream sta mode
+ * @ps_on_time: PS on time, once enabled
+ * @ps_trans_time: PS transition time
+ * @num_nodes: Number of nodes associated to radio
+ * @num_nodes_multistream: Multistream nodes associated to radio
+ * @ps_state: PS state
+ * @ps_event: PS event
+ * @ps_timer: Timer
  * @lock: green ap spinlock
- * @egap_params - Enhanced green ap params
+ * @bcn_mult: beacon multiplier
+ * @ps_en_cmd_cnt: Power save enable command count
+ * @ps_dis_cmd_cnt: Power save disable command count
+ * @egap_params: Enhanced green ap params
+ * @dbg_enable: Debug Enable
  */
 struct wlan_pdev_green_ap_ctx {
 	struct wlan_objmgr_pdev *pdev;
@@ -126,6 +131,11 @@ struct wlan_pdev_green_ap_ctx {
 	enum wlan_green_ap_ps_event ps_event;
 	qdf_timer_t ps_timer;
 	qdf_spinlock_t lock;
+#ifdef WLAN_SUPPORT_GAP_LL_PS_MODE
+	uint32_t bcn_mult;
+	qdf_atomic_t ps_en_cmd_cnt;
+	qdf_atomic_t ps_dis_cmd_cnt;
+#endif
 	struct wlan_green_ap_egap_params egap_params;
 	bool dbg_enable;
 };

+ 38 - 1
umac/green_ap/dispatcher/inc/cfg_green_ap_params.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2012-2019 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
@@ -93,6 +94,41 @@
 		2000, \
 		CFG_VALUE_OR_DEFAULT, \
 		"egap inactivity time")
+
+#ifdef WLAN_SUPPORT_GAP_LL_PS_MODE
+/*
+ * <ini>
+ * gGAPLowBeaconMult - configure Low Beacon interval multiplier.
+ * @Min: 0
+ * @Max: 10
+ * @Default: 10
+ *
+ * This ini is used to configure the Low Beacon interval
+ * multiplier which is used to calculate Low Beacon interval for
+ * power save.
+ *
+ * Related: None
+ *
+ * Supported Feature: SAP
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+
+#define CFG_GAP_LL_PS_LOW_BEACON_MULT CFG_INI_UINT( \
+		"gGAPLowBeaconMult", \
+		0, \
+		10, \
+		10, \
+		CFG_VALUE_OR_DEFAULT, \
+		"low beacon interval multiplier")
+
+#define CFG_GAP_LL_PS_ALL_CFG CFG(CFG_GAP_LL_PS_LOW_BEACON_MULT)
+#else
+#define CFG_GAP_LL_PS_ALL_CFG
+#endif
+
 /*
  * <ini>
  * gEGAPWaitTime - configure the wait time for EGAP
@@ -150,7 +186,8 @@
 	CFG(CFG_ENABLE_EGAP_FEATURE) \
 	CFG(CFG_EGAP_INACT_TIME_FEATURE) \
 	CFG(CFG_EGAP_WAIT_TIME_FEATURE) \
-	CFG(CFG_EGAP_FLAGS_FEATURE)
+	CFG(CFG_EGAP_FLAGS_FEATURE) \
+	CFG_GAP_LL_PS_ALL_CFG
 #else
 #define CFG_GREEN_AP_ALL
 #endif

+ 37 - 0
umac/green_ap/dispatcher/src/wlan_green_ap_api.c

@@ -218,6 +218,41 @@ QDF_STATUS wlan_green_ap_deinit(void)
 	return QDF_STATUS_SUCCESS;
 }
 
+#ifdef WLAN_SUPPORT_GAP_LL_PS_MODE
+/**
+ * wlan_green_ap_set_bcn_mult() - API to set Green AP beacon
+ * multiplier
+ * @pdev: Pdev pointer
+ *
+ */
+static void wlan_green_ap_set_bcn_mult(struct wlan_objmgr_pdev *pdev)
+{
+	struct wlan_pdev_green_ap_ctx *green_ap_ctx;
+	struct wlan_objmgr_psoc *psoc;
+
+	psoc = wlan_pdev_get_psoc(pdev);
+
+	if (!psoc) {
+		green_ap_err("psoc is NULL");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	green_ap_ctx = wlan_objmgr_pdev_get_comp_private_obj(
+			pdev, WLAN_UMAC_COMP_GREEN_AP);
+	if (!green_ap_ctx) {
+		green_ap_err("green ap context obtained is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	green_ap_ctx->bcn_mult = cfg_get(psoc,
+					 CFG_GAP_LL_PS_LOW_BEACON_MULT);
+}
+#else
+static inline void wlan_green_ap_set_bcn_mult(struct wlan_objmgr_pdev *pdev)
+{
+}
+#endif
+
 QDF_STATUS wlan_green_ap_pdev_open(struct wlan_objmgr_pdev *pdev)
 {
 	struct wlan_pdev_green_ap_ctx *green_ap_ctx;
@@ -254,6 +289,8 @@ QDF_STATUS wlan_green_ap_pdev_open(struct wlan_objmgr_pdev *pdev)
 	green_ap_ctx->egap_params.egap_feature_flags = cfg_get(psoc,
 					CFG_EGAP_FLAGS_FEATURE);
 
+	wlan_green_ap_set_bcn_mult(pdev);
+
 	qdf_spin_unlock_bh(&green_ap_ctx->lock);
 
 	return QDF_STATUS_SUCCESS;