From: Adrien Mazarguil Date: Wed, 14 Jun 2017 11:49:15 +0000 (+0200) Subject: net/mlx5: fix Rx interrupts support checks X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=9f91fb54831694a088ddc9e08cd643698560fa68;p=dpdk.git net/mlx5: fix Rx interrupts support checks Not exposing Rx interrupts callbacks when this feature is unsupported is less intrusive than having two different versions for these functions. Fixes: 3c7d44af252a ("net/mlx5: support user space Rx interrupt event") Cc: stable@dpdk.org Signed-off-by: Adrien Mazarguil --- diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index bcb2c1b25d..49d4dba2a8 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -246,8 +246,10 @@ static const struct eth_dev_ops mlx5_dev_ops = { .filter_ctrl = mlx5_dev_filter_ctrl, .rx_descriptor_status = mlx5_rx_descriptor_status, .tx_descriptor_status = mlx5_tx_descriptor_status, +#ifdef HAVE_UPDATE_CQ_CI .rx_queue_intr_enable = mlx5_rx_intr_enable, .rx_queue_intr_disable = mlx5_rx_intr_disable, +#endif }; static struct { diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index b683de55c0..4ed2d9da6c 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1421,6 +1421,8 @@ priv_destroy_intr_vec(struct priv *priv) rte_free(intr_handle->intr_vec); } +#ifdef HAVE_UPDATE_CQ_CI + /** * DPDK callback for rx queue interrupt enable. * @@ -1435,7 +1437,6 @@ priv_destroy_intr_vec(struct priv *priv) int mlx5_rx_intr_enable(struct rte_eth_dev *dev, uint16_t rx_queue_id) { -#ifdef HAVE_UPDATE_CQ_CI struct priv *priv = mlx5_get_priv(dev); struct rxq *rxq = (*priv->rxqs)[rx_queue_id]; struct rxq_ctrl *rxq_ctrl = container_of(rxq, struct rxq_ctrl, rxq); @@ -1445,11 +1446,6 @@ mlx5_rx_intr_enable(struct rte_eth_dev *dev, uint16_t rx_queue_id) ibv_mlx5_exp_update_cq_ci(cq, ci); ret = ibv_req_notify_cq(cq, 0); -#else - int ret = -1; - (void)dev; - (void)rx_queue_id; -#endif if (ret) WARN("unable to arm interrupt on rx queue %d", rx_queue_id); return ret; @@ -1469,7 +1465,6 @@ mlx5_rx_intr_enable(struct rte_eth_dev *dev, uint16_t rx_queue_id) int mlx5_rx_intr_disable(struct rte_eth_dev *dev, uint16_t rx_queue_id) { -#ifdef HAVE_UPDATE_CQ_CI struct priv *priv = mlx5_get_priv(dev); struct rxq *rxq = (*priv->rxqs)[rx_queue_id]; struct rxq_ctrl *rxq_ctrl = container_of(rxq, struct rxq_ctrl, rxq); @@ -1483,13 +1478,10 @@ mlx5_rx_intr_disable(struct rte_eth_dev *dev, uint16_t rx_queue_id) ret = -1; else ibv_ack_cq_events(cq, 1); -#else - int ret = -1; - (void)dev; - (void)rx_queue_id; -#endif if (ret) WARN("unable to disable interrupt on rx queue %d", rx_queue_id); return ret; } + +#endif /* HAVE_UPDATE_CQ_CI */ diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index cd79b5d63d..1a3ede44b3 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -311,8 +311,10 @@ int priv_intr_efd_enable(struct priv *priv); void priv_intr_efd_disable(struct priv *priv); int priv_create_intr_vec(struct priv *priv); void priv_destroy_intr_vec(struct priv *priv); +#ifdef HAVE_UPDATE_CQ_CI int mlx5_rx_intr_enable(struct rte_eth_dev *dev, uint16_t rx_queue_id); int mlx5_rx_intr_disable(struct rte_eth_dev *dev, uint16_t rx_queue_id); +#endif /* HAVE_UPDATE_CQ_CI */ /* mlx5_txq.c */