qcacld-3.0: Fix compiler error on UP target

QCA_CONFIG_SMP defined to support some thread scheduling features on
SMP target, while some variants defined only for SMP purpose are
referred out of this MACRO, like is_ol_rx_thread_suspended,
ol_rx_event_flag and ol_suspend_rx_event.

Defines separate functions for SMP/UP target to avoid it.

Change-Id: I01884644b7b77e55514cf00426609643386480e8
CRs-Fixed: 2344683
diff --git a/core/cds/inc/cds_sched.h b/core/cds/inc/cds_sched.h
index 3393e3c..33487d5 100644
--- a/core/cds/inc/cds_sched.h
+++ b/core/cds/inc/cds_sched.h
@@ -302,6 +302,14 @@
 void cds_free_ol_rx_pkt_freeq(p_cds_sched_context pSchedContext);
 #else
 /**
+ * cds_set_rx_thread_cpu_mask() - Rx_thread affinity from INI
+ * @cpu_affinity_mask: CPU affinity bitmap
+ *
+ * Return:None
+ */
+static inline void cds_set_rx_thread_cpu_mask(uint8_t cpu_affinity_mask) {}
+
+/**
  * cds_drop_rxpkt_by_staid() - api to drop pending rx packets for a sta
  * @pSchedContext: Pointer to the global CDS Sched Context
  * @staId: Station Id
diff --git a/core/cds/src/cds_sched.c b/core/cds/src/cds_sched.c
index 0dec9df..cfcb2c8 100644
--- a/core/cds/src/cds_sched.c
+++ b/core/cds/src/cds_sched.c
@@ -748,6 +748,19 @@
 
 	return 0;
 }
+
+void cds_resume_rx_thread(void)
+{
+	p_cds_sched_context cds_sched_context;
+
+	cds_sched_context = get_cds_sched_ctxt();
+	if (NULL == cds_sched_context) {
+		cds_err("cds_sched_context is NULL");
+		return;
+	}
+
+	complete(&cds_sched_context->ol_resume_rx_event);
+}
 #endif
 
 /**
@@ -1106,15 +1119,3 @@
 	return flags;
 }
 
-void cds_resume_rx_thread(void)
-{
-	p_cds_sched_context cds_sched_context = NULL;
-
-	cds_sched_context = get_cds_sched_ctxt();
-	if (NULL == cds_sched_context) {
-		cds_err("cds_sched_context is NULL");
-		return;
-	}
-
-	complete(&cds_sched_context->ol_resume_rx_event);
-}
diff --git a/core/hdd/inc/wlan_hdd_power.h b/core/hdd/inc/wlan_hdd_power.h
index 32fb41f..764ee50 100644
--- a/core/hdd/inc/wlan_hdd_power.h
+++ b/core/hdd/inc/wlan_hdd_power.h
@@ -522,4 +522,33 @@
 }
 #endif /* WLAN_SUSPEND_RESUME_TEST */
 
+#ifdef QCA_CONFIG_SMP
+/**
+ * wlan_hdd_rx_thread_resume() - Resume RX thread
+ * @hdd_ctx: HDD context
+ *
+ * Check if RX thread suspended, and resume if yes.
+ *
+ * Return: None
+ */
+void wlan_hdd_rx_thread_resume(struct hdd_context *hdd_ctx);
+
+/**
+ * wlan_hdd_rx_thread_suspend() - Suspend RX thread
+ * @hdd_ctx: HDD context
+ *
+ * To suspend RX thread
+ *
+ * Return: 0 for success
+ */
+int wlan_hdd_rx_thread_suspend(struct hdd_context *hdd_ctx);
+
+#else
+static inline void wlan_hdd_rx_thread_resume(struct hdd_context *hdd_ctx) {}
+static inline int wlan_hdd_rx_thread_suspend(struct hdd_context *hdd_ctx)
+{
+	return 0;
+}
+#endif
+
 #endif /* __WLAN_HDD_POWER_H */
diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c
index 8f8fa25..7eae7cc 100644
--- a/core/hdd/src/wlan_hdd_power.c
+++ b/core/hdd/src/wlan_hdd_power.c
@@ -87,9 +87,6 @@
 #define HDD_SSR_BRING_UP_TIME 30000
 #endif
 
-/* timeout in msec to wait for RX_THREAD to suspend */
-#define HDD_RXTHREAD_SUSPEND_TIMEOUT 200
-
 /* Type declarations */
 
 #ifdef FEATURE_WLAN_DIAG_SUPPORT
@@ -124,6 +121,47 @@
 }
 #endif
 
