![]() |
![]() |
The file implements the Packet Buffer Library. The library provides a well defined API which abstracts the CPPI descriptors and provides services which can be used by the applications without getting to the lower level details of the descriptors. More...
#include <stdint.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <pktlib_osal.h>
#include <ti/runtime/pktlib/pktlib.h>
#include <ti/csl/cslr.h>
#include <ti/drv/qmss/qmss_drv.h>
#include <ti/drv/cppi/cppi_drv.h>
#include <ti/drv/cppi/cppi_desc.h>
Data Structures | |
struct | Pktlib_Info |
The structure describes the Packet Library information. More... | |
struct | Pktlib_Heap |
The structure describes the Packet Library Heaps. More... | |
Defines | |
#define | PKTLIB_MAX_HEAP_NAME 32 |
This is the MAXIMUM length of the heap name. | |
#define | PKTLIB_CLONE_PACKET 0x1 |
Internal flag which indicates that the packet has been cloned and there are references held on the packet. | |
#define | PKTLIB_SHARED_HEAP_PACKET 0x2 |
Internal flag which indicates that the packet belongs to a shared heap. | |
#define | PKTLIB_HEAP_IDX_START_BIT 28 |
Packet Library Heap Index starting bit position. | |
#define | PKTLIB_HEAP_IDX_END_BIT 31 |
Packet Library Heap Index ending bit position. | |
#define | PKTLIB_REF_CNT_START_BIT 22 |
Packet Library Ref count starting bit position. | |
#define | PKTLIB_REF_CNT_END_BIT 27 |
Packet Library Ref count ending bit position. | |
#define | PKTLIB_INT_FLAGS_START_BIT 30 |
Packet Library flags starting bit position. | |
#define | PKTLIB_INT_FLAGS_END_BIT 31 |
Packet Library flags ending bit position. | |
#define | PKTLIB_MAX_PACKET_HEAP (1 << (PKTLIB_HEAP_IDX_END_BIT - PKTLIB_HEAP_IDX_START_BIT + 1)) |
This is the MAXIMUM numbers of Packet Library heaps which can exist in the system. | |
#define | PKTLIB_MAX_REF_COUNT ((1 << (PKTLIB_REF_CNT_END_BIT - PKTLIB_REF_CNT_START_BIT + 1)) - 1) |
This is the MAX reference count for a packet. | |
#define | PKTLIB_MAX_SUPER_MANAGED_HEAPS 4 |
This is the MAX number of heaps which can be managed by a super heap. | |
Typedefs | |
typedef struct Pktlib_Info | Pktlib_Info |
The structure describes the Packet Library information. | |
typedef struct Pktlib_Heap | Pktlib_Heap |
The structure describes the Packet Library Heaps. | |
Functions | |
static Pktlib_Info * | Pktlib_getPktLibInfo (Ti_Pkt *pPkt) |
static uint8_t | Pktlib_getPktLibHeapIndex (Pktlib_Info *ptrPktLibInfo) |
static void | Pktlib_setPktLibHeapIndex (Pktlib_Info *ptrPktLibInfo, uint8_t heapIndex) |
static uint8_t | Pktlib_getPktLibFlags (Pktlib_Info *ptrPktLibInfo) |
static void | Pktlib_setPktLibFlags (Pktlib_Info *ptrPktLibInfo, uint8_t flags) |
static uint8_t | Pktlib_getCount (Pktlib_Info *ptrPktLibInfo) |
static void | Pktlib_setRefCount (Pktlib_Info *ptrPktLibInfo, uint8_t refCount) |
Pktlib_HeapHandle | Pktlib_getPktHeap (Ti_Pkt *pPkt) |
static void | Pktlib_incRefCount (Ti_Pkt *pPkt) |
static void | Pktlib_decRefCount (Ti_Pkt *pPkt) |
static uint8_t | Pktlib_getRefCount (Ti_Pkt *pPkt) |
static uint8_t | Pktlib_isDataBufferPkt (Ti_Pkt *pPkt) |
static void | Pktlib_cppiSetReturnQueue (Cppi_DescType descType, Cppi_Desc *descAddr, Qmss_Queue *queue) |
static void | Pktlib_setReturnQueueToGarbage (Ti_Pkt *pPkt) |
static void | Pktlib_getQueueStarvationCount (Pktlib_Heap *ptrPktHeap, uint8_t *dataBufferCount, uint8_t *zeroDataBufferCount) |
static int32_t | Pktlib_allocateStarvationQueue (Qmss_QueueHnd *pBaseStarvationQueue) |
static int32_t | Pktlib_getDescSize (Qmss_MemRegion memRegion) |
int32_t | Pktlib_sharedHeapInit (void) |
Pktlib_HeapHandle | Pktlib_createHeap (Pktlib_HeapCfg *ptrHeapCfg, int32_t *errCode) |
static int32_t | Pktlib_cmpDataBufferSize (Pktlib_HeapHandle a, Pktlib_HeapHandle b) |
static void | Pktlib_sortOnDataBufferSize (Pktlib_HeapHandle memberHeaps[], uint32_t len) |
Pktlib_HeapHandle | Pktlib_createSuperHeap (const char *name, Pktlib_HeapHandle memberHeaps[], int32_t numMemberHeaps, int32_t *errCode) |
void | Pktlib_invalidatePkt (Ti_Pkt *pPkt) |
void | Pktlib_writebackPkt (Ti_Pkt *pPkt) |
Pktlib_HeapHandle | Pktlib_findHeapByName (const char *name) |
void | Pktlib_getHeapStats (Pktlib_HeapHandle heapHandle, Pktlib_HeapStats *ptrHeapStats) |
static void | __Pktlib_freePacket (Ti_Pkt *pPkt, uint8_t followLinks) |
void | Pktlib_garbageCollection (Pktlib_HeapHandle heapHandle) |
void | Pktlib_freePacket (Ti_Pkt *pPkt) |
uint32_t | Pktlib_getMaxBufferSize (Pktlib_HeapHandle heapHandle) |
static Ti_Pkt * | Pktlib_superHeapAllocPacket (Pktlib_Heap *ptrSuperHeap, uint32_t size) |
Ti_Pkt * | Pktlib_allocPacket (Pktlib_HeapHandle heapHandle, uint32_t size) |
Ti_Pkt * | Pktlib_packetMerge (Ti_Pkt *pPkt1, Ti_Pkt *pPkt2, Ti_Pkt *pLastPkt) |
int32_t | Pktlib_clonePacket (Ti_Pkt *ptrPktOrig, Ti_Pkt *ptrClonePacket) |
int32_t | Pktlib_splitPacket (Ti_Pkt *pOrgPkt, Ti_Pkt *pNewPkt, uint32_t splitPacketSize, Ti_Pkt **pPkt1, Ti_Pkt **pPkt2) |
int32_t | Pktlib_splitPacket2 (Ti_Pkt *pOrgPkt, Ti_Pkt *pNewPkt, uint32_t splitPacketSize, Ti_Pkt **pPkt1, Ti_Pkt **pPkt2) |
Qmss_QueueHnd | Pktlib_getInternalHeapQueue (Pktlib_HeapHandle heapHandle) |
Qmss_QueueHnd | Pktlib_getZeroHeapQueue (Pktlib_HeapHandle heapHandle) |
uint32_t | Pktlib_getVersion (void) |
int32_t | Pktlib_deleteHeap (Pktlib_HeapHandle heapHandle, int32_t *errCode) |
Variables | |
Pktlib_Heap | gPktHeaps [PKTLIB_MAX_PACKET_HEAP] |
Global list of all the private heaps which are core specific. | |
Pktlib_Heap | gSuperPktHeaps [PKTLIB_MAX_PACKET_HEAP] |
Global list of all the super heaps which are core specific. | |
Pktlib_Heap | gSharedPktHeaps [PKTLIB_MAX_PACKET_HEAP] |
Global list of all the shared heaps which can be present in the system. |
The file implements the Packet Buffer Library. The library provides a well defined API which abstracts the CPPI descriptors and provides services which can be used by the applications without getting to the lower level details of the descriptors.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of Texas Instruments Incorporated nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.