Przeglądaj źródła

[arbel] Fix received packet length

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 lat temu
rodzic
commit
860d5904fb
1 zmienionych plików z 3 dodań i 2 usunięć
  1. 3
    2
      src/drivers/infiniband/arbel.c

+ 3
- 2
src/drivers/infiniband/arbel.c Wyświetl plik

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

Ładowanie…
Anuluj
Zapisz