![]() |
PDK API Guide for J721E
|
Implements a simple buffer pool.
Go to the source code of this file.
Data Structures | |
struct | BufPool_Buf |
Fixed size data buffer. More... | |
struct | BufPool_Pool |
Fixed size buffer pool. More... | |
Macros | |
#define | BUFPOOL_MEM_LEN (BUFPOOL_MAX_POOLS * sizeof(BufPool_Pool)) |
#define | ETH_MAX_PAYLOAD (1514) |
#define | VLAN_TAG_SIZE (4U) |
#define | ETH_FRAME_SIZE (ETH_MAX_PAYLOAD + VLAN_TAG_SIZE) |
#define | BUFPOOL_MCU2_0_R5 (0) |
#define | BUFPOOL_MCU2_1 (1) |
#define | BUFPOOL_A72 (2) |
#define | BUFPOOL_MCU2_0_A72 (3) |
#define | BUFPOOL_MAX_POOLS (4) |
#define | BUFPOOL_BUF_MAX (1280U) |
#define | BUFPOOL_OK (0) |
#define | BUFPOOL_ERROR (-1) |
#define | BUF_OBJ_SIZE_IN_BYTES (sizeof(BufPool_Buf)) |
Typedefs | |
typedef struct BufPool_Pool_s * | BufPool_Handle |
BufPool handle. More... | |
Functions | |
int32_t | BufPool_init (BufPool_Handle hBufPool, uint32_t poolId, uint32_t maxSize) |
Initializes a buffer pool. More... | |
BufPool_Buf * | BufPool_getBuf (BufPool_Handle hBufPool) |
Returns a pointer to a free buffer. More... | |
int32_t | BufPool_freeBuf (BufPool_Buf *hBuf) |
Decrements the ref count of a buffer object. More... | |
Variables | |
BufPool_Handle | BufPoolTable_Handle |
#define BUFPOOL_MEM_LEN (BUFPOOL_MAX_POOLS * sizeof(BufPool_Pool)) |
Total memory used by all shared buffer pools combined
#define ETH_MAX_PAYLOAD (1514) |
Maximum Ethernet Payload Size.
#define VLAN_TAG_SIZE (4U) |
Size of the VLAN tag in bytes
#define ETH_FRAME_SIZE (ETH_MAX_PAYLOAD + VLAN_TAG_SIZE) |
Total size of the Ethernet frame in bytes
#define BUFPOOL_MCU2_0_R5 (0) |
MCU2_0 buffer pool for MCU2_0->MCU2_1 interface
#define BUFPOOL_MCU2_1 (1) |
MCU2_1 buffer pool
#define BUFPOOL_A72 (2) |
A72 buffer pool
#define BUFPOOL_MCU2_0_A72 (3) |
MCU2_0 buffer pool for MCU2_0->A72 interface
#define BUFPOOL_MAX_POOLS (4) |
Total number of buffer pools
#define BUFPOOL_BUF_MAX (1280U) |
Maximum no. of buffers in each buffer pool
#define BUFPOOL_OK (0) |
Buffer pool API return code: Success
#define BUFPOOL_ERROR (-1) |
Buffer pool API return code: Failure
#define BUF_OBJ_SIZE_IN_BYTES (sizeof(BufPool_Buf)) |
Size of buffer object
typedef struct BufPool_Pool_s* BufPool_Handle |
BufPool handle.
BufPool handle provided to the user
int32_t BufPool_init | ( | BufPool_Handle | hBufPool, |
uint32_t | poolId, | ||
uint32_t | maxSize | ||
) |
Initializes a buffer pool.
This function creates a buffer pool in the memory region pointed to by the BufPool_Handle
hBufPool | Pointer to pre-allocated memory for this buffer pool |
poolId | Buffer Pool ID |
maxSize | Total no. of buffers in this buffer pool |
BUFPOOL_OK |
BufPool_Buf* BufPool_getBuf | ( | BufPool_Handle | hBufPool | ) |
Returns a pointer to a free buffer.
This function alloctes a free buffer from the given buffer pool and returns a pointer to it.
hBufPool | Handle to the buffer pool from which to allocate a buffer |
Pointer | to a BufPool_Buf object if the get operation was successfull |
NULL | in case of failure |
int32_t BufPool_freeBuf | ( | BufPool_Buf * | hBuf | ) |
Decrements the ref count of a buffer object.
This function decrements the ref count of an allocated buffer object. If the ref count reaches zero, the buffer is released to the buffer pool.
hBuf | Handle to a buffer object |
BUFPOOL_OK |
BufPool_Handle BufPoolTable_Handle |