diff mbox series

[for-rc,3/7] IB/{hfi1, qib}: Fix WC.byte_len calculation for UD_SEND_WITH_IMM

Message ID 20190117204127.30826.96869.stgit@scvm10.sc.intel.com (mailing list archive)
State Accepted
Delegated to: Jason Gunthorpe
Headers show
Series hfi1 and qib patches for rc | expand

Commit Message

Dennis Dalessandro Jan. 17, 2019, 8:41 p.m. UTC
From: Brian Welty <brian.welty@intel.com>

The work completion length for a receiving a UD send with immediate
is short by 4 bytes.

The UD receive logic incorrectly subtracts 4 bytes for immediate
value. These bytes are already included in header length and are
used to calculate header/payload split, so the result is these
4 bytes are subtracted twice, once when the header length subtracted
from the overall length and once again in the UD opcode specific
path.  Remove the extra subtraction when handling the opcode.

Fixes: 7724105686e7 ("IB/hfi1: add driver files")
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Brian Welty <brian.welty@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
---
 drivers/infiniband/hw/hfi1/ud.c    |    1 -
 drivers/infiniband/hw/qib/qib_ud.c |    1 -
 2 files changed, 0 insertions(+), 2 deletions(-)

Comments

Jason Gunthorpe Jan. 18, 2019, 8:47 p.m. UTC | #1
On Thu, Jan 17, 2019 at 12:41:32PM -0800, Dennis Dalessandro wrote:
> From: Brian Welty <brian.welty@intel.com>
> 
> The work completion length for a receiving a UD send with immediate
> is short by 4 bytes.
> 
> The UD receive logic incorrectly subtracts 4 bytes for immediate
> value. These bytes are already included in header length and are
> used to calculate header/payload split, so the result is these
> 4 bytes are subtracted twice, once when the header length subtracted
> from the overall length and once again in the UD opcode specific
> path.  Remove the extra subtraction when handling the opcode.
> 
> Fixes: 7724105686e7 ("IB/hfi1: add driver files")
> Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
> Signed-off-by: Brian Welty <brian.welty@intel.com>
> Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
> ---
>  drivers/infiniband/hw/hfi1/ud.c    |    1 -
>  drivers/infiniband/hw/qib/qib_ud.c |    1 -
>  2 files changed, 0 insertions(+), 2 deletions(-)

Applied to for-rc thanks

Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/hfi1/ud.c b/drivers/infiniband/hw/hfi1/ud.c
index 88242fe..bf96067 100644
--- a/drivers/infiniband/hw/hfi1/ud.c
+++ b/drivers/infiniband/hw/hfi1/ud.c
@@ -987,7 +987,6 @@  void hfi1_ud_rcv(struct hfi1_packet *packet)
 	    opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) {
 		wc.ex.imm_data = packet->ohdr->u.ud.imm_data;
 		wc.wc_flags = IB_WC_WITH_IMM;
-		tlen -= sizeof(u32);
 	} else if (opcode == IB_OPCODE_UD_SEND_ONLY) {
 		wc.ex.imm_data = 0;
 		wc.wc_flags = 0;
diff --git a/drivers/infiniband/hw/qib/qib_ud.c b/drivers/infiniband/hw/qib/qib_ud.c
index 868da0e..445ea19 100644
--- a/drivers/infiniband/hw/qib/qib_ud.c
+++ b/drivers/infiniband/hw/qib/qib_ud.c
@@ -512,7 +512,6 @@  void qib_ud_rcv(struct qib_ibport *ibp, struct ib_header *hdr,
 	    opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) {
 		wc.ex.imm_data = ohdr->u.ud.imm_data;
 		wc.wc_flags = IB_WC_WITH_IMM;
-		tlen -= sizeof(u32);
 	} else if (opcode == IB_OPCODE_UD_SEND_ONLY) {
 		wc.ex.imm_data = 0;
 		wc.wc_flags = 0;