qcacld-3.0: Enable TDLS configures based on converged CFG component

Enable TDLS configures based on converged cfg component and remove
legacy codes.

Change-Id: I77221a8493c8a20efdae9e714a98da74f5c6b6ed
CRs-Fixed: 2277572
diff --git a/Kbuild b/Kbuild
index 877d390..f2a6d7c 100644
--- a/Kbuild
+++ b/Kbuild
@@ -832,6 +832,7 @@
        $(UMAC_TDLS_DIR)/dispatcher/src/wlan_tdls_tgt_api.o \
        $(UMAC_TDLS_DIR)/dispatcher/src/wlan_tdls_ucfg_api.o \
        $(UMAC_TDLS_DIR)/dispatcher/src/wlan_tdls_utils_api.o \
+       $(UMAC_TDLS_DIR)/dispatcher/src/wlan_tdls_cfg.o \
        $(WLAN_COMMON_ROOT)/os_if/linux/tdls/src/wlan_cfg80211_tdls.o
 
 ########### BMI ###########
diff --git a/components/cfg/cfg_all.h b/components/cfg/cfg_all.h
index 7f0e1cd..ff668b6 100644
--- a/components/cfg/cfg_all.h
+++ b/components/cfg/cfg_all.h
@@ -25,6 +25,13 @@
 #define CFG_P2P_ALL
 #endif
 
+#ifdef CONVERGED_TDLS_ENABLE
+#include "wlan_tdls_cfg.h"
+#else
+#define CFG_TDLS_ALL
+#endif
+
 #define CFG_ALL \
 	CFG_CONVERGED_ALL \
-	CFG_P2P_ALL
+	CFG_P2P_ALL \
+	CFG_TDLS_ALL
diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h
index f9e345e..8439339 100644
--- a/core/hdd/inc/wlan_hdd_cfg.h
+++ b/core/hdd/inc/wlan_hdd_cfg.h
@@ -6276,413 +6276,6 @@
 #define CFG_PREVENT_LINK_DOWN_DEFAULT		(0)
 #endif /* QCA_WIFI_NAPIER_EMULATION */
 
