src/dpdk/drivers/net/mlx5/mlx5_rxq.c
struct mlx5_rxq_ctrl *
mlx5_rxq_hairpin_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
		     const struct rte_eth_hairpin_conf *hairpin_conf)
{
	struct mlx5_priv *priv = dev->data->dev_private;
	struct mlx5_rxq_ctrl *tmpl;

	tmpl = mlx5_malloc(MLX5_MEM_RTE | MLX5_MEM_ZERO, sizeof(*tmpl), 0,
			   SOCKET_ID_ANY);
	if (!tmpl) {
		rte_errno = ENOMEM;
		return NULL;
	}
	tmpl->type = MLX5_RXQ_TYPE_HAIRPIN;
	tmpl->socket = SOCKET_ID_ANY;
	tmpl->rxq.rss_hash = 0;
	tmpl->rxq.port_id = dev->data->port_id;
	tmpl->priv = priv;
	tmpl->rxq.mp = NULL;
	tmpl->rxq.elts_n = log2above(desc);
	tmpl->rxq.elts = NULL;
	tmpl->rxq.mr_ctrl.cache_bh = (struct mlx5_mr_btree) { 0 };
	tmpl->hairpin_conf = *hairpin_conf;
	tmpl->rxq.idx = idx;
	__atomic_fetch_add(&tmpl->refcnt, 1, __ATOMIC_RELAXED);
	LIST_INSERT_HEAD(&priv->rxqsctrl, tmpl, next);
	return tmpl;
}
/**
 * Create a DPDK Rx hairpin queue.
 *
 * @param dev
 *   Pointer to Ethernet device.
 * @param idx
 *   RX queue index.
 * @param desc
 *   Number of descriptors to configure in queue.
 * @param hairpin_conf
 *   The hairpin binding configuration.
 *
 * @return
 *   A DPDK queue object on success, NULL otherwise and rte_errno is set.
 */
Create a DPDK Rx hairpin queue.
@param dev
Pointer to Ethernet device.
@param idx
RX queue index.
@param desc
Number of descriptors to configure in queue.
@param hairpin_conf
The hairpin binding configuration.

@return
A DPDK queue object on success, NULL otherwise and rte_errno is set.
Create a DPDK Rx hairpin queue . @param dev Pointer to Ethernet device . @param idx RX queue index . @param desc Number of descriptors to configure in queue . @param hairpin_conf The hairpin binding configuration . @return A DPDK queue object on success NULL otherwise and rte_errno is set .
struct mlx5_rxq_ctrl *
mlx5_rxq_hairpin_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
		     const struct rte_eth_hairpin_conf *hairpin_conf)
{
	struct mlx5_priv *priv = dev->data->dev_private;
	struct mlx5_rxq_ctrl *tmpl;
	tmpl = mlx5_malloc(MLX5_MEM_RTE | MLX5_MEM_ZERO, sizeof(*tmpl), 0,
			   SOCKET_ID_ANY);
	if (!tmpl) {
		rte_errno = ENOMEM;
		return NULL;
	}
	tmpl->type = MLX5_RXQ_TYPE_HAIRPIN;
	tmpl->socket = SOCKET_ID_ANY;
	tmpl->rxq.rss_hash = 0;
	tmpl->rxq.port_id = dev->data->port_id;
	tmpl->priv = priv;
	tmpl->rxq.mp = NULL;
	tmpl->rxq.elts_n = log2above(desc);
	tmpl->rxq.elts = NULL;
	tmpl->rxq.mr_ctrl.cache_bh = (struct mlx5_mr_btree) { 0 };
	tmpl->hairpin_conf = *hairpin_conf;
	tmpl->rxq.idx = idx;
	__atomic_fetch_add(&tmpl->refcnt, 1, __ATOMIC_RELAXED);
	LIST_INSERT_HEAD(&priv->rxqsctrl, tmpl, next);
	return tmpl;
}
struct mlx5_rxq_ctrl * mlx5_rxq_hairpin_new ( struct rte_eth_dev * dev , uint16_t idx , uint16_t desc , const struct rte_eth_hairpin_conf * hairpin_conf ) { struct mlx5_priv * priv = dev -> data -> dev_private ; struct mlx5_rxq_ctrl * tmpl ; tmpl = mlx5_malloc ( MLX5_MEM_RTE | MLX5_MEM_ZERO , sizeof ( * tmpl ) , 0 , SOCKET_ID_ANY ) ; if ( ! tmpl ) { rte_errno = ENOMEM ; return NULL ; } tmpl -> type = MLX5_RXQ_TYPE_HAIRPIN ; tmpl -> socket = SOCKET_ID_ANY ; tmpl -> rxq . rss_hash = 0 ; tmpl -> rxq . port_id = dev -> data -> port_id ; tmpl -> priv = priv ; tmpl -> rxq . mp = NULL ; tmpl -> rxq . elts_n = log2above ( desc ) ; tmpl -> rxq . elts = NULL ; tmpl -> rxq . mr_ctrl . cache_bh = ( struct mlx5_mr_btree ) { 0 } ; tmpl -> hairpin_conf = * hairpin_conf ; tmpl -> rxq . idx = idx ; __atomic_fetch_add ( & tmpl -> refcnt , 1 , __ATOMIC_RELAXED ) ; LIST_INSERT_HEAD ( & priv -> rxqsctrl , tmpl , next ) ; return tmpl ; }
Create a DPDK Rx hairpin queue.
Create a DPDK Rx hairpin queue .