blob: 89acfdd6e2cd28dad1708f2c23316e3fe8763901 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42#if !defined( __VOS_PKT_H )
43#define __VOS_PKT_H
44
45/**=========================================================================
46
47 \file vos_packet.h
48
49 \brief virtual Operating System Services (vOSS) network Packet APIs
50
51 Network Protocol packet/buffer support interfaces
52
53 Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
54
55 Qualcomm Confidential and Proprietary.
56
57 ========================================================================*/
58
59/* $Header$ */
60
61/*--------------------------------------------------------------------------
62 Include Files
63 ------------------------------------------------------------------------*/
64#include <vos_types.h>
65#include <vos_status.h>
66
67/*--------------------------------------------------------------------------
68 Preprocessor definitions and constants
69 ------------------------------------------------------------------------*/
70
71/*--------------------------------------------------------------------------
72 Type declarations
73 ------------------------------------------------------------------------*/
74struct vos_pkt_t;
75typedef struct vos_pkt_t vos_pkt_t;
76
77
78/// data vector
79typedef struct
80{
81 /// address of data
82 v_VOID_t *pData;
83
84 /// number of bytes at address
85 v_U32_t numBytes;
86
87} vos_pkt_data_vector_t;
88
89
90
91/// voss Packet Types
92typedef enum
93{
94 /// voss Packet is used to transmit 802.11 Management frames.
95 VOS_PKT_TYPE_TX_802_11_MGMT,
96
97 /// voss Packet is used to transmit 802.11 Data frames.
98 VOS_PKT_TYPE_TX_802_11_DATA,
99
100 /// voss Packet is used to transmit 802.3 Data frames.
101 VOS_PKT_TYPE_TX_802_3_DATA,
102
103 /// voss Packet contains Received data of an unknown frame type
104 VOS_PKT_TYPE_RX_RAW,
105
106 /// Invalid sentinel value
107 VOS_PKT_TYPE_MAXIMUM
108
109} VOS_PKT_TYPE;
110
111/// user IDs. These IDs are needed on the vos_pkt_get/set_user_data_ptr()
112/// to identify the user area in the voss Packet.
113typedef enum
114{
115 VOS_PKT_USER_DATA_ID_TL =0,
116 VOS_PKT_USER_DATA_ID_BAL,
117 VOS_PKT_USER_DATA_ID_WDA,
118 VOS_PKT_USER_DATA_ID_HDD,
119 VOS_PKT_USER_DATA_ID_BAP,
120 VOS_PKT_USER_DATA_ID_BSL,
121
122 VOS_PKT_USER_DATA_ID_MAX
123
124} VOS_PKT_USER_DATA_ID;
125
126/**------------------------------------------------------------------------
127
128 \brief voss asynchronous get_packet callback function
129
130 This is a callback function invoked when vos_pkt_get_packet() cannot
131 get the requested packet and the caller specified a callback to be
132 invoked when packets are available.
133
134 \param pPacket - the packet obtained by voss for the caller.
135
136 \param userData - the userData field given on the vos_pkt_get_packet()
137 call
138
139 \return
140
141 \sa
142
143 ------------------------------------------------------------------------*/
144typedef VOS_STATUS ( *vos_pkt_get_packet_callback )( vos_pkt_t *pPacket,
145 v_VOID_t *userData );
146
147/*
148 * include the OS-specific packet abstraction
149 * we include it here since the abstraction probably needs to access the
150 * generic types defined above
151 */
152#include "i_vos_packet.h"
153
154/*-------------------------------------------------------------------------
155 Function declarations and documenation
156 ------------------------------------------------------------------------*/
157
158/**--------------------------------------------------------------------------
159
160 \brief vos_pkt_get_packet() - Get a voss Packets
161
162 Gets a voss Packets from an internally managed packet pool.
163
164 \param ppPacket - pointer to location where the voss Packet pointer is
165 returned. If multiple packets are requested, they
166 will be chained onto this first packet.
167
168 \param pktType - the packet type to be retreived. Valid packet types are:
169 <ul>
170 <li> VOS_PKT_TYPE_TX_802_11_MGMT - voss packet is for Transmitting 802.11
171 Management frames.
172
173 <li> VOS_PKT_TYPE_RX_RAW - voss Packet contains a buffer for Receiving
174 raw frames of unknown type.
175 </ul>
176
177 \param dataSize - the Data size needed in the voss Packet.
178
179 \param numPackets - the number of packets requested.
180
181 \param zeroBuffer - parameter that tells the API to zero the data buffer
182 in this voss Packet.
183 <ul>
184 <li> VOS_TRUE - the API will zero out the entire data buffer.
185
186 <li> VOS_FALSE - the API will not zero out the data buffer.
187 </ul>
188
189 \note If enough room for headers to transmit or receive the packet is not
190 available, this API will fail.
191
192 \param callback - This callback function, if provided, is invoked in the
193 case when resources are not available at the time of the call to
194 get packets. This callback function is invoked when packets are
195 available.
196
197 \param userData - This user data is passed back to the caller in the
198 callback function, if the callback is invoked.
199
200 \return VOS_STATUS_SUCCESS - the API was able to get a vos_packet for the
201 requested type. *ppPacket contains a pointer to the packet.
202
203 VOS_STATUS_E_INVAL - pktType is not a valid packet type. This
204 API only supports getting vos packets for 802_11_MGMT and
205 RX_RAW packet types. This status is also returned if the
206 numPackets or dataSize are invalid.
207
208 VOS_STATUS_E_RESOURCES - unable to get resources needed to get
209 a vos packet. If a callback function is specified and this
210 status is returned from the API, the callback will be called
211 when resources are available to fulfill the original request.
212
213 Note that the low resources condition is indicated to the caller
214 by returning VOS_STATUS_E_RESOURCES. This status is the only
215 non-success status that indicates to the caller that the callback
216 will be called when resources are available. All other status
217 indicate failures that are not recoverable and the 'callback'
218 will not be called.
219
220 VOS_STATUS_E_FAILURE - The API returns this status when unable
221 to get a packet from the packet pool because the pool
222 is depleted and the caller did not specify a low resource callback.
223
224 VOS_STATUS_E_ALREADY - This status is returned when the VOS
225 packet pool is in a 'low resource' condition and cannot
226 accomodate any more calls to retrieve packets from that
227 pool. Note this is a FAILURE and the 'low resource' callback
228 will *not* be called.
229
230 VOS_STATUS_E_FAULT - ppPacket does not specify a valid pointer.
231
232 \sa
233
234 ------------------------------------------------------------------------*/
235VOS_STATUS vos_pkt_get_packet( vos_pkt_t **ppPacket, VOS_PKT_TYPE pktType,
236 v_SIZE_t dataSize, v_SIZE_t numPackets,
237 v_BOOL_t zeroBuffer,
238 vos_pkt_get_packet_callback callback,
239 v_VOID_t *userData );
240
241
242/**--------------------------------------------------------------------------
243
244 \brief vos_pkt_wrap_data_packets() - Wrap an OS provided data packet in a
245 vos packet.
246
247 Takes as input an OS provided data packet and 'wraps' that packet in a
248 vos_packet, returning the vos_packet to the caller.
249
250 This function is intended to be called from the HDD to wrap Tx data packets
251 from the OS into vos_packets before sending them to TL for transmission.
252
253 \param ppPacket - pointer to location where the voss Packet pointer is
254 returned. If multiple packets are requested, they
255 will be chained onto this first packet.
256
257 \param pktType - the packet type to be retreived. Valid packet types are:
258 <ul>
259 <li> VOS_PKT_TYPE_802_3_DATA - voss packet is for Transmitting 802.3
260 data frames.
261
262 <li> VOS_PKT_TYPE_802_11_DATA - voss Packet is for Transmitting 802.11
263 data frames.
264 </ul>
265
266 \param pOSPacket - a pointer to the Transmit packet provided by the OS. This
267 OS provided packet will be wrapped into a vos_packet_t. Note this
268 OS packet pointer can be NULL. The OS packet pointer can be inserted
269 into a VOS packet of type VOS_PKT_TYPE_802_3_DATA or
270 VOS_PKT_TYPE_802_11_DATA through vos_pkt_set_os_packet().
271
272 \note If enough room for headers to transmit or receive the packet is not
273 available, this API will fail.
274
275 \param callback - This callback function, if provided, is invoked in the
276 case where packets are not available at the time of the call to
277 return the packets to the caller (a 'low resource' condition).
278
279 When packets become available, the callback callback function is
280 invoked to return a VOS packet to the caller. Note that the
281 OS Packet is *not* inserted into the VOS packet when it is returned
282 to the low resource callback. It is up to the caller to insert
283 the OS packet into the VOS packet by calling vos_pkt_set_os_packet()
284
285 \param userData - This user data is passed back to the caller in the
286 callback function, if the callback is invoked.
287
288 \return VOS_STATUS_SUCCESS - the API was able to get a vos_packet for the
289 requested type. *ppPacket contains a pointer to the packet.
290
291 VOS_STATUS_E_INVAL - pktType is not a valid packet type. This
292 API only supports getting vos packets for 802_11_MGMT and
293 RX_RAW packet types.
294
295 VOS_STATUS_E_RESOURCES - unable to get resources needed to get
296 a vos packet. If a callback function is specified and this
297 status is returned from the API, the callback will be called
298 when resources are available to fulfill the original request.
299
300 Note that the low resources condition is indicated to the caller
301 by returning VOS_STATUS_E_RESOURCES. This status is the only
302 non-success status that indicates to the caller that the callback
303 will be called when resources are available. All other status
304 indicate failures that are not recoverable and the 'callback'
305 will not be called.
306
307 VOS_STATUS_E_FAILURE - The API returns this status when unable
308 to get a packet from the packet pool because the pool
309 is depleted and the caller did not specify a low resource callback.
310
311 VOS_STATUS_E_ALREADY - This status is returned when the VOS
312 packet pool is in a 'low resource' condition and cannot
313 accomodate any more calls to retrieve packets from that
314 pool. Note this is a FAILURE and the 'low resource' callback
315 will *not* be called.
316
317 VOS_STATUS_E_FAULT - ppPacket or pOSPacket do not specify valid
318 pointers.
319
320 \sa vos_pkt_set_os_packet()
321
322 ------------------------------------------------------------------------*/
323VOS_STATUS vos_pkt_wrap_data_packet( vos_pkt_t **ppPacket, VOS_PKT_TYPE pktType,
324 v_VOID_t *pOSPacket,
325 vos_pkt_get_packet_callback callback,
326 v_VOID_t *userData );
327
328
329/*---------------------------------------------------------------------------
330
331 \brief vos_pkt_set_os_packet() - set the OS packet in a VOS data packet
332
333 This API inserts an OS packet into a previously retreived VOS packet.
334 This API only applies to VOS packets of type VOS_PKT_TYPE_802_3_DATA or
335 VOS_PKT_TYPE_802_11_DATA.
336
337 There are cases where a user will need to get a VOS data packet without
338 having the OS packet to insert/wrap into the data packet. This could happen
339 if the user calls vos_pkt_wrap_data_packet() without the OS packet.
340
341 Also, when the user hit a 'low resource' situation for data packets, the
342 low resource callback is going to return a VOS packet without an OS packet
343 attached to it. The caller who gets the packet through the low resource
344 callback uses this API to insert an OS packet into the VOS packet that
345 was returned through the low resource callback.
346
347 \param pPacket - the voss Packet to insert the OS packet into.
348
349 \param pOSPacket - a pointer to the Transmit packet provided by the OS. This
350 OS provided packet will be wrapped into a vos_packet_t. Note this
351 OS packet pointer can be NULL. The OS packet pointer can be inserted
352 into a VOS packet of type VOS_PKT_TYPE_802_3_DATA or
353 VOS_PKT_TYPE_802_11_DATA through vos_pkt_set_os_packet().
354
355 Caller beware. If there is a valid OS packet wrapped into this
356 VOS packet already, this API will blindly overwrite the OS packet
357 with the new one specified on this API call. If you need to determine
358 or retreive the current OS packet from a VOS packet, call
359 vos_pkt_get_os_packet() first.
360
361 \return VOS_STATUS_SUCCESS - the API was able to insert the OS packet into
362 the vos_packet.
363
364 VOS_STATUS_E_INVAL - pktType is not a valid packet type. This
365 API only supports getting vos packets of type
366 VOS_PKT_TYPE_802_3_DATA or VOS_PKT_TYPE_802_11_DATA.
367
368 VOS_STATUS_E_FAULT - pPacket does not specify a valid pointer.
369
370 \sa vos_pkt_get_os_packet()
371
372 ----------------------------------------------------------------------------*/
373VOS_STATUS vos_pkt_set_os_packet( vos_pkt_t *pPacket, v_VOID_t *pOSPacket );
374
375
376
377/*---------------------------------------------------------------------------
378
379 \brief vos_pkt_get_os_packet() - get the OS packet in a VOS data packet
380
381 This API returns the OS packet that is inserted in a VOS packet.
382 This API only applies to VOS packets of type VOS_PKT_TYPE_802_3_DATA or
383 VOS_PKT_TYPE_802_11_DATA.
384
385 \param pPacket - the voss Packet to return the OS packet from.
386
387 \param ppOSPacket - a pointer to the location where the OS packet pointer
388 retreived from the VOS packet will be returned. Note this OS packet
389 pointer can be NULL, meaning there is no OS packet attached to this
390 VOS data packet.
391
392 \param clearOSPacket - a boolean value that tells the API to clear out the
393 OS packet pointer from the VOS packet. Setting this to 'true' will
394 essentially remove the OS packet from the VOS packet. 'false' means
395 the OS packet remains chained to the VOS packet. In either case,
396 the OS packet pointer is returned to the caller.
397
398 \return VOS_STATUS_SUCCESS - the API was able to retreive the OS packet
399 pointer from the VOS packet and return it to the caller in
400 *ppOsPacket
401
402 VOS_STATUS_E_INVAL - pktType is not a valid packet type. This
403 API only supports getting vos packets of type
404 VOS_PKT_TYPE_802_3_DATA or VOS_PKT_TYPE_802_11_DATA.
405
406 VOS_STATUS_E_FAULT - pPacket or ppOsPacket does not specify a valid
407 pointers.
408
409 \sa vos_pkt_set_os_packet(), vos_pkt_wrap_data_packet(), vos_pkt_return_packet()
410
411 ----------------------------------------------------------------------------*/
412VOS_STATUS vos_pkt_get_os_packet( vos_pkt_t *pPacket, v_VOID_t **ppOSPacket,
413 v_BOOL_t clearOSPacket );
414
415
416/**--------------------------------------------------------------------------
417
418 \brief vos_pkt_get_user_data_ptr() - return a pointer to user data area
419 of a voss Packet
420
421 This API returns a pointer to a specified user Data area in the voss
422 Packet. User data areas are uniqua areas of the voss Packet that can
423 be used by specific components to store private data. These areas are
424 identified by a user "ID" and should only be accessed by the component
425 specified.
426
427 \param pPacket - the voss Packet to retreive the user data pointer from.
428
429 \param userID - the identifier for the user data area in the voss Packet
430 to get.
431
432 User IDs and user data areas in the voss Packet are
433 available for:
434 - Transport Layer (TL)
435 - Bus Abstraction Layer (BAL)
436 - SDIO Services Component (SSC)
437 - Host Device Driver (HDD)
438
439 \param ppUserData - pointer to location to return the pointer to the user
440 data.
441
442 \return - Nothing.
443
444 \sa
445
446 ----------------------------------------------------------------------------*/
447v_VOID_t vos_pkt_get_user_data_ptr( vos_pkt_t *pPacket, VOS_PKT_USER_DATA_ID userID,
448 v_VOID_t **ppUserData );
449
450
451/**--------------------------------------------------------------------------
452
453 \brief vos_pkt_set_user_data_ptr() - set the user data pointer of a voss
454 Packet
455
456 This API sets a pointer in the specified user Data area in the voss
457 Packet. User data areas are uniqua areas of the voss Packet that can
458 be used by specific components to store private data. These areas are
459 identified by a user "ID" and should only be accessed by the component
460 specified.
461
462 Note: The size of the user data areas in the voss Packet are fixed. The
463 size of a single pointer is available in each user area.
464
465 \param pPacket - the voss Packet to set the user pointer.
466
467 \param userID - the identifier for the user data area in the voss Packet
468 to set.
469
470 User IDs and user data areas in the voss Packet are
471 available for:
472 - Transport Layer (TL)
473 - Bus Abstraction Layer (BAL)
474 - SDIO Services Component (SSC)
475 - Host Device Driver (HDD)
476
477 \param pUserData - pointer value to set in the user data area of the voss
478 packet..
479
480 \return - Nothing.
481
482 \sa
483
484 ----------------------------------------------------------------------------*/
485v_VOID_t vos_pkt_set_user_data_ptr( vos_pkt_t *pPacket, VOS_PKT_USER_DATA_ID userID,
486 v_VOID_t *pUserData );
487
488/**--------------------------------------------------------------------------
489
490 \brief vos_pkt_return_packet() - Return a voss Packet (chain) to vOSS
491
492 This API returns a voss Packet to the internally managed packet pool.
493
494 Note: If there are multiple packets chained to this packet, the entire
495 packet chain is returned to vOSS. The caller must unchain the
496 packets throgh vos_pkt_get_next_packet() and return them individually
497 if all packets in the packet chain are not to be returned.
498
499 \param pPacket - the voss Packet(s) to return. Note all packets chained
500 to this packet are returned to vOSS.
501
502 \return
503
504 \sa
505
506 ----------------------------------------------------------------------------*/
507VOS_STATUS vos_pkt_return_packet( vos_pkt_t *pPacket );
508
509
510/**--------------------------------------------------------------------------
511
512 \brief vos_pkt_chain_packet() - chain a voss Packet to another packet
513
514 This API chains a voss Packet to another voss Packet, creating a packet
515 chain. Packets can be chained before or after the current packet in the
516 packet chain.
517
518 \param pPacket - pointer to a voss packet to chain to
519
520 \param pChainPacket - pointer to packet to chain
521
522 \param chainAfter - boolean to specify to chain packet after or before
523 the input packet
524 <ul>
525 <li> true - chain packet AFTER pPacket (chain behind)
526 <li> false - chain packet BEFORE pPacket (chain in front)
527 </ul>
528
529 \return
530
531 \sa
532
533 ----------------------------------------------------------------------------*/
534VOS_STATUS vos_pkt_chain_packet( vos_pkt_t *pPacket, vos_pkt_t *pChainPacket,
535 v_BOOL_t chainAfter );
536
537
538/**--------------------------------------------------------------------------
539
540 \brief vos_pkt_walk_packet_chain() - Walk packet chain and (possibly)
541 unchain packets
542
543 This API will walk the voss Packet and unchain the packet from the chain,
544 if specified. The 'next' packet in the packet chain is returned as the
545 packet chain is traversed.
546
547 \param pPacket - input vos_packet walk
548
549 \param ppChainedPacket - pointer to location to return the 'next' voss
550 packet pointer in the packet chain.
551 NULL means there is was not packet chained
552 to this packet.
553
554 \param unchainPacket - Flag that specifies if the caller wants the packet
555 to be removed from the packet chain. This is
556 provided to allow the caller to walk the packet chain
557 with or without breaking the chain.
558
559 <ul>
560 <li> true - when set 'true' the API will return
561 the 'next' packet pointer in the voss Packte chain and
562 *WILL* unchain the input packet from the packet chain.
563
564 <li> NOT false - when set 'false' the API will return
565 the 'next' packet pointer in the voss Packet chain but
566 *WILL NOT* unchain the packet chain. This option gives
567 the caller the ability to walk the packet chain without
568 modifying it in the process.
569 </ul>
570
571 \note Having the packets chained has an implicaiton on how the return
572 packet API (vos_pkt_return_packet() ) operates.
573
574 \return
575
576 \sa
577
578 ----------------------------------------------------------------------------*/
579VOS_STATUS vos_pkt_walk_packet_chain( vos_pkt_t *pPacket, vos_pkt_t **ppChainedPacket,
580 v_BOOL_t unchainPacket );
581
582
583/**--------------------------------------------------------------------------
584
585 \brief vos_pkt_get_data_vector() - Get data vectors from a voss Packet
586
587 This API gets the complete set of Vectors (pointer / length pairs) that
588 describe all of the data that makes up the voss Packet.
589
590 \param pPacket - pointer to the vOSS Packet to get the pointer/length
591 vector from
592
593 \param pVector - pointer to the vector array where the vectors are returned.
594
595 \param pNumVectors - Number of vector's in the vector array (at pVector).
596 On successful return, *pNumVectors is updated with the
597 number of pointer/length vectors at pVector populated
598 with valid vectors.
599
600 Call with NULL pVector or 0 vectorSize, will return the size of vector
601 needed (in *pNumVectors)
602
603 Caller allocates and frees the vector memory.
604
605 \return
606
607 \sa
608
609 ----------------------------------------------------------------------------*/
610VOS_STATUS vos_pkt_get_data_vector( vos_pkt_t *pPacket, vos_pkt_data_vector_t *pVector,
611 v_SIZE_t *pNumVectors );
612
613
614/**--------------------------------------------------------------------------
615
616 \brief vos_pkt_extract_data() - Extract data from the voss Packet.
617
618 This API extracts data from a voss Packet, copying the data into the
619 supplied output buffer. Note the data is copied from the vos packet
620 but the data remains in the vos packet and the size is unaffected.
621
622 \param pPacket - the voss Packet to get the data from.
623
624 \param pktOffset - the offset from the start of the voss Packet to get the
625 data. (i.e. 0 would be the beginning of the voss Packet).
626
627 \param pOutputBuffer - Pointer to the location where the voss Packet data
628 will be copied.
629
630 \param pOutputBufferSize - on input, contains the amount of data to extract
631 into the output buffer. Upon return, contains the amount of data
632 extracted into the output buffer.
633
634 Note: an input of 0 in *pOutputBufferSize, means to copy *all*
635 data in the voss Packet into the output buffer. The caller is
636 responsible for assuring the output buffer size is big enough
637 since the size of the buffer is not being passed in!
638
639 \return
640
641 \sa
642
643 ----------------------------------------------------------------------------*/
644VOS_STATUS vos_pkt_extract_data( vos_pkt_t *pPacket, v_SIZE_t pktOffset,
645 v_VOID_t *pOutputBuffer, v_SIZE_t *pOutputBufferSize );
646
647
648/**--------------------------------------------------------------------------
649
650 \brief vos_pkt_extract_data_chain() - Extract data from a voss Packet chain.
651
652 This API extracts *all* the data from a voss Packet chain, copying the
653 data into the supplied output buffer. Note the data is copied from
654 the vos packet chain but the data remains in the vos packet and the
655 size of the vos packets are unaffected.
656
657 \param pPacket - the first voss Packet in the voss packet chain to
658 extract data.
659
660 \param pOutputBuffer - Pointer to the location where the voss Packet data
661 will be copied.
662
663 \param pOutputBufferSize - on input, contains the maximum amount of data
664 that can be extracted into the output buffer. Upon return, contains
665 the amount of data extracted from the packet chain.
666
667 \return VOS_STATUS_SUCCESS - the data from the entire packet chain is
668 extracted and found at *pOutputBuffer. *pOutputBufferSize bytes
669 were extracted.
670
671 VOS_STATUS_E_FAULT - pPacket, pOutputBuffer, or pOutputBufferSize
672 is not a valid pointer.
673
674 VOS_STATUS_E_NOMEM - there is not enough room to extract the data
675 from the entire packet chain. *pOutputBufferSize has been updated
676 with the size needed to extract the entier packet chain.
677
678 \sa vos_pkt_extract_data()
679
680 ----------------------------------------------------------------------------*/
681VOS_STATUS vos_pkt_extract_data_chain( vos_pkt_t *pPacket, v_VOID_t *pOutputBuffer,
682 v_SIZE_t *pOutputBufferSize );
683
684
685
686/**--------------------------------------------------------------------------
687
688 \brief vos_pkt_peek_data() - peek into voss Packet at given offset
689
690 This API provides a pointer to a specified offset into a voss Packet,
691 allowing the caller to peek at a given number of bytes in the voss Packet.
692 Upon successful return, the caller can access "numBytes" of data at
693 "pPacketData".
694
695 This API will fail if the data length requested to peek at is not in
696 contiguous memory in the voss Packet. In this case, the caller should
697 use vos_pkt_extract_data() to have the data copied into a caller supplied
698 buffer.
699
700 \param pPacket - the vOSS Packet to peek into
701
702 \param pktOffset - the offset into the voss Packet data to peek into.
703
704 \param ppPacketData - pointer to the location where the pointer to the
705 packet data at pktOffset will be returned.
706
707 \param numBytes - the number of bytes the caller wishes to peek at.
708
709 \return
710
711 \sa
712
713 ----------------------------------------------------------------------------*/
714VOS_STATUS vos_pkt_peek_data( vos_pkt_t *pPacket, v_SIZE_t pktOffset,
715 v_VOID_t **ppPacketData, v_SIZE_t numBytes );
716
717
718/**--------------------------------------------------------------------------
719
720 \brief vos_pkt_get_packet_type() - Get packet type for a voss Packet
721
722 This API returns the packet Type for a voss Packet.
723
724 \param pPacket - the voss Packet to get the packet type from.
725
726 \param pPacketType - location to return the packet type for the voss Packet
727
728 \return
729
730 \sa
731
732 ----------------------------------------------------------------------------*/
733VOS_STATUS vos_pkt_get_packet_type( vos_pkt_t *pPacket, VOS_PKT_TYPE *pPacketType );
734
735
736/**--------------------------------------------------------------------------
737
738 \brief vos_pkt_get_packet_length() - Get packet length for a voss Packet
739
740 This API returns the total length of the data in a voss Packet.
741
742 \param pPacket - the voss Packet to get the packet length from.
743
744 \param pPacketSize - location to return the total size of the data contained
745 in the voss Packet.
746 \return
747
748 \sa
749
750 ----------------------------------------------------------------------------*/
751VOS_STATUS vos_pkt_get_packet_length( vos_pkt_t *pPacket, v_U16_t *pPacketSize );
752
753
754/**--------------------------------------------------------------------------
755
756 \brief vos_pkt_get_packet_chain_length() - Get length of a vos packet chain
757
758 This API returns the total length of the data in a voss Packet chain.
759
760 \param pPacket - the voss Packet at the start of the packet chain. This API
761 will calculate the length of data in the packet chain stating with
762 this packet.
763
764 \param pPacketSize - location to return the total size of the data contained
765 in the voss Packet.
766 \return
767
768 \sa
769
770 ----------------------------------------------------------------------------*/
771VOS_STATUS vos_pkt_get_packet_chain_length( vos_pkt_t *pPacketChain, v_SIZE_t *pPacketChainSize );
772
773
774
775
776/**--------------------------------------------------------------------------
777
778 \brief vos_pkt_push_head() - push data on the front a of a voss Packet
779
780 This API will push data onto the front of a voss Packet. The data will be
781 appended in front of any data already contained in the voss Packet.
782
783 \param pPacket - the voss Packet to modify.
784
785 \param pData - pointer to the data to push onto the head of the voss Packet.
786
787 \param dataSize - the size of the data to put onto the head of the voss Packet.
788
789 \return
790
791 \sa
792
793 ----------------------------------------------------------------------------*/
794VOS_STATUS vos_pkt_push_head( vos_pkt_t *pPacket, v_VOID_t *pData, v_SIZE_t dataSize );
795
796
797/**--------------------------------------------------------------------------
798
799 \brief vos_pkt_reserve_head() - Reserve space at the front of a voss Packet
800
801 This API will reserve space at the front of a voss Packet. The caller can
802 then copy data into this reserved space using memcpy() like functions. This
803 allows the caller to reserve space and build headers directly in this
804 reserved space in the voss Packet.
805
806 Upon successful return, the length of the voss Packet is increased by
807 dataSize.
808
809 < put a before / after picture here>
810
811 \param pPacket - the voss Packet to modify.
812
813 \param ppData - pointer to the location where the pointer to the reserved
814 space is returned. Upon successful return, the caller has
815 write / read access to the data space at *ppData for length
816 dataSize to build headers, etc.
817
818 \param dataSize - the size of the data to reserve at the head of the voss
819 Packet. Upon successful return, the length of the voss
820 Packet is increased by dataSize.
821
822 \return
823
824 \sa
825
826 ----------------------------------------------------------------------------*/
827VOS_STATUS vos_pkt_reserve_head( vos_pkt_t *pPacket, v_VOID_t **ppData,
828 v_SIZE_t dataSize );
829
830/**--------------------------------------------------------------------------
831
832 \brief vos_pkt_reserve_head_fast()- Reserve space at the front of a voss Pkt
833
834 This API will reserve space at the front of a voss Packet. The caller can
835 then copy data into this reserved space using memcpy() like functions. This
836 allows the caller to reserve space and build headers directly in this
837 reserved space in the voss Packet.
838
839 Upon successful return, the length of the voss Packet is increased by
840 dataSize.
841
842 Same as above API but no memset to 0.
843
844 < put a before / after picture here>
845
846 \param pPacket - the voss Packet to modify.
847
848 \param ppData - pointer to the location where the pointer to the reserved
849 space is returned. Upon successful return, the caller has
850 write / read access to the data space at *ppData for length
851 dataSize to build headers, etc.
852
853 \param dataSize - the size of the data to reserve at the head of the voss
854 Packet. Upon successful return, the length of the voss
855 Packet is increased by dataSize.
856
857 \return
858
859 \sa
860
861 ----------------------------------------------------------------------------*/
862VOS_STATUS vos_pkt_reserve_head_fast( vos_pkt_t *pPacket,
863 v_VOID_t **ppData,
864 v_SIZE_t dataSize );
865
866/**--------------------------------------------------------------------------
867
868 \brief vos_pkt_pop_head() - Remove data from the front of the voss Packet
869
870 This API removes data from the front of a voss Packet. The data is
871 copied into the output buffer described by pData and pDataSize
872
873 \param pPacket - the voss Packet to operate on.
874
875 \param pData - pointer to the data buffer where the data removed from the
876 voss Packet is placed.
877
878 \param dataSize - The amount of space to remove from the head of the voss
879 Packet. The output buffer (at *pData) must contain at
880 least this amount of space.
881
882 \return
883
884 \sa
885
886 ----------------------------------------------------------------------------*/
887VOS_STATUS vos_pkt_pop_head( vos_pkt_t *pPacket, v_VOID_t *pData, v_SIZE_t dataSize );
888
889
890/**--------------------------------------------------------------------------
891
892 \brief vos_pkt_trim_head() - Skip over bytes at the front of a voss Packet
893
894 This API moves the pointers at the head of a voss Packet to essentially
895 skip over data at the front of a voss Packet. Upon successful return, the
896 length of the voss Packet is reduced by dataSize and the starting pointer
897 to the voss Packet is adjusted to eliminate the data from the start of the
898 voss Packet.
899
900 This API has the opposite effect of \a vos_pkt_reserve_head().
901
902 \param pPacket - the voss Packet to operate on.
903
904 \param dataSize - The amount of space to skip at the start of the voss
905 Packet.
906
907 Note that upon return, the data skipped over is
908 inaccessible to the caller. If the caller needs access
909 to the head data, use vos_pkt_pop_head() or
910 vos_pkt_extract_data() to get a copy of the data.
911
912 \return
913
914 \sa
915
916 ----------------------------------------------------------------------------*/
917VOS_STATUS vos_pkt_trim_head( vos_pkt_t *pPacket, v_SIZE_t dataSize );
918
919
920/**--------------------------------------------------------------------------
921
922 \brief vos_pkt_push_tail() - push data on the end a of a voss Packet
923
924 This API will push data onto the end of a voss Packet. The data will be
925 appended to the end of any data already contained in the voss Packet.
926
927 \param pPacket - the voss Packet to modify.
928
929 \param pData - pointer to the data to push onto the tail of the voss Packet.
930
931 \param dataSize - the size of the data to put onto the tail of the voss Packet.
932
933 \return
934
935 \sa
936
937 ----------------------------------------------------------------------------*/
938VOS_STATUS vos_pkt_push_tail( vos_pkt_t *pPacket, v_VOID_t *pData, v_SIZE_t dataSize );
939
940
941/**--------------------------------------------------------------------------
942
943 \brief vos_pkt_reserve_tail() - Reserve space at the end of a voss Packet
944
945 This API will reserve space at the end of a voss Packet. The caller can
946 then copy data into this reserved space using memcpy() like functions. This
947 allows the caller to reserve space and build headers directly in this
948 reserved space in the voss Packet.
949
950 Upon successful return, the length of the voss Packet is increased by
951 dataSize.
952
953 \param pPacket - the voss Packet to modify.
954
955 \param ppData - pointer to the location where the pointer to the reserved
956 space is returned. Upon successful return, the caller has
957 write / read access to the data space at *ppData for length
958 dataSize to build headers, etc.
959
960 \param dataSize - the size of the data to reserve at the head of the voss
961 Packet. Upon successful return, the length of the voss
962 Packet is increased by dataSize.
963
964 \return
965
966 \sa
967
968 ----------------------------------------------------------------------------*/
969VOS_STATUS vos_pkt_reserve_tail( vos_pkt_t *pPacket, v_VOID_t **ppData,
970 v_SIZE_t dataSize );
971
972
973/**--------------------------------------------------------------------------
974
975 \brief vos_pkt_pop_tail() - Remove data from the end of the voss Packet
976
977 This API removes data from the end of a voss Packet. The data is
978 copied into the output buffer described by pData and pDataSize
979
980 \param pPacket - the voss Packet to operate on.
981
982 \param pData - pointer to the data buffer where the data removed from the
983 voss Packet is placed.
984
985 \param dataSize - The amount of space to remove from the end of the voss
986 Packet. The output buffer (at *pData) must contain at
987 least this amount of space.
988
989 \return
990
991 \sa
992
993 ----------------------------------------------------------------------------*/
994VOS_STATUS vos_pkt_pop_tail( vos_pkt_t *pPacket, v_VOID_t *pData, v_SIZE_t dataSize );
995
996
997/**--------------------------------------------------------------------------
998
999 \brief vos_pkt_trim_tail() - Skip over bytes at the end of a voss Packet
1000
1001 This API moves the pointers at the head of a voss Packet to essentially
1002 skip over data at the end of a voss Packet. Upon successful return, the
1003 length of the voss Packet is reduced by dataSize and voss Packet is
1004 adjusted to eliminate the data from the end of the voss Packet.
1005
1006 This API has the opposite effect of \a vos_pkt_reserve_tail().
1007
1008 \param pPacket - the voss Packet to operate on.
1009
1010 \param dataSize - The amount of space to remove at the end of the voss
1011 Packet.
1012
1013 Note that upon return, the data skipped over is
1014 inaccessible to the caller. If the caller needs access
1015 to the tail data, use vos_pkt_pop_tail() or
1016 vos_pkt_extract_data() to get a copy of the data.
1017
1018 \return
1019
1020 \sa
1021
1022 ----------------------------------------------------------------------------*/
1023VOS_STATUS vos_pkt_trim_tail( vos_pkt_t *pPacket, v_SIZE_t dataSize );
1024
1025/**--------------------------------------------------------------------------
1026
1027 \brief vos_pkt_get_timestamp() - Retrive the timestamp attribute from the
1028 specified VOSS packet
1029
1030 \param pPacket - the voss Packet to operate on.
1031
1032 \param pTstamp - the timestamp will be returned here.
1033
1034 \return VOS_STATUS_E_FAULT - invalid parameter(s) specified
1035
1036 VOS_STATUS_SUCCESS - timestamp retrived successfully
1037
1038 \sa
1039
1040 ----------------------------------------------------------------------------*/
1041VOS_STATUS vos_pkt_get_timestamp( vos_pkt_t *pPacket, v_TIME_t* pTstamp );
1042
1043/**--------------------------------------------------------------------------
1044
1045 \brief vos_pkt_flatten_rx_pkt() - Transform a platform based RX VOSS
1046 packet into a flat buffer based VOSS packet if needed. This is needed in cases
1047 where for reasons of efficiency we want the RX packets to be very platform specific
1048 (for e.g. DSM based on AMSS, etc). However platform independent code may rely
1049 on making calls on the VOSS packet which can only be supported by the flat buffer
1050 based implementation of a RX packet. This API will allocate a new VOSS packet
1051 with flat buffer, extract the data from the input VOSS packet and then release
1052 the input VOSS packet. The new VOSS packet will be returned from this call.
1053
1054 \param ppPacket - the voss Packet to operate on. on input contains
1055 the platform based packet. On output contains the flat
1056 buffer based packet. Any applicable resources
1057 are freed as part of this call.
1058
1059 \return VOS_STATUS_E_FAULT - invalid parameter specified
1060
1061 VOS_STATUS_E_INVAL - packet type not RX_RAW
1062
1063 VOS_STATUS_SUCCESS - transform successful
1064
1065 other VOSS status - other errors encountered
1066
1067 \sa
1068
1069 ----------------------------------------------------------------------------*/
1070VOS_STATUS vos_pkt_flatten_rx_pkt( vos_pkt_t **ppPacket );
1071
1072/**--------------------------------------------------------------------------
1073
1074 \brief vos_pkt_set_rx_length() - Set the length of a received packet
1075
1076 This API set the length of the data inside the packet after a DMA has occurred
1077 on rx, it will also set the tail pointer to the end of the data.
1078
1079 \param pPacket - the voss Packet to operate on.
1080
1081 \param pktLen - The size of the data placed in the Rx packet during DMA.
1082
1083
1084 \return
1085
1086 \sa
1087
1088 ---------------------------------------------------------------------------*/
1089VOS_STATUS vos_pkt_set_rx_length( vos_pkt_t *pPacket, v_SIZE_t pktLen );
1090
1091/**--------------------------------------------------------------------------
1092
1093 \brief vos_pkt_get_available_buffer_pool() - Get avaliable VOS packet size
1094 VOSS Packet pool is limitted resource
1095 VOSS Client need to know how many packet pool is still avaliable to control the flow
1096
1097 \param pktType - Packet type want to know free buffer count
1098 VOS_PKT_TYPE_TX_802_11_MGMT, management free buffer count,
1099 VOS_PKT_TYPE_TX_802_11_DATA
1100 VOS_PKT_TYPE_TX_802_3_DATA, TX free buffer count
1101 VOS_PKT_TYPE_RX_RAW, RX free buffer count
1102
1103 vosFreeBuffer - free frame buffer size
1104
1105 \return VOS_STATUS_E_INVAL - invalid input parameter
1106
1107 VOS_STATUS_SUCCESS - Get size success
1108
1109 \sa
1110
1111 ----------------------------------------------------------------------------*/
1112VOS_STATUS vos_pkt_get_available_buffer_pool
1113(
1114 VOS_PKT_TYPE pktType,
1115 v_SIZE_t *vosFreeBuffer
1116);
1117
1118#endif // !defined( __VOS_PKT_H )