📄 ixosalbuffermgt.h
字号:
/** * @file IxOsalBufferMgt.h * * @brief OSAL Buffer pool management and buffer management definitions. * * Design Notes: * * @par * IXP400 SW Release version 2.1 * * -- Copyright Notice -- * * @par * Copyright (c) 2001-2005, Intel Corporation. * All rights reserved. * * @par * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. 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. * 3. Neither the name of the Intel Corporation nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * * @par * 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. * * * @par * -- End of Copyright Notice -- *//* @par * -- Copyright Notice -- * * @par * Copyright 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 * The Regents of the University of California. All rights reserved. * * @par * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. 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. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * @par * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. * * @par * -- End of Copyright Notice -- */#ifndef IxOsalBufferMgt_H#define IxOsalBufferMgt_H#include "IxOsal.h"/** * @defgroup IxOsalBufferMgt OSAL Buffer Management Module. * * @brief Buffer management module for IxOsal * * @{ *//** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_MAX_POOLS * * @brief The maximum number of pools that can be allocated, must be * a multiple of 32 as required by implementation logic. * @note This can safely be increased if more pools are required. */#define IX_OSAL_MBUF_MAX_POOLS 32/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_POOL_NAME_LEN * * @brief The maximum string length of the pool name */#define IX_OSAL_MBUF_POOL_NAME_LEN 64/** * Define IX_OSAL_MBUF *//* forward declaration of internal structure */struct __IXP_BUF;/* * OS can define it in IxOsalOs.h to skip the following * definition. */#ifndef IX_OSAL_ATTRIBUTE_ALIGN32#define IX_OSAL_ATTRIBUTE_ALIGN32 __attribute__ ((aligned(32)))#endif/* release v1.4 backward compatible definitions */struct __IX_MBUF{ struct __IXP_BUF *ix_next IX_OSAL_ATTRIBUTE_ALIGN32; struct __IXP_BUF *ix_nextPacket; UINT8 *ix_data; UINT32 ix_len; unsigned char ix_type; unsigned char ix_flags; unsigned short ix_reserved; UINT32 ix_rsvd; UINT32 ix_PktLen; void *ix_priv; };struct __IX_CTRL{ UINT32 ix_reserved[2]; /**< Reserved field */ UINT32 ix_signature; /**< Field to indicate if buffers are allocated by the system */ UINT32 ix_allocated_len; /**< Allocated buffer length */ UINT32 ix_allocated_data; /**< Allocated buffer data pointer */ void *ix_pool; /**< pointer to the buffer pool */ struct __IXP_BUF *ix_chain; /**< chaining */ void *ix_osbuf_ptr; /**< Storage for OS-specific buffer pointer */};#ifdef _DIAB_TOOLIX_OSAL_ATTRIBUTE_ALIGN32 struct __IX_NE_SHARED{ UINT32 reserved[8]; /**< Reserved area for NPE Service-specific usage */};#elsestruct __IX_NE_SHARED{ UINT32 reserved[8] IX_OSAL_ATTRIBUTE_ALIGN32; /**< Reserved area for NPE Service-specific usage */};#endif/* * IXP buffer structure */typedef struct __IXP_BUF{ struct __IX_MBUF ix_mbuf IX_OSAL_ATTRIBUTE_ALIGN32; /**< buffer header */ struct __IX_CTRL ix_ctrl; /**< buffer management */ struct __IX_NE_SHARED ix_ne; /**< Reserved area for NPE Service-specific usage*/} IXP_BUF;/** * @ingroup IxOsalBufferMgt * * @def typedef IX_OSAL_MBUF * * @brief Generic IXP mbuf format. */typedef IXP_BUF IX_OSAL_MBUF;/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_IXP_NEXT_BUFFER_IN_PKT_PTR(m_blk_ptr) * * @brief Return pointer to the next mbuf in a single packet */#define IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR(m_blk_ptr) \ (m_blk_ptr)->ix_mbuf.ix_next/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_NEXT_PKT_IN_CHAIN_PTR(m_blk_ptr) * * @brief Return pointer to the next packet in the chain */#define IX_OSAL_MBUF_NEXT_PKT_IN_CHAIN_PTR(m_blk_ptr) \ (m_blk_ptr)->ix_mbuf.ix_nextPacket/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_MDATA(m_blk_ptr) * * @brief Return pointer to the data in the mbuf */#define IX_OSAL_MBUF_MDATA(m_blk_ptr) (m_blk_ptr)->ix_mbuf.ix_data/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_MLEN(m_blk_ptr) * * @brief Return the data length */#define IX_OSAL_MBUF_MLEN(m_blk_ptr) \ (m_blk_ptr)->ix_mbuf.ix_len/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_MTYPE(m_blk_ptr) * * @brief Return the data type in the mbuf */#define IX_OSAL_MBUF_MTYPE(m_blk_ptr) \ (m_blk_ptr)->ix_mbuf.ix_type/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_FLAGS(m_blk_ptr) * * @brief Return the buffer flags */#define IX_OSAL_MBUF_FLAGS(m_blk_ptr) \ (m_blk_ptr)->ix_mbuf.ix_flags/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_NET_POOL(m_blk_ptr) * * @brief Return pointer to a network pool */#define IX_OSAL_MBUF_NET_POOL(m_blk_ptr) \ (m_blk_ptr)->ix_ctrl.ix_pool/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_PKT_LEN(m_blk_ptr) * * @brief Return the total length of all the data in * the mbuf chain for this packet */#define IX_OSAL_MBUF_PKT_LEN(m_blk_ptr) \ (m_blk_ptr)->ix_mbuf.ix_PktLen/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_PRIV(m_blk_ptr) * * @brief Return the private field */#define IX_OSAL_MBUF_PRIV(m_blk_ptr) \ (m_blk_ptr)->ix_mbuf.ix_priv/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_SIGNATURE(m_blk_ptr) * * @brief Return the signature field of IX_OSAL_MBUF */#define IX_OSAL_MBUF_SIGNATURE(m_blk_ptr) \ (m_blk_ptr)->ix_ctrl.ix_signature/** * @ingroup IxOsalBufferMgt * * @def IX_OSAL_MBUF_OSBUF_PTR(m_blk_ptr) * * @brief Return ix_osbuf_ptr field of IX_OSAL_MBUF, which is used to store OS-specific buffer pointer during a buffer conversion. */#define IX_OSAL_MBUF_OSBUF_PTR(m_blk_ptr) \ (m_blk_ptr)->ix_ctrl.ix_osbuf_ptr
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -