src/dpdk/drivers/net/mlx5/linux/mlx5_verbs.c
static int
mlx5_rxq_ibv_obj_drop_create(struct rte_eth_dev *dev)
{
	struct mlx5_priv *priv = dev->data->dev_private;
	struct ibv_context *ctx = priv->sh->ctx;
	struct mlx5_rxq_obj *rxq = priv->drop_queue.rxq;

	if (rxq)
		return 0;
	rxq = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*rxq), 0, SOCKET_ID_ANY);
	if (!rxq) {
		DEBUG("Port %u cannot allocate drop Rx queue memory.",
		      dev->data->port_id);
		rte_errno = ENOMEM;
		return -rte_errno;
	}
	priv->drop_queue.rxq = rxq;
	rxq->ibv_cq = mlx5_glue->create_cq(ctx, 1, NULL, NULL, 0);
	if (!rxq->ibv_cq) {
		DEBUG("Port %u cannot allocate CQ for drop queue.",
		      dev->data->port_id);
		rte_errno = errno;
		goto error;
	}
	rxq->wq = mlx5_glue->create_wq(ctx, &(struct ibv_wq_init_attr){
						    .wq_type = IBV_WQT_RQ,
						    .max_wr = 1,
						    .max_sge = 1,
						    .pd = priv->sh->pd,
						    .cq = rxq->ibv_cq,
					      });
	if (!rxq->wq) {
		DEBUG("Port %u cannot allocate WQ for drop queue.",
		      dev->data->port_id);
		rte_errno = errno;
		goto error;
	}
	priv->drop_queue.rxq = rxq;
	return 0;
error:
	mlx5_rxq_ibv_obj_drop_release(dev);
	return -rte_errno;
}
/**
 * Create a drop Rx queue Verbs object.
 *
 * @param dev
 *   Pointer to Ethernet device.
 *
 * @return
 *   0 on success, a negative errno value otherwise and rte_errno is set.
 */
Create a drop Rx queue Verbs object.
@param dev
Pointer to Ethernet device.

@return
0 on success, a negative errno value otherwise and rte_errno is set.
Create a drop Rx queue Verbs object . @param dev Pointer to Ethernet device . @return 0 on success a negative errno value otherwise and rte_errno is set .
static int
mlx5_rxq_ibv_obj_drop_create(struct rte_eth_dev *dev)
{
	struct mlx5_priv *priv = dev->data->dev_private;
	struct ibv_context *ctx = priv->sh->ctx;
	struct mlx5_rxq_obj *rxq = priv->drop_queue.rxq;
	if (rxq)
		return 0;
	rxq = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*rxq), 0, SOCKET_ID_ANY);
	if (!rxq) {
		DEBUG("Port %u cannot allocate drop Rx queue memory.",
		      dev->data->port_id);
		rte_errno = ENOMEM;
		return -rte_errno;
	}
	priv->drop_queue.rxq = rxq;
	rxq->ibv_cq = mlx5_glue->create_cq(ctx, 1, NULL, NULL, 0);
	if (!rxq->ibv_cq) {
		DEBUG("Port %u cannot allocate CQ for drop queue.",
		      dev->data->port_id);
		rte_errno = errno;
		goto error;
	}
	rxq->wq = mlx5_glue->create_wq(ctx, &(struct ibv_wq_init_attr){
						    .wq_type = IBV_WQT_RQ,
						    .max_wr = 1,
						    .max_sge = 1,
						    .pd = priv->sh->pd,
						    .cq = rxq->ibv_cq,
					      });
	if (!rxq->wq) {
		DEBUG("Port %u cannot allocate WQ for drop queue.",
		      dev->data->port_id);
		rte_errno = errno;
		goto error;
	}
	priv->drop_queue.rxq = rxq;
	return 0;
error:
	mlx5_rxq_ibv_obj_drop_release(dev);
	return -rte_errno;
}
static int mlx5_rxq_ibv_obj_drop_create ( struct rte_eth_dev * dev ) { struct mlx5_priv * priv = dev -> data -> dev_private ; struct ibv_context * ctx = priv -> sh -> ctx ; struct mlx5_rxq_obj * rxq = priv -> drop_queue . rxq ; if ( rxq ) return 0 ; rxq = mlx5_malloc ( MLX5_MEM_ZERO , sizeof ( * rxq ) , 0 , SOCKET_ID_ANY ) ; if ( ! rxq ) { DEBUG ( " " , dev -> data -> port_id ) ; rte_errno = ENOMEM ; return - rte_errno ; } priv -> drop_queue . rxq = rxq ; rxq -> ibv_cq = mlx5_glue -> create_cq ( ctx , 1 , NULL , NULL , 0 ) ; if ( ! rxq -> ibv_cq ) { DEBUG ( " " , dev -> data -> port_id ) ; rte_errno = errno ; goto error ; } rxq -> wq = mlx5_glue -> create_wq ( ctx , & ( struct ibv_wq_init_attr ) { . wq_type = IBV_WQT_RQ , . max_wr = 1 , . max_sge = 1 , . pd = priv -> sh -> pd , . cq = rxq -> ibv_cq , } ) ; if ( ! rxq -> wq ) { DEBUG ( " " , dev -> data -> port_id ) ; rte_errno = errno ; goto error ; } priv -> drop_queue . rxq = rxq ; return 0 ; error : mlx5_rxq_ibv_obj_drop_release ( dev ) ; return - rte_errno ; }
Create a drop Rx queue Verbs object.
Create a drop Rx queue Verbs object .