Browse Source

[arbel] Fix received packet length

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 years ago
parent
commit
860d5904fb
1 changed files with 3 additions and 2 deletions
  1. 3
    2
      src/drivers/infiniband/arbel.c

+ 3
- 2
src/drivers/infiniband/arbel.c View File

1646
 		MLX_FILL_1 ( &recv_wqe->data[0], 0, byte_count, 0 );
1646
 		MLX_FILL_1 ( &recv_wqe->data[0], 0, byte_count, 0 );
1647
 		MLX_FILL_1 ( &recv_wqe->data[0], 1,
1647
 		MLX_FILL_1 ( &recv_wqe->data[0], 1,
1648
 			     l_key, ARBEL_INVALID_LKEY );
1648
 			     l_key, ARBEL_INVALID_LKEY );
1649
-		assert ( len <= iob_tailroom ( iobuf ) );
1650
-		iob_put ( iobuf, len );
1651
 		memset ( &recv_dest, 0, sizeof ( recv_dest ) );
1649
 		memset ( &recv_dest, 0, sizeof ( recv_dest ) );
1652
 		recv_dest.qpn = qpn;
1650
 		recv_dest.qpn = qpn;
1653
 		switch ( qp->type ) {
1651
 		switch ( qp->type ) {
1657
 			/* Locate corresponding GRH */
1655
 			/* Locate corresponding GRH */
1658
 			assert ( arbel_recv_wq->grh != NULL );
1656
 			assert ( arbel_recv_wq->grh != NULL );
1659
 			grh = &arbel_recv_wq->grh[wqe_idx];
1657
 			grh = &arbel_recv_wq->grh[wqe_idx];
1658
+			len -= sizeof ( *grh );
1660
 			/* Construct address vector */
1659
 			/* Construct address vector */
1661
 			source = &recv_source;
1660
 			source = &recv_source;
1662
 			memset ( source, 0, sizeof ( *source ) );
1661
 			memset ( source, 0, sizeof ( *source ) );
1677
 			assert ( 0 );
1676
 			assert ( 0 );
1678
 			return -EINVAL;
1677
 			return -EINVAL;
1679
 		}
1678
 		}
1679
+		assert ( len <= iob_tailroom ( iobuf ) );
1680
+		iob_put ( iobuf, len );
1680
 		/* Hand off to completion handler */
1681
 		/* Hand off to completion handler */
1681
 		ib_complete_recv ( ibdev, qp, &recv_dest, source, iobuf, rc );
1682
 		ib_complete_recv ( ibdev, qp, &recv_dest, source, iobuf, rc );
1682
 	}
1683
 	}

Loading…
Cancel
Save