blob: 94876c49a6d647bb49a8d73539da5e8615bf1d45 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Jeff Johnson32d95a32012-09-10 13:15:23 -07002 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -07003 *
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
24 b a p A p i L i n k C n t l . C
25
26 OVERVIEW:
27
28 This software unit holds the implementation of the WLAN BAP modules
29 Link Control functions.
30
31 The functions externalized by this module are to be called ONLY by other
32 WLAN modules (HDD) that properly register with the BAP Layer initially.
33
34 DEPENDENCIES:
35
36 Are listed for each API below.
37
38
39 Copyright (c) 2008 QUALCOMM Incorporated.
40 All Rights Reserved.
41 Qualcomm Confidential and Proprietary
42===========================================================================*/
43
44/*===========================================================================
45
46 EDIT HISTORY FOR FILE
47
48
49 This section contains comments describing changes made to the module.
50 Notice that changes are listed in reverse chronological order.
51
52
53 $Header: /home/labuser/ampBlueZ_2/CORE/BAP/src/bapApiLinkCntl.c,v 1.1 2010/10/23 23:40:28 labuser Exp labuser $$DateTime$$Author: labuser $
54
55
56 when who what, where, why
57---------- --- --------------------------------------------------------
582008-09-15 jez Created module
59
60===========================================================================*/
61
62/*----------------------------------------------------------------------------
63 * Include Files
64 * -------------------------------------------------------------------------*/
65//#include "wlan_qct_tl.h"
66#include "vos_trace.h"
67// Pick up the CSR callback definition
68#include "csrApi.h"
69
70/* BT-AMP PAL API header file */
71#include "bapApi.h"
72#include "bapInternal.h"
73#include "btampFsm.h"
74
75//#define BAP_DEBUG
76/*----------------------------------------------------------------------------
77 * Preprocessor Definitions and Constants
78 * -------------------------------------------------------------------------*/
79
80
81/*----------------------------------------------------------------------------
82 * Type Declarations
83 * -------------------------------------------------------------------------*/
84
85/*----------------------------------------------------------------------------
86 * Global Data Definitions
87 * -------------------------------------------------------------------------*/
88
89/*----------------------------------------------------------------------------
90 * Static Variable Definitions
91 * -------------------------------------------------------------------------*/
92
93/*----------------------------------------------------------------------------
94 * Static Function Declarations and Definitions
95 * -------------------------------------------------------------------------*/
96
97/*----------------------------------------------------------------------------
98 * Externalized Function Definitions
99* -------------------------------------------------------------------------*/
100
101/*----------------------------------------------------------------------------
102 * Function Declarations and Documentation
103 * -------------------------------------------------------------------------*/
104
105/*----------------------------------------------------------------------------
106
107 FUNCTION WLANBAP_RoamCallback()
108
109 DESCRIPTION
110 Callback for Roam (connection status) Events
111
112 DEPENDENCIES
113 NA.
114
115 PARAMETERS
116
117 IN
118 pContext: is the pContext passed in with the roam request
119 pCsrRoamInfo: is a pointer to a tCsrRoamInfo, see definition of eRoamCmdStatus and
120 eRoamCmdResult: for detail valid members. It may be NULL
121 roamId: is to identify the callback related roam request. 0 means unsolicited
122 roamStatus: is a flag indicating the status of the callback
123 roamResult: is the result
124
125 RETURN VALUE
126 The eHalStatus code associated with performing the operation
127
128 eHAL_STATUS_SUCCESS: Success
129
130 SIDE EFFECTS
131
132----------------------------------------------------------------------------*/
133#if 0
134eCSR_ROAM_RESULT_WDS_STARTED
135#define eWLAN_BAP_MAC_START_BSS_SUCCESS /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_STARTED */
136
137eCSR_ROAM_RESULT_FAILURE
138eCSR_ROAM_RESULT_NOT_ASSOCIATED
139#define eWLAN_BAP_MAC_START_FAILS /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_FAILURE or eCSR_ROAM_RESULT_NOT_ASSOCIATED */
140
141eCSR_ROAM_RESULT_WDS_ASSOCIATED
142#define eWLAN_BAP_MAC_CONNECT_COMPLETED /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_ASSOCIATED */
143
144
145eCSR_ROAM_RESULT_FAILURE
146eCSR_ROAM_RESULT_NOT_ASSOCIATED
147#define eWLAN_BAP_MAC_CONNECT_FAILED /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_FAILURE or eCSR_ROAM_RESULT_NOT_ASSOCIATED */
148
149
150eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND
151#define eWLAN_BAP_MAC_CONNECT_INDICATION /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND */
152
153
154eCSR_ROAM_RESULT_KEY_SET
155#define eWLAN_BAP_MAC_KEY_SET_SUCCESS /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_KEY_SET */
156
157
158eCSR_ROAM_RESULT_WDS_DISASSOC_IND
159#define eWLAN_BAP_MAC_INDICATES_MEDIA_DISCONNECTION /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_DISASSOC_IND */
160
161
162eCSR_ROAM_RESULT_WDS_STOPPED
163#define eWLAN_BAP_MAC_READY_FOR_CONNECTIONS /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_STOPPED */
164
165#endif //0
166
167
168eHalStatus
169WLANBAP_RoamCallback
170(
171 void *pContext,
172 tCsrRoamInfo *pCsrRoamInfo,
173 tANI_U32 roamId,
174 eRoamCmdStatus roamStatus,
175 eCsrRoamResult roamResult
176)
177{
178 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
179 /* btampContext value */
180 ptBtampContext btampContext = (ptBtampContext) pContext;
181 tWLAN_BAPEvent bapEvent; /* State machine event */
182 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
183 v_U8_t status; /* return the BT-AMP status here */
184 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
185
186 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, before switch on roamStatus = %d", __FUNCTION__, roamStatus);
187
188 switch (roamStatus) {
189 //JEZ081110: For testing purposes, with Infra STA as BT STA, this
190 //actually takes care of the "eCSR_ROAM_RESULT_WDS_STARTED" case,
191 //below, better than "eCSR_ROAM_RESULT_IBSS_STARTED".
192 //case eCSR_ROAM_ROAMING_START:
193 case eCSR_ROAM_ASSOCIATION_START:
194 /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_STARTED */
195 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_ROAMING_START", roamResult);
196 // This only gets called when CSR decides to roam on its own - due to lostlink.
197#if 0
198 if ((pCsrRoamInfo) && (pCsrRoamInfo->pConnectedProfile) && (pCsrRoamInfo->pConnectedProfile->pBssDesc))
199 {
200 memcpy(bssid.ether_addr_octet, pCsrRoamInfo->pConnectedProfile->pBssDesc->bssId,
201 sizeof(tSirMacAddr));
202 apple80211Interface->willRoam(&bssid); // Return result isn't significant
203 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: willRoam returns\n", __FUNCTION__);
204 }
205#endif //0
206 /* Fill in the event structure */
207 bapEvent.event = eWLAN_BAP_MAC_START_BSS_SUCCESS;
208 bapEvent.params = pCsrRoamInfo;
209 bapEvent.u1 = roamStatus;
210 bapEvent.u2 = roamResult;
211
212 /* Handle event */
213 vosStatus = btampFsm(btampContext, &bapEvent, &status);
214
215 break;
216
217 case eCSR_ROAM_SET_KEY_COMPLETE:
218 /* bapRoamCompleteCallback with eCSR_ROAM_SET_KEY_COMPLETE */
219 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)", __FUNCTION__, "eCSR_ROAM_SET_KEY_COMPLETE", roamStatus);
220
221 /* Fill in the event structure */
222 bapEvent.event = eWLAN_BAP_MAC_KEY_SET_SUCCESS;
223 bapEvent.params = pCsrRoamInfo;
224 bapEvent.u1 = roamStatus;
225 bapEvent.u2 = roamResult;
226
227 /* Handle event */
228 vosStatus = btampFsm(btampContext, &bapEvent, &status);
229
230 break;
231
232 case eCSR_ROAM_DISASSOCIATED:
233 /* bapRoamCompleteCallback with eCSR_ROAM_DISASSOCIATED */
234 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)", __FUNCTION__, "eCSR_ROAM_DISASSOCIATED", roamStatus);
235 case eCSR_ROAM_LOSTLINK:
236 /* bapRoamCompleteCallback with eCSR_ROAM_LOSTLINK */
237 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamStatus = %s (%d)", __FUNCTION__, "eCSR_ROAM_LOSTLINK", roamStatus);
238
239 if (roamResult != eCSR_ROAM_RESULT_NONE) {
240 /* Fill in the event structure */
241 bapEvent.event = eWLAN_BAP_MAC_READY_FOR_CONNECTIONS;
242 bapEvent.params = pCsrRoamInfo;
243 bapEvent.u1 = roamStatus;
244 bapEvent.u2 = roamResult;
245
246 /* Handle event */
247 vosStatus = btampFsm(btampContext, &bapEvent, &status);
248 }
249
250 break;
251
252 default:
253 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, unsupported CSR roamStatus = %d", __FUNCTION__, roamStatus);
254
255 break;
256 }
257
258 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, before switch on roamResult = %d", __FUNCTION__, roamResult);
259
260 switch (roamResult) {
261 //JEZ081110: Commented out for testing. Test relies upon IBSS.
262 case eCSR_ROAM_RESULT_IBSS_STARTED:
263 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_IBSS_STARTED", roamResult);
264 case eCSR_ROAM_RESULT_WDS_STARTED:
265 /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_STARTED */
266 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_WDS_STARTED", roamResult);
267
268 /* Fill in the event structure */
269 bapEvent.event = eWLAN_BAP_MAC_START_BSS_SUCCESS;
270 bapEvent.params = pCsrRoamInfo;
271 bapEvent.u1 = roamStatus;
272 bapEvent.u2 = roamResult;
273
274 /* Handle event */
275 vosStatus = btampFsm(btampContext, &bapEvent, &status);
276
277 break;
278
279 //JEZ081110: Commented out for testing. Test relies upon IBSS.
280 //JEZ081110: But I cannot rely upon IBSS for the initial testing.
281 case eCSR_ROAM_RESULT_FAILURE:
282 //case eCSR_ROAM_RESULT_NOT_ASSOCIATED:
283 //case eCSR_ROAM_RESULT_IBSS_START_FAILED:
284 /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_FAILURE or eCSR_ROAM_RESULT_NOT_ASSOCIATED */
285 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_FAILURE", roamResult);
286#ifdef FEATURE_WLAN_BTAMP_UT_RF
287 break;
288#endif
289 case eCSR_ROAM_RESULT_WDS_START_FAILED:
290 /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_START_FAILED */
291 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_WDS_START_FAILED", roamResult);
292
293 /* Fill in the event structure */
294 /* I don't think I should signal a eCSR_ROAM_RESULT_FAILURE
295 * as a eWLAN_BAP_MAC_START_FAILS
296 */
297 bapEvent.event = eWLAN_BAP_MAC_START_FAILS;
298 bapEvent.params = pCsrRoamInfo;
299 bapEvent.u1 = roamStatus;
300 bapEvent.u2 = roamResult;
301
302 /* Handle event */
303 vosStatus = btampFsm(btampContext, &bapEvent, &status);
304
305 break;
306
307 //JEZ081110: Commented out for testing. This handles both Infra STA and IBSS STA.
308 case eCSR_ROAM_RESULT_IBSS_CONNECT:
309 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_IBSS_CONNECT", roamResult);
310 case eCSR_ROAM_RESULT_ASSOCIATED:
311 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_ASSOCIATED", roamResult);
312 case eCSR_ROAM_RESULT_WDS_ASSOCIATED:
313 /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_ASSOCIATED */
314 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_WDS_ASSOCIATED", roamResult);
315
316 /* Fill in the event structure */
317 bapEvent.event = eWLAN_BAP_MAC_CONNECT_COMPLETED;
318 bapEvent.params = pCsrRoamInfo;
319 bapEvent.u1 = roamStatus;
320 bapEvent.u2 = roamResult;
321
322 /* Handle event */
323 vosStatus = btampFsm(btampContext, &bapEvent, &status);
324
325 break;
326
327 //JEZ081110: Commented out for testing. Test relies upon IBSS.
328 //JEZ081110: But I cannot rely upon IBSS for the initial testing.
329 //case eCSR_ROAM_RESULT_FAILURE:
330 case eCSR_ROAM_RESULT_IBSS_START_FAILED:
331 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_IBSS_START_FAILED", roamResult);
332 case eCSR_ROAM_RESULT_NOT_ASSOCIATED:
333 /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_FAILURE or eCSR_ROAM_RESULT_NOT_ASSOCIATED */
334 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_NOT_ASSOCIATED", roamResult);
335#ifdef FEATURE_WLAN_BTAMP_UT_RF
336 break;
337#endif
338 case eCSR_ROAM_RESULT_WDS_NOT_ASSOCIATED:
339 /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_NOT_ASSOCIATED */
340 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_WDS_NOT_ASSOCIATED", roamResult);
341
342 /* Fill in the event structure */
343 bapEvent.event = eWLAN_BAP_MAC_CONNECT_FAILED;
344 bapEvent.params = pCsrRoamInfo;
345 bapEvent.u1 = roamStatus;
346 bapEvent.u2 = roamResult;
347
348 /* Handle event */
349 vosStatus = btampFsm(btampContext, &bapEvent, &status);
350
351 break;
352
353 //JEZ081110: I think I have to check for the bssType to
354 //differentiate between IBSS Start and IBSS Join success.
355 //case eCSR_ROAM_RESULT_IBSS_CONNECT:
356 //VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_IBSS_CONNECT", roamResult);
357
358 //JEZ081110: Commented out for testing. Test relies upon IBSS.
359 // No longer commented out.
360 case eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND:
361 /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND */
362 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND", roamResult);
363
364 /* Fill in the event structure */
365 bapEvent.event = eWLAN_BAP_MAC_CONNECT_INDICATION;
366 bapEvent.params = pCsrRoamInfo;
367 bapEvent.u1 = roamStatus;
368 bapEvent.u2 = roamResult;
369
370 /* Handle event */
371 vosStatus = btampFsm(btampContext, &bapEvent, &status);
372
373 /* If BAP doesn't like the incoming association, signal SME/CSR */
374 if ( status != WLANBAP_STATUS_SUCCESS)
375 halStatus = eHAL_STATUS_FAILURE;
376
377 break;
378
379 //JEZ081110: Not supported in SME and CSR, yet.
380#if 0
381 case eCSR_ROAM_RESULT_KEY_SET:
382 /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_KEY_SET */
383 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_KEY_SET", roamResult);
384
385 /* Fill in the event structure */
386 bapEvent.event = eWLAN_BAP_MAC_KEY_SET_SUCCESS;
387 bapEvent.params = pCsrRoamInfo;
388 bapEvent.u1 = roamStatus;
389 bapEvent.u2 = roamResult;
390
391 /* Handle event */
392 vosStatus = btampFsm(btampContext, &bapEvent, &status);
393
394 break;
395#endif //0
396
397 case eCSR_ROAM_RESULT_DISASSOC_IND:
398 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_DISASSOC_IND", roamResult);
399 case eCSR_ROAM_RESULT_WDS_DISASSOCIATED:
400 /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_DISASSOCIATED */
401 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_WDS_DISASSOCIATED", roamResult);
402
403 /* Fill in the event structure */
404 bapEvent.event = eWLAN_BAP_MAC_INDICATES_MEDIA_DISCONNECTION;
405 bapEvent.params = pCsrRoamInfo;
406 bapEvent.u1 = roamStatus;
407 bapEvent.u2 = roamResult;
408
409 /* Handle event */
410 vosStatus = btampFsm(btampContext, &bapEvent, &status);
411
412 /* Fill in the event structure */
413 bapEvent.event = eWLAN_BAP_MAC_READY_FOR_CONNECTIONS;
414 bapEvent.params = pCsrRoamInfo;
415 bapEvent.u1 = roamStatus;
416 bapEvent.u2 = roamResult;
417
418 /* Handle event */
419 vosStatus = btampFsm(btampContext, &bapEvent, &status);
420
421 break;
422
423 //JEZ081110: Commented out for testing. Test relies upon IBSS.
424 case eCSR_ROAM_RESULT_IBSS_INACTIVE:
425 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_IBSS_INACTIVE", roamResult);
426 case eCSR_ROAM_RESULT_WDS_STOPPED:
427 /* bapRoamCompleteCallback with eCSR_ROAM_RESULT_WDS_STOPPED */
428 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, CSR roamResult = %s (%d)", __FUNCTION__, "eCSR_ROAM_RESULT_WDS_STOPPED", roamResult);
429
430 /* Fill in the event structure */
431 bapEvent.event = eWLAN_BAP_MAC_READY_FOR_CONNECTIONS;
432 bapEvent.params = pCsrRoamInfo;
433 bapEvent.u1 = roamStatus;
434 bapEvent.u2 = roamResult;
435
436 /* Handle event */
437 vosStatus = btampFsm(btampContext, &bapEvent, &status);
438
439 break;
440
441 default:
442 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, unsupported CSR roamResult = %d", __FUNCTION__, roamResult);
443
444 break;
445 }
446
447#if 0
448 switch (roamResult) {
449 case eCSR_ROAM_RESULT_IBSS_CONNECT:
450 // we have an IBSS connection...
451
452 // update our state
453 btampContext->mAssociatedStatus = WLANBAP_STATUS_SUCCESS;
454 btampContext->mAssociated = VOS_TRUE;
455 // update "assocBssid" with the BSSID of the IBSS
456 if (pCsrRoamInfo)
457 memcpy(btampContext->assocBssid, pCsrRoamInfo->peerMacOrBssidForIBSS, 6);
458
459 // We must update the system role to match that of the
460 // lower layers in case the upper layers decided to try
461 // joining the network in infrastructure mode if the
462 // initial join in IBSS mode fails. Andreas Wolf
463 // (awolf@apple.com) explains the behavior as follows:
464 // "If the client attempts to join an open network and it fails
465 // on the first attempt, it reverts back to b-only mode. This
466 // workaround was specifically put in place to allow the client
467 // to associate to some third party b-only infrastructure APs.
468 // It did not take IBSS into account, it seems that the fallback
469 // always forces infrastructure."
470
471 btampContext->systemRole = eSYSTEM_STA_IN_IBSS_ROLE;
472
473 if (mLinkStatus == 0)
474 {
475 // enable the flow of data
476 DBGLOG("%s: marking link as up in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_IBSS_CONNECT");
477 mLinkStatus = 1;
478 ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkUp);
479 outputQueue->setCapacity(TRANSMIT_QUEUE_SIZE);
480 outputQueue->start();
481 // Let them know we are ready
482 ((IO80211Interface*) mNetworkIF)->postMessage(APPLE80211_M_ASSOC_DONE);
483 }
484 else
485 {
486 DBGLOG("%s: link is already up in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_IBSS_CONNECT");
487 }
488 break;
489
490 case eCSR_ROAM_RESULT_IBSS_INACTIVE:
491 // we have no more IBSS peers, so disable the flow of data
492 if (mLinkStatus != 0)
493 {
494 DBGLOG("%s: marking link as down in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_IBSS_INACTIVE");
495 mLinkStatus = (tANI_U8) 0;
496 // JEZ070627: Revisit ?
497 ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkDown);
498 outputQueue->stop();
499 outputQueue->setCapacity(0);
500
501 // update our state
502 btampContext->mAssociated = false;
503 }
504 else
505 {
506 DBGLOG("%s: link already down in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_IBSS_INACTIVE");
507 }
508
509 break;
510
511 case eCSR_ROAM_RESULT_ASSOCIATED:
512 btampContext->mAssociatedStatus = APPLE80211_STATUS_SUCCESS;
513 btampContext->mAssociated = true;
514
515 if ((pCsrRoamInfo) && (pCsrRoamInfo->pBssDesc)) {
516 ccpCsrToAppleScanResult(mPMacObject, pCsrRoamInfo->pBssDesc, &scanResult);
517
518 /* Save away the IEs used by the AP */
519 ccpCsrToAssocApiedata( mPMacObject, pCsrRoamInfo->pBssDesc, &(btampContext->apiedata));
520
521 if (BssidChanged((tCsrBssid*) btampContext->assocBssid, (ether_addr*) scanResult.asr_bssid)) {
522 memcpy(btampContext->assocBssid, scanResult.asr_bssid, 6);
523 ((IO80211Interface*) mNetworkIF)->postMessage(APPLE80211_M_BSSID_CHANGED );
524 }
525 }
526
527 ((IO80211Interface*) mNetworkIF)->postMessage(APPLE80211_M_ASSOC_DONE);
528
529 if (mLinkStatus == 0)
530 {
531 mLinkStatus = (tANI_U8) 1;
532 ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkUp);
533 DBGLOG("%s: marking link as up in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_ASSOCIATED");
534 outputQueue->setCapacity(TRANSMIT_QUEUE_SIZE);
535 outputQueue->start();
536 }
537 else
538 {
539 DBGLOG("%s: link is already up in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_ASSOCIATED");
540 }
541 break;
542 case eCSR_ROAM_RESULT_NOT_ASSOCIATED:
543 btampContext->mAssociatedStatus = APPLE80211_STATUS_UNAVAILABLE;
544 btampContext->mAssociated = false;
545
546 if (mLinkStatus != 0)
547 {
548 DBGLOG("%s: marking link as down in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_NOT_ASSOCIATED");
549 mLinkStatus = (tANI_U8) 0;
550 ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkDown);
551 }
552 else
553 {
554 DBGLOG("%s: link already down in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_NOT_ASSOCIATED");
555 }
556 break;
557
558 case eCSR_ROAM_RESULT_FAILURE:
559 btampContext->mAssociatedStatus = APPLE80211_STATUS_UNSPECIFIED_FAILURE;
560 btampContext->mAssociated = false;
561
562 if (mLinkStatus != 0)
563 {
564 DBGLOG("%s: marking link as down in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_FAILURE");
565 mLinkStatus = (tANI_U8) 0;
566 ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkDown);
567 }
568 else
569 {
570 DBGLOG("%s: link already down in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_FAILURE");
571 }
572 break;
573
574 case eCSR_ROAM_RESULT_DISASSOC_IND:
575 {
576 btampContext->mAssociated = false;
577
578 if (mLinkStatus != 0)
579 {
580 DBGLOG("%s: marking link as down in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_DISASSOC_IND");
581 mLinkStatus = (tANI_U8) 0;
582 ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkDown);
583 }
584 else
585 {
586 DBGLOG("%s: link already down in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_DISASSOC_IND");
587 }
588
589 //if (pCsrRoamInfo) // For now, leave this commented out. Until CSR changes integrated.
590 {
591 // Now set the reason and status codes.
592 // Actually, the "result code" field in the tSirSmeDisassocInd should be named reasonCode and NOT statusCode.
593 // "Reason Codes" are found in DisAssoc or DeAuth Ind. "Status Code" fields are found in Rsp Mgmt Frame.
594 // For now, we are going to have to (painfully) map the only "result code" type information we have
595 // available at ALL from LIM/CSR. And that is the statusCode field of type tSirResultCodes
596 // BTW, tSirResultCodes is the COMPLETELY WRONG TYPE for this "result code" field. It SHOULD be
597 // of type tSirMacReasonCodes.
598 // Right now, we don't even have that. So, I have to just make up some "reason code" that I will
599 // pretend I found in the incoming DisAssoc Indication.
600 //btampContext->statusCode = ((tpSirSmeDisassocInd) pCallbackInfo)->statusCode; // tSirResultCodes
601 //btampContext->reasonCode = ((tpSirSmeDisassocInd) pCallbackInfo)->statusCode; // tSirResultCodes
602 btampContext->reasonCode = (tANI_U16) eSIR_MAC_UNSPEC_FAILURE_REASON; //tANI_U16 // tSirMacReasonCodes
603 btampContext->deAuthReasonCode = 0; // tANI_U16 // eSIR_SME_DEAUTH_FROM_PEER
604 // Shouldn't the next line really use a tANI_U16? //0; // tANI_U16 // eSIR_SME_DISASSOC_FROM_PEER
605 btampContext->disassocReasonCode = btampContext->reasonCode; // tSirMacReasonCodes
606 // Let's remember the peer who just disassoc'd us
607 //memcpy(btampContext->peerMacAddr, pCsrRoamInfo->peerMacOrBssidForIBSS, 6);
608 }
609 }
610 break;
611
612 case eCSR_ROAM_RESULT_DEAUTH_IND:
613 {
614 btampContext->mAssociated = false;
615
616 if (mLinkStatus != 0)
617 {
618 DBGLOG("%s: marking link as down in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_DEAUTH_IND");
619 mLinkStatus = (tANI_U8) 0;
620 ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkDown);
621 }
622 else
623 {
624 DBGLOG("%s: link already down in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_DEAUTH_IND");
625 }
626
627 //if (pCsrRoamInfo) // For now, leave this commented out. Until CSR changes integrated.
628 {
629 // Now set the reason and status codes.
630 // Actually, the "result code" field in the tSirSmeDeauthInd should be named reasonCode and NOT statusCode.
631 // "Reason Codes" are found in DisAssoc or DeAuth Ind. "Status Code" fields are found in Rsp Mgmt Frame.
632 // For now, we are going to have to (painfully) map the only "result code" type information we have
633 // available at ALL from LIM/CSR. And that is the statusCode field of type tSirResultCodes
634 // BTW, tSirResultCodes is the COMPLETELY WRONG TYPE for this "result code" field. It SHOULD be
635 // of type tSirMacReasonCodes.
636 // Right now, we don't even have that. So, I have to just make up some "reason code" that I will
637 // pretend I found in the incoming DeAuth Indication.
638 //btampContext->statusCode = ((tpSirSmeDeauthInd) pCallbackInfo)->statusCode; // tSirResultCodes
639 //btampContext->reasonCode = ((tpSirSmeDeauthInd) pCallbackInfo)->statusCode; // tSirResultCodes
640 btampContext->reasonCode = (tANI_U16) eSIR_MAC_UNSPEC_FAILURE_REASON; //tANI_U16 // tSirMacReasonCodes
641 btampContext->disassocReasonCode = 0; // tANI_U16 // eSIR_SME_DISASSOC_FROM_PEER
642 // Shouldn't the next line really use a tANI_U16? //0; // tANI_U16 // eSIR_SME_DEAUTH_FROM_PEER
643 btampContext->deAuthReasonCode = btampContext->reasonCode; // tSirMacReasonCodes
644 // Let's remember the peer who just de-auth'd us
645 //memcpy(btampContext->peerMacAddr, ((tpSirSmeDeauthInd) pCallbackInfo)->peerMacAddr, 6);
646 }
647 }
648 break;
649
650 case eCSR_ROAM_RESULT_MIC_ERROR_UNICAST:
651
652 //if (eCSR_ROAM_MIC_ERROR_IND == roamStatus) // Make sure
653 {
654 if (btampContext->mTKIPCounterMeasures)
655 {
656 ((IO80211Interface*) mNetworkIF)->postMessage(APPLE80211_M_MIC_ERROR_UCAST);
657 DBGLOG("%s: TKIP Countermeasures in effect in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_MIC_ERROR_UNICAST");
658 }
659 else
660 {
661 DBGLOG("%s: TKIP Countermeasures disabled in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_MIC_ERROR_UNICAST");
662 }
663 }
664 break;
665
666 case eCSR_ROAM_RESULT_MIC_ERROR_GROUP:
667
668 //if (eCSR_ROAM_MIC_ERROR_IND == roamStatus) // Make sure
669 {
670 if (btampContext->mTKIPCounterMeasures)
671 {
672 ((IO80211Interface*) mNetworkIF)->postMessage(APPLE80211_M_MIC_ERROR_MCAST);
673 DBGLOG("%s: TKIP Countermeasures in effect in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_MIC_ERROR_GROUP");
674 }
675 else
676 {
677 DBGLOG("%s: TKIP Countermeasures disabled in %s\n", __FUNCTION__, "eCSR_ROAM_RESULT_MIC_ERROR_GROUP");
678 }
679 }
680 break;
681
682 default:
683 break;
684 }
685 switch (roamStatus) {
686 case eCSR_ROAM_ROAMING_START:
687 DBGLOG("%s: In %s\n", __FUNCTION__, "eCSR_ROAM_ROAMING_START");
688 // This only gets called when CSR decides to roam on its own - due to lostlink.
689 // Apple still needs to be told.
690 if ((pCsrRoamInfo) && (pCsrRoamInfo->pConnectedProfile) && (pCsrRoamInfo->pConnectedProfile->pBssDesc))
691 {
692 memcpy(bssid.ether_addr_octet, pCsrRoamInfo->pConnectedProfile->pBssDesc->bssId,
693 sizeof(tSirMacAddr));
694 apple80211Interface->willRoam(&bssid); // Return result isn't significant
695 DBGLOG("%s: willRoam returns\n", __FUNCTION__);
696 }
697 break;
698
699 case eCSR_ROAM_SHOULD_ROAM:
700 if ((pCsrRoamInfo) && (pCsrRoamInfo->pBssDesc)) {
701 // pCallbackInfo points to the BSS desc. Convert to Apple Scan Result.
702 halStatus = ccpCsrToAppleScanResult(
703 mPMacObject,
704 pCsrRoamInfo->pBssDesc,
705 &scanResult);
706 if ( halStatus != 0 )
707 return eHAL_STATUS_FAILURE;
708 roamAccepted = apple80211Interface->shouldRoam(&scanResult); // Return result is crucial
709 if (roamAccepted == true) {
710 // If the roam is acceptable, return SUCCESS
711 DBGLOG("%s: shouldRoam returns \"acceptable\"\n", __FUNCTION__);
712//#if 0
713 // Actually, before returning, immediately signal willRoam
714 // This is a workaround for a CSR bug. Eventually, when
715 // eCSR_ROAM_ASSOCIATION_START gets called WITH callback param p1
716 // pointing to a tBssDescription, this work-around can be removed.
717 memcpy(bssid.ether_addr_octet, pCsrRoamInfo->pBssDesc->bssId, sizeof(tSirMacAddr));
718 apple80211Interface->willRoam(&bssid); // Return result isn't significant
719 DBGLOG("%s: willRoam (called out of order) returns\n", __FUNCTION__);
720 DBGLOG(" with BSSID = " MAC_ADDR_STRING(bssid.ether_addr_octet));
721//#endif
722 return eHAL_STATUS_SUCCESS;
723 } else {
724 // If the roam is NOT acceptable, return FAILURE
725 DBGLOG("%s: shouldRoam returns \"NOT acceptable\"\n", __FUNCTION__);
726 return eHAL_STATUS_FAILURE;
727 }
728 }
729 break;
730
731 case eCSR_ROAM_DISASSOCIATED:
732 //if (eCSR_ROAM_RESULT_FORCED == roamResult || eCSR_ROAM_RESULT_MIC_ERROR == roamResult)
733 {
734 btampContext->mAssociated = false;
735
736 if (mLinkStatus != 0)
737 {
738 DBGLOG("%s: marking link as down in %s\n", __FUNCTION__, "eCSR_ROAM_DISASSOCIATED");
739 mLinkStatus = (tANI_U8) 0;
740 ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkDown);
741 }
742 else
743 {
744 DBGLOG("%s: link already down in %s\n", __FUNCTION__, "eCSR_ROAM_DISASSOCIATED");
745 }
746 }
747 break;
748
749 case eCSR_ROAM_LOSTLINK:
750 btampContext->mAssociatedStatus = APPLE80211_STATUS_UNSPECIFIED_FAILURE;
751 btampContext->mAssociated = false;
752
753 if (mLinkStatus != 0)
754 {
755 DBGLOG("%s: marking link as down in %s\n", __FUNCTION__, "eCSR_ROAM_LOSTLINK");
756 mLinkStatus = (tANI_U8) 0;
757 ((IO80211Interface*) mNetworkIF)->setLinkState(kIO80211NetworkLinkDown);
758 }
759 else
760 {
761 DBGLOG("%s: link already down in %s\n", __FUNCTION__, "eCSR_ROAM_LOSTLINK");
762 }
763 break;
764
765 case eCSR_ROAM_ASSOCIATION_START:
766 DBGLOG("%s: In %s\n", __FUNCTION__, "eCSR_ROAM_ASSOCIATION_START");
767#if 0
768 // This is the right place to call willRoam - for an "initial" association.
769 // But, unfortunately, when eCSR_ROAM_ASSOCIATION_START gets called,
770 // it doesn't have a pointer to the tBssDescription in the roaming callback
771 // routines parameter p1 (pCallbackInfo in SetWextState). So, don't use this code, yet.
772 if ((pCsrRoamInfo) && (pCsrRoamInfo->pBssDesc) {
773 memcpy(bssid.ether_addr_octet, pCsrRoamInfo->pBssDesc->bssId, 6);
774 apple80211Interface->willRoam(&bssid); // Return result isn't significant
775 DBGLOG("%s: willRoam returns\n", __FUNCTION__);
776 DBGLOG(" with BSSID = " MAC_ADDR_STRING(bssid.ether_addr_octet));
777 }
778#endif //0
779 break;
780
781 case eCSR_ROAM_ASSOCIATION_COMPLETION:
782 DBGLOG("%s: In %s\n", __FUNCTION__, "eCSR_ROAM_ASSOCIATION_COMPLETION");
783 break;
784
785 case eCSR_ROAM_MIC_ERROR_IND: // Handled in eCSR_ROAM_RESULT_MIC_ERROR_UNICAST and GROUP, above
786 case eCSR_ROAM_CANCELLED:
787 case eCSR_ROAM_ROAMING_COMPLETION:
788 case eCSR_ROAM_SCAN_FOUND_NEW_BSS:
789 default:
790 break;
791 }
792#endif //0
793
794 return halStatus;
795}
796
797/*----------------------------------------------------------------------------
798 Host Controller Interface Procedural API
799 ---------------------------------------------------------------------------*/
800
801/** BT v3.0 Link Control commands */
802
803/*----------------------------------------------------------------------------
804 Each of the next eight command result in asynchronous events (e.g.,
805 HCI_PHYSICAL_LINK_COMPLETE_EVENT, HCI_LOGICAL_LINK_COMPLETE_EVENT, etc...)
806 These are signalled thru the event callback. (I.E., (*tpWLAN_BAPEventCB).)
807 ---------------------------------------------------------------------------*/
808
809/*----------------------------------------------------------------------------
810
811 FUNCTION WLAN_BAPPhysicalLinkCreate()
812
813 DESCRIPTION
814 Implements the actual HCI Create Physical Link command
815
816 DEPENDENCIES
817 NA.
818
819 PARAMETERS
820
821 IN
822 btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
823 WLANBAP_GetNewHndl has to be called before every call to
824 WLAN_BAPPhysicalLinkCreate. Since the context is per
825 physical link.
826 pBapHCIPhysLinkCreate: pointer to the "HCI Create Physical Link" Structure.
827 pHddHdl: The context passed in by the caller. (e.g., BSL specific context)
828
829 IN/OUT
830 pBapHCIEvent: Return event value for the command status event.
831 (The caller of this routine is responsible for sending
832 the Command Status event up the HCI interface.)
833
834 RETURN VALUE
835 The result code associated with performing the operation
836
837 VOS_STATUS_E_FAULT: pointer to pBapHCIPhysLinkCreate is NULL
838 VOS_STATUS_SUCCESS: Success
839
840 SIDE EFFECTS
841
842----------------------------------------------------------------------------*/
843VOS_STATUS
844WLAN_BAPPhysicalLinkCreate
845(
846 ptBtampHandle btampHandle,
847 tBtampTLVHCI_Create_Physical_Link_Cmd *pBapHCIPhysLinkCreate,
848 v_PVOID_t pHddHdl, /* BSL passes in its specific context */
849 /* And I get phy_link_handle from the Command */
850 tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
851 /* Including Command Complete and Command Status*/
852)
853{
854 tWLAN_BAPEvent bapEvent; /* State machine event */
855 VOS_STATUS vosStatus;
856 /* I am using btampContext, instead of pBapPhysLinkMachine */
857 //tWLAN_BAPbapPhysLinkMachine *pBapPhysLinkMachine;
858 ptBtampContext btampContext = (ptBtampContext) btampHandle; /* btampContext value */
859 v_U8_t status; /* return the BT-AMP status here */
860 BTAMPFSM_INSTANCEDATA_T *instanceVar = &(btampContext->bapPhysLinkMachine);
861
862 /* Validate params */
863 if ((pBapHCIPhysLinkCreate == NULL) || (NULL == btampContext))
864 {
865 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "%s: btampHandle value: %x, pBapHCIPhysLinkCreate is %x",
866 __FUNCTION__, btampHandle, pBapHCIPhysLinkCreate);
867 return VOS_STATUS_E_FAULT;
868 }
869
870 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %x", __FUNCTION__, btampHandle);
871
872 if(DISCONNECTED != instanceVar->stateVar)
873 {
874 /* Create/Accept Phy link request in invalid state */
875 status = WLANBAP_ERROR_MAX_NUM_CNCTS;
876
877 }
878 else
879 {
880 /* Fill in the event structure */
881 bapEvent.event = eWLAN_BAP_HCI_PHYSICAL_LINK_CREATE;
882 bapEvent.params = pBapHCIPhysLinkCreate;
883 //bapEvent.callback = pBapHCIPhysLinkCreateCB;
884
885 /* Allocate a new state machine instance */
886 /* There will only ever be one of these (NB: Don't assume this.) */
887 /* So for now this returns a pointer to a static structure */
888 /* (With all state set to initial values) */
889 vosStatus = WLANBAP_CreateNewPhyLinkCtx (
890 btampHandle,
891 pBapHCIPhysLinkCreate->phy_link_handle, /* I get phy_link_handle from the Command */
892 pHddHdl, /* BSL passes in its specific context */
893 &btampContext, /* Handle to return per assoc btampContext value in */
894 BT_INITIATOR); /* BT_INITIATOR */
895
896 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampContext value: %x", __FUNCTION__, btampContext);
897
898 /* Handle event */
899 vosStatus = btampFsm(btampContext, &bapEvent, &status);
900 }
901
902 /* Format the command status event to return... */
903 pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT;
904 pBapHCIEvent->u.btampCommandStatusEvent.present = 1;
905 pBapHCIEvent->u.btampCommandStatusEvent.status = status;
906 pBapHCIEvent->u.btampCommandStatusEvent.num_hci_command_packets = 1;
907 pBapHCIEvent->u.btampCommandStatusEvent.command_opcode
908 = BTAMP_TLV_HCI_CREATE_PHYSICAL_LINK_CMD;
909
910 /* ... */
911
912 return VOS_STATUS_SUCCESS;
913} /* WLAN_BAPPhysicalLinkCreate */
914
915/*----------------------------------------------------------------------------
916
917 FUNCTION WLAN_BAPPhysicalLinkAccept()
918
919 DESCRIPTION
920 Implements the actual HCI Accept Physical Link command
921
922 DEPENDENCIES
923 NA.
924
925 PARAMETERS
926
927 IN
928 btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
929 pBapHCIPhysLinkAccept: pointer to the "HCI Accept Physical Link" Structure.
930 pHddHdl: The context passed in by the caller. (e.g., BSL specific context)
931
932 IN/OUT
933 pBapHCIEvent: Return event value for the command status event.
934 (The caller of this routine is responsible for sending
935 the Command Status event up the HCI interface.)
936
937 RETURN VALUE
938 The result code associated with performing the operation
939
940 VOS_STATUS_E_FAULT: pointer to pBapHCIPhysLinkAccept is NULL
941 VOS_STATUS_SUCCESS: Success
942
943 SIDE EFFECTS
944
945----------------------------------------------------------------------------*/
946VOS_STATUS
947WLAN_BAPPhysicalLinkAccept
948(
949 ptBtampHandle btampHandle,
950 tBtampTLVHCI_Accept_Physical_Link_Cmd *pBapHCIPhysLinkAccept,
951 v_PVOID_t pHddHdl, /* BSL passes in its specific context */
952 /* And I get phy_link_handle from the Command */
953 tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
954 /* Including Command Complete and Command Status*/
955)
956{
957 tWLAN_BAPEvent bapEvent; /* State machine event */
958 VOS_STATUS vosStatus;
959 /* I am using btampContext, instead of pBapPhysLinkMachine */
960 //tWLAN_BAPbapPhysLinkMachine *pBapPhysLinkMachine;
961 ptBtampContext btampContext = (ptBtampContext) btampHandle; /* btampContext value */
962 v_U8_t status; /* return the BT-AMP status here */
963 BTAMPFSM_INSTANCEDATA_T *instanceVar;
964
965 /* Validate params */
966 if ((pBapHCIPhysLinkAccept == NULL) || (NULL == btampContext))
967 {
968 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "%s: btampHandle value: %x, pBapHCIPhysLinkAccept is %x",
969 __FUNCTION__, btampHandle, pBapHCIPhysLinkAccept);
970 return VOS_STATUS_E_FAULT;
971 }
972
973 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %x", __FUNCTION__, btampHandle);
974
975 instanceVar = &(btampContext->bapPhysLinkMachine);
976 if(DISCONNECTED != instanceVar->stateVar)
977 {
978 /* Create/Accept Phy link request in invalid state */
979 status = WLANBAP_ERROR_MAX_NUM_CNCTS;
980
981 }
982 else
983 {
984 /* Fill in the event structure */
985 bapEvent.event = eWLAN_BAP_HCI_PHYSICAL_LINK_ACCEPT;
986 bapEvent.params = pBapHCIPhysLinkAccept;
987 //bapEvent.callback = pBapHCIPhysLinkAcceptCB;
988
989 /* Allocate a new state machine instance */
990 /* There will only ever be one of these (NB: Don't assume this.) */
991 /* So for now this returns a pointer to a static structure */
992 /* (With all state set to initial values) */
993 vosStatus = WLANBAP_CreateNewPhyLinkCtx (
994 btampHandle,
995 pBapHCIPhysLinkAccept->phy_link_handle, /* I get phy_link_handle from the Command */
996 pHddHdl, /* BSL passes in its specific context */
997 &btampContext, /* Handle to return per assoc btampContext value in */
998 BT_RESPONDER); /* BT_RESPONDER */
999
1000 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampContext value: %x", __FUNCTION__, btampContext);
1001
1002 /* Handle event */
1003 vosStatus = btampFsm(btampContext, &bapEvent, &status);
1004
1005 }
1006 /* Format the command status event to return... */
1007 pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT;
1008 pBapHCIEvent->u.btampCommandStatusEvent.present = 1;
1009 pBapHCIEvent->u.btampCommandStatusEvent.status = status;
1010 pBapHCIEvent->u.btampCommandStatusEvent.num_hci_command_packets = 1;
1011 pBapHCIEvent->u.btampCommandStatusEvent.command_opcode
1012 = BTAMP_TLV_HCI_ACCEPT_PHYSICAL_LINK_CMD;
1013
1014 /* ... */
1015
1016 return VOS_STATUS_SUCCESS;
1017} /* WLAN_BAPPhysicalLinkAccept */
1018
1019/*----------------------------------------------------------------------------
1020
1021 FUNCTION WLAN_BAPPhysicalLinkDisconnect()
1022
1023 DESCRIPTION
1024 Implements the actual HCI Disconnect Physical Link command
1025
1026 DEPENDENCIES
1027 NA.
1028
1029 PARAMETERS
1030
1031 IN
1032 btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
1033 pBapHCIPhysLinkDisconnect: pointer to the "HCI Disconnect Physical Link" Structure.
1034
1035 IN/OUT
1036 pBapHCIEvent: Return event value for the command status event.
1037 (The caller of this routine is responsible for sending
1038 the Command Status event up the HCI interface.)
1039
1040 RETURN VALUE
1041 The result code associated with performing the operation
1042
1043 VOS_STATUS_E_FAULT: pointer to pBapHCIPhysLinkDisconnect is NULL
1044 VOS_STATUS_SUCCESS: Success
1045
1046 SIDE EFFECTS
1047
1048----------------------------------------------------------------------------*/
1049VOS_STATUS
1050WLAN_BAPPhysicalLinkDisconnect
1051(
1052 ptBtampHandle btampHandle,
1053 tBtampTLVHCI_Disconnect_Physical_Link_Cmd *pBapHCIPhysLinkDisconnect,
1054 tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
1055 /* Including Command Complete and Command Status*/
1056)
1057{
1058 tWLAN_BAPEvent bapEvent; /* State machine event */
1059 VOS_STATUS vosStatus;
1060 /* I am using btampContext, instead of pBapPhysLinkMachine */
1061 //tWLAN_BAPbapPhysLinkMachine *pBapPhysLinkMachine;
1062 ptBtampContext btampContext = (ptBtampContext) btampHandle; /* btampContext value */
1063 v_U8_t status; /* return the BT-AMP status here */
1064
1065 /* Validate params */
1066 if (pBapHCIPhysLinkDisconnect == NULL) {
1067 return VOS_STATUS_E_FAULT;
1068 }
1069
1070 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %x", __FUNCTION__, btampHandle);
1071
1072 /* Validate the Physical link handle */
1073 if (pBapHCIPhysLinkDisconnect->phy_link_handle != btampContext->phy_link_handle)
1074 {
1075 /* Format the command status event to return... */
1076 pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT;
1077 pBapHCIEvent->u.btampCommandStatusEvent.present = 1;
1078 pBapHCIEvent->u.btampCommandStatusEvent.status = WLANBAP_ERROR_NO_CNCT;
1079 pBapHCIEvent->u.btampCommandStatusEvent.num_hci_command_packets = 1;
1080 pBapHCIEvent->u.btampCommandStatusEvent.command_opcode
1081 = BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_CMD;
1082 return VOS_STATUS_SUCCESS;
1083 }
1084
1085 /* Fill in the event structure */
1086 bapEvent.event = eWLAN_BAP_HCI_PHYSICAL_LINK_DISCONNECT;
1087 bapEvent.params = pBapHCIPhysLinkDisconnect;
1088
1089 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampContext value: %x", __FUNCTION__, btampContext);
1090
1091 /* Handle event */
1092 vosStatus = btampFsm(btampContext, &bapEvent, &status);
1093
1094 /* Fill in the event structure */
1095 bapEvent.event = eWLAN_BAP_MAC_READY_FOR_CONNECTIONS;
1096 bapEvent.params = pBapHCIPhysLinkDisconnect;
1097
1098 /* Handle event */
1099 vosStatus = btampFsm(btampContext, &bapEvent, &status);
1100
1101
1102 /* Format the command status event to return... */
1103 pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT;
1104 pBapHCIEvent->u.btampCommandStatusEvent.present = 1;
1105 pBapHCIEvent->u.btampCommandStatusEvent.status = status;
1106 pBapHCIEvent->u.btampCommandStatusEvent.num_hci_command_packets = 1;
1107 pBapHCIEvent->u.btampCommandStatusEvent.command_opcode
1108 = BTAMP_TLV_HCI_DISCONNECT_PHYSICAL_LINK_CMD;
1109
1110 /* ... */
1111
1112 return VOS_STATUS_SUCCESS;
1113} /* WLAN_BAPPhysicalLinkDisconnect */
1114
1115/*----------------------------------------------------------------------------
1116
1117 FUNCTION WLAN_BAPLogicalLinkCreate()
1118
1119 DESCRIPTION
1120 Implements the actual HCI Create Logical Link command
1121
1122 DEPENDENCIES
1123 NA.
1124
1125 PARAMETERS
1126
1127 IN
1128 btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
1129 pBapHCILogLinkCreate: pointer to the "HCI Create Logical Link" Structure.
1130
1131 IN/OUT
1132 pBapHCIEvent: Return event value for the command status event.
1133 (The caller of this routine is responsible for sending
1134 the Command Status event up the HCI interface.)
1135
1136 RETURN VALUE
1137 The result code associated with performing the operation
1138
1139 VOS_STATUS_E_FAULT: pointer to pBapHCILogLinkCreate is NULL
1140 VOS_STATUS_SUCCESS: Success
1141
1142 SIDE EFFECTS
1143
1144----------------------------------------------------------------------------*/
1145VOS_STATUS
1146WLAN_BAPLogicalLinkCreate
1147(
1148 ptBtampHandle btampHandle,
1149 tBtampTLVHCI_Create_Logical_Link_Cmd *pBapHCILogLinkCreate,
1150 tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
1151 /* Including Command Complete and Command Status*/
1152)
1153{
1154 tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */
1155 VOS_STATUS vosStatus;
1156 ptBtampContext btampContext = (ptBtampContext) btampHandle;
1157 v_U16_t log_link_index = 0;
1158 BTAMPFSM_INSTANCEDATA_T *instanceVar = &(btampContext->bapPhysLinkMachine);
1159 VOS_STATUS retval;
1160 v_U16_t index_for_logLinkCtx = 0;
1161 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
1162
1163
1164 /* Validate params */
1165 if (btampHandle == NULL) {
1166 return VOS_STATUS_E_FAULT;
1167 }
1168
1169 /* Validate params */
1170 if (pBapHCILogLinkCreate == NULL) {
1171 return VOS_STATUS_E_FAULT;
1172 }
1173
1174
1175 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %x", __FUNCTION__, btampHandle);
1176
1177 /* Validate the BAP state to accept the logical link request
1178 Logical Link create/accept requests are allowed only in
1179 CONNECTED state */
1180 /* Form and immediately return the command status event... */
1181 bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT;
1182 bapHCIEvent.u.btampCommandStatusEvent.present = 1;
1183 bapHCIEvent.u.btampCommandStatusEvent.num_hci_command_packets = 1;
1184 bapHCIEvent.u.btampCommandStatusEvent.command_opcode
1185 = BTAMP_TLV_HCI_CREATE_LOGICAL_LINK_CMD;
1186
1187 retval = VOS_STATUS_E_FAILURE;
1188 if(DISCONNECTED == instanceVar->stateVar)
1189 {
1190 /* Create Logical link request in invalid state */
1191 pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
1192 WLANBAP_ERROR_CMND_DISALLOWED;
1193 bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_NO_CNCT;
1194
1195 }
1196 else if (CONNECTED != instanceVar->stateVar)
1197 {
1198 /* Create Logical link request in invalid state */
1199 pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
1200 WLANBAP_ERROR_CMND_DISALLOWED;
1201 bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_CMND_DISALLOWED;
1202 }
1203 else if (pBapHCILogLinkCreate->phy_link_handle != btampContext->phy_link_handle)
1204 {
1205 /* Invalid Physical link handle */
1206 pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
1207 WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
1208 bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
1209 }
1210 else
1211 {
1212 btampContext->btamp_logical_link_state = WLAN_BAPLogLinkInProgress;
1213
1214 if( TRUE == btampContext->btamp_logical_link_cancel_pending )
1215 {
1216 pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
1217 WLANBAP_ERROR_NO_CNCT;
1218 bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_NO_CNCT;
1219 btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed;
1220 btampContext->btamp_logical_link_cancel_pending = FALSE;
1221 }
1222 else
1223 {
1224 /* If btamp_async_logical_link_create is set, we will seralize the req
1225 on MC thread & handle it there after; If the above flag is not set
1226 respond to HCI the sync way as before */
1227 if(FALSE == btampContext->btamp_async_logical_link_create)
1228 {
1229 /* Allocate a logical link index for these flow specs */
1230 vosStatus = WLANBAP_CreateNewLogLinkCtx(
1231 btampContext, /* per assoc btampContext value */
1232 pBapHCILogLinkCreate->phy_link_handle, /* I get phy_link_handle from the Command */
1233 pBapHCILogLinkCreate->tx_flow_spec, /* I get tx_flow_spec from the Command */
1234 pBapHCILogLinkCreate->rx_flow_spec, /* I get rx_flow_spec from the Command */
1235 &log_link_index /* Return the logical link index here */
1236 );
1237 if (VOS_STATUS_SUCCESS != vosStatus)
1238 {
1239 /* Invalid flow spec format */
1240 pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
1241 WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
1242 bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
1243 btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed;
1244 }
1245 else
1246 {
1247 retval = VOS_STATUS_SUCCESS;
1248 bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_STATUS_SUCCESS;
1249
1250 pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status = WLANBAP_STATUS_SUCCESS;
1251 btampContext->btamp_logical_link_state = WLAN_BAPLogLinkOpen;
1252 }
1253 }
1254 else
1255 {
1256 btampContext->btamp_logical_link_req_info.phyLinkHandle =
1257 pBapHCILogLinkCreate->phy_link_handle;
1258 vos_mem_copy(btampContext->btamp_logical_link_req_info.txFlowSpec,
1259 pBapHCILogLinkCreate->tx_flow_spec, 18);
1260 vos_mem_copy(btampContext->btamp_logical_link_req_info.rxFlowSpec,
1261 pBapHCILogLinkCreate->rx_flow_spec, 18);
1262 btampContext->btamp_async_logical_link_create = FALSE;
1263 vosStatus = btampEstablishLogLink(btampContext);
1264 if(VOS_STATUS_SUCCESS == vosStatus)
1265 {
1266 retval = VOS_STATUS_E_BUSY;//this will make sure event complete is not sent to HCI
1267 }
1268 else
1269 {
1270 pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
1271 WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
1272 bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
1273 btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed;
1274 }
1275
1276 }
1277 }
1278 }
1279
1280 vosStatus = (*btampContext->pBapHCIEventCB)
1281 (
1282 btampContext->pHddHdl, /* this refers to the BSL per connection context */
1283 &bapHCIEvent, /* This now encodes ALL event types */
1284 VOS_TRUE /* Flag to indicate assoc-specific event */
1285 );
1286
1287 index_for_logLinkCtx = log_link_index >> 8;
1288 /* Format the Logical Link Complete event to return... */
1289 pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_LOGICAL_LINK_COMPLETE_EVENT;
1290 pBapHCIEvent->u.btampLogicalLinkCompleteEvent.present = 1;
1291
1292 /* Return the logical link index here */
1293 pBapHCIEvent->u.btampLogicalLinkCompleteEvent.log_link_handle
1294 = log_link_index;
1295 pBapHCIEvent->u.btampLogicalLinkCompleteEvent.phy_link_handle
1296 = pBapHCILogLinkCreate->phy_link_handle;
1297 pBapHCIEvent->u.btampLogicalLinkCompleteEvent.flow_spec_id
1298 = btampContext->btampLogLinkCtx[index_for_logLinkCtx].btampFlowSpec.flow_spec_id;
1299
1300 /* ... */
1301
1302 return retval;
1303} /* WLAN_BAPLogicalLinkCreate */
1304
1305/*----------------------------------------------------------------------------
1306
1307 FUNCTION WLAN_BAPLogicalLinkAccept()
1308
1309 DESCRIPTION
1310 Implements the actual HCI Accept Logical Link command
1311
1312 DEPENDENCIES
1313 NA.
1314
1315 PARAMETERS
1316
1317 IN
1318 btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
1319 pBapHCILogLinkAccept: pointer to the "HCI Accept Logical Link" Structure.
1320
1321 IN/OUT
1322 pBapHCIEvent: Return event value for the command status event.
1323 (The caller of this routine is responsible for sending
1324 the Command Status event up the HCI interface.)
1325
1326 RETURN VALUE
1327 The result code associated with performing the operation
1328
1329 VOS_STATUS_E_FAULT: pointer to pBapHCILogLinkAccept is NULL
1330 VOS_STATUS_SUCCESS: Success
1331
1332 SIDE EFFECTS
1333
1334----------------------------------------------------------------------------*/
1335VOS_STATUS
1336WLAN_BAPLogicalLinkAccept
1337(
1338 ptBtampHandle btampHandle,
1339 tBtampTLVHCI_Accept_Logical_Link_Cmd *pBapHCILogLinkAccept,
1340 tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
1341 /* Including Command Complete and Command Status*/
1342)
1343{
1344 tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */
1345 VOS_STATUS vosStatus;
1346 ptBtampContext btampContext = (ptBtampContext) btampHandle;
1347 v_U16_t log_link_index = 0;
1348 BTAMPFSM_INSTANCEDATA_T *instanceVar = &(btampContext->bapPhysLinkMachine);
1349 VOS_STATUS retval;
1350 v_U16_t index_for_logLinkCtx;
1351 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
1352
1353
1354 /* Validate params */
1355 if (btampHandle == NULL) {
1356 return VOS_STATUS_E_FAULT;
1357 }
1358
1359 /* Validate params */
1360 if (pBapHCILogLinkAccept == NULL) {
1361 return VOS_STATUS_E_FAULT;
1362 }
1363
1364
1365 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %x", __FUNCTION__, btampHandle);
1366
1367 /* Validate the BAP state to accept the logical link request
1368 Logical Link create/accept requests are allowed only in
1369 CONNECTED state */
1370 /* Form and immediately return the command status event... */
1371 bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT;
1372 bapHCIEvent.u.btampCommandStatusEvent.present = 1;
1373 bapHCIEvent.u.btampCommandStatusEvent.num_hci_command_packets = 1;
1374 bapHCIEvent.u.btampCommandStatusEvent.command_opcode
1375 = BTAMP_TLV_HCI_ACCEPT_LOGICAL_LINK_CMD;
1376
1377 retval = VOS_STATUS_E_FAILURE;
1378 if(DISCONNECTED == instanceVar->stateVar)
1379 {
1380 /* Create Logical link request in invalid state */
1381 pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
1382 WLANBAP_ERROR_CMND_DISALLOWED;
1383 bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_NO_CNCT;
1384
1385 }
1386 else if (CONNECTED != instanceVar->stateVar)
1387 {
1388 /* Create Logical link request in invalid state */
1389 pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
1390 WLANBAP_ERROR_CMND_DISALLOWED;
1391 bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_CMND_DISALLOWED;
1392 }
1393 else if (pBapHCILogLinkAccept->phy_link_handle != btampContext->phy_link_handle)
1394 {
1395 /* Invalid Physical link handle */
1396 pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
1397 WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
1398 bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
1399 }
1400 else
1401 {
1402 btampContext->btamp_logical_link_state = WLAN_BAPLogLinkInProgress;
1403 if( TRUE == btampContext->btamp_logical_link_cancel_pending )
1404 {
1405 pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
1406 WLANBAP_ERROR_NO_CNCT;
1407 bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_NO_CNCT;
1408 btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed;
1409 btampContext->btamp_logical_link_cancel_pending = FALSE;
1410 }
1411 else
1412 {
1413 /* If btamp_async_logical_link_create is set, we will seralize the req
1414 on MC thread & handle it there after; If the above flag is not set
1415 respond to HCI the sync way as before */
1416 if(FALSE == btampContext->btamp_async_logical_link_create)
1417 {
1418 /* Allocate a logical link index for these flow specs */
1419 vosStatus = WLANBAP_CreateNewLogLinkCtx(
1420 btampContext, /* per assoc btampContext value */
1421 pBapHCILogLinkAccept->phy_link_handle, /* I get phy_link_handle from the Command */
1422 pBapHCILogLinkAccept->tx_flow_spec, /* I get tx_flow_spec from the Command */
1423 pBapHCILogLinkAccept->rx_flow_spec, /* I get rx_flow_spec from the Command */
1424 &log_link_index /* Return the logical link index here */
1425 );
1426 if (VOS_STATUS_SUCCESS != vosStatus)
1427 {
1428 /* Invalid flow spec format */
1429 pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
1430 WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
1431 bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
1432 btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed;
1433 }
1434 else
1435 {
1436 retval = VOS_STATUS_SUCCESS;
1437 bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_STATUS_SUCCESS;
1438
1439 pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status = WLANBAP_STATUS_SUCCESS;
1440 btampContext->btamp_logical_link_state = WLAN_BAPLogLinkOpen;
1441 }
1442 }
1443 else
1444 {
1445 btampContext->btamp_logical_link_req_info.phyLinkHandle =
1446 pBapHCILogLinkAccept->phy_link_handle;
1447 vos_mem_copy(btampContext->btamp_logical_link_req_info.txFlowSpec,
1448 pBapHCILogLinkAccept->tx_flow_spec, 18);
1449 vos_mem_copy(btampContext->btamp_logical_link_req_info.rxFlowSpec,
1450 pBapHCILogLinkAccept->rx_flow_spec, 18);
1451 btampContext->btamp_async_logical_link_create = FALSE;
1452 vosStatus = btampEstablishLogLink(btampContext);
1453 if(VOS_STATUS_SUCCESS == vosStatus)
1454 {
1455 retval = VOS_STATUS_E_BUSY;//this will make sure event complete is not sent to HCI
1456 }
1457 else
1458 {
1459 pBapHCIEvent->u.btampLogicalLinkCompleteEvent.status =
1460 WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
1461 bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
1462 btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed;
1463 }
1464
1465 }
1466 }
1467 }
1468 vosStatus = (*btampContext->pBapHCIEventCB)
1469 (
1470 btampContext->pHddHdl, /* this refers to the BSL per connection context */
1471 &bapHCIEvent, /* This now encodes ALL event types */
1472 VOS_TRUE /* Flag to indicate assoc-specific event */
1473 );
1474
1475 index_for_logLinkCtx = log_link_index >> 8;
1476
1477 /* Format the Logical Link Complete event to return... */
1478 pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_LOGICAL_LINK_COMPLETE_EVENT;
1479 pBapHCIEvent->u.btampLogicalLinkCompleteEvent.present = 1;
1480 /* Return the logical link index here */
1481 pBapHCIEvent->u.btampLogicalLinkCompleteEvent.log_link_handle
1482 = log_link_index;
1483 pBapHCIEvent->u.btampLogicalLinkCompleteEvent.phy_link_handle
1484 = pBapHCILogLinkAccept->phy_link_handle;
1485 pBapHCIEvent->u.btampLogicalLinkCompleteEvent.flow_spec_id
1486 = btampContext->btampLogLinkCtx[index_for_logLinkCtx].btampFlowSpec.flow_spec_id;
1487
1488 /* ... */
1489
1490 return retval;
1491} /* WLAN_BAPLogicalLinkAccept */
1492
1493/*----------------------------------------------------------------------------
1494
1495 FUNCTION WLAN_BAPLogicalLinkDisconnect()
1496
1497 DESCRIPTION
1498 Implements the actual HCI Disconnect Logical Link command
1499
1500 DEPENDENCIES
1501 NA.
1502
1503 PARAMETERS
1504
1505 IN
1506 btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
1507 pBapHCILogLinkDisconnect: pointer to the "HCI Disconnect Logical Link" Structure.
1508
1509 IN/OUT
1510 pBapHCIEvent: Return event value for the command status event.
1511 (The caller of this routine is responsible for sending
1512 the Command Status event up the HCI interface.)
1513
1514 RETURN VALUE
1515 The result code associated with performing the operation
1516
1517 VOS_STATUS_E_FAULT: pointer to pBapHCILogLinkDisconnect is NULL
1518 VOS_STATUS_SUCCESS: Success
1519
1520 SIDE EFFECTS
1521
1522----------------------------------------------------------------------------*/
1523VOS_STATUS
1524WLAN_BAPLogicalLinkDisconnect
1525(
1526 ptBtampHandle btampHandle,
1527 tBtampTLVHCI_Disconnect_Logical_Link_Cmd *pBapHCILogLinkDisconnect,
1528 tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
1529 /* Including Command Complete and Command Status*/
1530)
1531{
1532 tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */
1533 ptBtampContext btampContext = (ptBtampContext) btampHandle;
1534 tpBtampLogLinkCtx pLogLinkContext;
1535 VOS_STATUS retval = VOS_STATUS_SUCCESS;
1536 v_U8_t log_link_index;
1537
1538 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
1539
1540 /*------------------------------------------------------------------------
1541 Sanity check
1542 ------------------------------------------------------------------------*/
1543 if (( NULL == pBapHCILogLinkDisconnect ) ||
1544 ( NULL == btampContext))
1545 {
1546 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
1547 "Critical error: Invalid input parameter on %s",
1548 __FUNCTION__);
1549 return VOS_STATUS_E_FAULT;
1550 }
1551
1552 /* Derive logical link index from handle */
1553 log_link_index = ((pBapHCILogLinkDisconnect->log_link_handle) >> 8);
1554
1555 if( log_link_index > WLANBAP_MAX_LOG_LINKS )
1556 {
1557 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
1558 "Critical error: Invalid input parameter on %s",
1559 __FUNCTION__);
1560 /* Fill in the event code to propagate the event notification to BRM
1561 BRM generates the Command status Event based on this.*/
1562 pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_COMPLETE_EVENT;
1563 pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent.present = 1;
1564 pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent.status =
1565 WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
1566 return VOS_STATUS_E_INVAL;
1567
1568 }
1569
1570#ifdef BAP_DEBUG
1571 /* Trace the tBtampCtx being passed in. */
1572 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
1573 "WLAN BAP Context Monitor: btampContext value = %x in %s:%d", btampContext, __FUNCTION__, __LINE__ );
1574#endif //BAP_DEBUG
1575
1576 bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT;
1577 bapHCIEvent.u.btampCommandStatusEvent.present = 1;
1578 bapHCIEvent.u.btampCommandStatusEvent.num_hci_command_packets = 1;
1579 bapHCIEvent.u.btampCommandStatusEvent.command_opcode
1580 = BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_CMD;
1581
1582 /*------------------------------------------------------------------------
1583 FIXME: Validate the Logical Link handle, Generation and freeing...
1584 Here the Logical link is not validated and assumed that it is correct to.
1585 get the Logical link context. .
1586 ------------------------------------------------------------------------*/
1587 pLogLinkContext =
1588 &(btampContext->btampLogLinkCtx[log_link_index]);
1589
1590 // Validate whether the context is active.
1591 if ((VOS_FALSE == pLogLinkContext->present) ||
1592 (pBapHCILogLinkDisconnect->log_link_handle != pLogLinkContext->log_link_handle))
1593 {
1594 /* If status is failed, the platform specific layer generates the
1595 command status event with proper status */
1596 pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent.status =
1597 WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
1598 bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_NO_CNCT;
1599 retval = VOS_STATUS_E_FAILURE;
1600#ifdef BAP_DEBUG
1601 /* Log the error. */
1602 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
1603 "%s:%d Invalid Logical Link handle(should be) = %d(%d)", __FUNCTION__, __LINE__,
1604 pBapHCILogLinkDisconnect->log_link_handle, pLogLinkContext->log_link_handle);
1605 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
1606 " Logical Link index = %d", log_link_index);
1607#endif //BAP_DEBUG
1608 }
1609 else
1610 {
1611 /* Form and return the command status event... */
1612 bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_STATUS_SUCCESS;
1613 pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent.status
1614 = WLANBAP_STATUS_SUCCESS;
1615
1616
1617 pLogLinkContext->present = VOS_FALSE;
1618 pLogLinkContext->uTxPktCompleted = 0;
1619 pLogLinkContext->log_link_handle = 0;
1620 /* Decrement the total logical link count */
1621 btampContext->total_log_link_index--;
1622 btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed;
1623 }
1624
1625 /* Notify the Command status Event */
1626 (*btampContext->pBapHCIEventCB)
1627 (
1628 btampContext->pHddHdl, /* this refers to the BSL per connection context */
1629 &bapHCIEvent, /* This now encodes ALL event types */
1630 VOS_TRUE /* Flag to indicate assoc-specific event */
1631 );
1632
1633 /* Format the Logical Link Complete event to return... */
1634 pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_DISCONNECT_LOGICAL_LINK_COMPLETE_EVENT;
1635 pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent.present = 1;
1636 /* Return the logical link index here */
1637 pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent.log_link_handle
1638 = pBapHCILogLinkDisconnect->log_link_handle;
1639 pBapHCIEvent->u.btampDisconnectLogicalLinkCompleteEvent.reason
1640 = WLANBAP_ERROR_TERM_BY_LOCAL_HOST;
1641
1642 return retval;
1643} /* WLAN_BAPLogicalLinkDisconnect */
1644
1645/*----------------------------------------------------------------------------
1646
1647 FUNCTION WLAN_BAPLogicalLinkCancel()
1648
1649 DESCRIPTION
1650 Implements the actual HCI Cancel Logical Link command
1651
1652 DEPENDENCIES
1653 NA.
1654
1655 PARAMETERS
1656
1657 IN
1658 btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
1659 pBapHCILogLinkCancel: pointer to the "HCI Cancel Logical Link" Structure.
1660
1661 IN/OUT
1662 pBapHCIEvent: Return event value for the command complete event.
1663 (The caller of this routine is responsible for sending
1664 the Command Complete event up the HCI interface.)
1665 (BTW, the required "HCI Logical Link Complete Event"
1666 will be generated by the BAP state machine and sent up
1667 via the (*tpWLAN_BAPEventCB).)
1668
1669 RETURN VALUE
1670 The result code associated with performing the operation
1671
1672 VOS_STATUS_E_FAULT: pointer to pBapHCILogLinkCancel is NULL
1673 VOS_STATUS_SUCCESS: Success
1674
1675 SIDE EFFECTS
1676
1677----------------------------------------------------------------------------*/
1678VOS_STATUS
1679WLAN_BAPLogicalLinkCancel
1680(
1681 ptBtampHandle btampHandle,
1682 tBtampTLVHCI_Logical_Link_Cancel_Cmd *pBapHCILogLinkCancel,
1683 tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
1684 /* Including Command Complete and Command Status*/
1685)
1686{
1687 ptBtampContext btampContext;
1688 BTAMPFSM_INSTANCEDATA_T *instanceVar;
1689 /* Validate params */
1690 if ((btampHandle == NULL) || (pBapHCILogLinkCancel == NULL) ||
1691 (pBapHCIEvent == NULL))
1692 {
1693 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
1694 "%s: Null Parameters Not allowed", __FUNCTION__);
1695 return VOS_STATUS_E_FAULT;
1696 }
1697
1698 btampContext = (ptBtampContext) btampHandle;
1699 instanceVar = &(btampContext->bapPhysLinkMachine);
1700
1701 /* Form and immediately return the command status event... */
1702 pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
1703 pBapHCIEvent->u.btampCommandCompleteEvent.present = 1;
1704 pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode =
1705 BTAMP_TLV_HCI_LOGICAL_LINK_CANCEL_CMD;
1706 pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
1707
1708 if (pBapHCILogLinkCancel->phy_link_handle != btampContext->phy_link_handle)
1709 {
1710 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Logical_Link_Cancel.status =
1711 WLANBAP_ERROR_NO_CNCT;
1712 }
1713 else
1714 {
1715 /* As the logical link create is returned immediately, the logical link is
1716 created and so cancel can not return success.
1717 And it returns WLANBAP_ERROR_NO_CNCT if not connected or
1718 WLANBAP_ERROR_MAX_NUM_ACL_CNCTS if connected */
1719 if(WLAN_BAPLogLinkClosed == btampContext->btamp_logical_link_state )
1720 {
1721 /* Cancel Logical link request in invalid state */
1722 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Logical_Link_Cancel.status =
1723 WLANBAP_ERROR_NO_CNCT;
1724 }
1725 else if(WLAN_BAPLogLinkOpen == btampContext->btamp_logical_link_state )
1726 {
1727 /* Cancel Logical link request in conected state */
1728 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Logical_Link_Cancel.status =
1729 WLANBAP_ERROR_MAX_NUM_ACL_CNCTS;
1730 }
1731 else if(WLAN_BAPLogLinkInProgress == btampContext->btamp_logical_link_state )
1732 {
1733 /* Cancel Logical link request in progress state, need to fail logical link
1734 creation as well */
1735 btampContext->btamp_logical_link_cancel_pending = TRUE;
1736 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Logical_Link_Cancel.status =
1737 WLANBAP_STATUS_SUCCESS;
1738 }
1739 else
1740 {
1741 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Logical_Link_Cancel.status =
1742 WLANBAP_ERROR_NO_CNCT;
1743 }
1744 }
1745 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Logical_Link_Cancel.phy_link_handle =
1746 pBapHCILogLinkCancel->phy_link_handle;
1747 /* Since the status is not success, the Tx flow spec Id is not meaningful and
1748 filling with 0 */
1749 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Logical_Link_Cancel.tx_flow_spec_id =
1750 pBapHCILogLinkCancel->tx_flow_spec_id;
1751
1752 return VOS_STATUS_SUCCESS;
1753} /* WLAN_BAPLogicalLinkCancel */
1754
1755/*----------------------------------------------------------------------------
1756
1757 FUNCTION WLAN_BAPFlowSpecModify()
1758
1759 DESCRIPTION
1760 Implements the actual HCI Modify Logical Link command
1761 Produces an asynchronous flow spec modify complete event. Through the
1762 event callback.
1763
1764 DEPENDENCIES
1765 NA.
1766
1767 PARAMETERS
1768
1769 IN
1770 btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
1771 pBapHCIFlowSpecModify: pointer to the "HCI Flow Spec Modify" Structure.
1772
1773 IN/OUT
1774 pBapHCIEvent: Return event value for the command status event.
1775 (The caller of this routine is responsible for sending
1776 the Command Status event up the HCI interface.)
1777
1778 RETURN VALUE
1779 The result code associated with performing the operation
1780
1781 VOS_STATUS_E_FAULT: pointer to pBapHCIFlowSpecModify is NULL
1782 VOS_STATUS_SUCCESS: Success
1783
1784 SIDE EFFECTS
1785
1786----------------------------------------------------------------------------*/
1787VOS_STATUS
1788WLAN_BAPFlowSpecModify
1789(
1790 ptBtampHandle btampHandle,
1791 tBtampTLVHCI_Flow_Spec_Modify_Cmd *pBapHCIFlowSpecModify,
1792 tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
1793 /* Including Command Complete and Command Status*/
1794)
1795{
1796 v_U16_t index_for_logLinkHandle = 0;
1797 ptBtampContext btampContext;
1798 tpBtampLogLinkCtx pLogLinkContext;
1799 v_U32_t retval;
1800 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
1801 tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */
1802 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
1803 /* Validate params */
1804 if ((btampHandle == NULL) || (pBapHCIFlowSpecModify == NULL) ||
1805 (pBapHCIEvent == NULL))
1806 {
1807 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
1808 "%s: Null Parameters Not allowed", __FUNCTION__);
1809 return VOS_STATUS_E_FAULT;
1810 }
1811
1812 btampContext = (ptBtampContext) btampHandle;
1813
1814 index_for_logLinkHandle = pBapHCIFlowSpecModify->log_link_handle >> 8; /* Return the logical link index here */
1815 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
1816 " %s:index_for_logLinkHandle=%d", __FUNCTION__,index_for_logLinkHandle);
1817
1818 bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_STATUS_EVENT;
1819 bapHCIEvent.u.btampCommandStatusEvent.present = 1;
1820 bapHCIEvent.u.btampCommandStatusEvent.num_hci_command_packets = 1;
1821 bapHCIEvent.u.btampCommandStatusEvent.command_opcode
1822 = BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_CMD;
1823
1824 /*------------------------------------------------------------------------
1825 Evaluate the Tx and Rx Flow specification for this logical link.
1826 ------------------------------------------------------------------------*/
1827 // Currently we only support flow specs with service types of BE (0x01)
1828
1829 /*------------------------------------------------------------------------
1830 Now configure the Logical Link context.
1831 ------------------------------------------------------------------------*/
1832 pLogLinkContext = &(btampContext->btampLogLinkCtx[index_for_logLinkHandle]);
1833
1834 /* Extract Tx flow spec into the context structure */
1835 retval = btampUnpackTlvFlow_Spec((void *)btampContext, pBapHCIFlowSpecModify->tx_flow_spec,
1836 WLAN_BAP_PAL_FLOW_SPEC_TLV_LEN,
1837 &pLogLinkContext->btampFlowSpec);
1838 if (retval != BTAMP_PARSE_SUCCESS)
1839 {
1840 /* Flow spec parsing failed, return failure */
1841 vosStatus = VOS_STATUS_E_FAILURE;
1842 pBapHCIEvent->u.btampFlowSpecModifyCompleteEvent.status =
1843 WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
1844 bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
1845 }
1846 else
1847 {
1848 bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_STATUS_SUCCESS;
1849 pBapHCIEvent->u.btampFlowSpecModifyCompleteEvent.status
1850 = WLANBAP_STATUS_SUCCESS;
1851
1852 }
1853 /* Notify the Command status Event */
1854 vosStatus =
1855 (*btampContext->pBapHCIEventCB)
1856 (
1857 btampContext->pHddHdl, /* this refers to the BSL per connection context */
1858 &bapHCIEvent, /* This now encodes ALL event types */
1859 VOS_TRUE /* Flag to indicate assoc-specific event */
1860 );
1861
1862 /* Form and immediately return the command status event... */
1863 pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_FLOW_SPEC_MODIFY_COMPLETE_EVENT;
1864 pBapHCIEvent->u.btampFlowSpecModifyCompleteEvent.present = 1;
1865 pBapHCIEvent->u.btampFlowSpecModifyCompleteEvent.log_link_handle =
1866 pBapHCIFlowSpecModify->log_link_handle;
1867
1868 return vosStatus;
1869} /* WLAN_BAPFlowSpecModify */
1870
1871
1872void WLAN_BAPEstablishLogicalLink(ptBtampContext btampContext)
1873{
1874 tBtampHCI_Event bapHCIEvent; /* This now encodes ALL event types */
1875 v_U16_t log_link_index = 0;
1876 v_U16_t index_for_logLinkCtx = 0;
1877 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
1878
1879 if (btampContext == NULL)
1880 {
1881 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
1882 "%s: Null Parameters Not allowed", __FUNCTION__);
1883 return;
1884 }
1885
1886 if( TRUE == btampContext->btamp_logical_link_cancel_pending )
1887 {
1888 bapHCIEvent.u.btampCommandStatusEvent.status = WLANBAP_ERROR_NO_CNCT;
1889 btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed;
1890 btampContext->btamp_logical_link_cancel_pending = FALSE;
1891 }
1892 else
1893 {
1894 /* Allocate a logical link index for these flow specs */
1895 vosStatus = WLANBAP_CreateNewLogLinkCtx(
1896 btampContext, /* per assoc btampContext value */
1897 btampContext->btamp_logical_link_req_info.phyLinkHandle, /* I get phy_link_handle from the Command */
1898 btampContext->btamp_logical_link_req_info.txFlowSpec, /* I get tx_flow_spec from the Command */
1899 btampContext->btamp_logical_link_req_info.rxFlowSpec, /* I get rx_flow_spec from the Command */
1900 &log_link_index /* Return the logical link index here */
1901 );
1902 if (VOS_STATUS_SUCCESS != vosStatus)
1903 {
1904 /* Invalid flow spec format */
1905 bapHCIEvent.u.btampLogicalLinkCompleteEvent.status = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
1906 btampContext->btamp_logical_link_state = WLAN_BAPLogLinkClosed;
1907 }
1908 else
1909 {
1910 bapHCIEvent.u.btampLogicalLinkCompleteEvent.status = WLANBAP_STATUS_SUCCESS;
1911 btampContext->btamp_logical_link_state = WLAN_BAPLogLinkOpen;
1912 }
1913 }
1914
1915 index_for_logLinkCtx = log_link_index >> 8;
1916 /* Format the Logical Link Complete event to return... */
1917 bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_LOGICAL_LINK_COMPLETE_EVENT;
1918 bapHCIEvent.u.btampLogicalLinkCompleteEvent.present = 1;
1919
1920 /* Return the logical link index here */
1921 bapHCIEvent.u.btampLogicalLinkCompleteEvent.log_link_handle
1922 = log_link_index;
1923 bapHCIEvent.u.btampLogicalLinkCompleteEvent.phy_link_handle
1924 = btampContext->btamp_logical_link_req_info.phyLinkHandle;
1925 bapHCIEvent.u.btampLogicalLinkCompleteEvent.flow_spec_id
1926 = btampContext->btampLogLinkCtx[index_for_logLinkCtx].btampFlowSpec.flow_spec_id;
1927
1928 vosStatus = (*btampContext->pBapHCIEventCB)
1929 (
1930 btampContext->pHddHdl, /* this refers to the BSL per connection context */
1931 &bapHCIEvent, /* This now encodes ALL event types */
1932 VOS_TRUE /* Flag to indicate assoc-specific event */
1933 );
1934 return;
1935}
1936
1937
1938