prima: Enable TDLS off-channel based on FW feature capability

Enable TDLS off-channel functionality only if FW advertizes
the feature capability support.

CRs-fixed: 799369
Change-Id: I73413c1c77502cda36beb9fc0e2b6ba2270cc9e2
diff --git a/CORE/HDD/inc/wlan_hdd_cfg.h b/CORE/HDD/inc/wlan_hdd_cfg.h
index 3867d36..bba4ed8 100644
--- a/CORE/HDD/inc/wlan_hdd_cfg.h
+++ b/CORE/HDD/inc/wlan_hdd_cfg.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -1872,7 +1872,7 @@
 #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)
+#define CFG_TDLS_OFF_CHANNEL_SUPPORT_ENABLE_DEFAULT  (1)
 
 #define CFG_TDLS_WMM_MODE_ENABLE                     "gEnableTDLSWmmMode"
 #define CFG_TDLS_WMM_MODE_ENABLE_MIN                 (0)
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 9e52e9a..09d000c 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -14688,7 +14688,9 @@
         return -EINVAL;
     }
 
-    if (NULL != tdls_peer_params)
+    /* check FW TDLS Off Channel capability */
+    if ((TRUE == sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL)) &&
+        (NULL != tdls_peer_params))
     {
         pTdlsPeer->peerParams.channel = tdls_peer_params->channel;
         pTdlsPeer->peerParams.global_operating_class =
@@ -14723,7 +14725,9 @@
     else
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                      "%s: Invalid TDLS Peer Params", __func__);
+                  "%s: TDLS off channel FW capability %d or "
+                  "Invalid TDLS Peer Params", __func__,
+                  sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL));
     }
 
     if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, TRUE) ) {