[dpdk-dev,06/16] mlx4: use faster CQ polling function
Commit Message
From: Alex Rosenbaum <Alexr@mellanox.com>
Replace ibv_exp_poll_cq() with direct function call to improve performance.
Signed-off-by: Alex Rosenbaum <Alexr@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
drivers/net/mlx4/mlx4.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
@@ -196,6 +196,8 @@ struct rxq {
struct ibv_mr *mr; /* Memory Region (for mp). */
struct ibv_cq *cq; /* Completion Queue. */
struct ibv_qp *qp; /* Queue Pair. */
+ /* Faster callbacks that bypass Verbs. */
+ drv_exp_poll_cq_func ibv_exp_poll_cq;
/*
* There is exactly one flow configured per MAC address. Each flow
* may contain several specifications, one per configured VLAN ID.
@@ -2386,7 +2388,7 @@ mlx4_rx_burst_sp(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
return mlx4_rx_burst(dpdk_rxq, pkts, pkts_n);
if (unlikely(elts == NULL)) /* See RTE_DEV_CMD_SET_MTU. */
return 0;
- wcs_n = ibv_exp_poll_cq(rxq->cq, pkts_n, wcs, sizeof(wcs[0]));
+ wcs_n = rxq->ibv_exp_poll_cq(rxq->cq, pkts_n, wcs, sizeof(wcs[0]));
if (unlikely(wcs_n == 0))
return 0;
if (unlikely(wcs_n < 0)) {
@@ -2576,7 +2578,7 @@ mlx4_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
if (unlikely(rxq->sp))
return mlx4_rx_burst_sp(dpdk_rxq, pkts, pkts_n);
- wcs_n = ibv_exp_poll_cq(rxq->cq, pkts_n, wcs, sizeof(wcs[0]));
+ wcs_n = rxq->ibv_exp_poll_cq(rxq->cq, pkts_n, wcs, sizeof(wcs[0]));
if (unlikely(wcs_n == 0))
return 0;
if (unlikely(wcs_n < 0)) {
@@ -3213,6 +3215,13 @@ skip_alloc:
/* Save port ID. */
tmpl.port_id = dev->data->port_id;
DEBUG("%p: RTE port ID: %u", (void *)rxq, tmpl.port_id);
+ tmpl.ibv_exp_poll_cq = (drv_exp_poll_cq_func)(uintptr_t)
+ ibv_exp_get_provider_func(tmpl.cq->context,
+ IBV_EXP_POLL_CQ_FUNC);
+ if (tmpl.ibv_exp_poll_cq == NULL) {
+ ERROR("%p: cannot retrieve IBV_EXP_POLL_CQ_FUNC", (void *)dev);
+ goto error;
+ }
/* Clean up rxq in case we're reinitializing it. */
DEBUG("%p: cleaning-up old rxq just in case", (void *)rxq);
rxq_cleanup(rxq);