From patchwork Tue Oct 27 17:08:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matan Barak X-Patchwork-Id: 7499161 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4EBE29F36A for ; Tue, 27 Oct 2015 17:11:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 73DF520881 for ; Tue, 27 Oct 2015 17:11:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 803F42087F for ; Tue, 27 Oct 2015 17:11:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964780AbbJ0RLi (ORCPT ); Tue, 27 Oct 2015 13:11:38 -0400 Received: from [193.47.165.129] ([193.47.165.129]:53003 "EHLO mellanox.co.il" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S932367AbbJ0RLg (ORCPT ); Tue, 27 Oct 2015 13:11:36 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from matanb@mellanox.com) with ESMTPS (AES256-SHA encrypted); 27 Oct 2015 19:11:07 +0200 Received: from rsws33.mtr.labs.mlnx (dev-r-vrt-064.mtr.labs.mlnx [10.212.64.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id t9RHB7oG022362; Tue, 27 Oct 2015 19:11:07 +0200 From: Matan Barak To: Yishai Hadas Cc: linux-rdma@vger.kernel.org, Matan Barak , Eran Ben Elisha , Christoph Lameter Subject: [PATCH v1 libmlx4 6/7] Add support for different poll_one_ex functions Date: Tue, 27 Oct 2015 19:08:56 +0200 Message-Id: <1445965737-14187-7-git-send-email-matanb@mellanox.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1445965737-14187-1-git-send-email-matanb@mellanox.com> References: <1445965737-14187-1-git-send-email-matanb@mellanox.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In order to opitimize the poll_one extended verb for different wc_flags, add support for poll_one_ex callback function. Signed-off-by: Matan Barak --- src/cq.c | 5 +++-- src/mlx4.h | 5 +++++ src/verbs.c | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/cq.c b/src/cq.c index 7f40f12..1f2d572 100644 --- a/src/cq.c +++ b/src/cq.c @@ -601,7 +601,8 @@ int mlx4_poll_cq_ex(struct ibv_cq *ibcq, int npolled; int err = CQ_OK; unsigned int ne = attr->max_entries; - uint64_t wc_flags = cq->wc_flags; + int (*poll_fn)(struct mlx4_cq *cq, struct mlx4_qp **cur_qp, + struct ibv_wc_ex **wc_ex) = cq->mlx4_poll_one; if (attr->comp_mask) return -EINVAL; @@ -609,7 +610,7 @@ int mlx4_poll_cq_ex(struct ibv_cq *ibcq, pthread_spin_lock(&cq->lock); for (npolled = 0; npolled < ne; ++npolled) { - err = _mlx4_poll_one_ex(cq, &qp, &wc, wc_flags); + err = poll_fn(cq, &qp, &wc); if (err != CQ_OK) break; } diff --git a/src/mlx4.h b/src/mlx4.h index 8e1935d..46a18d6 100644 --- a/src/mlx4.h +++ b/src/mlx4.h @@ -215,6 +215,8 @@ struct mlx4_pd { struct mlx4_cq { struct ibv_cq ibv_cq; uint64_t wc_flags; + int (*mlx4_poll_one)(struct mlx4_cq *cq, struct mlx4_qp **cur_qp, + struct ibv_wc_ex **wc_ex); struct mlx4_buf buf; struct mlx4_buf resize_buf; pthread_spinlock_t lock; @@ -432,6 +434,9 @@ int mlx4_poll_cq(struct ibv_cq *cq, int ne, struct ibv_wc *wc); int mlx4_poll_cq_ex(struct ibv_cq *ibcq, struct ibv_wc_ex *wc, struct ibv_poll_cq_ex_attr *attr); +int mlx4_poll_one_ex(struct mlx4_cq *cq, + struct mlx4_qp **cur_qp, + struct ibv_wc_ex **pwc_ex); int mlx4_arm_cq(struct ibv_cq *cq, int solicited); void mlx4_cq_event(struct ibv_cq *cq); void __mlx4_cq_clean(struct mlx4_cq *cq, uint32_t qpn, struct mlx4_srq *srq); diff --git a/src/verbs.c b/src/verbs.c index 843ca1e..62908c1 100644 --- a/src/verbs.c +++ b/src/verbs.c @@ -432,6 +432,7 @@ static struct ibv_cq *create_cq(struct ibv_context *context, if (ret) goto err_db; + cq->mlx4_poll_one = mlx4_poll_one_ex; cq->creation_flags = cmd_e.ibv_cmd.flags; cq->wc_flags = cq_attr->wc_flags; cq->cqn = resp.cqn;