* Allocate an uninitialized mbuf from mempool *mp*. * * This function can be used by PMDs (especially in RX functions) to * allocate an uninitialized mbuf. The driver is responsible of * initializing all the required fields. See rte_pktmbuf_reset(). * For standard needs, prefer rte_pktmbuf_alloc(). * * The caller can expect that the following fields of the mbuf structure * are initialized:
| 594 | * - NULL if allocation failed. |
| 595 | */ |
| 596 | static inline struct rte_mbuf *rte_mbuf_raw_alloc(struct rte_mempool *mp) |
| 597 | { |
| 598 | struct rte_mbuf *m; |
| 599 | |
| 600 | if (rte_mempool_get(mp, (void **)&m) < 0) |
| 601 | return NULL; |
| 602 | __rte_mbuf_raw_sanity_check(m); |
| 603 | return m; |
| 604 | } |
| 605 | |
| 606 | /** |
| 607 | * Put mbuf back into its original mempool. |