+#ifdef QCA_CONFIG_SMP
+
+/* timeout in msec to wait for RX_THREAD to suspend */
+#define HDD_RXTHREAD_SUSPEND_TIMEOUT 200
+
+void wlan_hdd_rx_thread_resume(struct hdd_context *hdd_ctx)
+{
+	if (hdd_ctx->is_ol_rx_thread_suspended) {
+		cds_resume_rx_thread();
+		hdd_ctx->is_ol_rx_thread_suspended = false;
+	}
+}
+
+int wlan_hdd_rx_thread_suspend(struct hdd_context *hdd_ctx)
+{
+	p_cds_sched_context cds_sched_context = get_cds_sched_ctxt();
+	int rc;
+
+	if (!cds_sched_context)
+		return 0;
+
+	/* Suspend tlshim rx thread */
+	set_bit(RX_SUSPEND_EVENT, &cds_sched_context->ol_rx_event_flag);
+	wake_up_interruptible(&cds_sched_context->ol_rx_wait_queue);
+	rc = wait_for_completion_timeout(&cds_sched_context->
+					 ol_suspend_rx_event,
+					 msecs_to_jiffies
+					 (HDD_RXTHREAD_SUSPEND_TIMEOUT)
+					);
+	if (!rc) {
+		clear_bit(RX_SUSPEND_EVENT,
+			  &cds_sched_context->ol_rx_event_flag);
+		hdd_err("Failed to stop tl_shim rx thread");
+		return -EINVAL;
+	}
+	hdd_ctx->is_ol_rx_thread_suspended = true;
+
+	return 0;
+}
+#endif /* QCA_CONFIG_SMP */
+
 /**
  * hdd_enable_gtk_offload() - enable GTK offload
  * @adapter: pointer to the adapter
@@ -1216,10 +1254,7 @@
 		hdd_ctx->is_wiphy_suspended = false;
 	}
 
-	if (hdd_ctx->is_ol_rx_thread_suspended) {
-		cds_resume_rx_thread();
-		hdd_ctx->is_ol_rx_thread_suspended = false;
-	}
+	wlan_hdd_rx_thread_resume(hdd_ctx);
 
 	/*
 	 * After SSR, FW clear its txrx stats. In host,
@@ -1543,7 +1578,6 @@
 	struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	int exit_code;
-	p_cds_sched_context cds_sched_context = get_cds_sched_ctxt();
 
 	hdd_enter();
 
@@ -1588,10 +1622,8 @@
 	}
 
 	/* Resume tlshim Rx thread */
-	if (hdd_ctx->enable_rxthread && hdd_ctx->is_ol_rx_thread_suspended) {
-		complete(&cds_sched_context->ol_resume_rx_event);
-		hdd_ctx->is_ol_rx_thread_suspended = false;
-	}
+	if (hdd_ctx->enable_rxthread)
+		wlan_hdd_rx_thread_resume(hdd_ctx);
 
 	if (hdd_ctx->enable_dp_rx_threads)
 		dp_txrx_resume(cds_get_context(QDF_MODULE_ID_SOC));
@@ -1647,7 +1679,6 @@
 				     struct cfg80211_wowlan *wow)
 {
 	struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
-	p_cds_sched_context cds_sched_context = get_cds_sched_ctxt();
 	struct hdd_adapter *adapter;
 	struct hdd_scan_info *scan_info;
 	mac_handle_t mac_handle;
@@ -1765,21 +1796,8 @@
 	hdd_ctx->is_scheduler_suspended = true;
 
 	if (hdd_ctx->enable_rxthread) {
-		/* Suspend tlshim rx thread */
-		set_bit(RX_SUSPEND_EVENT, &cds_sched_context->ol_rx_event_flag);
-		wake_up_interruptible(&cds_sched_context->ol_rx_wait_queue);
-		rc = wait_for_completion_timeout(&cds_sched_context->
-						 ol_suspend_rx_event,
-						 msecs_to_jiffies
-						 (HDD_RXTHREAD_SUSPEND_TIMEOUT)
-						);
-		if (!rc) {
-			clear_bit(RX_SUSPEND_EVENT,
-				  &cds_sched_context->ol_rx_event_flag);
-			hdd_err("Failed to stop tl_shim rx thread");
+		if (wlan_hdd_rx_thread_suspend(hdd_ctx))
 			goto resume_ol_rx;
-		}
-		hdd_ctx->is_ol_rx_thread_suspended = true;
 	}
 
 	if (hdd_ctx->enable_dp_rx_threads)
@@ -1806,10 +1824,7 @@
 
 resume_ol_rx:
 	/* Resume tlshim Rx thread */
-	if (hdd_ctx->is_ol_rx_thread_suspended) {
-		cds_resume_rx_thread();
-		hdd_ctx->is_ol_rx_thread_suspended = false;
-	}
+	wlan_hdd_rx_thread_resume(hdd_ctx);
 	scheduler_resume();
 	hdd_ctx->is_scheduler_suspended = false;
 resume_tx: