Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1 | /* |
Gopichand Nakkala | 0c1331e | 2013-01-07 22:49:07 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 21 | /* |
| 22 | * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
| 23 | * |
| 24 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 25 | * |
| 26 | * |
| 27 | * Permission to use, copy, modify, and/or distribute this software for |
| 28 | * any purpose with or without fee is hereby granted, provided that the |
| 29 | * above copyright notice and this permission notice appear in all |
| 30 | * copies. |
| 31 | * |
| 32 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 33 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 35 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 36 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 37 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 38 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 39 | * PERFORMANCE OF THIS SOFTWARE. |
| 40 | */ |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 41 | |
| 42 | /** ------------------------------------------------------------------------- * |
| 43 | ------------------------------------------------------------------------- * |
| 44 | |
| 45 | |
| 46 | \file csrTdlsProcess.c |
| 47 | |
| 48 | Implementation for the TDLS interface to PE. |
| 49 | |
Gopichand Nakkala | bd9fa2d | 2013-01-08 13:16:22 -0800 | [diff] [blame] | 50 | Copyright (C) 2010 Qualcomm, Incorporated |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 51 | |
| 52 | |
| 53 | ========================================================================== */ |
| 54 | |
| 55 | #ifdef FEATURE_WLAN_TDLS |
| 56 | |
| 57 | #include "aniGlobal.h" //for tpAniSirGlobal |
| 58 | #include "palApi.h" |
| 59 | #include "csrInsideApi.h" |
| 60 | #include "smeInside.h" |
| 61 | #include "smsDebug.h" |
| 62 | |
| 63 | #include "csrSupport.h" |
| 64 | #include "wlan_qct_tl.h" |
| 65 | |
| 66 | #include "vos_diag_core_log.h" |
| 67 | #include "vos_diag_core_event.h" |
| 68 | #include "csrInternal.h" |
| 69 | |
| 70 | |
| 71 | |
| 72 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 73 | /* |
| 74 | * initialize Discovery list |
| 75 | */ |
| 76 | eHalStatus csrTdlsInitPeerList(tpAniSirGlobal pMac ) |
| 77 | { |
| 78 | tCsrTdlsCtxStruct *tdlsDisInfo = &pMac->tdlsCtx ; |
| 79 | csrLLOpen(pMac->hHdd, &tdlsDisInfo->tdlsPotentialPeerList) ; |
| 80 | |
| 81 | return eHAL_STATUS_SUCCESS ; |
| 82 | } |
| 83 | #endif |
| 84 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 85 | /* |
| 86 | * common routine to remove TDLS cmd from SME command list.. |
| 87 | * commands are removed after getting reponse from PE. |
| 88 | */ |
| 89 | eHalStatus csrTdlsRemoveSmeCmd(tpAniSirGlobal pMac, eSmeCommandType cmdType) |
| 90 | { |
| 91 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 92 | tListElem *pEntry; |
| 93 | tSmeCmd *pCommand; |
| 94 | |
| 95 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 96 | if( pEntry ) |
| 97 | { |
| 98 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 99 | if( cmdType == pCommand->command ) |
| 100 | { |
| 101 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, |
| 102 | pEntry, LL_ACCESS_LOCK ) ) |
| 103 | { |
| 104 | vos_mem_zero( &pCommand->u.tdlsCmd, sizeof( tTdlsCmd ) ); |
| 105 | csrReleaseCommand( pMac, pCommand ); |
| 106 | smeProcessPendingQueue( pMac ); |
| 107 | status = eHAL_STATUS_SUCCESS ; |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | return status ; |
| 112 | } |
| 113 | |
| 114 | /* |
| 115 | * TDLS request API, called from HDD to send a TDLS frame |
| 116 | * in SME/CSR and send message to PE to trigger TDLS discovery procedure. |
| 117 | */ |
| 118 | eHalStatus csrTdlsSendMgmtReq(tHalHandle hHal, tANI_U8 sessionId, tCsrTdlsSendMgmt *tdlsSendMgmt) |
| 119 | { |
| 120 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 121 | tSmeCmd *tdlsSendMgmtCmd ; |
| 122 | eHalStatus status = eHAL_STATUS_FAILURE ; |
| 123 | |
| 124 | //If connected and in Infra. Only then allow this |
| 125 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) && |
| 126 | csrIsConnStateConnectedInfra( pMac, sessionId ) && |
| 127 | (NULL != tdlsSendMgmt) ) |
| 128 | { |
| 129 | tdlsSendMgmtCmd = csrGetCommandBuffer(pMac) ; |
| 130 | |
| 131 | if(tdlsSendMgmtCmd) |
| 132 | { |
| 133 | tTdlsSendMgmtCmdInfo *tdlsSendMgmtCmdInfo = |
| 134 | &tdlsSendMgmtCmd->u.tdlsCmd.u.tdlsSendMgmtCmdInfo ; |
| 135 | |
| 136 | tdlsSendMgmtCmd->sessionId = sessionId; |
| 137 | |
| 138 | tdlsSendMgmtCmdInfo->frameType = tdlsSendMgmt->frameType ; |
| 139 | tdlsSendMgmtCmdInfo->dialog = tdlsSendMgmt->dialog ; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 140 | tdlsSendMgmtCmdInfo->statusCode = tdlsSendMgmt->statusCode ; |
| 141 | tdlsSendMgmtCmdInfo->responder = tdlsSendMgmt->responder; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 142 | palCopyMemory(pMac->hHdd, tdlsSendMgmtCmdInfo->peerMac, |
| 143 | tdlsSendMgmt->peerMac, sizeof(tSirMacAddr)) ; |
| 144 | |
| 145 | if( (0 != tdlsSendMgmt->len) && (NULL != tdlsSendMgmt->buf) ) |
| 146 | { |
| 147 | status = palAllocateMemory( pMac->hHdd, (void **)&tdlsSendMgmtCmdInfo->buf, |
| 148 | tdlsSendMgmt->len ); |
| 149 | if(!HAL_STATUS_SUCCESS( status ) ) |
| 150 | { |
| 151 | smsLog( pMac, LOGE, FL("Alloc Failed\n") ); |
| 152 | VOS_ASSERT(0) ; |
| 153 | return status ; |
| 154 | } |
| 155 | palCopyMemory(pMac->hHdd, tdlsSendMgmtCmdInfo->buf, |
| 156 | tdlsSendMgmt->buf, tdlsSendMgmt->len ); |
| 157 | tdlsSendMgmtCmdInfo->len = tdlsSendMgmt->len; |
| 158 | } |
| 159 | else |
| 160 | { |
| 161 | tdlsSendMgmtCmdInfo->buf = NULL; |
| 162 | tdlsSendMgmtCmdInfo->len = 0; |
| 163 | } |
| 164 | |
| 165 | tdlsSendMgmtCmd->command = eSmeCommandTdlsSendMgmt ; |
| 166 | tdlsSendMgmtCmd->u.tdlsCmd.size = sizeof(tTdlsSendMgmtCmdInfo) ; |
| 167 | smePushCommand(pMac, tdlsSendMgmtCmd, FALSE) ; |
| 168 | status = eHAL_STATUS_SUCCESS ; |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | return status ; |
| 173 | } |
| 174 | |
| 175 | /* |
| 176 | * TDLS request API, called from HDD to add a TDLS peer |
| 177 | */ |
| 178 | eHalStatus csrTdlsAddPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac) |
| 179 | { |
| 180 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 181 | tSmeCmd *tdlsAddStaCmd ; |
| 182 | eHalStatus status = eHAL_STATUS_FAILURE ; |
| 183 | |
| 184 | //If connected and in Infra. Only then allow this |
| 185 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) && |
| 186 | csrIsConnStateConnectedInfra( pMac, sessionId ) && |
| 187 | (NULL != peerMac) ) |
| 188 | { |
| 189 | tdlsAddStaCmd = csrGetCommandBuffer(pMac) ; |
| 190 | |
| 191 | if(tdlsAddStaCmd) |
| 192 | { |
| 193 | tTdlsAddStaCmdInfo *tdlsAddStaCmdInfo = |
| 194 | &tdlsAddStaCmd->u.tdlsCmd.u.tdlsAddStaCmdInfo ; |
| 195 | |
| 196 | tdlsAddStaCmd->sessionId = sessionId; |
| 197 | |
| 198 | palCopyMemory(pMac->hHdd, tdlsAddStaCmdInfo->peerMac, |
| 199 | peerMac, sizeof(tSirMacAddr)) ; |
| 200 | |
| 201 | tdlsAddStaCmd->command = eSmeCommandTdlsAddPeer ; |
| 202 | tdlsAddStaCmd->u.tdlsCmd.size = sizeof(tTdlsAddStaCmdInfo) ; |
| 203 | smePushCommand(pMac, tdlsAddStaCmd, FALSE) ; |
| 204 | status = eHAL_STATUS_SUCCESS ; |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | return status ; |
| 209 | } |
| 210 | |
| 211 | /* |
| 212 | * TDLS request API, called from HDD to delete a TDLS peer |
| 213 | */ |
| 214 | eHalStatus csrTdlsDelPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac) |
| 215 | { |
| 216 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 217 | tSmeCmd *tdlsDelStaCmd ; |
| 218 | eHalStatus status = eHAL_STATUS_FAILURE ; |
| 219 | |
| 220 | //If connected and in Infra. Only then allow this |
| 221 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) && |
| 222 | csrIsConnStateConnectedInfra( pMac, sessionId ) && |
| 223 | (NULL != peerMac) ) |
| 224 | { |
| 225 | tdlsDelStaCmd = csrGetCommandBuffer(pMac) ; |
| 226 | |
| 227 | if(tdlsDelStaCmd) |
| 228 | { |
| 229 | tTdlsDelStaCmdInfo *tdlsDelStaCmdInfo = |
| 230 | &tdlsDelStaCmd->u.tdlsCmd.u.tdlsDelStaCmdInfo ; |
| 231 | |
| 232 | tdlsDelStaCmd->sessionId = sessionId; |
| 233 | |
| 234 | palCopyMemory(pMac->hHdd, tdlsDelStaCmdInfo->peerMac, |
| 235 | peerMac, sizeof(tSirMacAddr)) ; |
| 236 | |
| 237 | tdlsDelStaCmd->command = eSmeCommandTdlsDelPeer ; |
| 238 | tdlsDelStaCmd->u.tdlsCmd.size = sizeof(tTdlsDelStaCmdInfo) ; |
| 239 | smePushCommand(pMac, tdlsDelStaCmd, FALSE) ; |
| 240 | status = eHAL_STATUS_SUCCESS ; |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | return status ; |
| 245 | } |
| 246 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 247 | /* |
| 248 | * TDLS request API, called from HDD to enable TDLS discovery request |
| 249 | * in SME/CSR and send message to PE to trigger TDLS discovery procedure. |
| 250 | */ |
| 251 | eHalStatus csrTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tCsrTdlsDisRequest *tdlsDisReq) |
| 252 | { |
| 253 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 254 | tSmeCmd *tdlsDisReqCmd ; |
| 255 | eHalStatus status = eHAL_STATUS_FAILURE ; |
| 256 | |
| 257 | if(tdlsDisReq) |
| 258 | { |
| 259 | tdlsDisReqCmd = csrGetCommandBuffer(pMac) ; |
| 260 | |
| 261 | if(tdlsDisReqCmd) |
| 262 | { |
| 263 | tTdlsDisReqCmdinfo *disReqCmdInfo = |
| 264 | &tdlsDisReqCmd->u.tdlsCmd.u.tdlsDisReqCmdInfo ; |
| 265 | |
| 266 | tdlsDisReqCmd->sessionId = sessionId; |
| 267 | |
| 268 | disReqCmdInfo->tdlsDisType = tdlsDisReq->disType ; |
| 269 | palCopyMemory(pMac->hHdd, disReqCmdInfo->peerMac, |
| 270 | tdlsDisReq->peerMac, sizeof(tSirMacAddr)) ; |
| 271 | tdlsDisReqCmd->command = eSmeCommandTdlsDiscovery ; |
| 272 | tdlsDisReqCmd->u.tdlsCmd.size = sizeof(tTdlsDisReqCmdinfo) ; |
| 273 | smePushCommand(pMac, tdlsDisReqCmd, FALSE) ; |
| 274 | status = eHAL_STATUS_SUCCESS ; |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | return status ; |
| 279 | } |
| 280 | |
| 281 | /* |
| 282 | * TDLS request API, called from HDD to enable TDLS link setup request |
| 283 | * in SME/CSR and send message to PE to trigger TDLS link setup procedure. |
| 284 | */ |
| 285 | eHalStatus csrTdlsSetupReq(tHalHandle hHal, tANI_U8 sessionId, tCsrTdlsSetupRequest *tdlsSetupReq) |
| 286 | { |
| 287 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 288 | tSmeCmd *tdlsSetupReqCmd ; |
| 289 | eHalStatus status = eHAL_STATUS_FAILURE ; |
| 290 | |
| 291 | if(tdlsSetupReq) |
| 292 | { |
| 293 | tdlsSetupReqCmd = csrGetCommandBuffer(pMac) ; |
| 294 | |
| 295 | if(tdlsSetupReqCmd) |
| 296 | { |
| 297 | tTdlsLinkSetupReqCmdinfo *setupCmdInfo = |
| 298 | &tdlsSetupReqCmd->u.tdlsCmd.u.tdlsLinkSetupReqCmdInfo ; |
| 299 | |
| 300 | tdlsSetupReqCmd->sessionId = sessionId; |
| 301 | |
| 302 | palCopyMemory(pMac->hHdd, setupCmdInfo->peerMac, |
| 303 | tdlsSetupReq->peerMac, sizeof(tSirMacAddr)) ; |
| 304 | tdlsSetupReqCmd->command = eSmeCommandTdlsLinkSetup ; |
| 305 | tdlsSetupReqCmd->u.tdlsCmd.size = sizeof(tTdlsLinkSetupReqCmdinfo) ; |
| 306 | smePushCommand(pMac, tdlsSetupReqCmd, FALSE) ; |
| 307 | status = eHAL_STATUS_SUCCESS ; |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | return status ; |
| 312 | } |
| 313 | /* |
| 314 | * TDLS request API, called from HDD to enable TDLS link teardown request |
| 315 | * in SME/CSR and send message to PE to trigger TDLS link teardown procedure. |
| 316 | */ |
| 317 | eHalStatus csrTdlsTeardownReq(tHalHandle hHal, tANI_U8 sessionId, |
| 318 | tCsrTdlsTeardownRequest *tdlsTeardownReq) |
| 319 | { |
| 320 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 321 | tSmeCmd *tdlsTeardownReqCmd ; |
| 322 | eHalStatus status = eHAL_STATUS_FAILURE ; |
| 323 | |
| 324 | if(tdlsTeardownReq) |
| 325 | { |
| 326 | tdlsTeardownReqCmd = csrGetCommandBuffer(pMac) ; |
| 327 | |
| 328 | if(tdlsTeardownReqCmd) |
| 329 | { |
| 330 | tTdlsLinkTeardownCmdinfo *teardownCmdInfo = |
| 331 | &tdlsTeardownReqCmd->u.tdlsCmd.u.tdlsLinkTeardownCmdInfo ; |
| 332 | |
| 333 | tdlsTeardownReqCmd->sessionId = sessionId; |
| 334 | |
| 335 | palCopyMemory(pMac->hHdd, teardownCmdInfo->peerMac, |
| 336 | tdlsTeardownReq->peerMac, sizeof(tSirMacAddr)) ; |
| 337 | tdlsTeardownReqCmd->command = eSmeCommandTdlsLinkTear ; |
| 338 | tdlsTeardownReqCmd->u.tdlsCmd.size = |
| 339 | sizeof(tTdlsLinkTeardownCmdinfo) ; |
| 340 | smePushCommand(pMac, tdlsTeardownReqCmd, FALSE) ; |
| 341 | status = eHAL_STATUS_SUCCESS ; |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | return status ; |
| 346 | } |
| 347 | |
| 348 | #endif |
| 349 | |
| 350 | /* |
| 351 | * TDLS messages sent to PE . |
| 352 | */ |
| 353 | eHalStatus tdlsSendMessage(tpAniSirGlobal pMac, tANI_U16 msg_type, |
| 354 | void *msg_data, tANI_U32 msg_size) |
| 355 | { |
| 356 | |
| 357 | tSirMbMsg *pMsg = (tSirMbMsg *)msg_data ; |
| 358 | pMsg->type = msg_type ; |
| 359 | pMsg->msgLen = (tANI_U16) (msg_size) ; |
| 360 | |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 361 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 362 | ("sending msg = %d\n"), pMsg->type) ; |
| 363 | /* Send message. */ |
| 364 | if (palSendMBMessage(pMac->hHdd, pMsg) != eHAL_STATUS_SUCCESS) |
| 365 | { |
| 366 | smsLog(pMac, LOGE, FL("Cannot send message\n")); |
| 367 | return eHAL_STATUS_FAILURE; |
| 368 | } |
| 369 | |
| 370 | return eHAL_STATUS_SUCCESS; |
| 371 | } |
| 372 | |
| 373 | eHalStatus csrTdlsProcessSendMgmt( tpAniSirGlobal pMac, tSmeCmd *cmd ) |
| 374 | { |
| 375 | tTdlsSendMgmtCmdInfo *tdlsSendMgmtCmdInfo = &cmd->u.tdlsCmd.u.tdlsSendMgmtCmdInfo ; |
| 376 | tSirTdlsSendMgmtReq *tdlsSendMgmtReq = NULL ; |
| 377 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); |
| 378 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 379 | |
| 380 | status = palAllocateMemory( pMac->hHdd, (void **)&tdlsSendMgmtReq, |
| 381 | (sizeof(tSirTdlsSendMgmtReq) + tdlsSendMgmtCmdInfo->len ) ); |
| 382 | |
| 383 | if(!HAL_STATUS_SUCCESS( status ) ) |
| 384 | { |
| 385 | smsLog( pMac, LOGE, FL("alloc failed \n") ); |
| 386 | VOS_ASSERT(0) ; |
| 387 | return status ; |
| 388 | } |
| 389 | tdlsSendMgmtReq->sessionId = cmd->sessionId; |
| 390 | //Using dialog as transactionId. This can be used to match response with request |
| 391 | tdlsSendMgmtReq->transactionId = tdlsSendMgmtCmdInfo->dialog; |
| 392 | tdlsSendMgmtReq->reqType = tdlsSendMgmtCmdInfo->frameType ; |
| 393 | tdlsSendMgmtReq->dialog = tdlsSendMgmtCmdInfo->dialog ; |
| 394 | tdlsSendMgmtReq->statusCode = tdlsSendMgmtCmdInfo->statusCode ; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 395 | tdlsSendMgmtReq->responder = tdlsSendMgmtCmdInfo->responder; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 396 | palCopyMemory(pMac->hHdd, tdlsSendMgmtReq->bssid, pSession->pConnectBssDesc->bssId, |
| 397 | sizeof (tSirMacAddr)); |
| 398 | palCopyMemory(pMac->hHdd, tdlsSendMgmtReq->peerMac, |
| 399 | tdlsSendMgmtCmdInfo->peerMac, sizeof(tSirMacAddr)) ; |
| 400 | |
| 401 | if(tdlsSendMgmtCmdInfo->len && tdlsSendMgmtCmdInfo->buf) |
| 402 | { |
| 403 | palCopyMemory(pMac->hHdd, tdlsSendMgmtReq->addIe, tdlsSendMgmtCmdInfo->buf, |
| 404 | tdlsSendMgmtCmdInfo->len); |
| 405 | |
| 406 | } |
| 407 | // Send the request to PE. |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 408 | smsLog( pMac, LOG1, "sending TDLS Mgmt Frame req to PE \n" ); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 409 | status = tdlsSendMessage(pMac, eWNI_SME_TDLS_SEND_MGMT_REQ, |
| 410 | (void *)tdlsSendMgmtReq , sizeof(tSirTdlsSendMgmtReq)+tdlsSendMgmtCmdInfo->len) ; |
| 411 | if(!HAL_STATUS_SUCCESS( status ) ) |
| 412 | { |
| 413 | smsLog( pMac, LOGE, FL("Failed to send request to MAC\n")); |
| 414 | } |
| 415 | if(tdlsSendMgmtCmdInfo->len && tdlsSendMgmtCmdInfo->buf) |
| 416 | { |
| 417 | //Done with the buf. Free it. |
| 418 | palFreeMemory( pMac->hHdd, tdlsSendMgmtCmdInfo->buf ); |
| 419 | tdlsSendMgmtCmdInfo->len = 0; |
| 420 | } |
| 421 | |
| 422 | return status; |
| 423 | } |
| 424 | |
| 425 | eHalStatus csrTdlsProcessAddSta( tpAniSirGlobal pMac, tSmeCmd *cmd ) |
| 426 | { |
| 427 | tTdlsAddStaCmdInfo *tdlsAddStaCmdInfo = &cmd->u.tdlsCmd.u.tdlsAddStaCmdInfo ; |
| 428 | tSirTdlsAddStaReq *tdlsAddStaReq = NULL ; |
| 429 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); |
| 430 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 431 | |
| 432 | status = palAllocateMemory( pMac->hHdd, (void **)&tdlsAddStaReq, |
| 433 | (sizeof(tSirTdlsAddStaReq) ) ); |
| 434 | |
| 435 | if(!HAL_STATUS_SUCCESS( status ) ) |
| 436 | { |
| 437 | smsLog( pMac, LOGE, FL("alloc failed \n") ); |
| 438 | VOS_ASSERT(0) ; |
| 439 | return status ; |
| 440 | } |
| 441 | tdlsAddStaReq->sessionId = cmd->sessionId; |
| 442 | //Using dialog as transactionId. This can be used to match response with request |
| 443 | tdlsAddStaReq->transactionId = 0; |
| 444 | palCopyMemory(pMac->hHdd, tdlsAddStaReq->bssid, pSession->pConnectBssDesc->bssId, |
| 445 | sizeof (tSirMacAddr)); |
| 446 | palCopyMemory(pMac->hHdd, tdlsAddStaReq->peerMac, |
| 447 | tdlsAddStaCmdInfo->peerMac, sizeof(tSirMacAddr)) ; |
| 448 | |
| 449 | // Send the request to PE. |
| 450 | smsLog( pMac, LOGE, "sending TDLS Add Sta req to PE \n" ); |
| 451 | status = tdlsSendMessage(pMac, eWNI_SME_TDLS_ADD_STA_REQ, |
| 452 | (void *)tdlsAddStaReq , sizeof(tSirTdlsAddStaReq)) ; |
| 453 | if(!HAL_STATUS_SUCCESS( status ) ) |
| 454 | { |
| 455 | smsLog( pMac, LOGE, FL("Failed to send request to MAC\n")); |
| 456 | } |
| 457 | return status; |
| 458 | } |
| 459 | |
| 460 | eHalStatus csrTdlsProcessDelSta( tpAniSirGlobal pMac, tSmeCmd *cmd ) |
| 461 | { |
| 462 | tTdlsDelStaCmdInfo *tdlsDelStaCmdInfo = &cmd->u.tdlsCmd.u.tdlsDelStaCmdInfo ; |
| 463 | tSirTdlsDelStaReq *tdlsDelStaReq = NULL ; |
| 464 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); |
| 465 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 466 | |
| 467 | status = palAllocateMemory( pMac->hHdd, (void **)&tdlsDelStaReq, |
| 468 | (sizeof(tSirTdlsDelStaReq) ) ); |
| 469 | |
| 470 | if(!HAL_STATUS_SUCCESS( status ) ) |
| 471 | { |
| 472 | smsLog( pMac, LOGE, FL("alloc failed \n") ); |
| 473 | VOS_ASSERT(0) ; |
| 474 | return status ; |
| 475 | } |
| 476 | tdlsDelStaReq->sessionId = cmd->sessionId; |
| 477 | //Using dialog as transactionId. This can be used to match response with request |
| 478 | tdlsDelStaReq->transactionId = 0; |
| 479 | palCopyMemory(pMac->hHdd, tdlsDelStaReq->bssid, pSession->pConnectBssDesc->bssId, |
| 480 | sizeof (tSirMacAddr)); |
| 481 | palCopyMemory(pMac->hHdd, tdlsDelStaReq->peerMac, |
| 482 | tdlsDelStaCmdInfo->peerMac, sizeof(tSirMacAddr)) ; |
| 483 | |
| 484 | // Send the request to PE. |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 485 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 486 | smsLog( pMac, LOGE, |
| 487 | #else |
| 488 | smsLog( pMac, LOG1, |
| 489 | #endif |
| 490 | "sending TDLS Del Sta %02x:%02x:%02x:%02x:%02x:%02x req to PE\n", |
| 491 | tdlsDelStaCmdInfo->peerMac[0], tdlsDelStaCmdInfo->peerMac[1], tdlsDelStaCmdInfo->peerMac[2], |
| 492 | tdlsDelStaCmdInfo->peerMac[3], tdlsDelStaCmdInfo->peerMac[4], tdlsDelStaCmdInfo->peerMac[5]); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 493 | status = tdlsSendMessage(pMac, eWNI_SME_TDLS_DEL_STA_REQ, |
| 494 | (void *)tdlsDelStaReq , sizeof(tSirTdlsDelStaReq)) ; |
| 495 | if(!HAL_STATUS_SUCCESS( status ) ) |
| 496 | { |
| 497 | smsLog( pMac, LOGE, FL("Failed to send request to MAC\n")); |
| 498 | } |
| 499 | return status; |
| 500 | } |
| 501 | /* |
| 502 | * commands received from CSR |
| 503 | */ |
| 504 | eHalStatus csrTdlsProcessCmd(tpAniSirGlobal pMac, tSmeCmd *cmd) |
| 505 | { |
| 506 | eSmeCommandType cmdType = cmd->command ; |
| 507 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 508 | tTdlsCmd tdlsCmd = cmd->u.tdlsCmd ; |
| 509 | #endif |
| 510 | tANI_BOOLEAN status = eANI_BOOLEAN_TRUE; |
| 511 | switch(cmdType) |
| 512 | { |
| 513 | case eSmeCommandTdlsSendMgmt: |
| 514 | { |
| 515 | status = csrTdlsProcessSendMgmt( pMac, cmd ); |
| 516 | if(HAL_STATUS_SUCCESS( status ) ) |
| 517 | { |
| 518 | status = eANI_BOOLEAN_FALSE ; |
| 519 | } |
| 520 | } |
| 521 | break ; |
| 522 | case eSmeCommandTdlsAddPeer: |
| 523 | { |
| 524 | status = csrTdlsProcessAddSta( pMac, cmd ); |
| 525 | if(HAL_STATUS_SUCCESS( status ) ) |
| 526 | { |
| 527 | status = eANI_BOOLEAN_FALSE ; |
| 528 | } |
| 529 | } |
| 530 | break; |
| 531 | case eSmeCommandTdlsDelPeer: |
| 532 | { |
| 533 | status = csrTdlsProcessDelSta( pMac, cmd ); |
| 534 | if(HAL_STATUS_SUCCESS( status ) ) |
| 535 | { |
| 536 | status = eANI_BOOLEAN_FALSE ; |
| 537 | } |
| 538 | } |
| 539 | break; |
| 540 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 541 | case eSmeCommandTdlsDiscovery: |
| 542 | { |
| 543 | tTdlsDisReqCmdinfo *disReqCmdInfo = &tdlsCmd.u.tdlsDisReqCmdInfo ; |
| 544 | tSirTdlsDisReq *disReq = NULL ; |
| 545 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); |
| 546 | |
| 547 | status = palAllocateMemory( pMac->hHdd, (void **)&disReq, |
| 548 | sizeof(tSirTdlsDisReq)); |
| 549 | |
| 550 | if(!HAL_STATUS_SUCCESS( status ) ) |
| 551 | { |
| 552 | smsLog( pMac, LOGE, "dis Req alloc failed \n" ); |
| 553 | VOS_ASSERT(0) ; |
| 554 | break ; |
| 555 | } |
| 556 | disReq->sessionId = cmd->sessionId; |
| 557 | disReq->transactionId = 0; /* TODO ? */ |
| 558 | disReq->reqType = disReqCmdInfo->tdlsDisType ; |
| 559 | palCopyMemory(pMac->hHdd, disReq->bssid, pSession->pConnectBssDesc->bssId, |
| 560 | sizeof (tSirMacAddr)); |
| 561 | palCopyMemory(pMac->hHdd, disReq->peerMac, |
| 562 | disReqCmdInfo->peerMac, sizeof(tSirMacAddr)) ; |
| 563 | smsLog( pMac, LOGE, "sending TDLS discovery to PE \n" ); |
| 564 | status = tdlsSendMessage(pMac, eWNI_SME_TDLS_DISCOVERY_START_REQ, |
| 565 | (void *)disReq , sizeof(tSirTdlsDisReq)) ; |
| 566 | if(HAL_STATUS_SUCCESS( status ) ) |
| 567 | { |
| 568 | status = eANI_BOOLEAN_FALSE ; |
| 569 | } |
| 570 | /* TODO: Add error handling */ |
| 571 | |
| 572 | break ; |
| 573 | } |
| 574 | case eSmeCommandTdlsLinkSetup: |
| 575 | { |
| 576 | tTdlsLinkSetupReqCmdinfo *linkSetupReqCmdInfo = |
| 577 | &tdlsCmd.u.tdlsLinkSetupReqCmdInfo ; |
| 578 | tSirTdlsSetupReq *setupReq = NULL ; |
| 579 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); |
| 580 | |
| 581 | status = palAllocateMemory( pMac->hHdd, (void **)&setupReq, |
| 582 | sizeof(tSirTdlsSetupReq)); |
| 583 | |
| 584 | if(!HAL_STATUS_SUCCESS( status ) ) |
| 585 | { |
| 586 | smsLog( pMac, LOGE, "dis Req alloc failed \n" ); |
| 587 | VOS_ASSERT(0) ; |
| 588 | break ; |
| 589 | } |
| 590 | setupReq->sessionId = cmd->sessionId; |
| 591 | setupReq->transactionId = 0; /* TODO ? */ |
| 592 | |
| 593 | palCopyMemory(pMac->hHdd, setupReq->bssid, pSession->pConnectBssDesc->bssId, |
| 594 | sizeof (tSirMacAddr)); |
| 595 | palCopyMemory(pMac->hHdd, setupReq->peerMac, |
| 596 | linkSetupReqCmdInfo->peerMac, sizeof(tSirMacAddr)) ; |
| 597 | |
| 598 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 599 | ("sending TDLS link setup to PE \n")); |
| 600 | status = tdlsSendMessage(pMac, eWNI_SME_TDLS_LINK_START_REQ, |
| 601 | (void *)setupReq , sizeof(tSirTdlsSetupReq) ) ; |
| 602 | |
| 603 | if(HAL_STATUS_SUCCESS( status ) ) |
| 604 | { |
| 605 | status = eANI_BOOLEAN_FALSE ; |
| 606 | } |
| 607 | /* TODO: Add error handling */ |
| 608 | break ; |
| 609 | } |
| 610 | case eSmeCommandTdlsLinkTear: |
| 611 | { |
| 612 | tTdlsLinkTeardownCmdinfo *linkTeardownCmdInfo = |
| 613 | &tdlsCmd.u.tdlsLinkTeardownCmdInfo ; |
| 614 | tSirTdlsTeardownReq *teardownReq = NULL ; |
| 615 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); |
| 616 | |
| 617 | status = palAllocateMemory( pMac->hHdd, (void **)&teardownReq, |
| 618 | sizeof(tSirTdlsTeardownReq)); |
| 619 | if(!HAL_STATUS_SUCCESS( status ) ) |
| 620 | { |
| 621 | smsLog( pMac, LOGE, "teardown Req alloc failed \n" ); |
| 622 | VOS_ASSERT(0) ; |
| 623 | break ; |
| 624 | } |
| 625 | teardownReq->sessionId = cmd->sessionId; |
| 626 | teardownReq->transactionId = 0; /* TODO ? */ |
| 627 | |
| 628 | palCopyMemory(pMac->hHdd, teardownReq->bssid, pSession->pConnectBssDesc->bssId, |
| 629 | sizeof (tSirMacAddr)); |
| 630 | palCopyMemory(pMac->hHdd, &teardownReq->peerMac, |
| 631 | linkTeardownCmdInfo->peerMac, sizeof(tSirMacAddr)) ; |
| 632 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 633 | ("teardown request..\n")) ; |
| 634 | status = tdlsSendMessage(pMac, eWNI_SME_TDLS_TEARDOWN_REQ, |
| 635 | (void *)teardownReq , sizeof(tSirTdlsTeardownReq)) ; |
| 636 | |
| 637 | if(HAL_STATUS_SUCCESS( status ) ) |
| 638 | { |
| 639 | status = eANI_BOOLEAN_FALSE ; |
| 640 | } |
| 641 | /* TODO: Add error handling */ |
| 642 | break ; |
| 643 | } |
| 644 | #endif |
| 645 | default: |
| 646 | { |
| 647 | /* TODO: Add defualt handling */ |
| 648 | break ; |
| 649 | } |
| 650 | |
| 651 | } |
| 652 | return status ; |
| 653 | } |
| 654 | |
| 655 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 656 | /* |
| 657 | * Find specific TDLS peer (based on peer MAC address). |
| 658 | */ |
| 659 | tCsrTdlsPeerLinkinfo *findTdlsPeer(tpAniSirGlobal pMac, |
| 660 | tDblLinkList *peerList, tSirMacAddr peerMac) |
| 661 | { |
| 662 | tListElem *pEntry = NULL ; |
| 663 | tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ; |
| 664 | tSirTdlsPeerInfo *peerInfo = NULL ; |
| 665 | |
| 666 | pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK ); |
| 667 | while(pEntry) |
| 668 | { |
| 669 | peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo, |
| 670 | tdlsPeerStaLink) ; |
| 671 | peerInfo = &peerLinkInfo->tdlsDisPeerInfo ; |
| 672 | |
| 673 | if(palEqualMemory( pMac->hHdd,(tANI_U8 *)peerInfo->peerMac, |
| 674 | (tANI_U8 *) peerMac, sizeof(tSirMacAddr)) ) |
| 675 | { |
| 676 | break ; |
| 677 | } |
| 678 | |
| 679 | pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ; |
| 680 | } |
| 681 | |
| 682 | return ((pEntry) ? peerLinkInfo: NULL) ; |
| 683 | } |
| 684 | /* |
| 685 | * Delete TDLD peer info, called from TDLS teardown request. |
| 686 | */ |
| 687 | static eHalStatus tdlsDeleteTdlsPeerInfo(tpAniSirGlobal pMac, |
| 688 | tSirMacAddr peerMac) |
| 689 | { |
| 690 | tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ; |
| 691 | tCsrTdlsPeerLinkinfo *peerInfo = |
| 692 | findTdlsPeer(pMac, &disInfo->tdlsPotentialPeerList, peerMac) ; |
| 693 | eHalStatus status = eHAL_STATUS_FAILURE ; |
| 694 | |
| 695 | if((csrLLRemoveEntry(&disInfo->tdlsPotentialPeerList, |
| 696 | &peerInfo->tdlsPeerStaLink, LL_ACCESS_NOLOCK))) |
| 697 | { |
| 698 | status = palFreeMemory(pMac->hHdd, (void *)peerInfo) ; |
| 699 | |
| 700 | } |
| 701 | |
| 702 | return status ; |
| 703 | } |
| 704 | |
| 705 | /* |
| 706 | * UPDATE TDLS peer state to TDLS LINK STATE, this will be called after |
| 707 | * link is successfully setup with TDLS Peer. |
| 708 | */ |
| 709 | static eHalStatus tdlsUpdateTdlsPeerState(tpAniSirGlobal pMac, |
| 710 | tSirMacAddr peerMac,tANI_U8 state ) |
| 711 | { |
| 712 | tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ; |
| 713 | tCsrTdlsPeerLinkinfo *peerLinkInfo = |
| 714 | findTdlsPeer(pMac, &disInfo->tdlsPotentialPeerList, peerMac) ; |
| 715 | eHalStatus status = eHAL_STATUS_FAILURE ; |
| 716 | |
| 717 | if(peerLinkInfo) |
| 718 | { |
| 719 | tSirTdlsPeerInfo *peerInfo = &peerLinkInfo->tdlsDisPeerInfo ; |
| 720 | peerInfo->tdlsPeerState = state ; |
| 721 | status = eHAL_STATUS_SUCCESS ; |
| 722 | } |
| 723 | else |
| 724 | { |
| 725 | /* TODO: update this peer found in link setup in peer list */ |
| 726 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 727 | ("This TDLS client is not in discovery list \n") ); |
| 728 | status = eHAL_STATUS_SUCCESS ; |
| 729 | } |
| 730 | |
| 731 | return status ; |
| 732 | } |
| 733 | |
| 734 | /* |
| 735 | * save TDLS peer info, this will be called after successfull completion |
| 736 | * of TDLS discovery procedure. |
| 737 | */ |
| 738 | static eHalStatus tdlsSaveTdlsPeerInfo(tpAniSirGlobal pMac, |
| 739 | tSirTdlsPeerInfo *disPeerInfo) |
| 740 | { |
| 741 | tCsrTdlsPeerLinkinfo *peerInfo = NULL ; |
| 742 | tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ; |
| 743 | eHalStatus status = eHAL_STATUS_FAILURE ; |
| 744 | /* |
| 745 | * Ok, allocate memory for peer info here |
| 746 | * we allocate memory for each peer here and free his memory |
| 747 | * at the time the peer node is getting deleted, possible case is |
| 748 | * teardown |
| 749 | */ |
| 750 | status = palAllocateMemory( pMac->hHdd, (void **)&peerInfo, |
| 751 | sizeof(tCsrTdlsPeerLinkinfo)); |
| 752 | |
| 753 | /* |
| 754 | * go ahead and copy peerInfo and insert this node info discovery rsp |
| 755 | * database. |
| 756 | */ |
| 757 | if (HAL_STATUS_SUCCESS(status)) |
| 758 | { |
| 759 | palZeroMemory(pMac->hHdd, &peerInfo->tdlsDisPeerInfo, |
| 760 | sizeof(tSirTdlsPeerInfo)); |
| 761 | palCopyMemory(pMac->hHdd, &peerInfo->tdlsDisPeerInfo, disPeerInfo, |
| 762 | sizeof(tSirTdlsPeerInfo)); |
| 763 | |
| 764 | /* |
| 765 | * update TDLS client count to indicate there is tdls client |
| 766 | * in tdls potential peer list. |
| 767 | */ |
| 768 | disInfo->tdlsPeerCount++ ; |
| 769 | |
| 770 | /* |
| 771 | * finally insert this tdls peer info into tdls potential peer list |
| 772 | */ |
| 773 | csrLLInsertTail( &disInfo->tdlsPotentialPeerList, |
| 774 | &peerInfo->tdlsPeerStaLink, LL_ACCESS_LOCK ); |
| 775 | } |
| 776 | |
| 777 | return status ; |
| 778 | |
| 779 | } |
| 780 | |
| 781 | #endif |
| 782 | /* |
| 783 | * TDLS Message processor, will be called after TDLS message recieved from |
| 784 | * PE |
| 785 | */ |
| 786 | eHalStatus tdlsMsgProcessor(tpAniSirGlobal pMac, v_U16_t msgType, |
| 787 | void *pMsgBuf) |
| 788 | { |
| 789 | switch(msgType) |
| 790 | { |
| 791 | case eWNI_SME_TDLS_SEND_MGMT_RSP: |
| 792 | { |
| 793 | /* remove pending eSmeCommandTdlsDiscovery command */ |
| 794 | csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsSendMgmt) ; |
| 795 | } |
| 796 | break; |
| 797 | case eWNI_SME_TDLS_ADD_STA_RSP: |
| 798 | { |
| 799 | tSirTdlsAddStaRsp *addStaRsp = (tSirTdlsAddStaRsp *) pMsgBuf ; |
| 800 | tCsrRoamInfo roamInfo = {0} ; |
| 801 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, addStaRsp->peerMac, |
| 802 | sizeof(tSirMacAddr)) ; |
| 803 | roamInfo.staId = addStaRsp->staId ; |
| 804 | roamInfo.ucastSig = addStaRsp->ucastSig ; |
| 805 | roamInfo.bcastSig = addStaRsp->bcastSig ; |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 806 | roamInfo.statusCode = addStaRsp->statusCode ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 807 | /* |
| 808 | * register peer with TL, we have to go through HDD as this is |
| 809 | * the only way to register any STA with TL. |
| 810 | */ |
| 811 | csrRoamCallCallback(pMac, addStaRsp->sessionId, &roamInfo, 0, |
| 812 | eCSR_ROAM_TDLS_STATUS_UPDATE, |
| 813 | eCSR_ROAM_RESULT_ADD_TDLS_PEER); |
| 814 | |
| 815 | /* remove pending eSmeCommandTdlsDiscovery command */ |
| 816 | csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsAddPeer) ; |
| 817 | } |
| 818 | break; |
| 819 | case eWNI_SME_TDLS_DEL_STA_RSP: |
| 820 | { |
| 821 | tSirTdlsDelStaRsp *delStaRsp = (tSirTdlsDelStaRsp *) pMsgBuf ; |
| 822 | tCsrRoamInfo roamInfo = {0} ; |
| 823 | |
| 824 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, delStaRsp->peerMac, |
| 825 | sizeof(tSirMacAddr)) ; |
| 826 | roamInfo.staId = delStaRsp->staId ; |
| 827 | roamInfo.statusCode = delStaRsp->statusCode ; |
| 828 | /* |
| 829 | * register peer with TL, we have to go through HDD as this is |
| 830 | * the only way to register any STA with TL. |
| 831 | */ |
| 832 | csrRoamCallCallback(pMac, delStaRsp->sessionId, &roamInfo, 0, |
| 833 | eCSR_ROAM_TDLS_STATUS_UPDATE, |
| 834 | eCSR_ROAM_RESULT_DELETE_TDLS_PEER); |
| 835 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 836 | csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsDelPeer) ; |
| 837 | } |
| 838 | break; |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 839 | case eWNI_SME_TDLS_DEL_STA_IND: |
| 840 | { |
| 841 | tpSirTdlsDelStaInd pSirTdlsDelStaInd = (tpSirTdlsDelStaInd) pMsgBuf ; |
| 842 | tCsrRoamInfo roamInfo = {0} ; |
| 843 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pSirTdlsDelStaInd->peerMac, |
| 844 | sizeof(tSirMacAddr)) ; |
| 845 | roamInfo.staId = pSirTdlsDelStaInd->staId ; |
| 846 | roamInfo.reasonCode = pSirTdlsDelStaInd->reasonCode ; |
| 847 | |
| 848 | /* Sending the TEARDOWN indication to HDD. */ |
| 849 | csrRoamCallCallback(pMac, pSirTdlsDelStaInd->sessionId, &roamInfo, 0, |
| 850 | eCSR_ROAM_TDLS_STATUS_UPDATE, |
| 851 | eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND); |
| 852 | break ; |
| 853 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 854 | case eWNI_SME_TDLS_DEL_ALL_PEER_IND: |
| 855 | { |
| 856 | tpSirTdlsDelAllPeerInd pSirTdlsDelAllPeerInd = (tpSirTdlsDelAllPeerInd) pMsgBuf ; |
| 857 | tCsrRoamInfo roamInfo = {0} ; |
| 858 | |
| 859 | /* Sending the TEARDOWN indication to HDD. */ |
| 860 | csrRoamCallCallback(pMac, pSirTdlsDelAllPeerInd->sessionId, &roamInfo, 0, |
| 861 | eCSR_ROAM_TDLS_STATUS_UPDATE, |
| 862 | eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 863 | break ; |
| 864 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame^] | 865 | case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND: |
| 866 | { |
| 867 | tpSirMgmtTxCompletionInd pSirTdlsDelAllPeerInd = (tpSirMgmtTxCompletionInd) pMsgBuf ; |
| 868 | tCsrRoamInfo roamInfo = {0} ; |
| 869 | roamInfo.reasonCode = pSirTdlsDelAllPeerInd->txCompleteStatus; |
| 870 | |
| 871 | csrRoamCallCallback(pMac, pSirTdlsDelAllPeerInd->sessionId, &roamInfo, |
| 872 | 0, eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND, 0); |
| 873 | } |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 874 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 875 | case eWNI_SME_TDLS_DISCOVERY_START_RSP: |
| 876 | { |
| 877 | /* remove pending eSmeCommandTdlsDiscovery command */ |
| 878 | csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsDiscovery) ; |
| 879 | } |
| 880 | /* fall through .. */ |
| 881 | case eWNI_SME_TDLS_DISCOVERY_START_IND: |
| 882 | { |
| 883 | tSirTdlsDisRsp *disRsp = (tSirTdlsDisRsp *)pMsgBuf ; |
| 884 | |
| 885 | if(eSIR_SME_SUCCESS == disRsp->statusCode) |
| 886 | { |
| 887 | tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ; |
| 888 | tANI_U16 disStaCount = disRsp->numDisSta ; |
| 889 | tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ; |
| 890 | tANI_U8 i = 0 ; |
| 891 | |
| 892 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 893 | ("DIS START RSP/IND recieved sta count = %d\n"), disStaCount) ; |
| 894 | for( ; i < disStaCount ; i++) |
| 895 | { |
| 896 | tSirTdlsPeerInfo *peerInfo = &disRsp->tdlsDisPeerInfo[i] ; |
| 897 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 898 | ("SME, peer MAC:\n")) ; |
| 899 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 900 | (" %02x,%02x,%02x,%02x,%02x,%02x"), |
| 901 | peerInfo->peerMac[0], |
| 902 | peerInfo->peerMac[1], |
| 903 | peerInfo->peerMac[2], |
| 904 | peerInfo->peerMac[3], |
| 905 | peerInfo->peerMac[4], |
| 906 | peerInfo->peerMac[5]) ; |
| 907 | |
| 908 | peerLinkInfo = findTdlsPeer(pMac, |
| 909 | &disInfo->tdlsPotentialPeerList, |
| 910 | peerInfo->peerMac) ; |
| 911 | |
| 912 | if(NULL == peerLinkInfo) |
| 913 | { |
| 914 | /* update discovery data base, if this is new entry */ |
| 915 | tdlsSaveTdlsPeerInfo(pMac, peerInfo) ; |
| 916 | } |
| 917 | else |
| 918 | { |
| 919 | /* update RSSI of existing peer */ |
| 920 | tSirTdlsPeerInfo *newPeerInfo = |
| 921 | &peerLinkInfo->tdlsDisPeerInfo ; |
| 922 | newPeerInfo->tdlsPeerRssi = peerInfo->tdlsPeerRssi ; |
| 923 | } |
| 924 | } |
| 925 | if(0 == i) |
| 926 | { |
| 927 | smsLog( pMac, LOGW, "there is no tdls client \ |
| 928 | discovered .." ) ; |
| 929 | } |
| 930 | } |
| 931 | else |
| 932 | { |
| 933 | smsLog( pMac, LOGW, "there is no tdls client discovered .." ); |
| 934 | } |
| 935 | /* Now free the memory for this message */ |
| 936 | break ; |
Ng Chilam | fc41646 | 2012-12-27 17:26:52 -0800 | [diff] [blame] | 937 | } |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 938 | case eWNI_SME_TDLS_LINK_START_RSP: |
| 939 | { |
| 940 | /* remove pending eSmeCommandTdlsLinkSetup command */ |
| 941 | csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsLinkSetup) ; |
| 942 | } |
| 943 | /* fall through .. */ |
| 944 | case eWNI_SME_TDLS_LINK_START_IND: |
| 945 | { |
| 946 | tSirTdlsLinksetupRsp *linkSetupRsp = |
| 947 | (tSirTdlsLinksetupRsp *) pMsgBuf ; |
| 948 | |
| 949 | if(eSIR_SME_SUCCESS == linkSetupRsp->statusCode) |
| 950 | { |
| 951 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 952 | ("Link setup for Peer %02x,%02x,%02x,%02x,%02x,%02x\n"), |
| 953 | linkSetupRsp->peerMac[0], |
| 954 | linkSetupRsp->peerMac[1], |
| 955 | linkSetupRsp->peerMac[2], |
| 956 | linkSetupRsp->peerMac[3], |
| 957 | linkSetupRsp->peerMac[4], |
| 958 | linkSetupRsp->peerMac[5]) ; |
| 959 | |
| 960 | tdlsUpdateTdlsPeerState(pMac, linkSetupRsp->peerMac, |
| 961 | TDLS_LINK_SETUP_STATE) ; |
| 962 | } |
| 963 | else |
| 964 | { |
| 965 | smsLog( pMac, LOGW, "failure receieved in link setup .." ); |
| 966 | } |
| 967 | break ; |
| 968 | } |
| 969 | |
| 970 | case eWNI_SME_TDLS_TEARDOWN_RSP: |
| 971 | { |
| 972 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 973 | ("TEARDOWN RSP from PE \n")) ; |
| 974 | /* remove pending eSmeCommandTdlsLinkTear command */ |
| 975 | csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsLinkTear) ; |
| 976 | } |
| 977 | /* fall through .. */ |
| 978 | case eWNI_SME_TDLS_TEARDOWN_IND: |
| 979 | { |
| 980 | tSirTdlsTeardownRsp *linkTearRsp = |
| 981 | (tSirTdlsTeardownRsp *) pMsgBuf ; |
| 982 | if(eSIR_SME_SUCCESS == linkTearRsp->statusCode) |
| 983 | { |
| 984 | |
| 985 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 986 | ("Teardown peer MAC = %02x,%02x,%02x,%02x,%02x,%02x\n"), |
| 987 | linkTearRsp->peerMac[0], |
| 988 | linkTearRsp->peerMac[1], |
| 989 | linkTearRsp->peerMac[2], |
| 990 | linkTearRsp->peerMac[3], |
| 991 | linkTearRsp->peerMac[4], |
| 992 | linkTearRsp->peerMac[5]) ; |
| 993 | tdlsDeleteTdlsPeerInfo(pMac, linkTearRsp->peerMac) ; |
| 994 | } |
| 995 | else |
| 996 | { |
| 997 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 998 | ("failure receieved in Teardown .." )); |
| 999 | } |
| 1000 | break ; |
| 1001 | } |
| 1002 | case eWNI_SME_ADD_TDLS_PEER_IND: |
| 1003 | { |
| 1004 | tSirTdlsPeerInd *peerInd = (tSirTdlsPeerInd *) pMsgBuf ; |
| 1005 | tCsrRoamInfo roamInfo = {0} ; |
| 1006 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, peerInd->peerMac, |
| 1007 | sizeof(tSirMacAddr)) ; |
| 1008 | roamInfo.staId = peerInd->staId ; |
| 1009 | roamInfo.ucastSig = peerInd->ucastSig ; |
| 1010 | roamInfo.bcastSig = peerInd->bcastSig ; |
| 1011 | /* |
| 1012 | * register peer with TL, we have to go through HDD as this is |
| 1013 | * the only way to register any STA with TL. |
| 1014 | */ |
| 1015 | csrRoamCallCallback(pMac, peerInd->sessionId, &roamInfo, 0, |
| 1016 | eCSR_ROAM_TDLS_STATUS_UPDATE, |
| 1017 | eCSR_ROAM_RESULT_ADD_TDLS_PEER); |
| 1018 | break ; |
| 1019 | |
| 1020 | } |
| 1021 | case eWNI_SME_DELETE_TDLS_PEER_IND: |
| 1022 | { |
| 1023 | tSirTdlsPeerInd *peerInd = (tSirTdlsPeerInd *) pMsgBuf ; |
| 1024 | tCsrRoamInfo roamInfo = {0} ; |
| 1025 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, peerInd->peerMac, |
| 1026 | sizeof(tSirMacAddr)) ; |
| 1027 | roamInfo.staId = peerInd->staId ; |
| 1028 | /* |
| 1029 | * register peer with TL, we have to go through HDD as this is |
| 1030 | * the only way to register any STA with TL. |
| 1031 | */ |
| 1032 | csrRoamCallCallback(pMac, peerInd->sessionId, &roamInfo, 0, |
| 1033 | eCSR_ROAM_TDLS_STATUS_UPDATE, |
| 1034 | eCSR_ROAM_RESULT_DELETE_TDLS_PEER); |
| 1035 | break ; |
| 1036 | |
| 1037 | } |
| 1038 | #endif |
| 1039 | default: |
| 1040 | { |
| 1041 | break ; |
| 1042 | } |
| 1043 | } |
| 1044 | |
| 1045 | return eHAL_STATUS_SUCCESS ; |
| 1046 | } |
| 1047 | #endif |