From patchwork Wed Jul 9 16:57:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 4518411 Return-Path: X-Original-To: patchwork-linux-rdma@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 C0D56BEEAA for ; Wed, 9 Jul 2014 16:57:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DAD542037F for ; Wed, 9 Jul 2014 16:57:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F0F642037D for ; Wed, 9 Jul 2014 16:57:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756590AbaGIQ5l (ORCPT ); Wed, 9 Jul 2014 12:57:41 -0400 Received: from mail-ig0-f177.google.com ([209.85.213.177]:47750 "EHLO mail-ig0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756579AbaGIQ5l (ORCPT ); Wed, 9 Jul 2014 12:57:41 -0400 Received: by mail-ig0-f177.google.com with SMTP id r10so2099220igi.10 for ; Wed, 09 Jul 2014 09:57:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:from:to:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; bh=drrJ4tDXp2SSk5pdKVwbj3mXNHf62+jPeayfGAgiCZg=; b=WQuKUIhMwX1RZPdkKC9XVTZoJZPhElDkw0Zai/OeGMx3xqowziMfGkTyUPcR9a23M0 uPB+OCx9MCjHwPkwZT0DLzRHfm/MC9EjKz7mY+CcswCp7iviDuar5zrpqHmNZI7zgNZD hvHZGPxvm1Mvyd5LA9wVEPyQcxIDfVC9V9q3L7uq62LN6L+i0UGjGvRdMVE2W0CNyGJw qjkbIz9jhkODqaFtfSfjsp2kXdNqqOubrbccJH2K0CWPsPUREQnk0Bv6m//csLJynQ7l ZUnJWcUXd5W9xgryYWbI1TcusDvGTrxnignWPNUcp3VzH5dzibfwQ9BwRTWXI+SabIzK W4XA== X-Received: by 10.43.144.80 with SMTP id jp16mr5183912icc.87.1404925060419; Wed, 09 Jul 2014 09:57:40 -0700 (PDT) Received: from manet.1015granger.net ([2604:8800:100:81fc:82ee:73ff:fe43:d64f]) by mx.google.com with ESMTPSA id gb7sm16924486igd.16.2014.07.09.09.57.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Jul 2014 09:57:39 -0700 (PDT) Subject: [PATCH v2 08/21] xprtrdma: Back off rkey when FAST_REG_MR fails From: Chuck Lever To: linux-rdma@vger.kernel.org, linux-nfs@vger.kernel.org Date: Wed, 09 Jul 2014 12:57:39 -0400 Message-ID: <20140709165739.3496.39485.stgit@manet.1015granger.net> In-Reply-To: <20140709163326.3496.37893.stgit@manet.1015granger.net> References: <20140709163326.3496.37893.stgit@manet.1015granger.net> User-Agent: StGit/0.17.1-3-g7d0f MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@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=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 If posting a FAST_REG_MR Work Reqeust fails, revert the rkey update to avoid subsequent IB_WC_MW_BIND_ERR completions. Suggested-by: Steve Wise Signed-off-by: Chuck Lever --- net/sunrpc/xprtrdma/verbs.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" 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 ce847d2..14d24ec 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c @@ -1487,6 +1487,24 @@ rpcrdma_unmap_one(struct rpcrdma_ia *ia, struct rpcrdma_mr_seg *seg) seg->mr_dma, seg->mr_dmalen, seg->mr_dir); } +static void +rpcrdma_increment_frmr_rkey(struct rpcrdma_mw *mw) +{ + struct ib_mr *mr = mw->r.frmr.fr_mr; + u8 key = mr->rkey & 0x000000FF; + + ib_update_fast_reg_key(mr, ++key); +} + +static void +rpcrdma_decrement_frmr_rkey(struct rpcrdma_mw *mw) +{ + struct ib_mr *mr = mw->r.frmr.fr_mr; + u8 key = mr->rkey & 0x000000FF; + + ib_update_fast_reg_key(mr, --key); +} + static int rpcrdma_register_frmr_external(struct rpcrdma_mr_seg *seg, int *nsegs, int writing, struct rpcrdma_ia *ia, @@ -1496,8 +1514,6 @@ rpcrdma_register_frmr_external(struct rpcrdma_mr_seg *seg, struct rpcrdma_mw *mw = seg1->mr_chunk.rl_mw; struct rpcrdma_frmr *frmr = &mw->r.frmr; struct ib_send_wr invalidate_wr, frmr_wr, *bad_wr, *post_wr; - - u8 key; int len, pageoff; int i, rc; int seg_len; @@ -1557,14 +1573,10 @@ rpcrdma_register_frmr_external(struct rpcrdma_mr_seg *seg, rc = -EIO; goto out_err; } - - /* Bump the key */ - key = (u8)(frmr->fr_mr->rkey & 0x000000FF); - ib_update_fast_reg_key(frmr->fr_mr, ++key); - frmr_wr.wr.fast_reg.access_flags = (writing ? IB_ACCESS_REMOTE_WRITE | IB_ACCESS_LOCAL_WRITE : IB_ACCESS_REMOTE_READ); + rpcrdma_increment_frmr_rkey(mw); frmr_wr.wr.fast_reg.rkey = frmr->fr_mr->rkey; DECR_CQCOUNT(&r_xprt->rx_ep); @@ -1573,6 +1585,7 @@ rpcrdma_register_frmr_external(struct rpcrdma_mr_seg *seg, if (rc) { dprintk("RPC: %s: failed ib_post_send for register," " status %i\n", __func__, rc); + rpcrdma_decrement_frmr_rkey(seg1->mr_chunk.rl_mw); goto out_err; } else { seg1->mr_rkey = frmr->fr_mr->rkey;