]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[arbel] Fix received packet length
authorMichael Brown <mcb30@ipxe.org>
Tue, 22 Mar 2016 16:11:58 +0000 (16:11 +0000)
committerMichael Brown <mcb30@ipxe.org>
Tue, 22 Mar 2016 16:11:58 +0000 (16:11 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/infiniband/arbel.c

index 5ab7015511a6b6cc30e2d0f7a4eb4e18c1902bc0..9671174c3a89ff80d06d9702ac42620e5f951292 100644 (file)
@@ -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 );
        }