chrmhoffmann | bb97ca4 | 2017-05-13 21:27:44 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012-2015 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 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | /** ------------------------------------------------------------------------- * |
| 29 | ------------------------------------------------------------------------- * |
| 30 | |
| 31 | |
| 32 | \file csrTdlsProcess.c |
| 33 | |
| 34 | Implementation for the TDLS interface to PE. |
| 35 | |
| 36 | Copyright (C) 2010 Qualcomm, Incorporated |
| 37 | |
| 38 | |
| 39 | ========================================================================== */ |
| 40 | |
| 41 | #ifdef FEATURE_WLAN_TDLS |
| 42 | |
| 43 | #include "aniGlobal.h" //for tpAniSirGlobal |
| 44 | #include "palApi.h" |
| 45 | #include "csrInsideApi.h" |
| 46 | #include "smeInside.h" |
| 47 | #include "smsDebug.h" |
| 48 | |
| 49 | #include "csrSupport.h" |
| 50 | #include "wlan_qct_tl.h" |
| 51 | |
| 52 | #include "vos_diag_core_log.h" |
| 53 | #include "vos_diag_core_event.h" |
| 54 | #include "csrInternal.h" |
| 55 | |
| 56 | |
| 57 | /* |
| 58 | * common routine to remove TDLS cmd from SME command list.. |
| 59 | * commands are removed after getting reponse from PE. |
| 60 | */ |
| 61 | eHalStatus csrTdlsRemoveSmeCmd(tpAniSirGlobal pMac, eSmeCommandType cmdType) |
| 62 | { |
| 63 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 64 | tListElem *pEntry; |
| 65 | tSmeCmd *pCommand; |
| 66 | |
| 67 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 68 | if( pEntry ) |
| 69 | { |
| 70 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 71 | if( cmdType == pCommand->command ) |
| 72 | { |
| 73 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, |
| 74 | pEntry, LL_ACCESS_LOCK ) ) |
| 75 | { |
| 76 | vos_mem_zero( &pCommand->u.tdlsCmd, sizeof( tTdlsCmd ) ); |
| 77 | csrReleaseCommand( pMac, pCommand ); |
| 78 | smeProcessPendingQueue( pMac ); |
| 79 | status = eHAL_STATUS_SUCCESS ; |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | return status ; |
| 84 | } |
| 85 | |
| 86 | /* |
| 87 | * TDLS request API, called from HDD to send a TDLS frame |
| 88 | * in SME/CSR and send message to PE to trigger TDLS discovery procedure. |
| 89 | */ |
| 90 | eHalStatus csrTdlsSendMgmtReq(tHalHandle hHal, tANI_U8 sessionId, tCsrTdlsSendMgmt *tdlsSendMgmt) |
| 91 | { |
| 92 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 93 | tSmeCmd *tdlsSendMgmtCmd ; |
| 94 | eHalStatus status = eHAL_STATUS_FAILURE ; |
| 95 | |
| 96 | //If connected and in Infra. Only then allow this |
| 97 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) && |
| 98 | csrIsConnStateConnectedInfra( pMac, sessionId ) && |
| 99 | (NULL != tdlsSendMgmt) ) |
| 100 | { |
| 101 | tdlsSendMgmtCmd = csrGetCommandBuffer(pMac) ; |
| 102 | |
| 103 | if(tdlsSendMgmtCmd) |
| 104 | { |
| 105 | tTdlsSendMgmtCmdInfo *tdlsSendMgmtCmdInfo = |
| 106 | &tdlsSendMgmtCmd->u.tdlsCmd.u.tdlsSendMgmtCmdInfo ; |
| 107 | |
| 108 | vos_mem_zero(&tdlsSendMgmtCmd->u.tdlsCmd, sizeof(tTdlsCmd)); |
| 109 | |
| 110 | tdlsSendMgmtCmd->sessionId = sessionId; |
| 111 | |
| 112 | tdlsSendMgmtCmdInfo->frameType = tdlsSendMgmt->frameType ; |
| 113 | tdlsSendMgmtCmdInfo->dialog = tdlsSendMgmt->dialog ; |
| 114 | tdlsSendMgmtCmdInfo->statusCode = tdlsSendMgmt->statusCode ; |
| 115 | tdlsSendMgmtCmdInfo->responder = tdlsSendMgmt->responder; |
| 116 | tdlsSendMgmtCmdInfo->peerCapability = tdlsSendMgmt->peerCapability; |
| 117 | vos_mem_copy(tdlsSendMgmtCmdInfo->peerMac, |
| 118 | tdlsSendMgmt->peerMac, sizeof(tSirMacAddr)) ; |
| 119 | |
| 120 | if( (0 != tdlsSendMgmt->len) && (NULL != tdlsSendMgmt->buf) ) |
| 121 | { |
| 122 | tdlsSendMgmtCmdInfo->buf = vos_mem_malloc(tdlsSendMgmt->len); |
| 123 | if ( NULL == tdlsSendMgmtCmdInfo->buf ) |
| 124 | status = eHAL_STATUS_FAILURE; |
| 125 | else |
| 126 | status = eHAL_STATUS_SUCCESS; |
| 127 | if(!HAL_STATUS_SUCCESS( status ) ) |
| 128 | { |
| 129 | smsLog( pMac, LOGE, FL("Alloc Failed") ); |
| 130 | VOS_ASSERT(0) ; |
| 131 | return status ; |
| 132 | } |
| 133 | vos_mem_copy(tdlsSendMgmtCmdInfo->buf, |
| 134 | tdlsSendMgmt->buf, tdlsSendMgmt->len ); |
| 135 | tdlsSendMgmtCmdInfo->len = tdlsSendMgmt->len; |
| 136 | } |
| 137 | else |
| 138 | { |
| 139 | tdlsSendMgmtCmdInfo->buf = NULL; |
| 140 | tdlsSendMgmtCmdInfo->len = 0; |
| 141 | } |
| 142 | |
| 143 | tdlsSendMgmtCmd->command = eSmeCommandTdlsSendMgmt ; |
| 144 | tdlsSendMgmtCmd->u.tdlsCmd.size = sizeof(tTdlsSendMgmtCmdInfo) ; |
| 145 | smePushCommand(pMac, tdlsSendMgmtCmd, FALSE) ; |
| 146 | status = eHAL_STATUS_SUCCESS ; |
| 147 | smsLog( pMac, LOG1, |
| 148 | FL("Successfully posted tdlsSendMgmtCmd to SME")); |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | return status ; |
| 153 | } |
| 154 | |
| 155 | /* |
| 156 | * TDLS request API, called from HDD to modify an existing TDLS peer |
| 157 | */ |
| 158 | eHalStatus csrTdlsChangePeerSta(tHalHandle hHal, tANI_U8 sessionId, |
| 159 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 160 | const tSirMacAddr peerMac, |
| 161 | #else |
| 162 | tSirMacAddr peerMac, |
| 163 | #endif |
| 164 | tCsrStaParams *pstaParams) |
| 165 | { |
| 166 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 167 | tSmeCmd *tdlsAddStaCmd ; |
| 168 | eHalStatus status = eHAL_STATUS_FAILURE ; |
| 169 | |
| 170 | if (NULL == pstaParams) |
| 171 | return status; |
| 172 | |
| 173 | //If connected and in Infra. Only then allow this |
| 174 | if (CSR_IS_SESSION_VALID( pMac, sessionId ) && |
| 175 | csrIsConnStateConnectedInfra( pMac, sessionId ) && |
| 176 | (NULL != peerMac)){ |
| 177 | |
| 178 | tdlsAddStaCmd = csrGetCommandBuffer(pMac) ; |
| 179 | |
| 180 | if (tdlsAddStaCmd) |
| 181 | { |
| 182 | tTdlsAddStaCmdInfo *tdlsAddStaCmdInfo = |
| 183 | &tdlsAddStaCmd->u.tdlsCmd.u.tdlsAddStaCmdInfo ; |
| 184 | |
| 185 | vos_mem_zero(&tdlsAddStaCmd->u.tdlsCmd, sizeof(tTdlsCmd)); |
| 186 | |
| 187 | tdlsAddStaCmdInfo->tdlsAddOper = TDLS_OPER_UPDATE; |
| 188 | |
| 189 | tdlsAddStaCmd->sessionId = sessionId; |
| 190 | |
| 191 | vos_mem_copy(tdlsAddStaCmdInfo->peerMac, |
| 192 | peerMac, sizeof(tSirMacAddr)) ; |
| 193 | tdlsAddStaCmdInfo->capability = pstaParams->capability; |
| 194 | tdlsAddStaCmdInfo->uapsdQueues = pstaParams->uapsd_queues; |
| 195 | tdlsAddStaCmdInfo->maxSp = pstaParams->max_sp; |
| 196 | vos_mem_copy(tdlsAddStaCmdInfo->extnCapability, |
| 197 | pstaParams->extn_capability, |
| 198 | sizeof(pstaParams->extn_capability)); |
| 199 | |
| 200 | tdlsAddStaCmdInfo->htcap_present = pstaParams->htcap_present; |
| 201 | if(pstaParams->htcap_present) |
| 202 | vos_mem_copy( &tdlsAddStaCmdInfo->HTCap, |
| 203 | &pstaParams->HTCap, sizeof(pstaParams->HTCap)); |
| 204 | else |
| 205 | vos_mem_set(&tdlsAddStaCmdInfo->HTCap, sizeof(pstaParams->HTCap), 0); |
| 206 | |
| 207 | tdlsAddStaCmdInfo->vhtcap_present = pstaParams->vhtcap_present; |
| 208 | if(pstaParams->vhtcap_present) |
| 209 | vos_mem_copy( &tdlsAddStaCmdInfo->VHTCap, |
| 210 | &pstaParams->VHTCap, sizeof(pstaParams->VHTCap)); |
| 211 | else |
| 212 | vos_mem_set(&tdlsAddStaCmdInfo->VHTCap, sizeof(pstaParams->VHTCap), 0); |
| 213 | |
| 214 | tdlsAddStaCmdInfo->supportedRatesLen = pstaParams->supported_rates_len; |
| 215 | |
| 216 | if (0 != pstaParams->supported_rates_len) |
| 217 | vos_mem_copy( &tdlsAddStaCmdInfo->supportedRates, |
| 218 | pstaParams->supported_rates, |
| 219 | pstaParams->supported_rates_len); |
| 220 | |
| 221 | tdlsAddStaCmd->command = eSmeCommandTdlsAddPeer; |
| 222 | tdlsAddStaCmd->u.tdlsCmd.size = sizeof(tTdlsAddStaCmdInfo) ; |
| 223 | smePushCommand(pMac, tdlsAddStaCmd, FALSE) ; |
| 224 | smsLog( pMac, LOG1, |
| 225 | FL("Successfully posted tdlsAddStaCmd to SME to modify peer ")); |
| 226 | status = eHAL_STATUS_SUCCESS ; |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | return status ; |
| 231 | } |
| 232 | /* |
| 233 | * TDLS request API, called from HDD to Send Link Establishment Parameters |
| 234 | */ |
| 235 | VOS_STATUS csrTdlsSendLinkEstablishParams(tHalHandle hHal, |
| 236 | tANI_U8 sessionId, |
| 237 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 238 | const tSirMacAddr peerMac, |
| 239 | #else |
| 240 | tSirMacAddr peerMac, |
| 241 | #endif |
| 242 | tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams) |
| 243 | { |
| 244 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 245 | tSmeCmd *tdlsLinkEstablishCmd; |
| 246 | eHalStatus status = eHAL_STATUS_FAILURE ; |
| 247 | //If connected and in Infra. Only then allow this |
| 248 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) && |
| 249 | csrIsConnStateConnectedInfra( pMac, sessionId ) && |
| 250 | (NULL != peerMac) ) |
| 251 | { |
| 252 | tdlsLinkEstablishCmd = csrGetCommandBuffer(pMac) ; |
| 253 | |
| 254 | if(tdlsLinkEstablishCmd) |
| 255 | { |
| 256 | tTdlsLinkEstablishCmdInfo *tdlsLinkEstablishCmdInfo = |
| 257 | &tdlsLinkEstablishCmd->u.tdlsCmd.u.tdlsLinkEstablishCmdInfo ; |
| 258 | |
| 259 | vos_mem_zero(&tdlsLinkEstablishCmd->u.tdlsCmd, sizeof(tTdlsCmd)); |
| 260 | |
| 261 | tdlsLinkEstablishCmd->sessionId = sessionId; |
| 262 | |
| 263 | vos_mem_copy( tdlsLinkEstablishCmdInfo->peerMac, |
| 264 | peerMac, sizeof(tSirMacAddr)); |
| 265 | tdlsLinkEstablishCmdInfo->isBufSta = tdlsLinkEstablishParams->isBufSta; |
| 266 | tdlsLinkEstablishCmdInfo->isResponder = tdlsLinkEstablishParams->isResponder; |
| 267 | tdlsLinkEstablishCmdInfo->maxSp = tdlsLinkEstablishParams->maxSp; |
| 268 | tdlsLinkEstablishCmdInfo->uapsdQueues = tdlsLinkEstablishParams->uapsdQueues; |
| 269 | tdlsLinkEstablishCmdInfo->isOffChannelSupported = |
| 270 | tdlsLinkEstablishParams->isOffChannelSupported; |
| 271 | |
| 272 | vos_mem_copy(tdlsLinkEstablishCmdInfo->supportedChannels, |
| 273 | tdlsLinkEstablishParams->supportedChannels, |
| 274 | tdlsLinkEstablishParams->supportedChannelsLen); |
| 275 | tdlsLinkEstablishCmdInfo->supportedChannelsLen = |
| 276 | tdlsLinkEstablishParams->supportedChannelsLen; |
| 277 | |
| 278 | vos_mem_copy(tdlsLinkEstablishCmdInfo->supportedOperClasses, |
| 279 | tdlsLinkEstablishParams->supportedOperClasses, |
| 280 | tdlsLinkEstablishParams->supportedOperClassesLen); |
| 281 | tdlsLinkEstablishCmdInfo->supportedOperClassesLen = |
| 282 | tdlsLinkEstablishParams->supportedOperClassesLen; |
| 283 | tdlsLinkEstablishCmdInfo->isResponder= tdlsLinkEstablishParams->isResponder; |
| 284 | tdlsLinkEstablishCmdInfo->maxSp= tdlsLinkEstablishParams->maxSp; |
| 285 | tdlsLinkEstablishCmdInfo->uapsdQueues= tdlsLinkEstablishParams->uapsdQueues; |
| 286 | tdlsLinkEstablishCmd->command = eSmeCommandTdlsLinkEstablish ; |
| 287 | tdlsLinkEstablishCmd->u.tdlsCmd.size = sizeof(tTdlsLinkEstablishCmdInfo) ; |
| 288 | smePushCommand(pMac, tdlsLinkEstablishCmd, FALSE) ; |
| 289 | status = eHAL_STATUS_SUCCESS ; |
| 290 | smsLog( pMac, LOG1, |
| 291 | FL("Successfully posted tdlsLinkEstablishCmd to SME")); |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | return status ; |
| 296 | } |
| 297 | |
| 298 | /* |
| 299 | * TDLS request API, called from HDD to add a TDLS peer |
| 300 | */ |
| 301 | eHalStatus csrTdlsAddPeerSta(tHalHandle hHal, tANI_U8 sessionId, |
| 302 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 303 | const tSirMacAddr peerMac |
| 304 | #else |
| 305 | tSirMacAddr peerMac |
| 306 | #endif |
| 307 | ) |
| 308 | { |
| 309 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 310 | tSmeCmd *tdlsAddStaCmd ; |
| 311 | eHalStatus status = eHAL_STATUS_FAILURE ; |
| 312 | |
| 313 | //If connected and in Infra. Only then allow this |
| 314 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) && |
| 315 | csrIsConnStateConnectedInfra( pMac, sessionId ) && |
| 316 | (NULL != peerMac) ) |
| 317 | { |
| 318 | tdlsAddStaCmd = csrGetCommandBuffer(pMac) ; |
| 319 | |
| 320 | if(tdlsAddStaCmd) |
| 321 | { |
| 322 | tTdlsAddStaCmdInfo *tdlsAddStaCmdInfo = |
| 323 | &tdlsAddStaCmd->u.tdlsCmd.u.tdlsAddStaCmdInfo ; |
| 324 | |
| 325 | vos_mem_zero(&tdlsAddStaCmd->u.tdlsCmd, sizeof(tTdlsCmd)); |
| 326 | |
| 327 | tdlsAddStaCmd->sessionId = sessionId; |
| 328 | tdlsAddStaCmdInfo->tdlsAddOper = TDLS_OPER_ADD; |
| 329 | |
| 330 | vos_mem_copy( tdlsAddStaCmdInfo->peerMac, |
| 331 | peerMac, sizeof(tSirMacAddr)) ; |
| 332 | |
| 333 | tdlsAddStaCmd->command = eSmeCommandTdlsAddPeer ; |
| 334 | tdlsAddStaCmd->u.tdlsCmd.size = sizeof(tTdlsAddStaCmdInfo) ; |
| 335 | smePushCommand(pMac, tdlsAddStaCmd, FALSE) ; |
| 336 | status = eHAL_STATUS_SUCCESS ; |
| 337 | smsLog( pMac, LOG1, |
| 338 | FL("Successfully posted tdlsAddStaCmd to SME")); |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | return status ; |
| 343 | } |
| 344 | |
| 345 | /* |
| 346 | * TDLS request API, called from HDD to delete a TDLS peer |
| 347 | */ |
| 348 | eHalStatus csrTdlsDelPeerSta(tHalHandle hHal, tANI_U8 sessionId, |
| 349 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 350 | const tSirMacAddr peerMac |
| 351 | #else |
| 352 | tSirMacAddr peerMac |
| 353 | #endif |
| 354 | ) |
| 355 | { |
| 356 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 357 | tSmeCmd *tdlsDelStaCmd ; |
| 358 | eHalStatus status = eHAL_STATUS_FAILURE ; |
| 359 | |
| 360 | //If connected and in Infra. Only then allow this |
| 361 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) && |
| 362 | csrIsConnStateConnectedInfra( pMac, sessionId ) && |
| 363 | (NULL != peerMac) ) |
| 364 | { |
| 365 | tdlsDelStaCmd = csrGetCommandBuffer(pMac) ; |
| 366 | |
| 367 | if(tdlsDelStaCmd) |
| 368 | { |
| 369 | tTdlsDelStaCmdInfo *tdlsDelStaCmdInfo = |
| 370 | &tdlsDelStaCmd->u.tdlsCmd.u.tdlsDelStaCmdInfo ; |
| 371 | |
| 372 | vos_mem_zero(&tdlsDelStaCmd->u.tdlsCmd, sizeof(tTdlsCmd)); |
| 373 | |
| 374 | tdlsDelStaCmd->sessionId = sessionId; |
| 375 | |
| 376 | vos_mem_copy(tdlsDelStaCmdInfo->peerMac, |
| 377 | peerMac, sizeof(tSirMacAddr)) ; |
| 378 | |
| 379 | tdlsDelStaCmd->command = eSmeCommandTdlsDelPeer ; |
| 380 | tdlsDelStaCmd->u.tdlsCmd.size = sizeof(tTdlsDelStaCmdInfo) ; |
| 381 | smePushCommand(pMac, tdlsDelStaCmd, FALSE) ; |
| 382 | status = eHAL_STATUS_SUCCESS ; |
| 383 | smsLog( pMac, LOG1, |
| 384 | FL("Successfully posted tdlsDelStaCmd to SME")); |
| 385 | } |
| 386 | } |
| 387 | |
| 388 | return status ; |
| 389 | } |
| 390 | |
| 391 | //tdlsoffchan |
| 392 | /* |
| 393 | * TDLS request API, called from HDD to Send Channel Switch Parameters |
| 394 | */ |
| 395 | VOS_STATUS csrTdlsSendChanSwitchReq(tHalHandle hHal, |
| 396 | tANI_U8 sessionId, |
| 397 | tSirMacAddr peerMac, |
| 398 | tANI_S32 tdlsOffCh, |
| 399 | tANI_S32 tdlsOffChBwOffset, |
| 400 | tANI_U8 tdlsSwMode) |
| 401 | { |
| 402 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 403 | tSmeCmd *tdlsChanSwitchCmd; |
| 404 | eHalStatus status = eHAL_STATUS_FAILURE ; |
| 405 | |
| 406 | //If connected and in Infra. Only then allow this |
| 407 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) && |
| 408 | csrIsConnStateConnectedInfra( pMac, sessionId ) && |
| 409 | (NULL != peerMac) ) |
| 410 | { |
| 411 | tdlsChanSwitchCmd = csrGetCommandBuffer(pMac) ; |
| 412 | |
| 413 | if(tdlsChanSwitchCmd) |
| 414 | { |
| 415 | tTdlsChanSwitchCmdInfo *tdlsChanSwitchCmdInfo = |
| 416 | &tdlsChanSwitchCmd->u.tdlsCmd.u.tdlsChanSwitchCmdInfo; |
| 417 | |
| 418 | vos_mem_zero(&tdlsChanSwitchCmd->u.tdlsCmd, sizeof(tTdlsCmd)); |
| 419 | |
| 420 | tdlsChanSwitchCmd->sessionId = sessionId; |
| 421 | |
| 422 | vos_mem_copy(tdlsChanSwitchCmdInfo->peerMac, |
| 423 | peerMac, sizeof(tSirMacAddr)); |
| 424 | tdlsChanSwitchCmdInfo->tdlsOffCh = tdlsOffCh; |
| 425 | tdlsChanSwitchCmdInfo->tdlsOffChBwOffset = tdlsOffChBwOffset; |
| 426 | tdlsChanSwitchCmdInfo->tdlsSwMode = tdlsSwMode; |
| 427 | |
| 428 | tdlsChanSwitchCmd->command = eSmeCommandTdlsChannelSwitch; |
| 429 | tdlsChanSwitchCmd->u.tdlsCmd.size = sizeof(tTdlsChanSwitchCmdInfo) ; |
| 430 | smePushCommand(pMac, tdlsChanSwitchCmd, FALSE) ; |
| 431 | status = eHAL_STATUS_SUCCESS ; |
| 432 | smsLog( pMac, LOG1, |
| 433 | FL("Successfully posted tdlsChanSwitchCmd to SME")); |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | return status ; |
| 438 | } |
| 439 | |
| 440 | |
| 441 | /* |
| 442 | * TDLS messages sent to PE . |
| 443 | */ |
| 444 | eHalStatus tdlsSendMessage(tpAniSirGlobal pMac, tANI_U16 msg_type, |
| 445 | void *msg_data, tANI_U32 msg_size) |
| 446 | { |
| 447 | |
| 448 | tSirMbMsg *pMsg = (tSirMbMsg *)msg_data ; |
| 449 | pMsg->type = msg_type ; |
| 450 | pMsg->msgLen = (tANI_U16) (msg_size) ; |
| 451 | |
| 452 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 453 | FL("sending msg = %d"), pMsg->type) ; |
| 454 | /* Send message. */ |
| 455 | if (palSendMBMessage(pMac->hHdd, pMsg) != eHAL_STATUS_SUCCESS) |
| 456 | { |
| 457 | smsLog(pMac, LOGE, FL("Cannot send message")); |
| 458 | return eHAL_STATUS_FAILURE; |
| 459 | } |
| 460 | |
| 461 | return eHAL_STATUS_SUCCESS; |
| 462 | } |
| 463 | |
| 464 | eHalStatus csrTdlsProcessSendMgmt( tpAniSirGlobal pMac, tSmeCmd *cmd ) |
| 465 | { |
| 466 | tTdlsSendMgmtCmdInfo *tdlsSendMgmtCmdInfo = &cmd->u.tdlsCmd.u.tdlsSendMgmtCmdInfo ; |
| 467 | tSirTdlsSendMgmtReq *tdlsSendMgmtReq = NULL ; |
| 468 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); |
| 469 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 470 | |
| 471 | if (NULL == pSession) |
| 472 | { |
| 473 | smsLog( pMac, LOGE, FL("pSession is NULL")); |
| 474 | return eHAL_STATUS_FAILURE; |
| 475 | } |
| 476 | if (NULL == pSession->pConnectBssDesc) |
| 477 | { |
| 478 | smsLog( pMac, LOGE, FL("BSS Description is not present") ); |
| 479 | return eHAL_STATUS_FAILURE; |
| 480 | } |
| 481 | |
| 482 | tdlsSendMgmtReq = vos_mem_malloc( |
| 483 | sizeof(tSirTdlsSendMgmtReq) + tdlsSendMgmtCmdInfo->len); |
| 484 | if ( NULL == tdlsSendMgmtReq ) |
| 485 | status = eHAL_STATUS_FAILURE; |
| 486 | else |
| 487 | status = eHAL_STATUS_SUCCESS; |
| 488 | |
| 489 | if (!HAL_STATUS_SUCCESS( status ) ) |
| 490 | { |
| 491 | smsLog( pMac, LOGE, FL("alloc failed") ); |
| 492 | VOS_ASSERT(0) ; |
| 493 | return status ; |
| 494 | } |
| 495 | tdlsSendMgmtReq->sessionId = cmd->sessionId; |
| 496 | //Using dialog as transactionId. This can be used to match response with request |
| 497 | tdlsSendMgmtReq->transactionId = tdlsSendMgmtCmdInfo->dialog; |
| 498 | tdlsSendMgmtReq->reqType = tdlsSendMgmtCmdInfo->frameType ; |
| 499 | tdlsSendMgmtReq->dialog = tdlsSendMgmtCmdInfo->dialog ; |
| 500 | tdlsSendMgmtReq->statusCode = tdlsSendMgmtCmdInfo->statusCode ; |
| 501 | tdlsSendMgmtReq->responder = tdlsSendMgmtCmdInfo->responder; |
| 502 | tdlsSendMgmtReq->peerCapability = tdlsSendMgmtCmdInfo->peerCapability; |
| 503 | |
| 504 | vos_mem_copy(tdlsSendMgmtReq->bssid, |
| 505 | pSession->pConnectBssDesc->bssId, sizeof (tSirMacAddr)); |
| 506 | |
| 507 | vos_mem_copy(tdlsSendMgmtReq->peerMac, |
| 508 | tdlsSendMgmtCmdInfo->peerMac, sizeof(tSirMacAddr)) ; |
| 509 | |
| 510 | if(tdlsSendMgmtCmdInfo->len && tdlsSendMgmtCmdInfo->buf) |
| 511 | { |
| 512 | vos_mem_copy(tdlsSendMgmtReq->addIe, tdlsSendMgmtCmdInfo->buf, |
| 513 | tdlsSendMgmtCmdInfo->len); |
| 514 | |
| 515 | } |
| 516 | // Send the request to PE. |
| 517 | smsLog( pMac, LOG1, FL("sending TDLS Mgmt Frame req to PE " )); |
| 518 | status = tdlsSendMessage(pMac, eWNI_SME_TDLS_SEND_MGMT_REQ, |
| 519 | (void *)tdlsSendMgmtReq , sizeof(tSirTdlsSendMgmtReq)+tdlsSendMgmtCmdInfo->len) ; |
| 520 | if(!HAL_STATUS_SUCCESS( status ) ) |
| 521 | { |
| 522 | smsLog( pMac, LOGE, FL("Failed to send request to MAC")); |
| 523 | } |
| 524 | if(tdlsSendMgmtCmdInfo->len && tdlsSendMgmtCmdInfo->buf) |
| 525 | { |
| 526 | //Done with the buf. Free it. |
| 527 | vos_mem_free( tdlsSendMgmtCmdInfo->buf ); |
| 528 | tdlsSendMgmtCmdInfo->buf = NULL; |
| 529 | tdlsSendMgmtCmdInfo->len = 0; |
| 530 | } |
| 531 | |
| 532 | return status; |
| 533 | } |
| 534 | |
| 535 | eHalStatus csrTdlsProcessAddSta( tpAniSirGlobal pMac, tSmeCmd *cmd ) |
| 536 | { |
| 537 | tTdlsAddStaCmdInfo *tdlsAddStaCmdInfo = &cmd->u.tdlsCmd.u.tdlsAddStaCmdInfo ; |
| 538 | tSirTdlsAddStaReq *tdlsAddStaReq = NULL ; |
| 539 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); |
| 540 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 541 | |
| 542 | if (NULL == pSession) |
| 543 | { |
| 544 | smsLog( pMac, LOGE, FL("pSession is NULL")); |
| 545 | return eHAL_STATUS_FAILURE; |
| 546 | } |
| 547 | |
| 548 | if (NULL == pSession->pConnectBssDesc) |
| 549 | { |
| 550 | smsLog( pMac, LOGE, FL("BSS description is not present") ); |
| 551 | return eHAL_STATUS_FAILURE; |
| 552 | } |
| 553 | |
| 554 | tdlsAddStaReq = vos_mem_malloc(sizeof(tSirTdlsAddStaReq)); |
| 555 | if ( NULL == tdlsAddStaReq ) |
| 556 | status = eHAL_STATUS_FAILURE; |
| 557 | else |
| 558 | status = eHAL_STATUS_SUCCESS; |
| 559 | |
| 560 | if (!HAL_STATUS_SUCCESS( status ) ) |
| 561 | { |
| 562 | smsLog( pMac, LOGE, FL("alloc failed") ); |
| 563 | VOS_ASSERT(0) ; |
| 564 | return status ; |
| 565 | } |
| 566 | vos_mem_set(tdlsAddStaReq, sizeof(tSirTdlsAddStaReq), 0); |
| 567 | |
| 568 | tdlsAddStaReq->sessionId = cmd->sessionId; |
| 569 | tdlsAddStaReq->tdlsAddOper = tdlsAddStaCmdInfo->tdlsAddOper; |
| 570 | //Using dialog as transactionId. This can be used to match response with request |
| 571 | tdlsAddStaReq->transactionId = 0; |
| 572 | |
| 573 | vos_mem_copy( tdlsAddStaReq->bssid, |
| 574 | pSession->pConnectBssDesc->bssId, sizeof (tSirMacAddr)); |
| 575 | |
| 576 | vos_mem_copy( tdlsAddStaReq->peerMac, |
| 577 | tdlsAddStaCmdInfo->peerMac, sizeof(tSirMacAddr)) ; |
| 578 | |
| 579 | tdlsAddStaReq->capability = tdlsAddStaCmdInfo->capability; |
| 580 | tdlsAddStaReq->uapsd_queues = tdlsAddStaCmdInfo->uapsdQueues; |
| 581 | tdlsAddStaReq->max_sp = tdlsAddStaCmdInfo->maxSp; |
| 582 | |
| 583 | vos_mem_copy( tdlsAddStaReq->extn_capability, |
| 584 | tdlsAddStaCmdInfo->extnCapability, |
| 585 | SIR_MAC_MAX_EXTN_CAP); |
| 586 | tdlsAddStaReq->htcap_present = tdlsAddStaCmdInfo->htcap_present; |
| 587 | vos_mem_copy( &tdlsAddStaReq->htCap, |
| 588 | &tdlsAddStaCmdInfo->HTCap, sizeof(tdlsAddStaCmdInfo->HTCap)); |
| 589 | tdlsAddStaReq->vhtcap_present = tdlsAddStaCmdInfo->vhtcap_present; |
| 590 | vos_mem_copy( &tdlsAddStaReq->vhtCap, |
| 591 | &tdlsAddStaCmdInfo->VHTCap, sizeof(tdlsAddStaCmdInfo->VHTCap)); |
| 592 | tdlsAddStaReq->supported_rates_length = tdlsAddStaCmdInfo->supportedRatesLen; |
| 593 | vos_mem_copy( &tdlsAddStaReq->supported_rates, |
| 594 | tdlsAddStaCmdInfo->supportedRates, tdlsAddStaCmdInfo->supportedRatesLen); |
| 595 | |
| 596 | // Send the request to PE. |
| 597 | smsLog( pMac, LOGE, "sending TDLS Add Sta req to PE " ); |
| 598 | status = tdlsSendMessage(pMac, eWNI_SME_TDLS_ADD_STA_REQ, |
| 599 | (void *)tdlsAddStaReq , sizeof(tSirTdlsAddStaReq)) ; |
| 600 | if(!HAL_STATUS_SUCCESS( status ) ) |
| 601 | { |
| 602 | smsLog( pMac, LOGE, FL("Failed to send request to MAC")); |
| 603 | } |
| 604 | return status; |
| 605 | } |
| 606 | |
| 607 | eHalStatus csrTdlsProcessDelSta( tpAniSirGlobal pMac, tSmeCmd *cmd ) |
| 608 | { |
| 609 | tTdlsDelStaCmdInfo *tdlsDelStaCmdInfo = &cmd->u.tdlsCmd.u.tdlsDelStaCmdInfo ; |
| 610 | tSirTdlsDelStaReq *tdlsDelStaReq = NULL ; |
| 611 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); |
| 612 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 613 | |
| 614 | if (NULL == pSession) |
| 615 | { |
| 616 | smsLog( pMac, LOGE, FL("pSession is NULL")); |
| 617 | return eHAL_STATUS_FAILURE; |
| 618 | } |
| 619 | |
| 620 | if (NULL == pSession->pConnectBssDesc) |
| 621 | { |
| 622 | smsLog( pMac, LOGE, FL("BSS description is not present") ); |
| 623 | return eHAL_STATUS_FAILURE; |
| 624 | } |
| 625 | |
| 626 | tdlsDelStaReq = vos_mem_malloc(sizeof(tSirTdlsDelStaReq)); |
| 627 | if ( NULL == tdlsDelStaReq ) |
| 628 | status = eHAL_STATUS_FAILURE; |
| 629 | else |
| 630 | status = eHAL_STATUS_SUCCESS; |
| 631 | |
| 632 | |
| 633 | if (!HAL_STATUS_SUCCESS( status ) ) |
| 634 | { |
| 635 | smsLog( pMac, LOGE, FL("alloc failed") ); |
| 636 | VOS_ASSERT(0) ; |
| 637 | return status ; |
| 638 | } |
| 639 | tdlsDelStaReq->sessionId = cmd->sessionId; |
| 640 | //Using dialog as transactionId. This can be used to match response with request |
| 641 | tdlsDelStaReq->transactionId = 0; |
| 642 | |
| 643 | vos_mem_copy( tdlsDelStaReq->bssid, |
| 644 | pSession->pConnectBssDesc->bssId, sizeof (tSirMacAddr)); |
| 645 | |
| 646 | vos_mem_copy( tdlsDelStaReq->peerMac, |
| 647 | tdlsDelStaCmdInfo->peerMac, sizeof(tSirMacAddr)) ; |
| 648 | |
| 649 | // Send the request to PE. |
| 650 | smsLog( pMac, LOG1, |
| 651 | "sending TDLS Del Sta "MAC_ADDRESS_STR" req to PE", |
| 652 | MAC_ADDR_ARRAY(tdlsDelStaCmdInfo->peerMac)); |
| 653 | status = tdlsSendMessage(pMac, eWNI_SME_TDLS_DEL_STA_REQ, |
| 654 | (void *)tdlsDelStaReq , sizeof(tSirTdlsDelStaReq)) ; |
| 655 | if(!HAL_STATUS_SUCCESS( status ) ) |
| 656 | { |
| 657 | smsLog( pMac, LOGE, FL("Failed to send request to MAC")); |
| 658 | } |
| 659 | return status; |
| 660 | } |
| 661 | /* |
| 662 | * commands received from CSR |
| 663 | */ |
| 664 | eHalStatus csrTdlsProcessCmd(tpAniSirGlobal pMac, tSmeCmd *cmd) |
| 665 | { |
| 666 | eSmeCommandType cmdType = cmd->command ; |
Gururaj Patil | 6b8abb3 | 2019-09-23 13:48:29 +0000 | [diff] [blame^] | 667 | tANI_BOOLEAN status = eANI_BOOLEAN_TRUE; |
chrmhoffmann | bb97ca4 | 2017-05-13 21:27:44 +0200 | [diff] [blame] | 668 | switch(cmdType) |
| 669 | { |
| 670 | case eSmeCommandTdlsSendMgmt: |
Gururaj Patil | 6b8abb3 | 2019-09-23 13:48:29 +0000 | [diff] [blame^] | 671 | { |
| 672 | status = csrTdlsProcessSendMgmt( pMac, cmd ); |
| 673 | if(HAL_STATUS_SUCCESS( status ) ) |
| 674 | { |
| 675 | status = eANI_BOOLEAN_FALSE ; |
| 676 | } |
| 677 | } |
chrmhoffmann | bb97ca4 | 2017-05-13 21:27:44 +0200 | [diff] [blame] | 678 | break ; |
| 679 | case eSmeCommandTdlsAddPeer: |
Gururaj Patil | 6b8abb3 | 2019-09-23 13:48:29 +0000 | [diff] [blame^] | 680 | { |
| 681 | status = csrTdlsProcessAddSta( pMac, cmd ); |
| 682 | if(HAL_STATUS_SUCCESS( status ) ) |
| 683 | { |
| 684 | status = eANI_BOOLEAN_FALSE ; |
| 685 | } |
| 686 | } |
chrmhoffmann | bb97ca4 | 2017-05-13 21:27:44 +0200 | [diff] [blame] | 687 | break; |
| 688 | case eSmeCommandTdlsDelPeer: |
Gururaj Patil | 6b8abb3 | 2019-09-23 13:48:29 +0000 | [diff] [blame^] | 689 | { |
| 690 | status = csrTdlsProcessDelSta( pMac, cmd ); |
| 691 | if(HAL_STATUS_SUCCESS( status ) ) |
| 692 | { |
| 693 | status = eANI_BOOLEAN_FALSE ; |
| 694 | } |
| 695 | } |
chrmhoffmann | bb97ca4 | 2017-05-13 21:27:44 +0200 | [diff] [blame] | 696 | break; |
| 697 | case eSmeCommandTdlsLinkEstablish: |
Gururaj Patil | 6b8abb3 | 2019-09-23 13:48:29 +0000 | [diff] [blame^] | 698 | { |
| 699 | status = csrTdlsProcessLinkEstablish( pMac, cmd ); |
| 700 | if(HAL_STATUS_SUCCESS( status ) ) |
| 701 | { |
| 702 | status = eANI_BOOLEAN_FALSE ; |
| 703 | } |
| 704 | } |
chrmhoffmann | bb97ca4 | 2017-05-13 21:27:44 +0200 | [diff] [blame] | 705 | break; |
| 706 | // tdlsoffchan |
| 707 | case eSmeCommandTdlsChannelSwitch: |
Gururaj Patil | 6b8abb3 | 2019-09-23 13:48:29 +0000 | [diff] [blame^] | 708 | { |
| 709 | status = csrTdlsProcessChanSwitchReq( pMac, cmd ); |
| 710 | if(HAL_STATUS_SUCCESS( status ) ) |
| 711 | { |
| 712 | status = eANI_BOOLEAN_FALSE ; |
| 713 | } |
| 714 | } |
chrmhoffmann | bb97ca4 | 2017-05-13 21:27:44 +0200 | [diff] [blame] | 715 | break; |
| 716 | default: |
Gururaj Patil | 6b8abb3 | 2019-09-23 13:48:29 +0000 | [diff] [blame^] | 717 | { |
chrmhoffmann | bb97ca4 | 2017-05-13 21:27:44 +0200 | [diff] [blame] | 718 | /* TODO: Add defualt handling */ |
| 719 | break ; |
Gururaj Patil | 6b8abb3 | 2019-09-23 13:48:29 +0000 | [diff] [blame^] | 720 | } |
| 721 | |
chrmhoffmann | bb97ca4 | 2017-05-13 21:27:44 +0200 | [diff] [blame] | 722 | } |
| 723 | return status ; |
| 724 | } |
| 725 | |
| 726 | eHalStatus csrTdlsProcessLinkEstablish( tpAniSirGlobal pMac, tSmeCmd *cmd ) |
| 727 | { |
| 728 | tTdlsLinkEstablishCmdInfo *tdlsLinkEstablishCmdInfo = &cmd->u.tdlsCmd.u.tdlsLinkEstablishCmdInfo ; |
| 729 | tSirTdlsLinkEstablishReq *tdlsLinkEstablishReq = NULL ; |
| 730 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 731 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); |
| 732 | |
| 733 | if (NULL == pSession) |
| 734 | { |
| 735 | smsLog( pMac, LOGE, FL("pSession is NULL")); |
| 736 | return eHAL_STATUS_FAILURE; |
| 737 | } |
| 738 | |
| 739 | tdlsLinkEstablishReq = vos_mem_malloc(sizeof(tSirTdlsLinkEstablishReq)); |
| 740 | |
| 741 | if (tdlsLinkEstablishReq == NULL) |
| 742 | { |
| 743 | smsLog( pMac, LOGE, FL("alloc failed \n") ); |
| 744 | VOS_ASSERT(0) ; |
| 745 | return status ; |
| 746 | } |
| 747 | tdlsLinkEstablishReq->sessionId = cmd->sessionId; |
| 748 | //Using dialog as transactionId. This can be used to match response with request |
| 749 | tdlsLinkEstablishReq->transactionId = 0; |
| 750 | vos_mem_copy(tdlsLinkEstablishReq->peerMac, |
| 751 | tdlsLinkEstablishCmdInfo->peerMac, sizeof(tSirMacAddr)); |
| 752 | vos_mem_copy(tdlsLinkEstablishReq->bssid, pSession->pConnectBssDesc->bssId, |
| 753 | sizeof (tSirMacAddr)); |
| 754 | vos_mem_copy(tdlsLinkEstablishReq->supportedChannels, |
| 755 | tdlsLinkEstablishCmdInfo->supportedChannels, |
| 756 | tdlsLinkEstablishCmdInfo->supportedChannelsLen); |
| 757 | tdlsLinkEstablishReq->supportedChannelsLen = |
| 758 | tdlsLinkEstablishCmdInfo->supportedChannelsLen; |
| 759 | vos_mem_copy(tdlsLinkEstablishReq->supportedOperClasses, |
| 760 | tdlsLinkEstablishCmdInfo->supportedOperClasses, |
| 761 | tdlsLinkEstablishCmdInfo->supportedOperClassesLen); |
| 762 | tdlsLinkEstablishReq->supportedOperClassesLen = |
| 763 | tdlsLinkEstablishCmdInfo->supportedOperClassesLen; |
| 764 | tdlsLinkEstablishReq->isBufSta = tdlsLinkEstablishCmdInfo->isBufSta; |
| 765 | tdlsLinkEstablishReq->isResponder= tdlsLinkEstablishCmdInfo->isResponder; |
| 766 | tdlsLinkEstablishReq->uapsdQueues= tdlsLinkEstablishCmdInfo->uapsdQueues; |
| 767 | tdlsLinkEstablishReq->maxSp= tdlsLinkEstablishCmdInfo->maxSp; |
| 768 | tdlsLinkEstablishReq->isOffChannelSupported = |
| 769 | tdlsLinkEstablishCmdInfo->isOffChannelSupported; |
| 770 | |
| 771 | // Send the request to PE. |
| 772 | smsLog( pMac, LOGE, "sending TDLS Link Establish Request to PE \n" ); |
| 773 | status = tdlsSendMessage(pMac, eWNI_SME_TDLS_LINK_ESTABLISH_REQ, |
| 774 | (void *)tdlsLinkEstablishReq, |
| 775 | sizeof(tSirTdlsLinkEstablishReq)); |
| 776 | if (!HAL_STATUS_SUCCESS( status ) ) |
| 777 | { |
| 778 | smsLog( pMac, LOGE, FL("Failed to send request to MAC\n")); |
| 779 | } |
| 780 | return status; |
| 781 | } |
| 782 | |
| 783 | // tdlsoffchan |
| 784 | eHalStatus csrTdlsProcessChanSwitchReq( tpAniSirGlobal pMac, tSmeCmd *cmd ) |
| 785 | { |
| 786 | tTdlsChanSwitchCmdInfo *tdlsChanSwitchCmdInfo = &cmd->u.tdlsCmd.u.tdlsChanSwitchCmdInfo ; |
| 787 | tSirTdlsChanSwitch *tdlsChanSwitch = NULL ; |
| 788 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 789 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); |
| 790 | |
| 791 | if (NULL == pSession) |
| 792 | { |
| 793 | smsLog( pMac, LOGE, FL("pSession is NULL")); |
| 794 | return eHAL_STATUS_FAILURE; |
| 795 | } |
| 796 | |
| 797 | tdlsChanSwitch = vos_mem_malloc(sizeof(tSirTdlsChanSwitch)); |
| 798 | if (tdlsChanSwitch == NULL) |
| 799 | { |
| 800 | smsLog( pMac, LOGE, FL("alloc failed \n") ); |
| 801 | VOS_ASSERT(0) ; |
| 802 | return status ; |
| 803 | } |
| 804 | tdlsChanSwitch->sessionId = cmd->sessionId; |
| 805 | //Using dialog as transactionId. This can be used to match response with request |
| 806 | tdlsChanSwitch->transactionId = 0; |
| 807 | vos_mem_copy( tdlsChanSwitch->peerMac, |
| 808 | tdlsChanSwitchCmdInfo->peerMac, sizeof(tSirMacAddr)); |
| 809 | vos_mem_copy(tdlsChanSwitch->bssid, pSession->pConnectBssDesc->bssId, |
| 810 | sizeof (tSirMacAddr)); |
| 811 | |
| 812 | tdlsChanSwitch->tdlsOffCh = tdlsChanSwitchCmdInfo->tdlsOffCh; |
| 813 | tdlsChanSwitch->tdlsOffChBwOffset = tdlsChanSwitchCmdInfo->tdlsOffChBwOffset; |
| 814 | tdlsChanSwitch->tdlsSwMode = tdlsChanSwitchCmdInfo->tdlsSwMode; |
| 815 | |
| 816 | // Send the request to PE. |
| 817 | smsLog( pMac, LOGE, "sending TDLS Channel Switch to PE \n" ); |
| 818 | status = tdlsSendMessage(pMac, eWNI_SME_TDLS_CHANNEL_SWITCH_REQ, |
| 819 | (void *)tdlsChanSwitch, |
| 820 | sizeof(tSirTdlsChanSwitch)); |
| 821 | if (!HAL_STATUS_SUCCESS( status ) ) |
| 822 | { |
| 823 | smsLog( pMac, LOGE, FL("Failed to send request to MAC\n")); |
| 824 | } |
| 825 | return status; |
| 826 | } |
| 827 | |
| 828 | /* |
| 829 | * TDLS Message processor, will be called after TDLS message recieved from |
| 830 | * PE |
| 831 | */ |
| 832 | eHalStatus tdlsMsgProcessor(tpAniSirGlobal pMac, v_U16_t msgType, |
| 833 | void *pMsgBuf) |
| 834 | { |
| 835 | switch(msgType) |
| 836 | { |
| 837 | case eWNI_SME_TDLS_SEND_MGMT_RSP: |
| 838 | { |
| 839 | tSirSmeRsp *pMsg = (tSirSmeRsp*) pMsgBuf; |
| 840 | tCsrRoamInfo roamInfo = {0} ; |
| 841 | |
| 842 | /* remove pending eSmeCommandTdlsDiscovery command */ |
| 843 | csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsSendMgmt) ; |
| 844 | |
| 845 | if (eSIR_SME_SUCCESS != pMsg->statusCode) |
| 846 | { |
| 847 | /* Tx failed, so there wont be any ack confirmation*/ |
| 848 | /* Indicate ack failure to upper layer */ |
| 849 | roamInfo.reasonCode = 0; |
| 850 | csrRoamCallCallback(pMac, pMsg->sessionId, &roamInfo, |
| 851 | 0, eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND, 0); |
| 852 | } |
| 853 | } |
| 854 | break; |
| 855 | case eWNI_SME_TDLS_ADD_STA_RSP: |
| 856 | { |
| 857 | tSirTdlsAddStaRsp *addStaRsp = (tSirTdlsAddStaRsp *) pMsgBuf ; |
| 858 | eCsrRoamResult roamResult ; |
| 859 | tCsrRoamInfo roamInfo = {0} ; |
| 860 | vos_mem_copy( &roamInfo.peerMac, addStaRsp->peerMac, |
| 861 | sizeof(tSirMacAddr)) ; |
| 862 | roamInfo.staId = addStaRsp->staId ; |
| 863 | roamInfo.ucastSig = addStaRsp->ucastSig ; |
| 864 | roamInfo.bcastSig = addStaRsp->bcastSig ; |
| 865 | roamInfo.statusCode = addStaRsp->statusCode ; |
| 866 | /* |
| 867 | * register peer with TL, we have to go through HDD as this is |
| 868 | * the only way to register any STA with TL. |
| 869 | */ |
| 870 | if (addStaRsp->tdlsAddOper == TDLS_OPER_ADD) |
| 871 | roamResult = eCSR_ROAM_RESULT_ADD_TDLS_PEER; |
| 872 | else /* addStaRsp->tdlsAddOper must be TDLS_OPER_UPDATE */ |
| 873 | roamResult = eCSR_ROAM_RESULT_UPDATE_TDLS_PEER; |
| 874 | csrRoamCallCallback(pMac, addStaRsp->sessionId, &roamInfo, 0, |
| 875 | eCSR_ROAM_TDLS_STATUS_UPDATE, |
| 876 | roamResult); |
| 877 | |
| 878 | /* remove pending eSmeCommandTdlsDiscovery command */ |
| 879 | csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsAddPeer) ; |
| 880 | } |
| 881 | break; |
| 882 | case eWNI_SME_TDLS_DEL_STA_RSP: |
| 883 | { |
| 884 | tSirTdlsDelStaRsp *delStaRsp = (tSirTdlsDelStaRsp *) pMsgBuf ; |
| 885 | tCsrRoamInfo roamInfo = {0} ; |
| 886 | |
| 887 | vos_mem_copy( &roamInfo.peerMac, delStaRsp->peerMac, |
| 888 | sizeof(tSirMacAddr)) ; |
| 889 | roamInfo.staId = delStaRsp->staId ; |
| 890 | roamInfo.statusCode = delStaRsp->statusCode ; |
| 891 | /* |
| 892 | * register peer with TL, we have to go through HDD as this is |
| 893 | * the only way to register any STA with TL. |
| 894 | */ |
| 895 | csrRoamCallCallback(pMac, delStaRsp->sessionId, &roamInfo, 0, |
| 896 | eCSR_ROAM_TDLS_STATUS_UPDATE, |
| 897 | eCSR_ROAM_RESULT_DELETE_TDLS_PEER); |
| 898 | |
| 899 | csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsDelPeer) ; |
| 900 | } |
| 901 | break; |
| 902 | case eWNI_SME_TDLS_DEL_STA_IND: |
| 903 | { |
| 904 | tpSirTdlsDelStaInd pSirTdlsDelStaInd = (tpSirTdlsDelStaInd) pMsgBuf ; |
| 905 | tCsrRoamInfo roamInfo = {0} ; |
| 906 | vos_mem_copy( &roamInfo.peerMac, pSirTdlsDelStaInd->peerMac, |
| 907 | sizeof(tSirMacAddr)) ; |
| 908 | roamInfo.staId = pSirTdlsDelStaInd->staId ; |
| 909 | roamInfo.reasonCode = pSirTdlsDelStaInd->reasonCode ; |
| 910 | |
| 911 | /* Sending the TEARDOWN indication to HDD. */ |
| 912 | csrRoamCallCallback(pMac, pSirTdlsDelStaInd->sessionId, &roamInfo, 0, |
| 913 | eCSR_ROAM_TDLS_STATUS_UPDATE, |
| 914 | eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND); |
| 915 | break ; |
| 916 | } |
| 917 | case eWNI_SME_TDLS_DEL_ALL_PEER_IND: |
| 918 | { |
| 919 | tpSirTdlsDelAllPeerInd pSirTdlsDelAllPeerInd = (tpSirTdlsDelAllPeerInd) pMsgBuf ; |
| 920 | tCsrRoamInfo roamInfo = {0} ; |
| 921 | |
| 922 | /* Sending the TEARDOWN indication to HDD. */ |
| 923 | csrRoamCallCallback(pMac, pSirTdlsDelAllPeerInd->sessionId, &roamInfo, 0, |
| 924 | eCSR_ROAM_TDLS_STATUS_UPDATE, |
| 925 | eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND); |
| 926 | break ; |
| 927 | } |
| 928 | case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND: |
| 929 | { |
| 930 | tpSirMgmtTxCompletionInd pSirTdlsDelAllPeerInd = (tpSirMgmtTxCompletionInd) pMsgBuf ; |
| 931 | tCsrRoamInfo roamInfo = {0} ; |
| 932 | roamInfo.reasonCode = pSirTdlsDelAllPeerInd->txCompleteStatus; |
| 933 | |
| 934 | csrRoamCallCallback(pMac, pSirTdlsDelAllPeerInd->sessionId, &roamInfo, |
| 935 | 0, eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND, 0); |
| 936 | break; |
| 937 | } |
| 938 | case eWNI_SME_TDLS_LINK_ESTABLISH_RSP: |
| 939 | { |
| 940 | tSirTdlsLinkEstablishReqRsp *linkEstablishReqRsp = (tSirTdlsLinkEstablishReqRsp *) pMsgBuf ; |
| 941 | tCsrRoamInfo roamInfo = {0} ; |
| 942 | #if 0 |
| 943 | vos_mem_copy(&roamInfo.peerMac, delStaRsp->peerMac, |
| 944 | sizeof(tSirMacAddr)) ; |
| 945 | roamInfo.staId = delStaRsp->staId ; |
| 946 | roamInfo.statusCode = delStaRsp->statusCode ; |
| 947 | #endif |
| 948 | csrRoamCallCallback(pMac, linkEstablishReqRsp->sessionId, &roamInfo, 0, |
| 949 | eCSR_ROAM_TDLS_STATUS_UPDATE, |
| 950 | eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP); |
| 951 | /* remove pending eSmeCommandTdlsLinkEstablish command */ |
| 952 | csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsLinkEstablish); |
| 953 | break; |
| 954 | } |
| 955 | |
| 956 | case eWNI_SME_TDLS_CHANNEL_SWITCH_RSP: |
| 957 | { |
| 958 | #if 0 |
| 959 | tSirTdlsChanSwitchReqRsp *ChanSwitchReqRsp = (tSirTdlsChanSwitchReqRsp *) pMsgBuf ; |
| 960 | tCsrRoamInfo roamInfo = {0} ; |
| 961 | vos_mem_copy(&roamInfo.peerMac, delStaRsp->peerMac, |
| 962 | sizeof(tSirMacAddr)) ; |
| 963 | roamInfo.staId = delStaRsp->staId ; |
| 964 | roamInfo.statusCode = delStaRsp->statusCode ; |
| 965 | csrRoamCallCallback(pMac, ChanSwitchReqRsp->sessionId, &roamInfo, 0, |
| 966 | eCSR_ROAM_TDLS_STATUS_UPDATE, |
| 967 | eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP); |
| 968 | #endif |
| 969 | /* remove pending eSmeCommandTdlsChanSwitch command */ |
| 970 | csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsChannelSwitch); |
| 971 | break; |
| 972 | } |
| 973 | default: |
| 974 | { |
| 975 | break ; |
| 976 | } |
| 977 | } |
| 978 | |
| 979 | return eHAL_STATUS_SUCCESS ; |
| 980 | } |
| 981 | #endif |