diff options
author | Michael Brown | 2016-03-22 17:11:58 +0100 |
---|---|---|
committer | Michael Brown | 2016-03-22 17:11:58 +0100 |
commit | 860d5904fb71bbf154901030712ed00e4403b79c (patch) | |
tree | e4374901bc44ebd6bd7632848a997e5469cd6db3 /src/drivers/infiniband | |
parent | [hermon] Fix received packet length (diff) | |
download | ipxe-860d5904fb71bbf154901030712ed00e4403b79c.tar.gz ipxe-860d5904fb71bbf154901030712ed00e4403b79c.tar.xz ipxe-860d5904fb71bbf154901030712ed00e4403b79c.zip |
[arbel] Fix received packet length
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/infiniband')
-rw-r--r-- | src/drivers/infiniband/arbel.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/drivers/infiniband/arbel.c b/src/drivers/infiniband/arbel.c index 5ab70155..9671174c 100644 --- a/src/drivers/infiniband/arbel.c +++ b/src/drivers/infiniband/arbel.c @@ -1646,8 +1646,6 @@ static int arbel_complete ( struct ib_device *ibdev, MLX_FILL_1 ( &recv_wqe->data[0], 0, byte_count, 0 ); MLX_FILL_1 ( &recv_wqe->data[0], 1, l_key, ARBEL_INVALID_LKEY ); - assert ( len <= iob_tailroom ( iobuf ) ); - iob_put ( iobuf, len ); memset ( &recv_dest, 0, sizeof ( recv_dest ) ); recv_dest.qpn = qpn; switch ( qp->type ) { @@ -1657,6 +1655,7 @@ static int arbel_complete ( struct ib_device *ibdev, /* Locate corresponding GRH */ assert ( arbel_recv_wq->grh != NULL ); grh = &arbel_recv_wq->grh[wqe_idx]; + len -= sizeof ( *grh ); /* Construct address vector */ source = &recv_source; memset ( source, 0, sizeof ( *source ) ); @@ -1677,6 +1676,8 @@ static int arbel_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 ); } |