summaryrefslogtreecommitdiffstats
path: root/src/drivers/infiniband
diff options
context:
space:
mode:
authorMichael Brown2016-03-22 17:09:18 +0100
committerMichael Brown2016-03-22 17:09:18 +0100
commit3ad028cf1cf8c9304c9a40051279761b0a6e0cca (patch)
tree3a06f3327796f4b9fbc0f4322bc958b4fc8d63e0 /src/drivers/infiniband
parent[etherfabric] Avoid use of sleep() in driver code (diff)
downloadipxe-3ad028cf1cf8c9304c9a40051279761b0a6e0cca.tar.gz
ipxe-3ad028cf1cf8c9304c9a40051279761b0a6e0cca.tar.xz
ipxe-3ad028cf1cf8c9304c9a40051279761b0a6e0cca.zip
[hermon] Fix received packet length
Debugged-by: Wissam Shoukair <wissams@mellanox.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/infiniband')
-rw-r--r--src/drivers/infiniband/hermon.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/drivers/infiniband/hermon.c b/src/drivers/infiniband/hermon.c
index 99a54a14..79d60609 100644
--- a/src/drivers/infiniband/hermon.c
+++ b/src/drivers/infiniband/hermon.c
@@ -1769,8 +1769,6 @@ static int hermon_complete ( struct ib_device *ibdev,
} else {
/* Set received length */
len = MLX_GET ( &cqe->normal, byte_cnt );
- assert ( len <= iob_tailroom ( iobuf ) );
- iob_put ( iobuf, len );
memset ( &recv_dest, 0, sizeof ( recv_dest ) );
recv_dest.qpn = qpn;
memset ( &recv_source, 0, sizeof ( recv_source ) );
@@ -1781,6 +1779,7 @@ static int hermon_complete ( struct ib_device *ibdev,
/* Locate corresponding GRH */
assert ( hermon_qp->recv.grh != NULL );
grh = &hermon_qp->recv.grh[ wqe_idx & wqe_idx_mask ];
+ len -= sizeof ( *grh );
/* Construct address vector */
source = &recv_source;
source->qpn = MLX_GET ( &cqe->normal, srq_rqpn );
@@ -1806,6 +1805,8 @@ static int hermon_complete ( struct ib_device *ibdev,
assert ( 0 );
return -EINVAL;
}
+ assert ( len <= iob_tailroom ( iobuf ) );
+ iob_put ( iobuf, len );
/* Hand off to completion handler */
ib_complete_recv ( ibdev, qp, &recv_dest, source, iobuf, rc );
}