From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by dpdk.org (Postfix) with ESMTP id 7D334C390 for ; Sat, 6 Jun 2015 01:16:01 +0200 (CEST) Received: by wigg3 with SMTP id g3so628161wig.1 for ; Fri, 05 Jun 2015 16:16:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Fg3eAJuPPlvZiFoJMrahshl586i6CnZ/xnGZnJ0Hfbc=; b=UE7Nu6/k8dAqELzK3++A5gGVoqIG3DQfzkK7FvDPVHiw/iIW50cbZ5Bo4U9bVdYt14 5NAOEgqjAiirRWYeJ8EWFgtqY2M738G1iYj25Kcc6d7qB3GcnmDXYgMIwRXx6kzHZINw Gpg4W1JO9+avBBvakZ9UXQM5Yi46SdWDjykTYzpslBZ68YnPqDpX6YllmZJVtTUhPiR1 nTiRUGyafb1S7H2AHW2xqRMji0oql0p1rg/VExhh+8RNyNCkC6FZZ8wj1yT8/wpCaOsa IsXHxabhb+e/iyzlbwsG942+3fS0mN72iAKNNolj5vYVuFky+e5NjwebQSI6lrdjj2nM egVg== X-Gm-Message-State: ALoCoQkuXZ4lm+iPS2EEEuGIIyYloXhvtUDYVsHZPKpSdXiBwLEuaPHLLVFTPuS6YEhcm/KD2Skt X-Received: by 10.180.90.228 with SMTP id bz4mr931030wib.69.1433546161393; Fri, 05 Jun 2015 16:16:01 -0700 (PDT) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by mx.google.com with ESMTPSA id g15sm5290623wiv.22.2015.06.05.16.15.59 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 05 Jun 2015 16:16:00 -0700 (PDT) From: Adrien Mazarguil To: dev@dpdk.org Date: Sat, 6 Jun 2015 01:15:10 +0200 Message-Id: <1433546120-2254-7-git-send-email-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1433546120-2254-1-git-send-email-adrien.mazarguil@6wind.com> References: <1433546120-2254-1-git-send-email-adrien.mazarguil@6wind.com> Cc: Alex Rosenbaum Subject: [dpdk-dev] [PATCH 06/16] mlx4: use faster CQ polling function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Jun 2015 23:16:01 -0000 From: Alex Rosenbaum Replace ibv_exp_poll_cq() with direct function call to improve performance. Signed-off-by: Alex Rosenbaum Signed-off-by: Adrien Mazarguil --- drivers/net/mlx4/mlx4.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 3210120..1b86e58 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -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); -- 2.1.0