Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3815772ybi; Mon, 29 Jul 2019 13:10:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwowSNkkCIOMKHmE3HGl2mRH1r2YbfIgjuAO52gpjlWlSc6qg6B8ntry7kSHePu1LCCmxcx X-Received: by 2002:a65:6114:: with SMTP id z20mr107466898pgu.141.1564431029342; Mon, 29 Jul 2019 13:10:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564431029; cv=none; d=google.com; s=arc-20160816; b=FXfzMfmq9Qbu2Wk7G3yW0mk+9wWK+I9xGLuQdTqIOMnqu4+2EVLz20jNOyhBK+Q2du NytIW1J2Umvr3xWWQdh9PbbH+3lVIq4YLCwPO0BrDjp5dsMoXx205yyOdwlOsXknff5/ xaTgvF9LkdHqZBfNdC8iWejlqedUx3gIba1P9Ogm6407+qp/pt6QBjbjkwbWoD9fkUEa 67sSzCFAJre4ggTEmW75f59iRgK7knHR/M1ZbT5JwBXyx/pxz0Z88543MHxmp97w8hOu j6F2av7VmkAECVNHt/tqIo7qiGb1QzX76PPvoFr8Pfk1XiyHEaxz19lmAhAWHqgZqY6O 1w5Q== 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=KYU94uYbO1XMQILxP4fOQKpta758ZbhmGATVchEz4xY=; b=A2PI4CCB8bNFHKs8D4v7VTKq0u2X8tQqGmRFSx6n/+aZ8nWP+Nrg2IUHviGxnXXmiJ pC5W2t7faVUySC1ueRuQPm6J7bfSqarOld28iKBNtS0NwUkvMhdps8Ts6edGj9V5UIAG QVlUBqN8Mvt5c+4G4eTvPGUQqXxTBcmQopeVUiUGtQH9NETRqbv9FS/VKWoi4woYVBXP OzLen+0LjQW/kfw/gSfiVRd1CpRMNPlghQzYPRouy5K+I+xN32e8MHW2i/4hDXVMTOLL 0PhdYBXuTfmy4xjz23CmdyJdu5G8KpOFrBsqCnjLKjAiPYNdF7MWf7R+MVjIYq73rV3o NHlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XbT3mgV8; 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 p1si31333284pff.250.2019.07.29.13.10.14; Mon, 29 Jul 2019 13:10:29 -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=XbT3mgV8; 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 S2388684AbfG2ThV (ORCPT + 99 others); Mon, 29 Jul 2019 15:37:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:51940 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387908AbfG2ThQ (ORCPT ); Mon, 29 Jul 2019 15:37:16 -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 1CFE72184B; Mon, 29 Jul 2019 19:37:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429035; bh=QUH2HVlCZzCSEYNqBC3dDREXI2MkI3HNm6UVaQKkVuo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XbT3mgV8plrdGXOb0YuVFx+uu3UeQiwM4HkTw7If/nPz5K1c95BwKWuSIeV9qyox5 VAyguF+5sGQM869AaUc71EVNN2XYJxm3P283ScvgCLV2BxD3UoaxNTGrTIBHhpYtU6 lY51QwRzKnLiHcOAm6sh/mXsOYEYXVkyqRmvPSSg= 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.14 263/293] RDMA/rxe: Fill in wc byte_len with IB_WC_RECV_RDMA_WITH_IMM Date: Mon, 29 Jul 2019 21:22:34 +0200 Message-Id: <20190729190844.535666878@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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 74328561bee2..9207682b7a2e 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; @@ -860,7 +861,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 59f6a24db064..b2b76a316eba 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.h +++ b/drivers/infiniband/sw/rxe/rxe_verbs.h @@ -214,6 +214,7 @@ struct rxe_resp_info { struct rxe_mem *mr; u32 resid; u32 rkey; + u32 length; u64 atomic_orig; /* SRQ only */ -- 2.20.1