Fix for the VOS_ASSERT in add station time.

Change the TDLS capability to eTDLS_CAP_SUPPORTED at the time of
sending discovery response or set_up response to the peer device.
Clean up some debug prints for easing the debugging.

CRs-Fixed: 462352
Change-Id: I668a51ebd00663dbd17fdacc4bc10050718701f0
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 4891e9e..50bc480 100755
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -2725,7 +2725,18 @@
         return -EBUSY;
     }
 
-    if ((0 == update) && wlan_hdd_tdls_is_progress(pAdapter, mac, FALSE))
+    /* when self is on-going, we dont' want to change link_status */
+    if ((0 == update) && wlan_hdd_tdls_is_peer_progress(pAdapter, mac))
+    {
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                   "%s: " MAC_ADDRESS_STR
+                   " TDLS setup is ongoing. Request declined.",
+                   __func__, MAC_ADDR_ARRAY(mac));
+        return -EPERM;
+    }
+
+    /* when others are on-going, we want to change link_status to idle */
+    if (wlan_hdd_tdls_is_progress(pAdapter, mac, TRUE))
     {
         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                    "%s: " MAC_ADDRESS_STR
@@ -2781,13 +2792,13 @@
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                 "%s: timeout waiting for tdls add station indication",
                 __func__);
-        goto error;
+        return -EPERM;
     }
     if ( eHAL_STATUS_SUCCESS != pAdapter->tdlsAddStaStatus)
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                 "%s: Add Station is unsucessful", __func__);
-        goto error;
+        return -EPERM;
     }
 
     return 0;
@@ -6758,8 +6769,8 @@
         {
              VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                         "%s: " MAC_ADDRESS_STR
-                        " TDLS mode is disabled. Request declined.",
-                        __func__, MAC_ADDR_ARRAY(peer));
+                        " TDLS mode is disabled. action %d declined.",
+                        __func__, MAC_ADDR_ARRAY(peer), action_code);
 
         return -ENOTSUPP;
         }
@@ -6771,9 +6782,9 @@
         {
             VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                        "%s: " MAC_ADDRESS_STR
-                       " TDLS setup is ongoing. Request declined.",
-                       __func__, MAC_ADDR_ARRAY(peer));
-            goto error;
+                       " TDLS setup is ongoing. action %d declined.",
+                       __func__, MAC_ADDR_ARRAY(peer), action_code);
+            return -EPERM;
         }
     }
 
@@ -6790,8 +6801,8 @@
             {
                 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                            "%s: " MAC_ADDRESS_STR
-                           " TDLS Max peer already connected. Request declined.",
-                           __func__, MAC_ADDR_ARRAY(peer));
+                           " TDLS Max peer already connected. action %d declined.",
+                           __func__, MAC_ADDR_ARRAY(peer), action_code);
                 goto error;
             }
             else
@@ -6815,8 +6826,8 @@
             if (pTdlsPeer && (eTDLS_LINK_CONNECTED == pTdlsPeer->link_status))
             {
                 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                        "%s:" MAC_ADDRESS_STR " already connected. Request declined.",
-                        __func__, MAC_ADDR_ARRAY(peer));
+                        "%s:" MAC_ADDRESS_STR " already connected. action %d declined.",
+                        __func__, MAC_ADDR_ARRAY(peer), action_code);
                 return -EPERM;
             }
         }
@@ -6863,7 +6874,7 @@
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                 "%s: sme_SendTdlsMgmtFrame failed!", __func__);
-        goto error;
+        return -EPERM;
     }
 
     /* not block discovery request, as it is called from timer callback */
@@ -6879,7 +6890,7 @@
             VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                       "%s: Mgmt Tx Completion failed status %ld TxCompletion %lu",
                       __func__, rc, pAdapter->mgmtTxCompletionStatus);
-            goto error;
+            return -EPERM;
         }
     }