-#ifdef FEATURE_WLAN_TDLS
-/*
- * <ini>
- * gEnableTDLSSupport - Enable support for TDLS.
- * @Min: 0
- * @Max: 1
- * @Default: 0
- *
- * This ini is used to enable/disable TDLS support.
- *
- * Related: None.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_SUPPORT_ENABLE                     "gEnableTDLSSupport"
-#define CFG_TDLS_SUPPORT_ENABLE_MIN                 (0)
-#define CFG_TDLS_SUPPORT_ENABLE_MAX                 (1)
-#define CFG_TDLS_SUPPORT_ENABLE_DEFAULT             (0)
-
-/*
- * <ini>
- * gEnableTDLSImplicitTrigger - Enable Implicit TDLS.
- * @Min: 0
- * @Max: 1
- * @Default: 0
- *
- * This ini is used to enable/disable implicit TDLS.
- * CLD driver initiates TDLS Discovery towards a peer whenever TDLS Setup
- * criteria (throughput and RSSI thresholds) is met and then it tears down
- * TDLS when teardown criteria (idle packet count and RSSI) is met.
- *
- * Related: gEnableTDLSSupport.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_IMPLICIT_TRIGGER                   "gEnableTDLSImplicitTrigger"
-#define CFG_TDLS_IMPLICIT_TRIGGER_MIN               (0)
-#define CFG_TDLS_IMPLICIT_TRIGGER_MAX               (1)
-#define CFG_TDLS_IMPLICIT_TRIGGER_DEFAULT           (0)
-
-/*
- * <ini>
- * gTDLSTxStatsPeriod - TDLS TX statistics time period.
- * @Min: 1000
- * @Max: 4294967295
- * @Default: 2000
- *
- * This ini is used to configure the time period (in ms) to evaluate whether
- * the number of Tx/Rx packets exceeds TDLSTxPacketThreshold and triggers a
- * TDLS Discovery request.
- *
- * Related: gEnableTDLSSupport.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_TX_STATS_PERIOD                    "gTDLSTxStatsPeriod"
-#define CFG_TDLS_TX_STATS_PERIOD_MIN                (1000)
-#define CFG_TDLS_TX_STATS_PERIOD_MAX                (4294967295UL)
-#define CFG_TDLS_TX_STATS_PERIOD_DEFAULT            (2000)
-
-/*
- * <ini>
- * gTDLSTxPacketThreshold - Tx/Rx Packet threshold for initiating TDLS.
- * @Min: 0
- * @Max: 4294967295
- * @Default: 40
- *
- * This ini is used to configure the number of Tx/Rx packets during the
- * period of gTDLSTxStatsPeriod when exceeded, a TDLS Discovery request
- * is triggered.
- * Related: gEnableTDLSSupport.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_TX_PACKET_THRESHOLD                "gTDLSTxPacketThreshold"
-#define CFG_TDLS_TX_PACKET_THRESHOLD_MIN            (0)
-#define CFG_TDLS_TX_PACKET_THRESHOLD_MAX            (4294967295UL)
-#define CFG_TDLS_TX_PACKET_THRESHOLD_DEFAULT        (40)
-
-/*
- * <ini>
- * gTDLSMaxDiscoveryAttempt - Attempts for sending TDLS discovery requests.
- * @Min: 1
- * @Max: 100
- * @Default: 5
- *
- * This ini is used to configure the number of failures of discover request,
- * when exceeded, the peer is assumed to be not TDLS capable and no further
- * TDLS Discovery request is made.
- *
- * Related: gEnableTDLSSupport.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_MAX_DISCOVERY_ATTEMPT              "gTDLSMaxDiscoveryAttempt"
-#define CFG_TDLS_MAX_DISCOVERY_ATTEMPT_MIN          (1)
-#define CFG_TDLS_MAX_DISCOVERY_ATTEMPT_MAX          (100)
-#define CFG_TDLS_MAX_DISCOVERY_ATTEMPT_DEFAULT      (5)
-
-/*
- * <ini>
- * gTDLSIdleTimeout - Duration within which number of TX / RX frames meet the
- * criteria for TDLS teardown.
- * @Min: 500
- * @Max: 40000
- * @Default: 5000
- *
- * This ini is used to configure the time period (in ms) to evaluate whether
- * the number of Tx/Rx packets exceeds gTDLSIdlePacketThreshold and thus meets
- * criteria for TDLS teardown.
- * Teardown notification interval (gTDLSIdleTimeout) should be multiple of
- * setup notification (gTDLSTxStatsPeriod) interval.
- * e.g.
- *      if setup notification (gTDLSTxStatsPeriod) interval = 500, then
- *      teardown notification (gTDLSIdleTimeout) interval should be 1000,
- *      1500, 2000, 2500...
- *
- * Related: gEnableTDLSSupport.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_IDLE_TIMEOUT                       "gTDLSIdleTimeout"
-#define CFG_TDLS_IDLE_TIMEOUT_MIN                   (500)
-#define CFG_TDLS_IDLE_TIMEOUT_MAX                   (40000)
-#define CFG_TDLS_IDLE_TIMEOUT_DEFAULT               (5000)
-
-
-/*
- * <ini>
- * gTDLSIdlePacketThreshold - Number of idle packet.
- * @Min: 0
- * @Max: 40000
- * @Default: 3
- *
- * This ini is used to configure the number of Tx/Rx packet, below which
- * within last gTDLSTxStatsPeriod period is considered as idle condition.
- *
- * Related: gEnableTDLSSupport.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_IDLE_PACKET_THRESHOLD              "gTDLSIdlePacketThreshold"
-#define CFG_TDLS_IDLE_PACKET_THRESHOLD_MIN          (0)
-#define CFG_TDLS_IDLE_PACKET_THRESHOLD_MAX          (40000)
-#define CFG_TDLS_IDLE_PACKET_THRESHOLD_DEFAULT      (3)
-
-/*
- * <ini>
- * gTDLSRSSITriggerThreshold - RSSI threshold for TDLS connection.
- * @Min: -120
- * @Max: 0
- * @Default: -75
- *
- * This ini is used to configure the absolute value (in dB) of the peer RSSI,
- * below which a TDLS setup request is triggered.
- *
- * Related: gEnableTDLSSupport.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_RSSI_TRIGGER_THRESHOLD             "gTDLSRSSITriggerThreshold"
-#define CFG_TDLS_RSSI_TRIGGER_THRESHOLD_MIN         (-120)
-#define CFG_TDLS_RSSI_TRIGGER_THRESHOLD_MAX         (0)
-#define CFG_TDLS_RSSI_TRIGGER_THRESHOLD_DEFAULT     (-75)
-
-/*
- * <ini>
- * gTDLSRSSITeardownThreshold - RSSI threshold for TDLS teardown.
- * @Min: -120
- * @Max: 0
- * @Default: -75
- *
- * This ini is used to configure the absolute value (in dB) of the peer RSSI,
- * when exceed, a TDLS teardown is triggered.
- *
- * Related: gEnableTDLSSupport.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_RSSI_TEARDOWN_THRESHOLD            "gTDLSRSSITeardownThreshold"
-#define CFG_TDLS_RSSI_TEARDOWN_THRESHOLD_MIN        (-120)
-#define CFG_TDLS_RSSI_TEARDOWN_THRESHOLD_MAX        (0)
-#define CFG_TDLS_RSSI_TEARDOWN_THRESHOLD_DEFAULT    (-75)
-
-/*
- * <ini>
- * gTDLSRSSIDelta - Delta value for the peer RSSI that can trigger teardown.
- * @Min: -30
- * @Max: 0
- * @Default: -20
- *
- * This ini is used to .
- * This ini is used to configure delta for peer RSSI such that if Peer RSSI
- * is less than AP RSSI plus delta will trigger a teardown.
- *
- * Related: gEnableTDLSSupport.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_RSSI_DELTA                         "gTDLSRSSIDelta"
-#define CFG_TDLS_RSSI_DELTA_MIN                     (-30)
-#define CFG_TDLS_RSSI_DELTA_MAX                     (0)
-#define CFG_TDLS_RSSI_DELTA_DEFAULT                 (-20)
-
-/*
- * <ini>
- * gTDLSUapsdMask - ACs to setup U-APSD for TDLS Sta.
- * @Min: 0
- * @Max: 0x0F
- * @Default: 0x0F
- *
- * This ini is used to configure the ACs for which mask needs to be enabled.
- * 0x1: Background	0x2: Best effort
- * 0x4: Video		0x8:Voice
- *
- * Related: gEnableTDLSSupport.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_QOS_WMM_UAPSD_MASK_NAME            "gTDLSUapsdMask"
-#define CFG_TDLS_QOS_WMM_UAPSD_MASK_MIN             (0)
-#define CFG_TDLS_QOS_WMM_UAPSD_MASK_MAX             (0x0F)
-#define CFG_TDLS_QOS_WMM_UAPSD_MASK_DEFAULT         (0x0F)
-
-/*
- * <ini>
- * gEnableTDLSBufferSta - Controls the TDLS buffer.
- * @Min: 0
- * @Max: 1
- * @Default: 1
- *
- * This ini is used to control the TDLS buffer.
- * Buffer STA is not enabled in CLD 2.0 yet.
- *
- * Related: gEnableTDLSSupport.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_BUFFER_STA_SUPPORT_ENABLE          "gEnableTDLSBufferSta"
-#define CFG_TDLS_BUFFER_STA_SUPPORT_ENABLE_MIN      (0)
-#define CFG_TDLS_BUFFER_STA_SUPPORT_ENABLE_MAX      (1)
-#define CFG_TDLS_BUFFER_STA_SUPPORT_ENABLE_DEFAULT  (1)
-
-/*
- * <ini>
- * gTDLSPuapsdInactivityTime - Peer UAPSD Inactivity time.
- * @Min: 0
- * @Max: 10
- * @Default: 0
- *
- * This ini is used to configure peer uapsd inactivity time.
- *
- * Related: gEnableTDLSSupport.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_PUAPSD_INACTIVITY_TIME             "gTDLSPuapsdInactivityTime"
-#define CFG_TDLS_PUAPSD_INACTIVITY_TIME_MIN         (0)
-#define CFG_TDLS_PUAPSD_INACTIVITY_TIME_MAX         (10)
-#define CFG_TDLS_PUAPSD_INACTIVITY_TIME_DEFAULT     (0)
-
-/*
- * <ini>
- * gTDLSPuapsdRxFrameThreshold - Peer UAPSD Rx frame threshold.
- * @Min: 10
- * @Max: 20
- * @Default: 10
- *
- * This ini is used to configure maximum Rx frame during SP.
- *
- * Related: gEnableTDLSSupport.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_PUAPSD_RX_FRAME_THRESHOLD          "gTDLSPuapsdRxFrameThreshold"
-#define CFG_TDLS_PUAPSD_RX_FRAME_THRESHOLD_MIN      (10)
-#define CFG_TDLS_PUAPSD_RX_FRAME_THRESHOLD_MAX      (20)
-#define CFG_TDLS_PUAPSD_RX_FRAME_THRESHOLD_DEFAULT  (10)
-
-/*
- * <ini>
- * gTDLSPuapsdPTIWindow - This ini is used to configure peer traffic indication
- * window.
- * @Min: 1
- * @Max: 5
- * @Default: 2
- *
- * This ini is used to configure buffering time in number of beacon intervals.
- *
- * Related: gEnableTDLSSupport.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_PUAPSD_PEER_TRAFFIC_IND_WINDOW          "gTDLSPuapsdPTIWindow"
-#define CFG_TDLS_PUAPSD_PEER_TRAFFIC_IND_WINDOW_MIN      (1)
-#define CFG_TDLS_PUAPSD_PEER_TRAFFIC_IND_WINDOW_MAX      (5)
-#define CFG_TDLS_PUAPSD_PEER_TRAFFIC_IND_WINDOW_DEFAULT  (2)
-
-/*
- * <ini>
- * gTDLSPuapsdPTRTimeout - Peer Traffic Response timer duration in ms.
- * @Min: 0
- * @Max: 10000
- * @Default: 5000
- *
- * This ini is used to configure the peer traffic response timer duration
- * in ms.
- *
- * Related: gEnableTDLSSupport.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_PUAPSD_PEER_TRAFFIC_RSP_TIMEOUT         "gTDLSPuapsdPTRTimeout"
-#define CFG_TDLS_PUAPSD_PEER_TRAFFIC_RSP_TIMEOUT_MIN     (0)
-#define CFG_TDLS_PUAPSD_PEER_TRAFFIC_RSP_TIMEOUT_MAX     (10000)
-#define CFG_TDLS_PUAPSD_PEER_TRAFFIC_RSP_TIMEOUT_DEFAULT (5000)
-
-/*
- * <ini>
- * gTDLSExternalControl - Enable external TDLS control.
- * @Min: 0
- * @Max: 1
- * @Default: 1
- *
- * This ini is used to enable/disable external TDLS control.
- * TDLS external control works with TDLS implicit trigger. TDLS external
- * control allows a user to add a MAC address of potential TDLS peers so
- * that the CLD driver can initiate implicit TDLS setup to only those peers
- * when criteria for TDLS setup (throughput and RSSI threshold) is met.
- *
- * Related: gEnableTDLSSupport, gEnableTDLSImplicitTrigger.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_EXTERNAL_CONTROL                   "gTDLSExternalControl"
-#define CFG_TDLS_EXTERNAL_CONTROL_MIN               (0)
-#define CFG_TDLS_EXTERNAL_CONTROL_MAX               (1)
-#define CFG_TDLS_EXTERNAL_CONTROL_DEFAULT           (1)
-
 /*
  * This INI item is used to control subsystem restart(SSR) test framework
  * Set it's value to 1 to enable APPS trigerred SSR testing
@@ -6694,186 +6287,6 @@
 
 /*
  * <ini>
- * gEnableTDLSOffChannel - Enables off-channel support for TDLS link.
- * @Min: 0
- * @Max: 1
- * @Default: 0
- *
- * This ini is used to enable/disable off-channel support for TDLS link.
- *
- * Related: gEnableTDLSSupport.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_OFF_CHANNEL_SUPPORT_ENABLE          "gEnableTDLSOffChannel"
-#define CFG_TDLS_OFF_CHANNEL_SUPPORT_ENABLE_MIN      (0)
-#define CFG_TDLS_OFF_CHANNEL_SUPPORT_ENABLE_MAX      (1)
-#define CFG_TDLS_OFF_CHANNEL_SUPPORT_ENABLE_DEFAULT  (0)
-
-/*
- * <ini>
- * gEnableTDLSWmmMode - Enables WMM support over TDLS link.
- * @Min: 0
- * @Max: 1
- * @Default: 1
- *
- * This ini is used to enable/disable WMM support over TDLS link.
- * This is required to be set to 1 for any TDLS and uAPSD functionality.
- *
- * Related: gEnableTDLSSupport.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_WMM_MODE_ENABLE                     "gEnableTDLSWmmMode"
-#define CFG_TDLS_WMM_MODE_ENABLE_MIN                 (0)
-#define CFG_TDLS_WMM_MODE_ENABLE_MAX                 (1)
-#define CFG_TDLS_WMM_MODE_ENABLE_DEFAULT             (1)
-
-/*
- * <ini>
- * gTDLSPrefOffChanNum - Preferred TDLS channel number when off-channel support
- * is enabled.
- * @Min: 1
- * @Max: 165
- * @Default: 36
- *
- * This ini is used to configure preferred TDLS channel number when off-channel
- * support is enabled.
- *
- * Related: gEnableTDLSSupport, gEnableTDLSOffChannel.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_PREFERRED_OFF_CHANNEL_NUM          "gTDLSPrefOffChanNum"
-#define CFG_TDLS_PREFERRED_OFF_CHANNEL_NUM_MIN      (1)
-#define CFG_TDLS_PREFERRED_OFF_CHANNEL_NUM_MAX      (165)
-#define CFG_TDLS_PREFERRED_OFF_CHANNEL_NUM_DEFAULT  (36)
-
-/*
- * <ini>
- * gTDLSPrefOffChanBandwidth - Preferred TDLS channel bandwidth when
- * off-channel support is enabled.
- * @Min: 0x01
- * @Max: 0x0F
- * @Default: 0x07
- *
- * This ini is used to configure preferred TDLS channel bandwidth when
- * off-channel support is enabled.
- * 0x1: 20 MHz	0x2: 40 MHz	0x4: 80 MHz	0x8: 160 MHz
- * When more than one bits are set then firmware starts from the highest and
- * selects one based on capability of peer.
- *
- * Related: gEnableTDLSSupport, gEnableTDLSOffChannel.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_PREFERRED_OFF_CHANNEL_BW           "gTDLSPrefOffChanBandwidth"
-#define CFG_TDLS_PREFERRED_OFF_CHANNEL_BW_MIN      (0x01)
-#define CFG_TDLS_PREFERRED_OFF_CHANNEL_BW_MAX      (0x0F)
-#define CFG_TDLS_PREFERRED_OFF_CHANNEL_BW_DEFAULT  (0x07)
-
-/*
- * <ini>
- * gEnableTDLSScan - Allow scan and maintain TDLS link.
- * @Min: 0
- * @Max: 1
- * @Default: 0
- *
- * This ini is used to enable/disable TDLS scan.
- *  0: If peer is not buffer STA capable and device is not sleep STA
- *     capable, then teardown TDLS link when scan is initiated. If peer
- *     is buffer STA and we can be sleep STA then TDLS link is maintained
- *     during scan.
- *  1: Maintain TDLS link and allow scan even if peer is not buffer STA
- *     capable and device is not sleep STA capable. There will be loss of
- *     Rx pkts since peer would not know when device moves away from tdls
- *     channel. Tx on TDLS link would stop when device moves away from tdls
- *     channel.
- *
- * Related: gEnableTDLSSupport.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_SCAN_ENABLE                       "gEnableTDLSScan"
-#define CFG_TDLS_SCAN_ENABLE_MIN                   (0)
-#define CFG_TDLS_SCAN_ENABLE_MAX                   (1)
-#define CFG_TDLS_SCAN_ENABLE_DEFAULT               (1)
-
-/*
- * <ini>
- * gTDLSPeerKickoutThreshold - TDLS peer kickout threshold to firmware.
- * @Min: 10
- * @Max: 5000
- * @Default: 96
- *
- * This ini is used to configure TDLS peer kickout threshold to firmware.
- *     Firmware will use this value to determine, when to send TDLS
- *     peer kick out event to host.
- *     E.g.
- *        if peer kick out threshold is 10, then firmware will wait for 10
- *        consecutive packet failures and then send TDLS kickout
- *        notification to host driver
- *
- * Related: gEnableTDLSSupport.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_PEER_KICKOUT_THRESHOLD            "gTDLSPeerKickoutThreshold"
-#define CFG_TDLS_PEER_KICKOUT_THRESHOLD_MIN        (10)
-#define CFG_TDLS_PEER_KICKOUT_THRESHOLD_MAX        (5000)
-#define CFG_TDLS_PEER_KICKOUT_THRESHOLD_DEFAULT    (96)
-
-#endif
-
-/*
- * <ini>
- * gTDLSEnableDeferTime - Timer to defer for enabling TDLS on P2P listen.
- * @Min: 500
- * @Max: 6000
- * @Default: 2000
- *
- * This ini is used to set the timer to defer for enabling TDLS on P2P
- * listen (value in milliseconds).
- *
- * Related: gEnableTDLSSupport.
- *
- * Supported Feature: TDLS
- *
- * Usage: Internal/External
- *
- * </ini>
- */
-#define CFG_TDLS_ENABLE_DEFER_TIMER                "gTDLSEnableDeferTime"
-#define CFG_TDLS_ENABLE_DEFER_TIMER_MIN            (500)
-#define CFG_TDLS_ENABLE_DEFER_TIMER_MAX            (6000)
-#define CFG_TDLS_ENABLE_DEFER_TIMER_DEFAULT        (2000)
-
-/*
- * <ini>
  * gTxLdpcEnable - Config Param to enable Tx LDPC capability
  * @Min: 0
  * @Max: 3
@@ -14822,32 +14235,6 @@
 	uint8_t enable_rx_ldpc;
 	bool enable5gEBT;
 	bool prevent_link_down;
-#ifdef FEATURE_WLAN_TDLS
-	bool fEnableTDLSSupport;
-	bool fEnableTDLSImplicitTrigger;
-	uint32_t fTDLSTxStatsPeriod;
-	uint32_t fTDLSTxPacketThreshold;
-	uint32_t fTDLSMaxDiscoveryAttempt;
-	uint32_t tdls_idle_timeout;
-	uint32_t fTDLSIdlePacketThreshold;
-	int32_t fTDLSRSSITriggerThreshold;
-	int32_t fTDLSRSSITeardownThreshold;
-	int32_t fTDLSRSSIDelta;
-	uint32_t fTDLSUapsdMask;        /* what ACs to setup U-APSD for TDLS */
-	uint32_t fEnableTDLSBufferSta;
-	uint32_t fEnableTDLSSleepSta;
-	uint32_t fTDLSPuapsdInactivityTimer;
-	uint32_t fTDLSRxFrameThreshold;
-	uint32_t fTDLSPuapsdPTIWindow;
-	uint32_t fTDLSPuapsdPTRTimeout;
-	bool fTDLSExternalControl;
-	uint32_t fEnableTDLSOffChannel;
-	uint32_t fEnableTDLSWmmMode;
-	uint8_t fTDLSPrefOffChanNum;
-	uint8_t fTDLSPrefOffChanBandwidth;
-	uint8_t enable_tdls_scan;
-	uint32_t tdls_peer_kickout_threshold;
-#endif
 	uint8_t scanAgingTimeout;
 	uint8_t disableLDPCWithTxbfAP;
 	uint8_t enableMCCAdaptiveScheduler;
