From patchwork Sun Apr 23 11:31:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 9694793 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 94A82601E9 for ; Sun, 23 Apr 2017 11:31:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A88726E16 for ; Sun, 23 Apr 2017 11:31:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B91126E4E; Sun, 23 Apr 2017 11:31:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7C6026E16 for ; Sun, 23 Apr 2017 11:31:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1045011AbdDWLbt (ORCPT ); Sun, 23 Apr 2017 07:31:49 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:38876 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1045010AbdDWLbs (ORCPT ); Sun, 23 Apr 2017 07:31:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=X8IS6MEjAmlNe0wvwotsawzI/CQk7MDn6ArKdzDOheI=; b=kDp7r9ObmrOROM8Q2WsNbdzpV gCdcwP7oKSC6mD5/uzt2iXgVdNLI2nLohUL5jPgKN0aRNld8hIBb43U0jsbn7WBB+X+xo+VjRR4v9 n3k+BJyhKj+SDFXUb1AD7TLqVdX/RwaI2VEwkDNYxB4zqHlU65JdlfgQCFIUThP0hmrKY+lS1pdBp +mYHW+qDophPNnk3hH6CAY4h4WCsN2xgGshJvBAMMuS4TRjWTWMpLYgF4XypZ/e7WJcLwG4iT3GFs ASh+yjGXnsib9AjYPWX1wg75GoK7w86NZSfFvo4aAOQdxR0q2IpDp7DiJC7hWD5T2YpSsEkh43+bV /baA4FsRA==; Received: from bzq-82-81-101-184.red.bezeqint.net ([82.81.101.184] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1d2Fk2-0001HP-Oj; Sun, 23 Apr 2017 11:31:47 +0000 From: Sagi Grimberg To: linux-rdma@vger.kernel.org Cc: Bart Van Assche , Leon Romanovsky , Max Gurtuvoy Subject: [PATCH] mlx5: Fix mlx5_ib_map_mr_sg mr length Date: Sun, 23 Apr 2017 14:31:42 +0300 Message-Id: <1492947102-3133-1-git-send-email-sagi@grimberg.me> X-Mailer: git-send-email 2.7.4 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In case we got an initial sg_offset, we need to account for it in the mr length. Fixes: ff2ba9936591 ("IB/core: Add passing an offset into the SG to ib_map_mr_sg") Signed-off-by: Sagi Grimberg Tested-by: Israel Rukshin --- drivers/infiniband/hw/mlx5/mr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c index b8f9382a8b7d..d9c6c0ea750b 100644 --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c @@ -1782,7 +1782,7 @@ mlx5_ib_sg_to_klms(struct mlx5_ib_mr *mr, klms[i].va = cpu_to_be64(sg_dma_address(sg) + sg_offset); klms[i].bcount = cpu_to_be32(sg_dma_len(sg) - sg_offset); klms[i].key = cpu_to_be32(lkey); - mr->ibmr.length += sg_dma_len(sg); + mr->ibmr.length += sg_dma_len(sg) - sg_offset; sg_offset = 0; }