src/dpdk/drivers/net/mlx4/mlx4.c
static void *
mlx4_alloc_verbs_buf(size_t size, void *data)
{
	struct mlx4_priv *priv = data;
	void *ret;
	size_t alignment = sysconf(_SC_PAGESIZE);
	unsigned int socket = SOCKET_ID_ANY;

	if (priv->verbs_alloc_ctx.type == MLX4_VERBS_ALLOC_TYPE_TX_QUEUE) {
		const struct txq *txq = priv->verbs_alloc_ctx.obj;

		socket = txq->socket;
	} else if (priv->verbs_alloc_ctx.type ==
		   MLX4_VERBS_ALLOC_TYPE_RX_QUEUE) {
		const struct rxq *rxq = priv->verbs_alloc_ctx.obj;

		socket = rxq->socket;
	}
	MLX4_ASSERT(data != NULL);
	ret = rte_malloc_socket(__func__, size, alignment, socket);
	if (!ret && size)
		rte_errno = ENOMEM;
	return ret;
}
/**
 * Verbs callback to allocate a memory. This function should allocate the space
 * according to the size provided residing inside a huge page.
 * Please note that all allocation must respect the alignment from libmlx4
 * (i.e. currently sysconf(_SC_PAGESIZE)).
 *
 * @param[in] size
 *   The size in bytes of the memory to allocate.
 * @param[in] data
 *   A pointer to the callback data.
 *
 * @return
 *   Allocated buffer, NULL otherwise and rte_errno is set.
 */
Verbs callback to allocate a memory. This function should allocate the space
according to the size provided residing inside a huge page.
Please note that all allocation must respect the alignment from libmlx4
).

@param[in] size
The size in bytes of the memory to allocate.
@param[in] data
A pointer to the callback data.

@return
Allocated buffer, NULL otherwise and rte_errno is set.
Verbs callback to allocate a memory . This function should allocate the space according to the size provided residing inside a huge page . Please note that all allocation must respect the alignment from libmlx4 ) . @param [ in ] size The size in bytes of the memory to allocate . @param [ in ] data A pointer to the callback data . @return Allocated buffer NULL otherwise and rte_errno is set .
static void *
mlx4_alloc_verbs_buf(size_t size, void *data)
{
	struct mlx4_priv *priv = data;
	void *ret;
	size_t alignment = sysconf(_SC_PAGESIZE);
	unsigned int socket = SOCKET_ID_ANY;
	if (priv->verbs_alloc_ctx.type == MLX4_VERBS_ALLOC_TYPE_TX_QUEUE) {
		const struct txq *txq = priv->verbs_alloc_ctx.obj;
		socket = txq->socket;
	} else if (priv->verbs_alloc_ctx.type ==
		   MLX4_VERBS_ALLOC_TYPE_RX_QUEUE) {
		const struct rxq *rxq = priv->verbs_alloc_ctx.obj;
		socket = rxq->socket;
	}
	MLX4_ASSERT(data != NULL);
	ret = rte_malloc_socket(__func__, size, alignment, socket);
	if (!ret && size)
		rte_errno = ENOMEM;
	return ret;
}
static void * mlx4_alloc_verbs_buf ( size_t size , void * data ) { struct mlx4_priv * priv = data ; void * ret ; size_t alignment = sysconf ( _SC_PAGESIZE ) ; unsigned int socket = SOCKET_ID_ANY ; if ( priv -> verbs_alloc_ctx . type == MLX4_VERBS_ALLOC_TYPE_TX_QUEUE ) { const struct txq * txq = priv -> verbs_alloc_ctx . obj ; socket = txq -> socket ; } else if ( priv -> verbs_alloc_ctx . type == MLX4_VERBS_ALLOC_TYPE_RX_QUEUE ) { const struct rxq * rxq = priv -> verbs_alloc_ctx . obj ; socket = rxq -> socket ; } MLX4_ASSERT ( data != NULL ) ; ret = rte_malloc_socket ( __func__ , size , alignment , socket ) ; if ( ! ret && size ) rte_errno = ENOMEM ; return ret ; }
Verbs callback to allocate a memory.
Verbs callback to allocate a memory .