summaryrefslogtreecommitdiffstats
path: root/src/net/infiniband.c
diff options
context:
space:
mode:
authorMichael Brown2009-07-17 23:50:33 +0200
committerMichael Brown2009-07-18 00:06:33 +0200
commit1f5c0239b4fc5dea895645397d5aaa3d4b95205a (patch)
tree0f4f5f50363702b601f3a7b966bc12a2a6797a22 /src/net/infiniband.c
parent[infiniband] Provide ib_get_hca_info() as a commonly-available function (diff)
downloadipxe-1f5c0239b4fc5dea895645397d5aaa3d4b95205a.tar.gz
ipxe-1f5c0239b4fc5dea895645397d5aaa3d4b95205a.tar.xz
ipxe-1f5c0239b4fc5dea895645397d5aaa3d4b95205a.zip
[infiniband] Centralise assumption of 2048-byte payloads
IPoIB and the SMA have separate constants for the packet size to be used to I/O buffer allocations. Merge these into the single IB_MAX_PAYLOAD_SIZE constant. (Various other points in the Infiniband stack have hard-coded assumptions of a 2048-byte payload; we don't currently support variable MTUs.)
Diffstat (limited to 'src/net/infiniband.c')
-rw-r--r--src/net/infiniband.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/net/infiniband.c b/src/net/infiniband.c
index 1c19fada..4784f404 100644
--- a/src/net/infiniband.c
+++ b/src/net/infiniband.c
@@ -345,6 +345,13 @@ int ib_post_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
struct io_buffer *iobuf ) {
int rc;
+ /* Check packet length */
+ if ( iob_tailroom ( iobuf ) < IB_MAX_PAYLOAD_SIZE ) {
+ DBGC ( ibdev, "IBDEV %p QPN %#lx wrong RX buffer size (%zd)\n",
+ ibdev, qp->qpn, iob_tailroom ( iobuf ) );
+ return -EINVAL;
+ }
+
/* Check queue fill level */
if ( qp->recv.fill >= qp->recv.num_wqes ) {
DBGC ( ibdev, "IBDEV %p QPN %#lx receive queue full\n",