From patchwork Tue May 5 12:50:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Wang X-Patchwork-Id: 6337581 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 1A4FE9F373 for ; Tue, 5 May 2015 12:52:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9223420149 for ; Tue, 5 May 2015 12:52:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9DCA520268 for ; Tue, 5 May 2015 12:52:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758799AbbEEMv4 (ORCPT ); Tue, 5 May 2015 08:51:56 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:35745 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758749AbbEEMvW (ORCPT ); Tue, 5 May 2015 08:51:22 -0400 Received: by widdi4 with SMTP id di4so159312421wid.0 for ; Tue, 05 May 2015 05:51:21 -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=HeY6TUMc1bB7FByjrrdoVvCxD9Sh888IjQuzhf3WrtU=; b=QoDd8zUbf0dW69AjBgfXNxoozEUkVqp68KPJOLkZvp9r2a4JhhRPn/OizXUGYJB5NH 7l/6DnbbjF8MIVdavuPmrDg2YZ6HQkoKfLJV2J5oaL5q4Vqe/pWcAfzzUvyEtEJSRq+h 2CR2jPqkCo21vVrXcXZuE3VC9qoKtjd2TtAcinRoQWXyHZGKTxlWZvASqnmYvQIJkEth Gh67Mc5Jvx9+ZZQm1W7oDxf3xirfIkp+Q2xOGVCxEz+gv32CAGlLfjmFwSpnRtBY/BKM h5wMM8oirH6nU8Sw+WqCK8+aQotaIJWQ4TXLSdkyJ8pcu1qt1lWO6ubxw1kwZIDs/SaJ 3BgA== X-Gm-Message-State: ALoCoQlY3B07bvfhOLa/+wXAgdoyRZdsQSdAWfOceBNDAVw9qsSie3ZRy1mFGSckGnvqWasZltpg X-Received: by 10.180.81.3 with SMTP id v3mr3760753wix.36.1430830281185; Tue, 05 May 2015 05:51:21 -0700 (PDT) Received: from ubuntu.pb.local ([62.217.45.26]) by mx.google.com with ESMTPSA id gs7sm16033234wib.10.2015.05.05.05.51.19 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 May 2015 05:51:20 -0700 (PDT) From: Michael Wang To: Roland Dreier , Sean Hefty , Hal Rosenstock , Doug Ledford , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Michael Wang , Tom Tucker , Steve Wise , Hoang-Nam Nguyen , Christoph Raisch , Mike Marciniszyn , Eli Cohen , Faisal Latif , Jack Morgenstein , Or Gerlitz , Haggai Eran , Ira Weiny , Tom Talpey , Jason Gunthorpe , Devesh Sharma , Liran Liss , Dave Goodell Subject: [PATCH v8 21/23] IB/Verbs: Use management helper rdma_cap_read_multi_sge() Date: Tue, 5 May 2015 14:50:38 +0200 Message-Id: <1430830240-32389-22-git-send-email-yun.wang@profitbricks.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1430830240-32389-1-git-send-email-yun.wang@profitbricks.com> References: <1430830240-32389-1-git-send-email-yun.wang@profitbricks.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, T_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 Introduce helper rdma_cap_read_multi_sge() to help us check if the port of an IB device support RDMA Read Multiple Scatter-Gather Entries. Signed-off-by: Michael Wang --- include/rdma/ib_verbs.h | 16 ++++++++++++++++ net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 6bbbc86..2cf23b1 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -1864,6 +1864,22 @@ static inline bool rdma_cap_ib_mcast(struct ib_device *device, u8 port_num) return rdma_cap_ib_sa(device, port_num); } +/** + * rdma_cap_read_multi_sge - Check if the port of device has the capability + * RDMA Read Multiple Scatter-Gather Entries. + * + * @device: Device to be checked + * @port_num: Port number of the device + * + * Return false when port of the device don't support + * RDMA Read Multiple Scatter-Gather Entries. + */ +static inline bool rdma_cap_read_multi_sge(struct ib_device *device, + u8 port_num) +{ + return !rdma_protocol_iwarp(device, port_num); +} + int ib_query_gid(struct ib_device *device, u8 port_num, int index, union ib_gid *gid); diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c index 2cc625d..86b4416 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c @@ -117,8 +117,8 @@ static void rdma_build_arg_xdr(struct svc_rqst *rqstp, static int rdma_read_max_sge(struct svcxprt_rdma *xprt, int sge_count) { - if (rdma_protocol_iwarp(xprt->sc_cm_id->device, - xprt->sc_cm_id->port_num)) + if (!rdma_cap_read_multi_sge(xprt->sc_cm_id->device, + xprt->sc_cm_id->port_num)) return 1; else return min_t(int, sge_count, xprt->sc_max_sge);