Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1191644ybi; Fri, 2 Aug 2019 10:51:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqyh5DFDsz0D9ohTgIXmN94krYqvhz5EyIBaBCqsGEbxShvcKV8JjP5QH0bfckBFlRtmtXw0 X-Received: by 2002:a17:90a:3651:: with SMTP id s75mr5334437pjb.13.1564768297828; Fri, 02 Aug 2019 10:51:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564768297; cv=none; d=google.com; s=arc-20160816; b=MJN33MDee5kjQ+3FX/H8R2vbUfq7VCrP1EZubHrlAEgQ/JuOY/ihQykk2IBicglPZW Or65UmqnfXFIQZajgqEr7HjGuwdmqrr4XZY3PY4kIVn4oF4eUgRf2mYNwAW4We0RBlS3 29QYYSGnDskYZm6yNRC354RX1z8G469f3IGh7ISOXnFXVWwGqhHaPLzh9Xjoivx076FW mcXD5KuJZzY8/p5Yfbrf8xG7nlSiaVWiP85BkYu7d+iG0KeGY1lIT50dyeayuwcuDONb YZDUZUWtruWPkraWaQcW78XSCOJmELRgE9z02yzMxGiXP7cqvyd1i4OwxBa9trbaF3w9 QjbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xBlaomL4jt8YAKpDotCGLiO11SqBJ6cm+P8divLP5ts=; b=tAdywxrrSxRHoyDkzX8qsJbNwFUOhrlZea3t19qTPrKvQcKCXSwyZQpiVvYpUhRhTO zrTfiUAFh9NPjs52w6WdO4X6ug2Qz6rcetDpi6SFkE0GzIf0OUrphTskXzIuWtLbaDRO OgiweFAvyKASPRW4iWAvBWCTqR6KMMq68SWQmk16DMrmZ5QY9U+xMEYUV00fUwtNvA0G e60Oxu+jRqnXjWuiRSNXNz8Ng+udx95frwNGYV0cWWEUuIP2klR4F9nMgGE3RLrKyx6N NCirwn1qywKvxeI/4Kz2ZBY0HovE+eLPtaKHxRFDDG4LkFQFINd+uz40MmkiQcMWzktM xSPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=s0U5H0Ut; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 185si71924962pfa.40.2019.08.02.10.51.22; Fri, 02 Aug 2019 10:51:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=s0U5H0Ut; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391547AbfHBJvr (ORCPT + 99 others); Fri, 2 Aug 2019 05:51:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:57088 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405977AbfHBJvq (ORCPT ); Fri, 2 Aug 2019 05:51:46 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D640A20679; Fri, 2 Aug 2019 09:51:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564739505; bh=StWGtf6NFIgHwX2qfupd9JDopZuhlJkjQUoTCK9jBNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s0U5H0Utkpmum+1GSYt1wUnZn2fmTtMWSsQvZIt8J0finCLrPk0cRiXHOUnPhF8mC E+S2lDiyPfRscnDHTbkNZb93L50E457sFqAJM04g9RXpf/XHfPDJHd9cEnpQjrfd+k kqMlahBbvMJmq475jnXzydBfKl1m9Pf8Vf76tTd4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konstantin Taranov , Jason Gunthorpe , Sasha Levin Subject: [PATCH 4.9 191/223] RDMA/rxe: Fill in wc byte_len with IB_WC_RECV_RDMA_WITH_IMM Date: Fri, 2 Aug 2019 11:36:56 +0200 Message-Id: <20190802092249.759374311@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190802092238.692035242@linuxfoundation.org> References: <20190802092238.692035242@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit bdce1290493caa3f8119f24b5dacc3fb7ca27389 ] Calculate the correct byte_len on the receiving side when a work completion is generated with IB_WC_RECV_RDMA_WITH_IMM opcode. According to the IBA byte_len must indicate the number of written bytes, whereas it was always equal to zero for the IB_WC_RECV_RDMA_WITH_IMM opcode, even though data was transferred. Fixes: 8700e3e7c485 ("Soft RoCE driver") Signed-off-by: Konstantin Taranov Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/sw/rxe/rxe_resp.c | 5 ++++- drivers/infiniband/sw/rxe/rxe_verbs.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c index 297653ab4004..5bfea23f3b60 100644 --- a/drivers/infiniband/sw/rxe/rxe_resp.c +++ b/drivers/infiniband/sw/rxe/rxe_resp.c @@ -432,6 +432,7 @@ static enum resp_states check_rkey(struct rxe_qp *qp, qp->resp.va = reth_va(pkt); qp->resp.rkey = reth_rkey(pkt); qp->resp.resid = reth_len(pkt); + qp->resp.length = reth_len(pkt); } access = (pkt->mask & RXE_READ_MASK) ? IB_ACCESS_REMOTE_READ : IB_ACCESS_REMOTE_WRITE; @@ -841,7 +842,9 @@ static enum resp_states do_complete(struct rxe_qp *qp, pkt->mask & RXE_WRITE_MASK) ? IB_WC_RECV_RDMA_WITH_IMM : IB_WC_RECV; wc->vendor_err = 0; - wc->byte_len = wqe->dma.length - wqe->dma.resid; + wc->byte_len = (pkt->mask & RXE_IMMDT_MASK && + pkt->mask & RXE_WRITE_MASK) ? + qp->resp.length : wqe->dma.length - wqe->dma.resid; /* fields after byte_len are different between kernel and user * space diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.h b/drivers/infiniband/sw/rxe/rxe_verbs.h index cac1d52a08f0..47003d2a4a46 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.h +++ b/drivers/infiniband/sw/rxe/rxe_verbs.h @@ -209,6 +209,7 @@ struct rxe_resp_info { struct rxe_mem *mr; u32 resid; u32 rkey; + u32 length; u64 atomic_orig; /* SRQ only */ -- 2.20.1