qcacld-3.0: Featurize P2P Listen Offload

P2P Listen offload is not a requirement for Genoa, hence featurize
P2P listen offload code to save memory foot-print for Genoa.

Change-Id: If50c784bb4cd6daac513a0654364e78cd636c9d3
CRs-Fixed: 2304554
diff --git a/Kbuild b/Kbuild
index 15ba0ed..f55013a 100755
--- a/Kbuild
+++ b/Kbuild
@@ -2225,7 +2225,11 @@
 cppflags-$(CONFIG_FEATURE_SAR_LIMITS) += -DFEATURE_SAR_LIMITS
 cppflags-$(CONFIG_FEATURE_CONCURRENCY_MATRIX) += -DFEATURE_CONCURRENCY_MATRIX
 cppflags-$(CONFIG_FEATURE_SAP_COND_CHAN_SWITCH) += -DFEATURE_SAP_COND_CHAN_SWITCH
+
+#if converged p2p is enabled
+ifeq ($(CONFIG_CONVERGED_P2P_ENABLE), y)
 cppflags-$(CONFIG_FEATURE_P2P_LISTEN_OFFLOAD) += -DFEATURE_P2P_LISTEN_OFFLOAD
+endif
 
 # Dummy flag for WIN/MCL converged data path compilation
 cppflags-y += -DDP_PRINT_ENABLE=0
diff --git a/configs/genoa.common b/configs/genoa.common
index 9e3ffa5..638e7fb 100644
--- a/configs/genoa.common
+++ b/configs/genoa.common
@@ -130,7 +130,7 @@
 CONFIG_FEATURE_SAR_LIMITS := y
 CONFIG_FEATURE_CONCURRENCY_MATRIX := n
 CONFIG_FEATURE_SAP_COND_CHAN_SWITCH := n
