Browse Source

[hermon] Fix received packet length

Debugged-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 years ago
parent
commit
3ad028cf1c
1 changed files with 3 additions and 2 deletions
  1. 3
    2
      src/drivers/infiniband/hermon.c

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

1769
 	} else {
1769
 	} else {
1770
 		/* Set received length */
1770
 		/* Set received length */
1771
 		len = MLX_GET ( &cqe->normal, byte_cnt );
1771
 		len = MLX_GET ( &cqe->normal, byte_cnt );
1772
-		assert ( len <= iob_tailroom ( iobuf ) );
1773
-		iob_put ( iobuf, len );
1774
 		memset ( &recv_dest, 0, sizeof ( recv_dest ) );
1772
 		memset ( &recv_dest, 0, sizeof ( recv_dest ) );
1775
 		recv_dest.qpn = qpn;
1773
 		recv_dest.qpn = qpn;
1776
 		memset ( &recv_source, 0, sizeof ( recv_source ) );
1774
 		memset ( &recv_source, 0, sizeof ( recv_source ) );
1781
 			/* Locate corresponding GRH */
1779
 			/* Locate corresponding GRH */
1782
 			assert ( hermon_qp->recv.grh != NULL );
1780
 			assert ( hermon_qp->recv.grh != NULL );
1783
 			grh = &hermon_qp->recv.grh[ wqe_idx & wqe_idx_mask ];
1781
 			grh = &hermon_qp->recv.grh[ wqe_idx & wqe_idx_mask ];
1782
+			len -= sizeof ( *grh );
1784
 			/* Construct address vector */
1783
 			/* Construct address vector */
1785
 			source = &recv_source;
1784
 			source = &recv_source;
1786
 			source->qpn = MLX_GET ( &cqe->normal, srq_rqpn );
1785
 			source->qpn = MLX_GET ( &cqe->normal, srq_rqpn );
1806
 			assert ( 0 );
1805
 			assert ( 0 );
1807
 			return -EINVAL;
1806
 			return -EINVAL;
1808
 		}
1807
 		}
1808
+		assert ( len <= iob_tailroom ( iobuf ) );
1809
+		iob_put ( iobuf, len );
1809
 		/* Hand off to completion handler */
1810
 		/* Hand off to completion handler */
1810
 		ib_complete_recv ( ibdev, qp, &recv_dest, source, iobuf, rc );
1811
 		ib_complete_recv ( ibdev, qp, &recv_dest, source, iobuf, rc );
1811
 	}
1812
 	}

Loading…
Cancel
Save