diff --git a/Kbuild b/Kbuild index 53ed3a5ac6..b4f34428b0 100644 --- a/Kbuild +++ b/Kbuild @@ -1479,10 +1479,6 @@ ifeq ($(CONFIG_SMP),y) CDEFINES += -DQCA_CONFIG_SMP endif -ifeq ($(CONFIG_WLAN_FEATURE_RX_WAKELOCK), y) -CDEFINES += -DWLAN_FEATURE_HOLD_RX_WAKELOCK -endif - #Enable Channel Matrix restriction for all Rome only targets ifneq (y,$(filter y,$(CONFIG_CNSS_EOS) $(CONFIG_ICNSS))) CDEFINES += -DWLAN_ENABLE_CHNL_MATRIX_RESTRICTION diff --git a/Kconfig b/Kconfig index da483769e7..379880839f 100644 --- a/Kconfig +++ b/Kconfig @@ -108,10 +108,6 @@ config WLAN_LRO depends on CONFIG_INET_LRO default n -config WLAN_FEATURE_RX_WAKELOCK - bool "Enable RX wake lock feature" - default n - config WLAN_SYNC_TSF bool "Enable QCOM sync multi devices tsf feature" default n diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index af4e19f105..f020259d5e 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -3597,6 +3597,29 @@ enum dot11p_mode { #define CFG_CRASH_FW_TIMEOUT_ENABLE (1) #define CFG_CRASH_FW_TIMEOUT_DEFAULT (0) +/* + * + * rx_wakelock_timeout - Amount of time to hold wakelock for RX unicast packets + * @Min: 0 + * @Max: 100 + * @Default: 50 + * + * This ini item configures the amount of time, in milliseconds, that the driver + * should prevent system power collapse after receiving an RX unicast packet. + * A conigured value of 0 disables the RX Wakelock feature completely. + * + * Related: None. + * + * Supported Feature: RX Wakelock + * + * Usage: Internal/External + * + * + */ +#define CFG_RX_WAKELOCK_TIMEOUT_NAME "rx_wakelock_timeout" +#define CFG_RX_WAKELOCK_TIMEOUT_DEFAULT (50) +#define CFG_RX_WAKELOCK_TIMEOUT_MIN (0) +#define CFG_RX_WAKELOCK_TIMEOUT_MAX (100) /*--------------------------------------------------------------------------- Type declarations @@ -4269,6 +4292,7 @@ struct hdd_config { bool sta_prefer_80MHz_over_160MHz; uint8_t sap_max_inactivity_override; bool fw_timeout_crash; + uint32_t rx_wakelock_timeout; }; #define VAR_OFFSET(_Struct, _Var) (offsetof(_Struct, _Var)) diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index b043befeca..37f525ac1b 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -219,9 +219,6 @@ #define WLAN_HDD_PUBLIC_ACTION_TDLS_DISC_RESP 14 #define WLAN_HDD_TDLS_ACTION_FRAME 12 -#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK -#define HDD_WAKE_LOCK_DURATION 50 /* in msecs */ -#endif #define WLAN_HDD_QOS_ACTION_FRAME 1 #define WLAN_HDD_QOS_MAP_CONFIGURE 4 @@ -1341,10 +1338,7 @@ struct hdd_context_s { /** P2P Device MAC Address for the adapter */ struct qdf_mac_addr p2pDeviceAddress; -#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK qdf_wake_lock_t rx_wake_lock; -#endif - qdf_wake_lock_t sap_wake_lock; #ifdef FEATURE_WLAN_TDLS diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index 8cd32e6a90..8266b5d02c 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -4048,6 +4048,12 @@ REG_TABLE_ENTRY g_registry_table[] = { CFG_CRASH_FW_TIMEOUT_DEFAULT, CFG_CRASH_FW_TIMEOUT_DISABLE, CFG_CRASH_FW_TIMEOUT_ENABLE), + REG_VARIABLE(CFG_RX_WAKELOCK_TIMEOUT_NAME, WLAN_PARAM_Integer, + struct hdd_config, rx_wakelock_timeout, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_RX_WAKELOCK_TIMEOUT_DEFAULT, + CFG_RX_WAKELOCK_TIMEOUT_MIN, + CFG_RX_WAKELOCK_TIMEOUT_MAX) }; /** diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 43db0480ac..b2b5e5ac17 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -4654,7 +4654,6 @@ out: return ret; } -#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK /** * hdd_rx_wake_lock_destroy() - Destroy RX wakelock * @hdd_ctx: HDD context. @@ -4680,10 +4679,6 @@ static void hdd_rx_wake_lock_create(hdd_context_t *hdd_ctx) { qdf_wake_lock_create(&hdd_ctx->rx_wake_lock, "qcom_rx_wakelock"); } -#else -static void hdd_rx_wake_lock_destroy(hdd_context_t *hdd_ctx) { } -static void hdd_rx_wake_lock_create(hdd_context_t *hdd_ctx) { } -#endif /** * hdd_roc_context_init() - Init ROC context diff --git a/core/hdd/src/wlan_hdd_softap_tx_rx.c b/core/hdd/src/wlan_hdd_softap_tx_rx.c index d857524c56..56c0cdedce 100644 --- a/core/hdd/src/wlan_hdd_softap_tx_rx.c +++ b/core/hdd/src/wlan_hdd_softap_tx_rx.c @@ -662,13 +662,18 @@ QDF_STATUS hdd_softap_rx_packet_cbk(void *context, qdf_nbuf_t rxBuf) sizeof(qdf_nbuf_data(rxBuf)), QDF_RX)); skb->protocol = eth_type_trans(skb, skb->dev); -#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK - cds_host_diag_log_work(&pHddCtx->rx_wake_lock, - HDD_WAKE_LOCK_DURATION, - WIFI_POWER_EVENT_WAKELOCK_HOLD_RX); - qdf_wake_lock_timeout_acquire(&pHddCtx->rx_wake_lock, - HDD_WAKE_LOCK_DURATION); -#endif + + /* hold configurable wakelock for unicast traffic */ + if (pHddCtx->config->rx_wakelock_timeout && + skb->pkt_type != PACKET_BROADCAST && + skb->pkt_type != PACKET_MULTICAST) { + cds_host_diag_log_work(&pHddCtx->rx_wake_lock, + pHddCtx->config->rx_wakelock_timeout, + WIFI_POWER_EVENT_WAKELOCK_HOLD_RX); + qdf_wake_lock_timeout_acquire(&pHddCtx->rx_wake_lock, + pHddCtx->config-> + rx_wakelock_timeout); + } /* Remove SKB from internal tracking table before submitting * it to stack diff --git a/core/hdd/src/wlan_hdd_tx_rx.c b/core/hdd/src/wlan_hdd_tx_rx.c index e6df73876a..83aa05d692 100644 --- a/core/hdd/src/wlan_hdd_tx_rx.c +++ b/core/hdd/src/wlan_hdd_tx_rx.c @@ -1013,13 +1013,17 @@ QDF_STATUS hdd_rx_packet_cbk(void *context, qdf_nbuf_t rxBuf) return QDF_STATUS_SUCCESS; } -#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK - cds_host_diag_log_work(&pHddCtx->rx_wake_lock, - HDD_WAKE_LOCK_DURATION, - WIFI_POWER_EVENT_WAKELOCK_HOLD_RX); - qdf_wake_lock_timeout_acquire(&pHddCtx->rx_wake_lock, - HDD_WAKE_LOCK_DURATION); -#endif + /* hold configurable wakelock for unicast traffic */ + if (pHddCtx->config->rx_wakelock_timeout && + skb->pkt_type != PACKET_BROADCAST && + skb->pkt_type != PACKET_MULTICAST) { + cds_host_diag_log_work(&pHddCtx->rx_wake_lock, + pHddCtx->config->rx_wakelock_timeout, + WIFI_POWER_EVENT_WAKELOCK_HOLD_RX); + qdf_wake_lock_timeout_acquire(&pHddCtx->rx_wake_lock, + pHddCtx->config-> + rx_wakelock_timeout); + } /* Remove SKB from internal tracking table before submitting * it to stack