Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4112187ybi; Mon, 29 Jul 2019 19:31:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqwF0X3CzOaGLt1ECG5du9FmXvCDNNBV3lnYmtuiHaYuebCPMkMScQyX919xtUP00Ofe5Zty X-Received: by 2002:a63:3112:: with SMTP id x18mr24886792pgx.385.1564453905120; Mon, 29 Jul 2019 19:31:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564453905; cv=none; d=google.com; s=arc-20160816; b=QPfqyjd2U6YgDVy/M/sgQELMaxB348cxu+ga6IgUEmyx6Ik7JTxfRG0VvbDlFESzNb gz0eo07KwnhE/QtsFIDvvnWezu8SvwapTnIP9mpbwFWCoRdSsJgcaIKKZG57cVQ6RRP3 14pyIERNi/ibJeDVNqOmPN2OX6vd9xbVkKddatViJlL9LZ42K8FI/EMw3lcGLj8zU8uH tJU2ySDraBrZIbUI3KsSdXJAvzc5cX16RpGgZA5bd25oYqv2K9eXeaBZXL3RzQ0yGh/r zBJsWE8ySAQA1T7qpTkgeQ/anxVSpMUHgiJYtgo17P24d/SWcK5/arlo+KUC9svC2l/G 19wA== 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=xVjcWUe6etIGVY9N8AZK59mwDEcjfkmQHxxqoCE7Ix8=; b=uEnC12/YoxyBG5PpgeyN5ELVEPnJreiUp8l6/VKdJtZdgVLVwwIj4wgl2ttK7yLtoY DK76wi38/h+hUFP0J8W9/DptVvWvJ2yDLw2d51mXw9jvkeQpit1SlCV2bIHRApoYoOCe G56d3HkjBi0FkvVlUgG0hzC6tP3fcob134sFN2rftWxoarfvzy6YzH/ppSQE4HAiUFFP U8UHrKiAUh6JTLykQx7+nn5Ti43yQ3+TyxzYNtrv0PmhY5GBBzP4KPlpT2wh7ZgGtlhS lMHg2T3IvzIEn+YpwiMz7FNd7ns8kxuZkksnzbdYNr62RApr+NoCsNKOHe5TVpqcQzSj R/Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PmGN1XwG; 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 r26si28452980pgv.189.2019.07.29.19.31.29; Mon, 29 Jul 2019 19:31:45 -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=PmGN1XwG; 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 S2389596AbfG2TnG (ORCPT + 99 others); Mon, 29 Jul 2019 15:43:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:59168 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388798AbfG2TnF (ORCPT ); Mon, 29 Jul 2019 15:43:05 -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 C476421655; Mon, 29 Jul 2019 19:43:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429384; bh=f+8Ftz2vLwSHvraHowlMQIfQXhGubVSDurcWm4TMKqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PmGN1XwGpaOCH9F0bUg5+/BIroWTeT2n1FxVYO/knefmaVgXsTR1yi1FbUCTBLBpI Q2TGz0p7xNzmKMo95JW1Ku1hkfhHJ7Af0Qf6n3S88cHylLAxnVSx7NX70BFhzwOiRy Qch/gN4F0lW+Az7CA2rN/Bd4wrsjxEsKv23/xfS4= 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.19 073/113] RDMA/rxe: Fill in wc byte_len with IB_WC_RECV_RDMA_WITH_IMM Date: Mon, 29 Jul 2019 21:22:40 +0200 Message-Id: <20190729190712.935561329@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190655.455345569@linuxfoundation.org> References: <20190729190655.455345569@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 4111b798fd3c..681d8e0913d0 100644 --- a/drivers/infiniband/sw/rxe/rxe_resp.c +++ b/drivers/infiniband/sw/rxe/rxe_resp.c @@ -435,6 +435,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; @@ -859,7 +860,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 332a16dad2a7..3b731c7682e5 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.h +++ b/drivers/infiniband/sw/rxe/rxe_verbs.h @@ -212,6 +212,7 @@ struct rxe_resp_info { struct rxe_mem *mr; u32 resid; u32 rkey; + u32 length; u64 atomic_orig; /* SRQ only */ -- 2.20.1