@@ -15065,7 +14452,6 @@
 	bool active_mode_offload;
 	bool apf_packet_filter_enable;
 	/* parameter for defer timer for enabling TDLS on p2p listen */
-	uint16_t tdls_enable_defer_time;
 	uint32_t fine_time_meas_cap;
 	uint8_t max_scan_count;
 #ifdef WLAN_FEATURE_FASTPATH
diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c
index 77522de..a411eee 100644
--- a/core/hdd/src/wlan_hdd_cfg.c
+++ b/core/hdd/src/wlan_hdd_cfg.c
@@ -43,6 +43,7 @@
 #include "wlan_hdd_green_ap_cfg.h"
 #include "wlan_hdd_twt.h"
 #include "wlan_p2p_cfg_api.h"
+#include "wlan_tdls_cfg_api.h"
 
 static void
 cb_notify_set_roam_prefer5_g_hz(struct hdd_context *hdd_ctx,
@@ -2160,171 +2161,6 @@
 		     CFG_PREVENT_LINK_DOWN_MIN,
 		     CFG_PREVENT_LINK_DOWN_MAX),
 
-#ifdef FEATURE_WLAN_TDLS
-	REG_VARIABLE(CFG_TDLS_SUPPORT_ENABLE, WLAN_PARAM_Integer,
-		     struct hdd_config, fEnableTDLSSupport,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_SUPPORT_ENABLE_DEFAULT,
-		     CFG_TDLS_SUPPORT_ENABLE_MIN,
-		     CFG_TDLS_SUPPORT_ENABLE_MAX),
-
-	REG_VARIABLE(CFG_TDLS_IMPLICIT_TRIGGER, WLAN_PARAM_Integer,
-		     struct hdd_config, fEnableTDLSImplicitTrigger,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_IMPLICIT_TRIGGER_DEFAULT,
-		     CFG_TDLS_IMPLICIT_TRIGGER_MIN,
-		     CFG_TDLS_IMPLICIT_TRIGGER_MAX),
-
-	REG_VARIABLE(CFG_TDLS_TX_STATS_PERIOD, WLAN_PARAM_Integer,
-		     struct hdd_config, fTDLSTxStatsPeriod,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_TX_STATS_PERIOD_DEFAULT,
-		     CFG_TDLS_TX_STATS_PERIOD_MIN,
-		     CFG_TDLS_TX_STATS_PERIOD_MAX),
-
-	REG_VARIABLE(CFG_TDLS_TX_PACKET_THRESHOLD, WLAN_PARAM_Integer,
-		     struct hdd_config, fTDLSTxPacketThreshold,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_TX_PACKET_THRESHOLD_DEFAULT,
-		     CFG_TDLS_TX_PACKET_THRESHOLD_MIN,
-		     CFG_TDLS_TX_PACKET_THRESHOLD_MAX),
-
-	REG_VARIABLE(CFG_TDLS_MAX_DISCOVERY_ATTEMPT, WLAN_PARAM_Integer,
-		     struct hdd_config, fTDLSMaxDiscoveryAttempt,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_MAX_DISCOVERY_ATTEMPT_DEFAULT,
-		     CFG_TDLS_MAX_DISCOVERY_ATTEMPT_MIN,
-		     CFG_TDLS_MAX_DISCOVERY_ATTEMPT_MAX),
-
-	REG_VARIABLE(CFG_TDLS_IDLE_TIMEOUT, WLAN_PARAM_Integer,
-		     struct hdd_config, tdls_idle_timeout,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_IDLE_TIMEOUT_DEFAULT,
-		     CFG_TDLS_IDLE_TIMEOUT_MIN,
-		     CFG_TDLS_IDLE_TIMEOUT_MAX),
-
-	REG_VARIABLE(CFG_TDLS_IDLE_PACKET_THRESHOLD, WLAN_PARAM_Integer,
-		     struct hdd_config, fTDLSIdlePacketThreshold,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_IDLE_PACKET_THRESHOLD_DEFAULT,
-		     CFG_TDLS_IDLE_PACKET_THRESHOLD_MIN,
-		     CFG_TDLS_IDLE_PACKET_THRESHOLD_MAX),
-
-	REG_VARIABLE(CFG_TDLS_RSSI_TRIGGER_THRESHOLD, WLAN_PARAM_SignedInteger,
-		     struct hdd_config, fTDLSRSSITriggerThreshold,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_RSSI_TRIGGER_THRESHOLD_DEFAULT,
-		     CFG_TDLS_RSSI_TRIGGER_THRESHOLD_MIN,
-		     CFG_TDLS_RSSI_TRIGGER_THRESHOLD_MAX),
-
-	REG_VARIABLE(CFG_TDLS_RSSI_TEARDOWN_THRESHOLD, WLAN_PARAM_SignedInteger,
-		     struct hdd_config, fTDLSRSSITeardownThreshold,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_RSSI_TEARDOWN_THRESHOLD_DEFAULT,
-		     CFG_TDLS_RSSI_TEARDOWN_THRESHOLD_MIN,
-		     CFG_TDLS_RSSI_TEARDOWN_THRESHOLD_MAX),
-
-	REG_VARIABLE(CFG_TDLS_RSSI_DELTA, WLAN_PARAM_SignedInteger,
-		     struct hdd_config, fTDLSRSSIDelta,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_RSSI_DELTA_DEFAULT,
-		     CFG_TDLS_RSSI_DELTA_MIN,
-		     CFG_TDLS_RSSI_DELTA_MAX),
-
-	REG_VARIABLE(CFG_TDLS_QOS_WMM_UAPSD_MASK_NAME, WLAN_PARAM_HexInteger,
-		     struct hdd_config, fTDLSUapsdMask,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_QOS_WMM_UAPSD_MASK_DEFAULT,
-		     CFG_TDLS_QOS_WMM_UAPSD_MASK_MIN,
-		     CFG_TDLS_QOS_WMM_UAPSD_MASK_MAX),
-
-	REG_VARIABLE(CFG_TDLS_BUFFER_STA_SUPPORT_ENABLE, WLAN_PARAM_Integer,
-		     struct hdd_config, fEnableTDLSBufferSta,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_BUFFER_STA_SUPPORT_ENABLE_DEFAULT,
-		     CFG_TDLS_BUFFER_STA_SUPPORT_ENABLE_MIN,
-		     CFG_TDLS_BUFFER_STA_SUPPORT_ENABLE_MAX),
-
-	REG_VARIABLE(CFG_TDLS_OFF_CHANNEL_SUPPORT_ENABLE, WLAN_PARAM_Integer,
-		     struct hdd_config, fEnableTDLSOffChannel,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_OFF_CHANNEL_SUPPORT_ENABLE_DEFAULT,
-		     CFG_TDLS_OFF_CHANNEL_SUPPORT_ENABLE_MIN,
-		     CFG_TDLS_OFF_CHANNEL_SUPPORT_ENABLE_MAX),
-
-	REG_VARIABLE(CFG_TDLS_PREFERRED_OFF_CHANNEL_NUM, WLAN_PARAM_Integer,
-		     struct hdd_config, fTDLSPrefOffChanNum,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_PREFERRED_OFF_CHANNEL_NUM_DEFAULT,
-		     CFG_TDLS_PREFERRED_OFF_CHANNEL_NUM_MIN,
-		     CFG_TDLS_PREFERRED_OFF_CHANNEL_NUM_MAX),
-
-	REG_VARIABLE(CFG_TDLS_PREFERRED_OFF_CHANNEL_BW, WLAN_PARAM_Integer,
-		     struct hdd_config, fTDLSPrefOffChanBandwidth,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_PREFERRED_OFF_CHANNEL_BW_DEFAULT,
-		     CFG_TDLS_PREFERRED_OFF_CHANNEL_BW_MIN,
-		     CFG_TDLS_PREFERRED_OFF_CHANNEL_BW_MAX),
-
-	REG_VARIABLE(CFG_TDLS_PUAPSD_INACTIVITY_TIME, WLAN_PARAM_Integer,
-		     struct hdd_config, fTDLSPuapsdInactivityTimer,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_PUAPSD_INACTIVITY_TIME_DEFAULT,
-		     CFG_TDLS_PUAPSD_INACTIVITY_TIME_MIN,
-		     CFG_TDLS_PUAPSD_INACTIVITY_TIME_MAX),
-
-	REG_VARIABLE(CFG_TDLS_PUAPSD_RX_FRAME_THRESHOLD, WLAN_PARAM_Integer,
-		     struct hdd_config, fTDLSRxFrameThreshold,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_PUAPSD_RX_FRAME_THRESHOLD_DEFAULT,
-		     CFG_TDLS_PUAPSD_RX_FRAME_THRESHOLD_MIN,
-		     CFG_TDLS_PUAPSD_RX_FRAME_THRESHOLD_MAX),
-
-	REG_VARIABLE(CFG_TDLS_PUAPSD_PEER_TRAFFIC_IND_WINDOW,
-		     WLAN_PARAM_Integer,
-		     struct hdd_config, fTDLSPuapsdPTIWindow,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_PUAPSD_PEER_TRAFFIC_IND_WINDOW_DEFAULT,
-		     CFG_TDLS_PUAPSD_PEER_TRAFFIC_IND_WINDOW_MIN,
-		     CFG_TDLS_PUAPSD_PEER_TRAFFIC_IND_WINDOW_MAX),
-
-	REG_VARIABLE(CFG_TDLS_PUAPSD_PEER_TRAFFIC_RSP_TIMEOUT,
-		     WLAN_PARAM_Integer,
-		     struct hdd_config, fTDLSPuapsdPTRTimeout,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_PUAPSD_PEER_TRAFFIC_RSP_TIMEOUT_DEFAULT,
-		     CFG_TDLS_PUAPSD_PEER_TRAFFIC_RSP_TIMEOUT_MIN,
-		     CFG_TDLS_PUAPSD_PEER_TRAFFIC_RSP_TIMEOUT_MAX),
-
-	REG_VARIABLE(CFG_TDLS_EXTERNAL_CONTROL, WLAN_PARAM_Integer,
-		     struct hdd_config, fTDLSExternalControl,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_EXTERNAL_CONTROL_DEFAULT,
-		     CFG_TDLS_EXTERNAL_CONTROL_MIN,
-		     CFG_TDLS_EXTERNAL_CONTROL_MAX),
-	REG_VARIABLE(CFG_TDLS_WMM_MODE_ENABLE, WLAN_PARAM_Integer,
-		     struct hdd_config, fEnableTDLSWmmMode,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_WMM_MODE_ENABLE_DEFAULT,
-		     CFG_TDLS_WMM_MODE_ENABLE_MIN,
-		     CFG_TDLS_WMM_MODE_ENABLE_MAX),
-
-	REG_VARIABLE(CFG_TDLS_SCAN_ENABLE, WLAN_PARAM_Integer,
-		     struct hdd_config, enable_tdls_scan,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_SCAN_ENABLE_DEFAULT,
-		     CFG_TDLS_SCAN_ENABLE_MIN,
-		     CFG_TDLS_SCAN_ENABLE_MAX),
-
-	REG_VARIABLE(CFG_TDLS_PEER_KICKOUT_THRESHOLD, WLAN_PARAM_Integer,
-		     struct hdd_config, tdls_peer_kickout_threshold,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_PEER_KICKOUT_THRESHOLD_DEFAULT,
-		     CFG_TDLS_PEER_KICKOUT_THRESHOLD_MIN,
-		     CFG_TDLS_PEER_KICKOUT_THRESHOLD_MAX),
-
-#endif
-
 	REG_VARIABLE(CFG_SCAN_AGING_PARAM_NAME, WLAN_PARAM_Integer,
 		     struct hdd_config, scanAgingTimeout,
 		     VAR_FLAGS_OPTIONAL,
@@ -3417,13 +3253,6 @@
 		     CFG_APF_PACKET_FILTER_OFFLOAD_MIN,
 		     CFG_APF_PACKET_FILTER_OFFLOAD_MAX),
 
