]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/5.0.4/ib-rdmavt-fix-loopback-send-with-invalidate-ordering.patch
Linux 5.0.4
[thirdparty/kernel/stable-queue.git] / releases / 5.0.4 / ib-rdmavt-fix-loopback-send-with-invalidate-ordering.patch
1 From 38bbc9f0381550d1d227fc57afa08436e36b32fc Mon Sep 17 00:00:00 2001
2 From: Mike Marciniszyn <mike.marciniszyn@intel.com>
3 Date: Tue, 26 Feb 2019 08:45:16 -0800
4 Subject: IB/rdmavt: Fix loopback send with invalidate ordering
5
6 From: Mike Marciniszyn <mike.marciniszyn@intel.com>
7
8 commit 38bbc9f0381550d1d227fc57afa08436e36b32fc upstream.
9
10 The IBTA spec notes:
11
12 o9-5.2.1: For any HCA which supports SEND with Invalidate, upon receiving
13 an IETH, the Invalidate operation must not take place until after the
14 normal transport header validation checks have been successfully
15 completed.
16
17 The rdmavt loopback code does the validation after the invalidate.
18
19 Fix by relocating the operation specific logic for all SEND variants until
20 after the validity checks.
21
22 Cc: <stable@vger.kernel.org> #v4.20+
23 Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
24 Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
25 Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
26 Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
27 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
28
29 ---
30 drivers/infiniband/sw/rdmavt/qp.c | 26 ++++++++++++++++----------
31 1 file changed, 16 insertions(+), 10 deletions(-)
32
33 --- a/drivers/infiniband/sw/rdmavt/qp.c
34 +++ b/drivers/infiniband/sw/rdmavt/qp.c
35 @@ -2893,18 +2893,8 @@ again:
36 goto send_comp;
37
38 case IB_WR_SEND_WITH_INV:
39 - if (!rvt_invalidate_rkey(qp, wqe->wr.ex.invalidate_rkey)) {
40 - wc.wc_flags = IB_WC_WITH_INVALIDATE;
41 - wc.ex.invalidate_rkey = wqe->wr.ex.invalidate_rkey;
42 - }
43 - goto send;
44 -
45 case IB_WR_SEND_WITH_IMM:
46 - wc.wc_flags = IB_WC_WITH_IMM;
47 - wc.ex.imm_data = wqe->wr.ex.imm_data;
48 - /* FALLTHROUGH */
49 case IB_WR_SEND:
50 -send:
51 ret = rvt_get_rwqe(qp, false);
52 if (ret < 0)
53 goto op_err;
54 @@ -2912,6 +2902,22 @@ send:
55 goto rnr_nak;
56 if (wqe->length > qp->r_len)
57 goto inv_err;
58 + switch (wqe->wr.opcode) {
59 + case IB_WR_SEND_WITH_INV:
60 + if (!rvt_invalidate_rkey(qp,
61 + wqe->wr.ex.invalidate_rkey)) {
62 + wc.wc_flags = IB_WC_WITH_INVALIDATE;
63 + wc.ex.invalidate_rkey =
64 + wqe->wr.ex.invalidate_rkey;
65 + }
66 + break;
67 + case IB_WR_SEND_WITH_IMM:
68 + wc.wc_flags = IB_WC_WITH_IMM;
69 + wc.ex.imm_data = wqe->wr.ex.imm_data;
70 + break;
71 + default:
72 + break;
73 + }
74 break;
75
76 case IB_WR_RDMA_WRITE_WITH_IMM: