prima: Increment/decrement TDLS peer count

Increment TDLS peer count after receiving the eCSR_ROAM_RESULT_ADD_TDLS_PEER
response and decrement TDLS peer count after receiving the
eCSR_ROAM_RESULT_DELETE_TDLS_PEER response.

Change-Id: Ic6e09b49563ba05787e6b4407d277c1346bfb273
CRs-Fixed: 814339
diff --git a/CORE/HDD/src/wlan_hdd_assoc.c b/CORE/HDD/src/wlan_hdd_assoc.c
index e76c2c1..bd5317e 100644
--- a/CORE/HDD/src/wlan_hdd_assoc.c
+++ b/CORE/HDD/src/wlan_hdd_assoc.c
@@ -2840,6 +2840,7 @@
                                                       pRoamInfo->peerMac,
                                                       pRoamInfo->staId,
                                                       pRoamInfo->ucastSig);
+                    wlan_hdd_tdls_increment_peer_count(pAdapter);
                 }
                 else
                 {
@@ -2893,15 +2894,12 @@
                        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                                  " Current status for peer" MAC_ADDRESS_STR "is %d",
                                  MAC_ADDR_ARRAY(pRoamInfo->peerMac), curr_peer->link_status);
-                       if (TDLS_IS_CONNECTED(curr_peer))
-                       {
-                           hdd_roamDeregisterTDLSSTA ( pAdapter, pRoamInfo->staId );
-                           wlan_hdd_tdls_decrement_peer_count(pAdapter);
-                       }
-                       else if (eTDLS_LINK_CONNECTING == curr_peer->link_status)
+                       if (TDLS_IS_CONNECTED(curr_peer) ||
+                          (eTDLS_LINK_CONNECTING == curr_peer->link_status))
                        {
                            hdd_roamDeregisterTDLSSTA ( pAdapter, pRoamInfo->staId );
                        }
+                       wlan_hdd_tdls_decrement_peer_count(pAdapter);
                     }
                     wlan_hdd_tdls_reset_peer(pAdapter, pRoamInfo->peerMac);
 
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 8977e8d..32d6a09 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -15040,7 +15040,7 @@
                 /* TDLS Off Channel, Disable tdls channel switch,
                    when there are more than one tdls link */
                 numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter);
-                if (numCurrTdlsPeers == 1)
+                if (numCurrTdlsPeers == 2)
                 {
                     /* get connected peer and send disable tdls off chan */
                     connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter);
@@ -15138,7 +15138,6 @@
                                  hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to suspend data tx"));
                             }
                         }
-                        wlan_hdd_tdls_increment_peer_count(pAdapter);
 
                         /* TDLS Off Channel, Enable tdls channel switch,
                            when their is only one tdls link and it supports */