qcacld-3.0: Conditionally build TDLS component

Currently the TDLS component code is unconditionally built which will
bloat images where TDLS is not required. Fix this by only building the
TDLS component when the TDLS feature is enabled.

Change-Id: I7496b8f07ed495b00e62fc3cf50a96e1829d9341
CRs-Fixed: 2399966
diff --git a/Kbuild b/Kbuild
index 35f5203..59b3f40 100644
--- a/Kbuild
+++ b/Kbuild
@@ -1028,6 +1028,8 @@
 TDLS_INC := -I$(WLAN_ROOT)/$(TDLS_DIR)/dispatcher/inc \
 	    -I$(WLAN_ROOT)/$(TDLS_OS_IF_INC) \
 	    -I$(WLAN_ROOT)/$(TDLS_TARGET_IF_INC)
+
+ifeq ($(CONFIG_CONVERGED_TDLS_ENABLE), y)
 TDLS_OBJS := $(TDLS_DIR)/core/src/wlan_tdls_main.o \
        $(TDLS_DIR)/core/src/wlan_tdls_cmds_process.o \
        $(TDLS_DIR)/core/src/wlan_tdls_peer.o \
@@ -1039,6 +1041,7 @@
        $(TDLS_DIR)/dispatcher/src/wlan_tdls_cfg.o \
        $(TDLS_OS_IF_SRC)/wlan_cfg80211_tdls.o \
        $(TDLS_TARGET_IF_SRC)/target_if_tdls.o
+endif
 
 ########### BMI ###########
 BMI_DIR := core/bmi
diff --git a/components/tdls/dispatcher/inc/wlan_tdls_ucfg_api.h b/components/tdls/dispatcher/inc/wlan_tdls_ucfg_api.h
index 62e0a87..ba108d7 100644
--- a/components/tdls/dispatcher/inc/wlan_tdls_ucfg_api.h
+++ b/components/tdls/dispatcher/inc/wlan_tdls_ucfg_api.h
@@ -32,6 +32,8 @@
 #include <wlan_objmgr_pdev_obj.h>
 #include <wlan_objmgr_vdev_obj.h>
 
+#ifdef CONVERGED_TDLS_ENABLE
+
 /**
  * ucfg_tdls_init() - TDLS module initialization API
  *
@@ -253,4 +255,63 @@
  */
 QDF_STATUS ucfg_set_tdls_secoffchanneloffset(struct wlan_objmgr_vdev *vdev,
 					     int offchanoffset);
+
+#else
+
+static inline
+QDF_STATUS ucfg_tdls_init(void)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline
+QDF_STATUS ucfg_tdls_deinit(void)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline
+QDF_STATUS ucfg_tdls_psoc_open(struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline
+QDF_STATUS ucfg_tdls_psoc_close(struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline
+QDF_STATUS ucfg_tdls_psoc_enable(struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline
+QDF_STATUS ucfg_tdls_psoc_disable(struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline
+void ucfg_tdls_update_rx_pkt_cnt(struct wlan_objmgr_vdev *vdev,
+				 struct qdf_mac_addr *mac_addr,
+				 struct qdf_mac_addr *dest_mac_addr)
+{
+}
+
+static inline
+void ucfg_tdls_update_tx_pkt_cnt(struct wlan_objmgr_vdev *vdev,
+				 struct qdf_mac_addr *mac_addr)
+{
+}
+
+static inline
+QDF_STATUS ucfg_tdls_teardown_links(struct wlan_objmgr_vdev *vdev)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+#endif /* CONVERGED_TDLS_ENABLE */
 #endif
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index d773dd5..4135ba6 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -1261,6 +1261,7 @@
 	}
 }
 
+#ifdef CONVERGED_TDLS_ENABLE
 static int hdd_update_tdls_config(struct hdd_context *hdd_ctx)
 {
 	struct wlan_objmgr_psoc *psoc = hdd_ctx->psoc;
@@ -1303,6 +1304,12 @@
 
 	return 0;
 }
+#else
+static int hdd_update_tdls_config(struct hdd_context *hdd_ctx)
+{
+	return 0;
+}
+#endif
 
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 static void hdd_update_roam_offload(struct hdd_context *hdd_ctx,
diff --git a/os_if/tdls/inc/wlan_cfg80211_tdls.h b/os_if/tdls/inc/wlan_cfg80211_tdls.h
index c4c6b1c..0e12284 100644
--- a/os_if/tdls/inc/wlan_cfg80211_tdls.h
+++ b/os_if/tdls/inc/wlan_cfg80211_tdls.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-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
@@ -270,7 +270,18 @@
  */
 void hdd_notify_teardown_tdls_links(struct wlan_objmgr_vdev *vdev);
 
-#else
+#else /* CONVERGED_TDLS_ENABLE */
+static inline
+QDF_STATUS wlan_cfg80211_tdls_priv_init(struct vdev_osif_priv *osif_priv)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline
+void wlan_cfg80211_tdls_priv_deinit(struct vdev_osif_priv *osif_priv)
+{
+}
+
 static inline void
 hdd_notify_tdls_reset_adapter(struct wlan_objmgr_vdev *vdev)
 {
@@ -305,5 +316,5 @@
 {
 
 }
-#endif
-#endif
+#endif /* CONVERGED_TDLS_ENABLE */
+#endif /* _WLAN_CFG80211_TDLS_H_ */