/* Mallocs a block of memory and initializes an mbuf pool to use it. The specified block_size indicates the size of an mbuf acquired from the pool if it does not contain a pkthdr. */
int mem_malloc_mbuf_pool(struct os_mempool *mempool, struct os_mbuf_pool *mbuf_pool, uint16_t num_blocks, uint32_t block_size, char *name, void **out_buf)
/* Mallocs a block of memory and initializes an mbuf pool to use it. The specified block_size indicates the size of an mbuf acquired from the pool if it does not contain a pkthdr. */
int mem_malloc_mbuf_pool(struct os_mempool *mempool, struct os_mbuf_pool *mbuf_pool, uint16_t num_blocks, uint32_t block_size, char *name, void **out_buf)
{
    void *buf;
    int rc;
    block_size = OS_ALIGN(block_size + sizeof (struct os_mbuf), OS_ALIGNMENT);
    rc = mem_malloc_mempool(mempool, num_blocks, block_size, name, &buf);
    if (rc != 0) {
        return rc;
    }
    rc = os_mbuf_pool_init(mbuf_pool, mempool, block_size, num_blocks);
    if (rc != 0) {
        tls_mem_free(buf);
        return rc;
    }
    if (out_buf != NULL) {
        *out_buf = buf;
    }
    return 0;
}