IxOsalBufferMgt.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. /**
  2. * @file IxOsalBufferMgt.h
  3. *
  4. * @brief OSAL Buffer pool management and buffer management definitions.
  5. *
  6. * Design Notes:
  7. *
  8. * @par
  9. * IXP400 SW Release version 2.0
  10. *
  11. * -- Copyright Notice --
  12. *
  13. * @par
  14. * Copyright 2001-2005, Intel Corporation.
  15. * All rights reserved.
  16. *
  17. * @par
  18. * Redistribution and use in source and binary forms, with or without
  19. * modification, are permitted provided that the following conditions
  20. * are met:
  21. * 1. Redistributions of source code must retain the above copyright
  22. * notice, this list of conditions and the following disclaimer.
  23. * 2. Redistributions in binary form must reproduce the above copyright
  24. * notice, this list of conditions and the following disclaimer in the
  25. * documentation and/or other materials provided with the distribution.
  26. * 3. Neither the name of the Intel Corporation nor the names of its contributors
  27. * may be used to endorse or promote products derived from this software
  28. * without specific prior written permission.
  29. *
  30. * @par
  31. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
  32. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  33. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  34. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
  35. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  36. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  37. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  38. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  39. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  40. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  41. * SUCH DAMAGE.
  42. *
  43. * @par
  44. * -- End of Copyright Notice --
  45. */
  46. /* @par
  47. * -- Copyright Notice --
  48. *
  49. * @par
  50. * Copyright 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
  51. * The Regents of the University of California. All rights reserved.
  52. *
  53. * @par
  54. * Redistribution and use in source and binary forms, with or without
  55. * modification, are permitted provided that the following conditions
  56. * are met:
  57. * 1. Redistributions of source code must retain the above copyright
  58. * notice, this list of conditions and the following disclaimer.
  59. * 2. Redistributions in binary form must reproduce the above copyright
  60. * notice, this list of conditions and the following disclaimer in the
  61. * documentation and/or other materials provided with the distribution.
  62. * 3. Neither the name of the University nor the names of its contributors
  63. * may be used to endorse or promote products derived from this software
  64. * without specific prior written permission.
  65. *
  66. * @par
  67. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  68. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  69. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  70. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  71. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  72. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  73. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  74. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  75. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  76. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  77. * SUCH DAMAGE.
  78. *
  79. * @par
  80. * -- End of Copyright Notice --
  81. */
  82. #ifndef IxOsalBufferMgt_H
  83. #define IxOsalBufferMgt_H
  84. #include "IxOsal.h"
  85. /**
  86. * @defgroup IxOsalBufferMgt OSAL Buffer Management Module.
  87. *
  88. * @brief Buffer management module for IxOsal
  89. *
  90. * @{
  91. */
  92. /**
  93. * @ingroup IxOsalBufferMgt
  94. *
  95. * @def IX_OSAL_MBUF_MAX_POOLS
  96. *
  97. * @brief The maximum number of pools that can be allocated, must be
  98. * a multiple of 32 as required by implementation logic.
  99. * @note This can safely be increased if more pools are required.
  100. */
  101. #define IX_OSAL_MBUF_MAX_POOLS 32
  102. /**
  103. * @ingroup IxOsalBufferMgt
  104. *
  105. * @def IX_OSAL_MBUF_POOL_NAME_LEN
  106. *
  107. * @brief The maximum string length of the pool name
  108. */
  109. #define IX_OSAL_MBUF_POOL_NAME_LEN 64
  110. /**
  111. * Define IX_OSAL_MBUF
  112. */
  113. /* forward declaration of internal structure */
  114. struct __IXP_BUF;
  115. /*
  116. * OS can define it in IxOsalOs.h to skip the following
  117. * definition.
  118. */
  119. #ifndef IX_OSAL_ATTRIBUTE_ALIGN32
  120. #define IX_OSAL_ATTRIBUTE_ALIGN32 __attribute__ ((aligned(32)))
  121. #endif
  122. /* release v1.4 backward compatible definitions */
  123. struct __IX_MBUF
  124. {
  125. struct __IXP_BUF *ix_next IX_OSAL_ATTRIBUTE_ALIGN32;
  126. struct __IXP_BUF *ix_nextPacket;
  127. UINT8 *ix_data;
  128. UINT32 ix_len;
  129. unsigned char ix_type;
  130. unsigned char ix_flags;
  131. unsigned short ix_reserved;
  132. UINT32 ix_rsvd;
  133. UINT32 ix_PktLen;
  134. void *ix_priv;
  135. };
  136. struct __IX_CTRL
  137. {
  138. UINT32 ix_reserved[2]; /**< Reserved field */
  139. UINT32 ix_signature; /**< Field to indicate if buffers are allocated by the system */
  140. UINT32 ix_allocated_len; /**< Allocated buffer length */
  141. UINT32 ix_allocated_data; /**< Allocated buffer data pointer */
  142. void *ix_pool; /**< pointer to the buffer pool */
  143. struct __IXP_BUF *ix_chain; /**< chaining */
  144. void *ix_osbuf_ptr; /**< Storage for OS-specific buffer pointer */
  145. };
  146. struct __IX_NE_SHARED
  147. {
  148. UINT32 reserved[8] IX_OSAL_ATTRIBUTE_ALIGN32; /**< Reserved area for NPE Service-specific usage */
  149. };
  150. /*
  151. * IXP buffer structure
  152. */
  153. typedef struct __IXP_BUF
  154. {
  155. struct __IX_MBUF ix_mbuf IX_OSAL_ATTRIBUTE_ALIGN32; /**< buffer header */
  156. struct __IX_CTRL ix_ctrl; /**< buffer management */
  157. struct __IX_NE_SHARED ix_ne; /**< Reserved area for NPE Service-specific usage*/
  158. } IXP_BUF;
  159. /**
  160. * @ingroup IxOsalBufferMgt
  161. *
  162. * @def typedef IX_OSAL_MBUF
  163. *
  164. * @brief Generic IXP mbuf format.
  165. */
  166. typedef IXP_BUF IX_OSAL_MBUF;
  167. /**
  168. * @ingroup IxOsalBufferMgt
  169. *
  170. * @def IX_OSAL_IXP_NEXT_BUFFER_IN_PKT_PTR(m_blk_ptr)
  171. *
  172. * @brief Return pointer to the next mbuf in a single packet
  173. */
  174. #define IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR(m_blk_ptr) \
  175. (m_blk_ptr)->ix_mbuf.ix_next
  176. /**
  177. * @ingroup IxOsalBufferMgt
  178. *
  179. * @def IX_OSAL_MBUF_NEXT_PKT_IN_CHAIN_PTR(m_blk_ptr)
  180. *
  181. * @brief Return pointer to the next packet in the chain
  182. */
  183. #define IX_OSAL_MBUF_NEXT_PKT_IN_CHAIN_PTR(m_blk_ptr) \
  184. (m_blk_ptr)->ix_mbuf.ix_nextPacket
  185. /**
  186. * @ingroup IxOsalBufferMgt
  187. *
  188. * @def IX_OSAL_MBUF_MDATA(m_blk_ptr)
  189. *
  190. * @brief Return pointer to the data in the mbuf
  191. */
  192. #define IX_OSAL_MBUF_MDATA(m_blk_ptr) (m_blk_ptr)->ix_mbuf.ix_data
  193. /**
  194. * @ingroup IxOsalBufferMgt
  195. *
  196. * @def IX_OSAL_MBUF_MLEN(m_blk_ptr)
  197. *
  198. * @brief Return the data length
  199. */
  200. #define IX_OSAL_MBUF_MLEN(m_blk_ptr) \
  201. (m_blk_ptr)->ix_mbuf.ix_len
  202. /**
  203. * @ingroup IxOsalBufferMgt
  204. *
  205. * @def IX_OSAL_MBUF_MTYPE(m_blk_ptr)
  206. *
  207. * @brief Return the data type in the mbuf
  208. */
  209. #define IX_OSAL_MBUF_MTYPE(m_blk_ptr) \
  210. (m_blk_ptr)->ix_mbuf.ix_type
  211. /**
  212. * @ingroup IxOsalBufferMgt
  213. *
  214. * @def IX_OSAL_MBUF_FLAGS(m_blk_ptr)
  215. *
  216. * @brief Return the buffer flags
  217. */
  218. #define IX_OSAL_MBUF_FLAGS(m_blk_ptr) \
  219. (m_blk_ptr)->ix_mbuf.ix_flags
  220. /**
  221. * @ingroup IxOsalBufferMgt
  222. *
  223. * @def IX_OSAL_MBUF_NET_POOL(m_blk_ptr)
  224. *
  225. * @brief Return pointer to a network pool
  226. */
  227. #define IX_OSAL_MBUF_NET_POOL(m_blk_ptr) \
  228. (m_blk_ptr)->ix_ctrl.ix_pool
  229. /**
  230. * @ingroup IxOsalBufferMgt
  231. *
  232. * @def IX_OSAL_MBUF_PKT_LEN(m_blk_ptr)
  233. *
  234. * @brief Return the total length of all the data in
  235. * the mbuf chain for this packet
  236. */
  237. #define IX_OSAL_MBUF_PKT_LEN(m_blk_ptr) \
  238. (m_blk_ptr)->ix_mbuf.ix_PktLen
  239. /**
  240. * @ingroup IxOsalBufferMgt
  241. *
  242. * @def IX_OSAL_MBUF_PRIV(m_blk_ptr)
  243. *
  244. * @brief Return the private field
  245. */
  246. #define IX_OSAL_MBUF_PRIV(m_blk_ptr) \
  247. (m_blk_ptr)->ix_mbuf.ix_priv
  248. /**
  249. * @ingroup IxOsalBufferMgt
  250. *
  251. * @def IX_OSAL_MBUF_SIGNATURE(m_blk_ptr)
  252. *
  253. * @brief Return the signature field of IX_OSAL_MBUF
  254. */
  255. #define IX_OSAL_MBUF_SIGNATURE(m_blk_ptr) \
  256. (m_blk_ptr)->ix_ctrl.ix_signature
  257. /**
  258. * @ingroup IxOsalBufferMgt
  259. *
  260. * @def IX_OSAL_MBUF_OSBUF_PTR(m_blk_ptr)
  261. *
  262. * @brief Return ix_osbuf_ptr field of IX_OSAL_MBUF, which is used to store OS-specific buffer pointer during a buffer conversion.
  263. */
  264. #define IX_OSAL_MBUF_OSBUF_PTR(m_blk_ptr) \
  265. (m_blk_ptr)->ix_ctrl.ix_osbuf_ptr
  266. /**
  267. * @ingroup IxOsalBufferMgt
  268. *
  269. * @def IX_OSAL_MBUF_ALLOCATED_BUFF_LEN(m_blk_ptr)
  270. *
  271. * @brief Return the allocated buffer size
  272. */
  273. #define IX_OSAL_MBUF_ALLOCATED_BUFF_LEN(m_blk_ptr) \
  274. (m_blk_ptr)->ix_ctrl.ix_allocated_len
  275. /**
  276. * @ingroup IxOsalBufferMgt
  277. *
  278. * @def IX_OSAL_MBUF_ALLOCATED_BUFF_DATA(m_blk_ptr)
  279. *
  280. * @brief Return the allocated buffer pointer
  281. */
  282. #define IX_OSAL_MBUF_ALLOCATED_BUFF_DATA(m_blk_ptr) \
  283. (m_blk_ptr)->ix_ctrl.ix_allocated_data
  284. /* Name length */
  285. #define IX_OSAL_MBUF_POOL_NAME_LEN 64
  286. /****************************************************
  287. * Macros for buffer pool management
  288. ****************************************************/
  289. /**
  290. * @ingroup IxOsalBufferMgt
  291. *
  292. * @def IX_OSAL_MBUF_POOL_FREE_COUNT(m_pool_ptr
  293. *
  294. * @brief Return the total number of freed buffers left in the pool.
  295. */
  296. #define IX_OSAL_MBUF_POOL_FREE_COUNT(m_pool_ptr) \
  297. ixOsalBuffPoolFreeCountGet(m_pool_ptr)
  298. /**
  299. * @ingroup IxOsalBufferMgt
  300. *
  301. * @def IX_OSAL_MBUF_POOL_SIZE_ALIGN
  302. *
  303. * @brief This macro takes an integer as an argument and
  304. * rounds it up to be a multiple of the memory cache-line
  305. * size.
  306. *
  307. * @param int [in] size - the size integer to be rounded up
  308. *
  309. * @return int - the size, rounded up to a multiple of
  310. * the cache-line size
  311. */
  312. #define IX_OSAL_MBUF_POOL_SIZE_ALIGN(size) \
  313. ((((size) + (IX_OSAL_CACHE_LINE_SIZE - 1)) / \
  314. IX_OSAL_CACHE_LINE_SIZE) * \
  315. IX_OSAL_CACHE_LINE_SIZE)
  316. /* Don't use this directly, use macro */
  317. PUBLIC UINT32 ixOsalBuffPoolMbufAreaSizeGet (int count);
  318. /**
  319. * @ingroup IxOsalBufferMgt
  320. *
  321. * @def IX_OSAL_MBUF_POOL_MBUF_AREA_SIZE_ALIGNED
  322. *
  323. * @brief This macro calculates, from the number of mbufs required, the
  324. * size of the memory area required to contain the mbuf headers for the
  325. * buffers in the pool. The size to be used for each mbuf header is
  326. * rounded up to a multiple of the cache-line size, to ensure
  327. * each mbuf header aligns on a cache-line boundary.
  328. * This macro is used by IX_OSAL_MBUF_POOL_MBUF_AREA_ALLOC()
  329. *
  330. * @param int [in] count - the number of buffers the pool will contain
  331. *
  332. * @return int - the total size required for the pool mbuf area (aligned)
  333. */
  334. #define IX_OSAL_MBUF_POOL_MBUF_AREA_SIZE_ALIGNED(count) \
  335. ixOsalBuffPoolMbufAreaSizeGet(count)
  336. /* Don't use this directly, use macro */
  337. PUBLIC UINT32 ixOsalBuffPoolDataAreaSizeGet (int count, int size);
  338. /**
  339. * @ingroup IxOsalBufferMgt
  340. *
  341. * @def IX_OSAL_MBUF_POOL_DATA_AREA_SIZE_ALIGNED
  342. *
  343. * @brief This macro calculates, from the number of mbufs required and the
  344. * size of the data portion for each mbuf, the size of the data memory area
  345. * required. The size is adjusted to ensure alignment on cache line boundaries.
  346. * This macro is used by IX_OSAL_MBUF_POOL_DATA_AREA_ALLOC()
  347. *
  348. *
  349. * @param int [in] count - The number of mbufs in the pool.
  350. * @param int [in] size - The desired size for each mbuf data portion.
  351. * This size will be rounded up to a multiple of the
  352. * cache-line size to ensure alignment on cache-line
  353. * boundaries for each data block.
  354. *
  355. * @return int - the total size required for the pool data area (aligned)
  356. */
  357. #define IX_OSAL_MBUF_POOL_DATA_AREA_SIZE_ALIGNED(count, size) \
  358. ixOsalBuffPoolDataAreaSizeGet((count), (size))
  359. /**
  360. * @ingroup IxOsalBufferMgt
  361. *
  362. * @def IX_OSAL_MBUF_POOL_MBUF_AREA_ALLOC
  363. *
  364. * @brief Allocates the memory area needed for the number of mbuf headers
  365. * specified by <i>count</i>.
  366. * This macro ensures the mbuf headers align on cache line boundaries.
  367. * This macro evaluates to a pointer to the memory allocated.
  368. *
  369. * @param int [in] count - the number of mbufs the pool will contain
  370. * @param int [out] memAreaSize - the total amount of memory allocated
  371. *
  372. * @return void * - a pointer to the allocated memory area
  373. */
  374. #define IX_OSAL_MBUF_POOL_MBUF_AREA_ALLOC(count, memAreaSize) \
  375. IX_OSAL_CACHE_DMA_MALLOC((memAreaSize = \
  376. IX_OSAL_MBUF_POOL_MBUF_AREA_SIZE_ALIGNED(count)))
  377. /**
  378. * @ingroup IxOsalBufferMgt
  379. *
  380. * @def IX_OSAL_MBUF_POOL_DATA_AREA_ALLOC
  381. *
  382. * @brief Allocates the memory pool for the data portion of the pool mbufs.
  383. * The number of mbufs is specified by <i>count</i>. The size of the data
  384. * portion of each mbuf is specified by <i>size</i>.
  385. * This macro ensures the mbufs are aligned on cache line boundaries
  386. * This macro evaluates to a pointer to the memory allocated.
  387. *
  388. * @param int [in] count - the number of mbufs the pool will contain
  389. * @param int [in] size - the desired size (in bytes) required for the data
  390. * portion of each mbuf. Note that this size may be
  391. * rounded up to ensure alignment on cache-line
  392. * boundaries.
  393. * @param int [out] memAreaSize - the total amount of memory allocated
  394. *
  395. * @return void * - a pointer to the allocated memory area
  396. */
  397. #define IX_OSAL_MBUF_POOL_DATA_AREA_ALLOC(count, size, memAreaSize) \
  398. IX_OSAL_CACHE_DMA_MALLOC((memAreaSize = \
  399. IX_OSAL_MBUF_POOL_DATA_AREA_SIZE_ALIGNED(count,size)))
  400. /**
  401. * @ingroup IxOsalBufferMgt
  402. *
  403. * @def IX_OSAL_MBUF_POOL_INIT
  404. *
  405. * @brief Wrapper macro for ixOsalPoolInit()
  406. * See function description below for details.
  407. */
  408. #define IX_OSAL_MBUF_POOL_INIT(count, size, name) \
  409. ixOsalPoolInit((count), (size), (name))
  410. /**
  411. * @ingroup IxOsalBufferMgt
  412. *
  413. * @def IX_OSAL_MBUF_NO_ALLOC_POOL_INIT
  414. *
  415. * @return Pointer to the new pool or NULL if the initialization failed.
  416. *
  417. * @brief Wrapper macro for ixOsalNoAllocPoolInit()
  418. * See function description below for details.
  419. *
  420. */
  421. #define IX_OSAL_MBUF_NO_ALLOC_POOL_INIT(bufPtr, dataPtr, count, size, name) \
  422. ixOsalNoAllocPoolInit( (bufPtr), (dataPtr), (count), (size), (name))
  423. /**
  424. * @ingroup IxOsalBufferMgt
  425. *
  426. * @def IX_OSAL_MBUF_POOL_GET
  427. *
  428. * @brief Wrapper macro for ixOsalMbufAlloc()
  429. * See function description below for details.
  430. */
  431. #define IX_OSAL_MBUF_POOL_GET(poolPtr) \
  432. ixOsalMbufAlloc(poolPtr)
  433. /**
  434. * @ingroup IxOsalBufferMgt
  435. *
  436. * @def IX_OSAL_MBUF_POOL_PUT
  437. *
  438. * @brief Wrapper macro for ixOsalMbufFree()
  439. * See function description below for details.
  440. */
  441. #define IX_OSAL_MBUF_POOL_PUT(bufPtr) \
  442. ixOsalMbufFree(bufPtr)
  443. /**
  444. * @ingroup IxOsalBufferMgt
  445. *
  446. * @def IX_OSAL_MBUF_POOL_PUT_CHAIN
  447. *
  448. * @brief Wrapper macro for ixOsalMbufChainFree()
  449. * See function description below for details.
  450. */
  451. #define IX_OSAL_MBUF_POOL_PUT_CHAIN(bufPtr) \
  452. ixOsalMbufChainFree(bufPtr)
  453. /**
  454. * @ingroup IxOsalBufferMgt
  455. *
  456. * @def IX_OSAL_MBUF_POOL_SHOW
  457. *
  458. * @brief Wrapper macro for ixOsalMbufPoolShow()
  459. * See function description below for details.
  460. */
  461. #define IX_OSAL_MBUF_POOL_SHOW(poolPtr) \
  462. ixOsalMbufPoolShow(poolPtr)
  463. /**
  464. * @ingroup IxOsalBufferMgt
  465. *
  466. * @def IX_OSAL_MBUF_POOL_MDATA_RESET
  467. *
  468. * @brief Wrapper macro for ixOsalMbufDataPtrReset()
  469. * See function description below for details.
  470. */
  471. #define IX_OSAL_MBUF_POOL_MDATA_RESET(bufPtr) \
  472. ixOsalMbufDataPtrReset(bufPtr)
  473. /**
  474. * @ingroup IxOsalBufferMgt
  475. *
  476. * @def IX_OSAL_MBUF_POOL_UNINIT
  477. *
  478. * @brief Wrapper macro for ixOsalBuffPoolUninit()
  479. * See function description below for details.
  480. */
  481. #define IX_OSAL_MBUF_POOL_UNINIT(m_pool_ptr) \
  482. ixOsalBuffPoolUninit(m_pool_ptr)
  483. /*
  484. * Include OS-specific bufferMgt definitions
  485. */
  486. #include "IxOsalOsBufferMgt.h"
  487. /**
  488. * @ingroup IxOsalBufferMgt
  489. *
  490. * @def IX_OSAL_CONVERT_OSBUF_TO_IXPBUF( osBufPtr, ixpBufPtr)
  491. *
  492. * @brief Convert pre-allocated os-specific buffer format to OSAL IXP_BUF (IX_OSAL_MBUF) format.
  493. * It is users' responsibility to provide pre-allocated and valid buffer pointers.
  494. * @param osBufPtr (in) - a pre-allocated os-specific buffer pointer.
  495. * @param ixpBufPtr (in)- a pre-allocated OSAL IXP_BUF pointer
  496. * @return None
  497. */
  498. #define IX_OSAL_CONVERT_OSBUF_TO_IXPBUF( osBufPtr, ixpBufPtr) \
  499. IX_OSAL_OS_CONVERT_OSBUF_TO_IXPBUF( osBufPtr, ixpBufPtr)
  500. /**
  501. * @ingroup IxOsalBufferMgt
  502. *
  503. * @def IX_OSAL_CONVERT_IXPBUF_TO_OSBUF( ixpBufPtr, osBufPtr)
  504. *
  505. * @brief Convert pre-allocated OSAL IXP_BUF (IX_OSAL_MBUF) format to os-specific buffer pointers.
  506. * @param ixpBufPtr (in) - OSAL IXP_BUF pointer
  507. * @param osBufPtr (out) - os-specific buffer pointer.
  508. * @return None
  509. */
  510. #define IX_OSAL_CONVERT_IXPBUF_TO_OSBUF( ixpBufPtr, osBufPtr) \
  511. IX_OSAL_OS_CONVERT_IXPBUF_TO_OSBUF( ixpBufPtr, osBufPtr)
  512. PUBLIC IX_OSAL_MBUF_POOL *ixOsalPoolInit (UINT32 count,
  513. UINT32 size, const char *name);
  514. PUBLIC IX_OSAL_MBUF_POOL *ixOsalNoAllocPoolInit (void *poolBufPtr,
  515. void *poolDataPtr,
  516. UINT32 count,
  517. UINT32 size,
  518. const char *name);
  519. PUBLIC IX_OSAL_MBUF *ixOsalMbufAlloc (IX_OSAL_MBUF_POOL * pool);
  520. PUBLIC IX_OSAL_MBUF *ixOsalMbufFree (IX_OSAL_MBUF * mbuf);
  521. PUBLIC void ixOsalMbufChainFree (IX_OSAL_MBUF * mbuf);
  522. PUBLIC void ixOsalMbufDataPtrReset (IX_OSAL_MBUF * mbuf);
  523. PUBLIC void ixOsalMbufPoolShow (IX_OSAL_MBUF_POOL * pool);
  524. PUBLIC IX_STATUS ixOsalBuffPoolUninit (IX_OSAL_MBUF_POOL * pool);
  525. PUBLIC UINT32 ixOsalBuffPoolFreeCountGet(IX_OSAL_MBUF_POOL * pool);
  526. /**
  527. * @} IxOsalBufferMgt
  528. */
  529. #endif /* IxOsalBufferMgt_H */