-CONFIG_FEATURE_P2P_LISTEN_OFFLOAD := n
+CONFIG_FEATURE_P2P_LISTEN_OFFLOAD := y
 
 ifeq ($(CONFIG_ARCH_SDM845), y)
 ifeq ($(CONFIG_IPA_OFFLOAD), y)
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 43a2030..c0172aa 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -10200,6 +10200,7 @@
 	return ret;
 }
 
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 /**
  * wlan_hdd_p2p_lo_event_callback - P2P listen offload stop event handler
  * @context: context registered with sme_register_p2p_lo_event(). HDD
@@ -10255,6 +10256,12 @@
 	hdd_debug("Sent P2P_LISTEN_OFFLOAD_STOP event for vdev_id = %d",
 			evt->vdev_id);
 }
+#else
+static void wlan_hdd_p2p_lo_event_callback(void *context,
+					   struct sir_p2p_lo_event *evt)
+{
+}
+#endif
 
 #ifdef FEATURE_WLAN_DYNAMIC_CVM
 static inline int hdd_set_vc_mode_config(struct hdd_context *hdd_ctx)
diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h
index 714f067..b132f2a 100644
--- a/core/sme/inc/sme_api.h
+++ b/core/sme/inc/sme_api.h
@@ -1577,8 +1577,16 @@
 void sme_update_vdev_type_nss(tHalHandle hal, uint8_t max_supp_nss,
 		uint32_t vdev_type_nss, enum band_info band);
 void sme_update_hw_dbs_capable(tHalHandle hal, uint8_t hw_dbs_capable);
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 void sme_register_p2p_lo_event(tHalHandle hHal, void *context,
 					p2p_lo_callback callback);
+#else
+static inline void sme_register_p2p_lo_event(tHalHandle hHal,
+					     void *context,
+					     p2p_lo_callback callback)
+{
+}
+#endif
 
 QDF_STATUS sme_remove_bssid_from_scan_list(tHalHandle hal,
 	tSirMacAddr bssid);
diff --git a/core/sme/inc/sme_internal.h b/core/sme/inc/sme_internal.h
index a67f0e9..f7c5cf4 100644
--- a/core/sme/inc/sme_internal.h
+++ b/core/sme/inc/sme_internal.h
@@ -331,8 +331,10 @@
 	ocb_callback dcc_stats_event_callback;
 	sme_set_thermal_level_callback set_thermal_level_cb;
 	void *apf_get_offload_context;
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 	p2p_lo_callback p2p_lo_event_callback;
 	void *p2p_lo_event_context;
+#endif
 #ifdef FEATURE_OEM_DATA_SUPPORT
 	sme_send_oem_data_rsp_msg oem_data_rsp_callback;
 #endif
diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c
index d2fcaf7..f7c0907 100644
--- a/core/sme/src/common/sme_api.c
+++ b/core/sme/src/common/sme_api.c
@@ -14364,6 +14364,7 @@
 	mac_ctx->hw_dbs_capable = hw_dbs_capable;
 }
 
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 /**
  * sme_register_p2p_lo_event() - Register for the p2p lo event
  * @hHal: reference to the HAL
@@ -14386,6 +14387,7 @@
 	pMac->sme.p2p_lo_event_context = context;
 	sme_release_global_lock(&pMac->sme);
 }
+#endif
 
 /**
  * sme_process_mac_pwr_dbg_cmd() - enable mac pwr debugging
diff --git a/core/wma/inc/wma_api.h b/core/wma/inc/wma_api.h
index e5bda03..5e9e1be 100644
--- a/core/wma/inc/wma_api.h
+++ b/core/wma/inc/wma_api.h
@@ -238,10 +238,17 @@
 QDF_STATUS wma_set_tx_power_scale_decr_db(uint8_t vdev_id, int value);
 
 bool wma_is_csa_offload_enabled(void);
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 bool wma_is_p2p_lo_capable(void);
-bool wma_capability_enhanced_mcast_filter(void);
 QDF_STATUS wma_p2p_lo_start(struct sir_p2p_lo_start *params);
 QDF_STATUS wma_p2p_lo_stop(u_int32_t vdev_id);
+#else
+static inline bool wma_is_p2p_lo_capable(void)
+{
+	return 0;
+}
+#endif
+bool wma_capability_enhanced_mcast_filter(void);
 #ifndef QCA_SUPPORT_CP_STATS
 QDF_STATUS wma_get_wakelock_stats(struct sir_wake_lock_stats *wake_lock_stats);
 #endif
diff --git a/core/wma/inc/wma_internal.h b/core/wma/inc/wma_internal.h
index 929d20d..e0c60d7 100644
--- a/core/wma/inc/wma_internal.h
+++ b/core/wma/inc/wma_internal.h
@@ -1155,8 +1155,10 @@
 				uint32_t len);
 void wma_remove_req(tp_wma_handle wma, uint8_t vdev_id,
 			    uint8_t type);
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 int wma_p2p_lo_event_handler(void *handle, uint8_t *event_buf,
 				uint32_t len);
+#endif
 
 QDF_STATUS wma_process_hal_pwr_dbg_cmd(WMA_HANDLE handle,
 				       struct sir_mac_pwr_dbg_cmd *
diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c
index 40b425c..24bf2e5 100644
--- a/core/wma/src/wma_features.c
+++ b/core/wma/src/wma_features.c
@@ -4940,6 +4940,7 @@
 	return QDF_STATUS_SUCCESS;
 }
 
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 /**
  *  wma_p2p_lo_start() - P2P listen offload start
  *  @params: p2p listen offload parameters
@@ -5135,6 +5136,7 @@
 
 	return 0;
 }
+#endif /* FEATURE_P2P_LISTEN_OFFLOAD */
 
 #ifndef QCA_SUPPORT_CP_STATS
 /**
diff --git a/core/wma/src/wma_utils.c b/core/wma/src/wma_utils.c
index 83a7637..9d5812d 100644
--- a/core/wma/src/wma_utils.c
+++ b/core/wma/src/wma_utils.c
@@ -4277,7 +4277,7 @@
 	return wmi_unified_dbglog_cmd_send(wmi_handle, &dbg_param);
 }
 #endif
-
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 /**
  * wma_is_p2p_lo_capable() - if driver is capable of p2p listen offload
  *
@@ -4299,6 +4299,7 @@
 
 	return 0;
 }
+#endif
 
 bool wma_capability_enhanced_mcast_filter(void)
 {