From patchwork Mon Apr 21 22:01:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 4027061 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 97F14BFF02 for ; Mon, 21 Apr 2014 22:02:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C91C820204 for ; Mon, 21 Apr 2014 22:02:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6A2422035E for ; Mon, 21 Apr 2014 22:02:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754719AbaDUWB7 (ORCPT ); Mon, 21 Apr 2014 18:01:59 -0400 Received: from mail-yk0-f171.google.com ([209.85.160.171]:57556 "EHLO mail-yk0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752896AbaDUWB6 (ORCPT ); Mon, 21 Apr 2014 18:01:58 -0400 Received: by mail-yk0-f171.google.com with SMTP id q9so3926029ykb.30 for ; Mon, 21 Apr 2014 15:01:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:subject:to:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; bh=I/4lu3HGBMEft9lU+fdWrV8eW0s0o19soqg3wmE88Lo=; b=O38EU9bTucqzP24gA0UdTBTVPCukSQ9Fu0/KiWlBWOybA4f172wnnMAKhd3VJY3Ie4 5GeJWCZUfpqiWJVSx1i8j0vaRCW4JDPydNz9aRjQHgplNzW+XN0rd6o2/Is6LYdkzTkz ru0sEtPZ3rzOMgIB/gQI0QMT6glYpWbbcHCxOMOM7HcGUeBwiVDWqg/R/uoetrC7sPYw VRwN7KKwvZumHrWE4LY3hIS0s6dR7c1UBj8vQKT/vEP/by2mZ+o2IFcvd066Hxqsr3lH /bO9q6VglZAcZt7oVUNg5CDKL7nRky5ZXSQslWbIz5KbC1UClM1wwYQR7IWHhl3IJaAY DMtg== X-Received: by 10.236.133.67 with SMTP id p43mr5903869yhi.114.1398117717915; Mon, 21 Apr 2014 15:01:57 -0700 (PDT) Received: from manet.1015granger.net ([2604:8800:100:81fc:82ee:73ff:fe43:d64f]) by mx.google.com with ESMTPSA id t42sm74351722yhn.12.2014.04.21.15.01.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Apr 2014 15:01:57 -0700 (PDT) From: Chuck Lever Subject: [PATCH V2 08/17] xprtrdma: Fall back to MTHCAFMR when FRMR is not supported To: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org Date: Mon, 21 Apr 2014 18:01:56 -0400 Message-ID: <20140421220156.12569.83037.stgit@manet.1015granger.net> In-Reply-To: <20140421214442.12569.8950.stgit@manet.1015granger.net> References: <20140421214442.12569.8950.stgit@manet.1015granger.net> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable 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 An audit of in-kernel RDMA providers that do not support the FRMR memory registration shows that several of them support MTHCAFMR. Prefer MTHCAFMR when FRMR is not supported. If MTHCAFMR is not supported, only then choose ALLPHYSICAL. Signed-off-by: Chuck Lever --- net/sunrpc/xprtrdma/verbs.c | 31 +++++++++++++++---------------- 1 files changed, 15 insertions(+), 16 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index 6bb9a07..a352798 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c @@ -491,33 +491,32 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg) ia->ri_dma_lkey = ia->ri_id->device->local_dma_lkey; } - switch (memreg) { - case RPCRDMA_MTHCAFMR: - if (!ia->ri_id->device->alloc_fmr) { - dprintk("RPC: %s: MTHCAFMR registration " - "specified but not supported by adapter, " - "using riskier RPCRDMA_ALLPHYSICAL\n", - __func__); - memreg = RPCRDMA_ALLPHYSICAL; - } - break; - case RPCRDMA_FRMR: + if (memreg == RPCRDMA_FRMR) { /* Requires both frmr reg and local dma lkey */ if ((devattr.device_cap_flags & (IB_DEVICE_MEM_MGT_EXTENSIONS|IB_DEVICE_LOCAL_DMA_LKEY)) != (IB_DEVICE_MEM_MGT_EXTENSIONS|IB_DEVICE_LOCAL_DMA_LKEY)) { dprintk("RPC: %s: FRMR registration " - "specified but not supported by adapter, " - "using riskier RPCRDMA_ALLPHYSICAL\n", - __func__); - memreg = RPCRDMA_ALLPHYSICAL; + "not supported by HCA\n", __func__); + memreg = RPCRDMA_MTHCAFMR; } else { /* Mind the ia limit on FRMR page list depth */ ia->ri_max_frmr_depth = min_t(unsigned int, RPCRDMA_MAX_DATA_SEGS, devattr.max_fast_reg_page_list_len); } - break; + } + if (memreg == RPCRDMA_MTHCAFMR) { + if (!ia->ri_id->device->alloc_fmr) { + dprintk("RPC: %s: MTHCAFMR registration " + "not supported by HCA\n", __func__); +#if RPCRDMA_PERSISTENT_REGISTRATION + memreg = RPCRDMA_ALLPHYSICAL; +#else + rc = -EINVAL; + goto out2; +#endif + } } /*