qcacld-3.0: Bind ol_rx_thread to perf CPU
When RX_PERFORMANCE is set, bind ol_rx_thread to perf CPU.
Do not update tdls stats and acquire rx_wakelock while
throughput is high, to avoid station drop packets caused
by slow process of ol_rx_data_cb(hdd_rx_packet_cbk).
Change-Id: I411f5ce67b04a70b194b0e8a7f8014b9c2c9bef7
CRs-Fixed: 2373936
diff --git a/Kbuild b/Kbuild
index a2a5e90..20acd16 100644
--- a/Kbuild
+++ b/Kbuild
@@ -2079,8 +2079,8 @@
cppflags-$(CONFIG_FEATURE_WLAN_RMC) += -DFEATURE_WLAN_RMC
cppflags-$(CONFIG_FEATURE_BECN_STATS) += -DWLAN_FEATURE_BEACON_RECEPTION_STATS
-#Set kernel thread scheduler
-cppflags-$(CONFIG_THREAD_PERFORMANCE) += -DTHREAD_PERFORMANCE
+#Set RX_PERFORMANCE
+cppflags-$(CONFIG_RX_PERFORMANCE) += -DRX_PERFORMANCE
#Enable OL debug and wmi unified functions
cppflags-$(CONFIG_ATH_PERF_PWR_OFFLOAD) += -DATH_PERF_PWR_OFFLOAD
diff --git a/configs/default_defconfig b/configs/default_defconfig
index 6ed4e9e..423aa64 100644
--- a/configs/default_defconfig
+++ b/configs/default_defconfig
@@ -89,7 +89,7 @@
ifeq ($(CONFIG_ARCH_QCS405), y)
CONFIG_WLAN_SYNC_TSF_PLUS := y
CONFIG_WLAN_SYNC_TSF_PLUS_NOIRQ := y
- CONFIG_THREAD_PERFORMANCE := y
+ CONFIG_RX_PERFORMANCE := y
endif
#Flag to enable Legacy Fast Roaming2(LFR2)
diff --git a/core/cds/src/cds_sched.c b/core/cds/src/cds_sched.c
index 808ae42..86c5675 100644
--- a/core/cds/src/cds_sched.c
+++ b/core/cds/src/cds_sched.c
@@ -35,7 +35,7 @@
#include <linux/spinlock.h>
#include <linux/kthread.h>
#include <linux/cpu.h>
-#ifdef THREAD_PERFORMANCE
+#ifdef RX_PERFORMANCE
#include <linux/sched/types.h>
#endif
@@ -388,6 +388,35 @@
{
cds_cpu_hotplug_notify(cpu, false);
}
+
+#ifdef RX_PERFORMANCE
+/**
+ * cds_set_ol_rx_thread_scheduler - set ol_rx_thread scheduler
+ * @psched_context: Pointer to a previously allocated buffer big
+ *
+ * Return: None
+ */
+static void cds_set_ol_rx_thread_scheduler(p_cds_sched_context psched_context)
+{
+ struct sched_param param;
+
+ if (!psched_context) {
+ cds_err("Null params being passed");
+ return;
+ }
+ if (!psched_context->ol_rx_thread) {
+ cds_alert("CDS OL RX Thread is NULL");
+ return;
+ }
+ param.sched_priority = 99;
+ sched_setscheduler(psched_context->ol_rx_thread, SCHED_RR, ¶m);
+}
+#else
+static void cds_set_ol_rx_thread_scheduler(p_cds_sched_context psched_context)
+{
+}
+#endif /* RX_PERFORMANCE */
+
#endif /* QCA_CONFIG_SMP */
/**
@@ -410,12 +439,6 @@
p_cds_sched_context pSchedContext,
uint32_t SchedCtxSize)
{
-#ifdef THREAD_PERFORMANCE
- struct sched_param param;
-
- param.sched_priority = 99;
-#endif
-
cds_debug("Opening the CDS Scheduler");
/* Sanity checks */
if ((p_cds_context == NULL) || (pSchedContext == NULL)) {
@@ -462,9 +485,7 @@
goto OL_RX_THREAD_START_FAILURE;
}
-#ifdef THREAD_PERFORMANCE
- sched_setscheduler(pSchedContext->ol_rx_thread, SCHED_RR, ¶m);
-#endif
+ cds_set_ol_rx_thread_scheduler(pSchedContext);
wake_up_process(pSchedContext->ol_rx_thread);
cds_debug("CDS OL RX thread Created");
wait_for_completion_interruptible(&pSchedContext->ol_rx_start_event);
diff --git a/core/hdd/inc/hdd_dp_cfg.h b/core/hdd/inc/hdd_dp_cfg.h
index f0bd14b..1dbd7b7 100644
--- a/core/hdd/inc/hdd_dp_cfg.h
+++ b/core/hdd/inc/hdd_dp_cfg.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2019 The Linux Foundation. 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
@@ -642,6 +642,16 @@
*
* </ini>
*/
+#ifdef RX_PERFORMANCE
+#define CFG_DP_RX_THREAD_CPU_MASK \
+ CFG_INI_UINT( \
+ "RX_THREAD_CPU_AFFINITY_MASK", \
+ 0, \
+ 0xFF, \
+ 0x02, \
+ CFG_VALUE_OR_DEFAULT, \
+ "CPU mask to affine Rx_thread")
+#else
#define CFG_DP_RX_THREAD_CPU_MASK \
CFG_INI_UINT( \
"RX_THREAD_CPU_AFFINITY_MASK", \
@@ -650,6 +660,7 @@
0, \
CFG_VALUE_OR_DEFAULT, \
"CPU mask to affine Rx_thread")
+#endif
/*
* <ini>
diff --git a/core/hdd/inc/wlan_hdd_tx_rx.h b/core/hdd/inc/wlan_hdd_tx_rx.h
index 691a845..b2ca501 100644
--- a/core/hdd/inc/wlan_hdd_tx_rx.h
+++ b/core/hdd/inc/wlan_hdd_tx_rx.h
@@ -287,9 +287,14 @@
#ifdef MSM_PLATFORM
void hdd_reset_tcp_delack(struct hdd_context *hdd_ctx);
+bool hdd_is_current_high_throughput(struct hdd_context *hdd_ctx);
#define HDD_MSM_CFG(msm_cfg) msm_cfg
#else
static inline void hdd_reset_tcp_delack(struct hdd_context *hdd_ctx) {}
+static inline bool hdd_is_current_high_throughput(struct hdd_context *hdd_ctx)
+{
+ return false;
+}
#define HDD_MSM_CFG(msm_cfg) 0
#endif
diff --git a/core/hdd/src/wlan_hdd_tx_rx.c b/core/hdd/src/wlan_hdd_tx_rx.c
index c948ab6..60227cb 100644
--- a/core/hdd/src/wlan_hdd_tx_rx.c
+++ b/core/hdd/src/wlan_hdd_tx_rx.c
@@ -2083,8 +2083,9 @@
dest_mac_addr = (struct qdf_mac_addr *)(skb->data);
mac_addr = (struct qdf_mac_addr *)(skb->data+QDF_MAC_ADDR_SIZE);
- ucfg_tdls_update_rx_pkt_cnt(adapter->vdev, mac_addr,
- dest_mac_addr);
+ if (!hdd_is_current_high_throughput(hdd_ctx))
+ ucfg_tdls_update_rx_pkt_cnt(adapter->vdev, mac_addr,
+ dest_mac_addr);
skb->dev = adapter->dev;
skb->protocol = eth_type_trans(skb, skb->dev);
@@ -2106,8 +2107,9 @@
}
/* hold configurable wakelock for unicast traffic */
- if (hdd_ctx->config->rx_wakelock_timeout &&
- sta_ctx->conn_info.uIsAuthenticated)
+ if (!hdd_is_current_high_throughput(hdd_ctx) &&
+ hdd_ctx->config->rx_wakelock_timeout &&
+ sta_ctx->conn_info.uIsAuthenticated)
wake_lock = hdd_is_rx_wake_lock_needed(skb);
if (wake_lock) {
@@ -2769,6 +2771,22 @@
hdd_ctx->rx_high_ind_cnt = 0;
wlan_hdd_update_tcp_rx_param(hdd_ctx, &rx_tp_data);
}
+
+/**
+ * hdd_is_current_high_throughput() - Check if vote level is high
+ * @hdd_ctx: Handle to hdd context
+ *
+ * Function used to check if vote level is high
+ *
+ * Return: True if vote level is high
+ */
+bool hdd_is_current_high_throughput(struct hdd_context *hdd_ctx)
+{
+ if (hdd_ctx->cur_vote_level < PLD_BUS_WIDTH_HIGH)
+ return false;
+ else
+ return true;
+}
#endif /* MSM_PLATFORM */
#ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL