]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.4.177/ib-hfi1-qib-fix-wc.byte_len-calculation-for-ud_send_.patch
Linux 4.4.177
[thirdparty/kernel/stable-queue.git] / releases / 4.4.177 / ib-hfi1-qib-fix-wc.byte_len-calculation-for-ud_send_.patch
CommitLineData
1981af9d
SL
1From e3a2df6cfc85b1156274ebe4640917fec3bd0417 Mon Sep 17 00:00:00 2001
2From: Brian Welty <brian.welty@intel.com>
3Date: Thu, 17 Jan 2019 12:41:32 -0800
4Subject: IB/{hfi1, qib}: Fix WC.byte_len calculation for UD_SEND_WITH_IMM
5
6[ Upstream commit 904bba211acc2112fdf866e5a2bc6cd9ecd0de1b ]
7
8The work completion length for a receiving a UD send with immediate is
9short by 4 bytes causing application using this opcode to fail.
10
11The UD receive logic incorrectly subtracts 4 bytes for immediate
12value. These bytes are already included in header length and are used to
13calculate header/payload split, so the result is these 4 bytes are
14subtracted twice, once when the header length subtracted from the overall
15length and once again in the UD opcode specific path.
16
17Remove the extra subtraction when handling the opcode.
18
19Fixes: 7724105686e7 ("IB/hfi1: add driver files")
20Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
21Signed-off-by: Brian Welty <brian.welty@intel.com>
22Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
23Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
24Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
25Signed-off-by: Sasha Levin <sashal@kernel.org>
26---
27 drivers/infiniband/hw/qib/qib_ud.c | 1 -
28 drivers/staging/rdma/hfi1/ud.c | 1 -
29 2 files changed, 2 deletions(-)
30
31diff --git a/drivers/infiniband/hw/qib/qib_ud.c b/drivers/infiniband/hw/qib/qib_ud.c
32index 59193f67ea78..56bd59bc08b5 100644
33--- a/drivers/infiniband/hw/qib/qib_ud.c
34+++ b/drivers/infiniband/hw/qib/qib_ud.c
35@@ -515,7 +515,6 @@ void qib_ud_rcv(struct qib_ibport *ibp, struct qib_ib_header *hdr,
36 opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) {
37 wc.ex.imm_data = ohdr->u.ud.imm_data;
38 wc.wc_flags = IB_WC_WITH_IMM;
39- tlen -= sizeof(u32);
40 } else if (opcode == IB_OPCODE_UD_SEND_ONLY) {
41 wc.ex.imm_data = 0;
42 wc.wc_flags = 0;
43diff --git a/drivers/staging/rdma/hfi1/ud.c b/drivers/staging/rdma/hfi1/ud.c
44index 5a9c784bec04..a88e37444be0 100644
45--- a/drivers/staging/rdma/hfi1/ud.c
46+++ b/drivers/staging/rdma/hfi1/ud.c
47@@ -793,7 +793,6 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)
48 opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) {
49 wc.ex.imm_data = ohdr->u.ud.imm_data;
50 wc.wc_flags = IB_WC_WITH_IMM;
51- tlen -= sizeof(u32);
52 } else if (opcode == IB_OPCODE_UD_SEND_ONLY) {
53 wc.ex.imm_data = 0;
54 wc.wc_flags = 0;
55--
562.19.1
57