Return-Path: Received: from mail-sn1nam01on0117.outbound.protection.outlook.com ([104.47.32.117]:16747 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965983AbeCHFDT (ORCPT ); Thu, 8 Mar 2018 00:03:19 -0500 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Johannes Thumshirn , Hannes Reinecke , Sagi Grimberg , Max Gurtovoy , Doug Ledford , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 132/190] IB/rxe: Don't clamp residual length to mtu Date: Thu, 8 Mar 2018 04:59:49 +0000 Message-ID: <20180308045810.8041-132-alexander.levin@microsoft.com> References: <20180308045810.8041-1-alexander.levin@microsoft.com> In-Reply-To: <20180308045810.8041-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Johannes Thumshirn [ Upstream commit d52418502e288b5c7e9e2e6cf1de5f1d3d79d2e1 ] When reading a RDMA WRITE FIRST packet we copy the DMA length from the RDMA header into the qp->resp.resid variable for later use. Later in check_rkey(= ) we clamp it to the MTU if the packet is an RDMA WRITE packet and has a residual length bigger than the MTU. Later in write_data_in() we subtract t= he payload of the packet from the residual length. If the packet happens to ha= ve a payload of exactly the MTU size we end up with a residual length of 0 despi= te the packet not being the last in the conversation. When the next packet in = the conversation arrives, we don't have any residual length left and thus set t= he QP into an error state. This broke NVMe over Fabrics functionality over rdma_rxe.ko The patch was verified using the following test. # echo eth0 > /sys/module/rdma_rxe/parameters/add # nvme connect -t rdma -a 192.168.155.101 -s 1023 -n nvmf-test # mkfs.xfs -fK /dev/nvme0n1 meta-data=3D/dev/nvme0n1 isize=3D256 agcount=3D4, agsize=3D65= 536 blks =3D sectsz=3D4096 attr=3D2, projid32bit=3D= 1 =3D crc=3D0 finobt=3D0, sparse=3D0 data =3D bsize=3D4096 blocks=3D262144, imaxpct= =3D25 =3D sunit=3D0 swidth=3D0 blks naming =3Dversion 2 bsize=3D4096 ascii-ci=3D0 ftype=3D1 log =3Dinternal log bsize=3D4096 blocks=3D2560, version= =3D2 =3D sectsz=3D4096 sunit=3D1 blks, lazy-cou= nt=3D1 realtime =3Dnone extsz=3D4096 blocks=3D0, rtextents=3D= 0 # mount /dev/nvme0n1 /tmp/ [ 148.923263] XFS (nvme0n1): Mounting V4 Filesystem [ 148.961196] XFS (nvme0n1): Ending clean mount # dd if=3D/dev/urandom of=3Dtest.bin bs=3D1M count=3D128 128+0 records in 128+0 records out 134217728 bytes (134 MB, 128 MiB) copied, 0.437991 s, 306 MB/s # sha256sum test.bin cde42941f045efa8c4f0f157ab6f29741753cdd8d1cff93a6b03649d83c4129a test.bin # cp test.bin /tmp/ sha256sum /tmp/test.bin cde42941f045efa8c4f0f157ab6f29741753cdd8d1cff93a6b03649d83c4129a /tmp/tes= t.bin Signed-off-by: Johannes Thumshirn Cc: Hannes Reinecke Cc: Sagi Grimberg Cc: Max Gurtovoy Acked-by: Moni Shoua Signed-off-by: Doug Ledford Signed-off-by: Sasha Levin --- drivers/infiniband/sw/rxe/rxe_resp.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/r= xe/rxe_resp.c index 8c0ddd7165ae..0d25dc84d294 100644 --- a/drivers/infiniband/sw/rxe/rxe_resp.c +++ b/drivers/infiniband/sw/rxe/rxe_resp.c @@ -471,8 +471,6 @@ static enum resp_states check_rkey(struct rxe_qp *qp, state =3D RESPST_ERR_LENGTH; goto err; } - - qp->resp.resid =3D mtu; } else { if (pktlen !=3D resid) { state =3D RESPST_ERR_LENGTH; --=20 2.14.1