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