-	REG_VARIABLE(CFG_TDLS_ENABLE_DEFER_TIMER, WLAN_PARAM_Integer,
-		     struct hdd_config, tdls_enable_defer_time,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_TDLS_ENABLE_DEFER_TIMER_DEFAULT,
-		     CFG_TDLS_ENABLE_DEFER_TIMER_MIN,
-		     CFG_TDLS_ENABLE_DEFER_TIMER_MAX),
-
 	REG_VARIABLE(CFG_FLOW_STEERING_ENABLED_NAME, WLAN_PARAM_Integer,
 		     struct hdd_config, flow_steering_enable,
 		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
@@ -6551,22 +6380,6 @@
 	hdd_debug("Name = [gPNOSlowScanMultiplier] Value = [%u] ",
 		  hdd_ctx->config->pno_slow_scan_multiplier);
 #endif
-#ifdef FEATURE_WLAN_TDLS
-	hdd_debug("Name = [fEnableTDLSSupport] Value = [%u] ",
-		  hdd_ctx->config->fEnableTDLSSupport);
-	hdd_debug("Name = [fEnableTDLSImplicitTrigger] Value = [%u] ",
-		  hdd_ctx->config->fEnableTDLSImplicitTrigger);
-	hdd_debug("Name = [fTDLSExternalControl] Value = [%u] ",
-		  hdd_ctx->config->fTDLSExternalControl);
-	hdd_debug("Name = [fTDLSUapsdMask] Value = [%u] ",
-		  hdd_ctx->config->fTDLSUapsdMask);
-	hdd_debug("Name = [fEnableTDLSBufferSta] Value = [%u] ",
-		  hdd_ctx->config->fEnableTDLSBufferSta);
-	hdd_debug("Name = [fEnableTDLSWmmMode] Value = [%u] ",
-		  hdd_ctx->config->fEnableTDLSWmmMode);
-	hdd_debug("Name = [enable_tdls_scan] Value = [%u]",
-		  hdd_ctx->config->enable_tdls_scan);
-#endif
 	hdd_debug("Name = [InfraDirAcVo] Value = [%u] ",
 		  hdd_ctx->config->InfraDirAcVo);
 	hdd_debug("Name = [InfraNomMsduSizeAcVo] Value = [0x%x] ",
@@ -7121,9 +6934,6 @@
 	hdd_debug("Name = [%s] Value = [%d]",
 		CFG_APF_PACKET_FILTER_OFFLOAD,
 		hdd_ctx->config->apf_packet_filter_enable);
-	hdd_debug("Name = [%s] Value = [%u]",
-		CFG_TDLS_ENABLE_DEFER_TIMER,
-		hdd_ctx->config->tdls_enable_defer_time);
 	hdd_debug("Name = [%s] Value = [%d]",
 		CFG_FILTER_MULTICAST_REPLAY_NAME,
 		hdd_ctx->config->multicast_replay_filter);
@@ -8098,6 +7908,7 @@
 	struct hdd_config *config = hdd_ctx->config;
 	mac_handle_t mac_handle;
 	uint32_t ivalue;
+	bool bvalue;
 	QDF_STATUS ret;
 
 	/*
@@ -8291,41 +8102,70 @@
 
 #ifdef FEATURE_WLAN_TDLS
 
-	if (sme_cfg_set_int(mac_handle, WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK,
-			    config->fTDLSUapsdMask) == QDF_STATUS_E_FAILURE) {
-		status = false;
-		hdd_err("Couldn't pass on WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK to CFG");
-	}
-	if (sme_cfg_set_int(mac_handle, WNI_CFG_TDLS_BUF_STA_ENABLED,
-			    config->fEnableTDLSBufferSta) ==
-			QDF_STATUS_E_FAILURE) {
-		status = false;
-		hdd_err("Couldn't pass on WNI_CFG_TDLS_BUF_STA_ENABLED to CFG");
-	}
-	if (sme_cfg_set_int(mac_handle, WNI_CFG_TDLS_PUAPSD_INACT_TIME,
-			    config->fTDLSPuapsdInactivityTimer) ==
-			QDF_STATUS_E_FAILURE) {
-		status = false;
-		hdd_err("Couldn't pass on WNI_CFG_TDLS_PUAPSD_INACT_TIME to CFG");
-	}
-	if (sme_cfg_set_int(mac_handle, WNI_CFG_TDLS_RX_FRAME_THRESHOLD,
-			    config->fTDLSRxFrameThreshold) ==
-			QDF_STATUS_E_FAILURE) {
-		status = false;
-		hdd_err("Couldn't pass on WNI_CFG_TDLS_RX_FRAME_THRESHOLD to CFG");
+	ret = cfg_tdls_get_uapsd_mask(hdd_ctx->hdd_psoc, &ivalue);
+	if (ret == QDF_STATUS_SUCCESS) {
+		ret = sme_cfg_set_int(mac_handle,
+				      WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK,
+				      ivalue);
+		if (ret == QDF_STATUS_E_FAILURE) {
+			status = false;
+			hdd_err("Couldn't pass on WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK to CFG");
+		}
 	}
 
-	if (sme_cfg_set_int(mac_handle, WNI_CFG_TDLS_OFF_CHANNEL_ENABLED,
-			    config->fEnableTDLSOffChannel) ==
-			QDF_STATUS_E_FAILURE) {
-		status = false;
-		hdd_err("Couldn't pass on WNI_CFG_TDLS_BUF_STA_ENABLED to CFG");
+	ret = cfg_tdls_get_buffer_sta_enable(hdd_ctx->hdd_psoc, &bvalue);
+	if (ret == QDF_STATUS_SUCCESS) {
+		ret = sme_cfg_set_int(mac_handle,
+				      WNI_CFG_TDLS_BUF_STA_ENABLED,
+				      (uint32_t)bvalue);
+		if (ret == QDF_STATUS_E_FAILURE) {
+			status = false;
+			hdd_err("Couldn't pass on WNI_CFG_TDLS_BUF_STA_ENABLED to CFG");
+		}
 	}
-	if (sme_cfg_set_int(mac_handle, WNI_CFG_TDLS_WMM_MODE_ENABLED,
-			    config->fEnableTDLSWmmMode) ==
-			QDF_STATUS_E_FAILURE) {
-		status = false;
-		hdd_err("Couldn't pass on WNI_CFG_TDLS_WMM_MODE_ENABLED to CFG");
+
+	ret = cfg_tdls_get_uapsd_inactivity_time(hdd_ctx->hdd_psoc, &ivalue);
+	if (ret == QDF_STATUS_SUCCESS) {
+		ret = sme_cfg_set_int(mac_handle,
+				      WNI_CFG_TDLS_PUAPSD_INACT_TIME,
+				      ivalue);
+		if (ret == QDF_STATUS_E_FAILURE) {
+			status = false;
+			hdd_err("Couldn't pass on WNI_CFG_TDLS_PUAPSD_INACT_TIME to CFG");
+		}
+	}
+
+	ret = cfg_tdls_get_rx_pkt_threshold(hdd_ctx->hdd_psoc, &ivalue);
+	if (ret == QDF_STATUS_SUCCESS) {
+		ret = sme_cfg_set_int(mac_handle,
+				      WNI_CFG_TDLS_RX_FRAME_THRESHOLD,
+				      ivalue);
+		if (ret == QDF_STATUS_E_FAILURE) {
+			status = false;
+			hdd_err("Couldn't pass on WNI_CFG_TDLS_RX_FRAME_THRESHOLD to CFG");
+		}
+	}
+
+	ret = cfg_tdls_get_off_channel_enable(hdd_ctx->hdd_psoc, &bvalue);
+	if (ret == QDF_STATUS_SUCCESS) {
+		ret = sme_cfg_set_int(mac_handle,
+				      WNI_CFG_TDLS_OFF_CHANNEL_ENABLED,
+				      (uint32_t)bvalue);
+		if (ret == QDF_STATUS_E_FAILURE) {
+			status = false;
+			hdd_err("Couldn't pass on WNI_CFG_TDLS_BUF_STA_ENABLED to CFG");
+		}
+	}
+
+	ret = cfg_tdls_get_wmm_mode_enable(hdd_ctx->hdd_psoc, &bvalue);
+	if (ret == QDF_STATUS_SUCCESS) {
+		ret = sme_cfg_set_int(mac_handle,
+				      WNI_CFG_TDLS_WMM_MODE_ENABLED,
+				      (uint32_t)bvalue);
+		if (ret == QDF_STATUS_E_FAILURE) {
+			status = false;
+			hdd_err("Couldn't pass on WNI_CFG_TDLS_WMM_MODE_ENABLED to CFG");
+		}
 	}
 #endif
 
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c
index 9d3b67f..90e2a32 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.c
+++ b/core/hdd/src/wlan_hdd_cfg80211.c
@@ -106,6 +106,7 @@
 #include "wlan_ipa_ucfg_api.h"
 #include <wlan_cfg80211_mc_cp_stats.h>
 #include <wlan_cp_stats_mc_ucfg_api.h>
+#include "wlan_tdls_cfg_api.h"
 
 #define g_mode_rates_size (12)
 #define a_mode_rates_size (8)
@@ -716,6 +717,11 @@
 	struct sk_buff *skb;
 	uint32_t set = 0;
 	uint32_t max_num_tdls_sta = 0;
+	bool tdls_support;
+	bool tdls_external_control;
+	bool tdls_sleep_sta_enable;
+	bool tdls_buffer_sta;
+	bool tdls_off_channel;
 
 	hdd_enter_dev(wdev->netdev);
 
@@ -735,7 +741,8 @@
 		goto fail;
 	}
 
-	if (false == hdd_ctx->config->fEnableTDLSSupport) {
+	if ((cfg_tdls_get_support_enable(hdd_ctx->hdd_psoc, &tdls_support) ==
+	     QDF_STATUS_SUCCESS) && tdls_support) {
 		hdd_debug("TDLS feature not Enabled or Not supported in FW");
 		if (nla_put_u32(skb, PARAM_MAX_TDLS_SESSION, 0) ||
 			nla_put_u32(skb, PARAM_TDLS_FEATURE_SUPPORT, 0)) {
@@ -743,14 +750,21 @@
 			goto fail;
 		}
 	} else {
+		cfg_tdls_get_external_control(hdd_ctx->hdd_psoc,
+					      &tdls_external_control);
+		cfg_tdls_get_sleep_sta_enable(hdd_ctx->hdd_psoc,
+					      &tdls_sleep_sta_enable);
+		cfg_tdls_get_buffer_sta_enable(hdd_ctx->hdd_psoc,
+					       &tdls_buffer_sta);
+		cfg_tdls_get_off_channel_enable(hdd_ctx->hdd_psoc,
+						&tdls_off_channel);
 		set = set | WIFI_TDLS_SUPPORT;
-		set = set | (hdd_ctx->config->fTDLSExternalControl ?
+		set = set | (tdls_external_control ?
 					WIFI_TDLS_EXTERNAL_CONTROL_SUPPORT : 0);
-		set = set | (hdd_ctx->config->fEnableTDLSOffChannel ?
+		set = set | (tdls_off_channel ?
 					WIIF_TDLS_OFFCHANNEL_SUPPORT : 0);
-		if (hdd_ctx->config->fEnableTDLSSleepSta ||
-		    hdd_ctx->config->fEnableTDLSBufferSta ||
-		    hdd_ctx->config->fEnableTDLSOffChannel)
+		if (tdls_sleep_sta_enable || tdls_buffer_sta ||
+		    tdls_off_channel)
 			max_num_tdls_sta = HDD_MAX_NUM_TDLS_STA_P_UAPSD_OFFCHAN;
 		else
 			max_num_tdls_sta = HDD_MAX_NUM_TDLS_STA;
@@ -2918,6 +2932,9 @@
 	struct sk_buff *skb = NULL;
 	uint32_t fset = 0;
 	int ret;
+#ifdef FEATURE_WLAN_TDLS
+	bool bvalue;
+#endif
 
 	/* ENTER_DEV() intentionally not used in a frequently invoked API */
 
@@ -2975,14 +2992,15 @@
 #endif
 	fset |= WIFI_FEATURE_ADDITIONAL_STA;
 #ifdef FEATURE_WLAN_TDLS
-	if ((true == hdd_ctx->config->fEnableTDLSSupport) &&
-	    sme_is_feature_supported_by_fw(TDLS)) {
+	cfg_tdls_get_support_enable(hdd_ctx->hdd_psoc, &bvalue);
+	if ((bvalue) && sme_is_feature_supported_by_fw(TDLS)) {
 		hdd_debug("TDLS is supported by firmware");
 		fset |= WIFI_FEATURE_TDLS;
 	}
+
+	cfg_tdls_get_off_channel_enable(hdd_ctx->hdd_psoc, &bvalue);
 	if (sme_is_feature_supported_by_fw(TDLS) &&
-	    (true == hdd_ctx->config->fEnableTDLSOffChannel) &&
-	    sme_is_feature_supported_by_fw(TDLS_OFF_CHANNEL)) {
+	    bvalue && sme_is_feature_supported_by_fw(TDLS_OFF_CHANNEL)) {
 		hdd_debug("TDLS off-channel is supported by firmware");
 		fset |= WIFI_FEATURE_TDLS_OFFCHANNEL;
 	}
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 5875d52..cf633b9 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -137,6 +137,7 @@
 #include "qc_sap_ioctl.h"
 #include "wlan_mlme_main.h"
 #include "wlan_p2p_cfg_api.h"
+#include "wlan_tdls_cfg_api.h"
 
 #ifdef CNSS_GENL
 #include <net/cnss_nl.h>
@@ -1169,41 +1170,13 @@
 {
 	struct wlan_objmgr_psoc *psoc = hdd_ctx->hdd_psoc;
 	struct tdls_start_params tdls_cfg;
-	struct tdls_user_config *config = &tdls_cfg.config;
 	struct hdd_config *cfg = hdd_ctx->config;
 	QDF_STATUS status;
 
-	config->tdls_tx_states_period = cfg->fTDLSTxStatsPeriod;
-	config->tdls_tx_pkt_threshold = cfg->fTDLSTxPacketThreshold;
-	config->tdls_rx_pkt_threshold = cfg->fTDLSRxFrameThreshold;
-	config->tdls_max_discovery_attempt = cfg->fTDLSMaxDiscoveryAttempt;
-	config->tdls_idle_timeout = cfg->tdls_idle_timeout;
-	config->tdls_idle_pkt_threshold = cfg->fTDLSIdlePacketThreshold;
-	config->tdls_rssi_trigger_threshold = cfg->fTDLSRSSITriggerThreshold;
-	config->tdls_rssi_teardown_threshold = cfg->fTDLSRSSITeardownThreshold;
-	config->tdls_rssi_delta = cfg->fTDLSRSSIDelta;
-	config->tdls_uapsd_mask = cfg->fTDLSUapsdMask;
-	config->tdls_uapsd_inactivity_time = cfg->fTDLSPuapsdInactivityTimer;
-	config->tdls_uapsd_pti_window = cfg->fTDLSPuapsdPTIWindow;
-	config->tdls_uapsd_ptr_timeout = cfg->fTDLSPuapsdPTRTimeout;
-	config->tdls_pre_off_chan_num = cfg->fTDLSPrefOffChanNum;
-	config->tdls_pre_off_chan_bw = cfg->fTDLSPrefOffChanBandwidth;
-	config->tdls_peer_kickout_threshold = cfg->tdls_peer_kickout_threshold;
-	config->delayed_trig_framint = cfg->DelayedTriggerFrmInt;
-	config->tdls_feature_flags = ((cfg->fEnableTDLSOffChannel ?
-				     1 << TDLS_FEATURE_OFF_CHANNEL : 0) |
-		(cfg->fEnableTDLSWmmMode ? 1 << TDLS_FEATURE_WMM : 0) |
-		(cfg->fEnableTDLSBufferSta ? 1 << TDLS_FEATURE_BUFFER_STA : 0) |
-		(cfg->fEnableTDLSSleepSta ? 1 << TDLS_FEATURE_SLEEP_STA : 0) |
-		(cfg->enable_tdls_scan ? 1 << TDLS_FEATURE_SCAN : 0) |
-		(cfg->fEnableTDLSSupport ? 1 << TDLS_FEATURE_ENABLE : 0) |
-		(cfg->fEnableTDLSImplicitTrigger ?
-		 1 << TDLS_FEAUTRE_IMPLICIT_TRIGGER : 0) |
-		(cfg->fTDLSExternalControl ?
-		 1 << TDLS_FEATURE_EXTERNAL_CONTROL : 0));
-	config->tdls_vdev_nss_2g = CFG_TDLS_NSS(cfg->vdev_type_nss_2g);
-	config->tdls_vdev_nss_5g = CFG_TDLS_NSS(cfg->vdev_type_nss_5g);
-
+	cfg_tdls_set_vdev_nss_2g(hdd_ctx->hdd_psoc,
+				 CFG_TDLS_NSS(cfg->vdev_type_nss_2g));
+	cfg_tdls_set_vdev_nss_5g(hdd_ctx->hdd_psoc,
+				 CFG_TDLS_NSS(cfg->vdev_type_nss_5g));
 	tdls_cfg.tdls_send_mgmt_req = eWNI_SME_TDLS_SEND_MGMT_REQ;
 	tdls_cfg.tdls_add_sta_req = eWNI_SME_TDLS_ADD_STA_REQ;
 	tdls_cfg.tdls_del_sta_req = eWNI_SME_TDLS_DEL_STA_REQ;
@@ -1238,7 +1211,12 @@
 				    struct wma_tgt_services *cfg)
 {
 	struct hdd_config *config = hdd_ctx->config;
-
+#ifdef FEATURE_WLAN_TDLS
+	bool tdls_support;
+	bool tdls_off_channel;
+	bool tdls_buffer_sta;
+	uint32_t tdls_uapsd_mask;
+#endif
 	/* Set up UAPSD */
 	config->apUapsdEnabled &= cfg->uapsd;
 
@@ -1262,15 +1240,25 @@
 		config->PnoOffload = true;
 #endif
 #ifdef FEATURE_WLAN_TDLS
-	config->fEnableTDLSSupport &= cfg->en_tdls;
-	config->fEnableTDLSOffChannel = config->fEnableTDLSOffChannel &&
-						cfg->en_tdls_offchan;
-	config->fEnableTDLSBufferSta = config->fEnableTDLSBufferSta &&
-						cfg->en_tdls_uapsd_buf_sta;
-	if (config->fTDLSUapsdMask && cfg->en_tdls_uapsd_sleep_sta)
-		config->fEnableTDLSSleepSta = true;
+	cfg_tdls_get_support_enable(hdd_ctx->hdd_psoc, &tdls_support);
+	cfg_tdls_set_support_enable(hdd_ctx->hdd_psoc,
+				    tdls_support & cfg->en_tdls);
+
+	cfg_tdls_get_off_channel_enable(hdd_ctx->hdd_psoc, &tdls_off_channel);
+	cfg_tdls_set_off_channel_enable(hdd_ctx->hdd_psoc,
+					tdls_off_channel &&
+					cfg->en_tdls_offchan);
+
+	cfg_tdls_get_buffer_sta_enable(hdd_ctx->hdd_psoc, &tdls_buffer_sta);
+	cfg_tdls_set_buffer_sta_enable(hdd_ctx->hdd_psoc,
+				       tdls_buffer_sta &&
+				       cfg->en_tdls_uapsd_buf_sta);
+
+	cfg_tdls_get_uapsd_mask(hdd_ctx->hdd_psoc, &tdls_uapsd_mask);
+	if (tdls_uapsd_mask && cfg->en_tdls_uapsd_sleep_sta)
+		cfg_tdls_set_sleep_sta_enable(hdd_ctx->hdd_psoc, true);
 	else
-		config->fEnableTDLSSleepSta = false;
+		cfg_tdls_set_sleep_sta_enable(hdd_ctx->hdd_psoc, false);
 #endif
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 	config->isRoamOffloadEnabled &= cfg->en_roam_offload;
diff --git a/core/hdd/src/wlan_hdd_tdls.c b/core/hdd/src/wlan_hdd_tdls.c
index 5db2834..b16894c 100644
--- a/core/hdd/src/wlan_hdd_tdls.c
+++ b/core/hdd/src/wlan_hdd_tdls.c
@@ -40,6 +40,7 @@
 #include "wma_types.h"
 #include "wlan_policy_mgr_api.h"
 #include <qca_vendor.h>
+#include "wlan_tdls_cfg_api.h"
 
 /**
  * enum qca_wlan_vendor_tdls_trigger_mode_hdd_map: Maps the user space TDLS
@@ -442,6 +443,7 @@
 {
 	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
 	struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
+	bool tdls_support;
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0))
 #if !(TDLS_MGMT_VERSION2)
 	u32 peer_capability;
@@ -467,7 +469,8 @@
 	if (wlan_hdd_validate_context(hdd_ctx))
 		return -EINVAL;
 
-	if (false == hdd_ctx->config->fEnableTDLSSupport) {
+	cfg_tdls_get_support_enable(hdd_ctx->hdd_psoc, &tdls_support);
+	if (!tdls_support) {
 		hdd_debug("TDLS Disabled in INI OR not enabled in FW. "
 			"Cannot process TDLS commands");
 		return -ENOTSUPP;
@@ -629,6 +632,7 @@
 	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
 	struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
 	int status;
+	bool tdls_support;
 
 	hdd_enter();
 
@@ -642,7 +646,8 @@
 		return -EINVAL;
 	}
 
-	if (false == hdd_ctx->config->fEnableTDLSSupport) {
+	cfg_tdls_get_support_enable(hdd_ctx->hdd_psoc, &tdls_support);
+	if (!tdls_support) {
 		hdd_debug("TDLS Disabled in INI OR not enabled in FW. "
 			"Cannot process TDLS commands");
 		return -ENOTSUPP;
@@ -812,7 +817,8 @@
 		return -EINVAL;
 	}
 
-	hdd_ctx->config->enable_tdls_scan = val;
+	cfg_tdls_set_scan_enable(hdd_ctx->hdd_psoc, (bool)val);
+
 	return 0;
 }