summaryrefslogtreecommitdiffstats
path: root/src/net/infiniband.c
diff options
context:
space:
mode:
authorMichael Brown2009-07-09 16:52:04 +0200
committerMichael Brown2009-07-18 00:06:34 +0200
commitf1d92fa8865c281cb7da31f2e3b62ece3f2f9ca1 (patch)
treed07c05965bd108d02d3c1b6fd1ac1574f70200d5 /src/net/infiniband.c
parent[infiniband] Always create an SMA and a GMA (diff)
downloadipxe-f1d92fa8865c281cb7da31f2e3b62ece3f2f9ca1.tar.gz
ipxe-f1d92fa8865c281cb7da31f2e3b62ece3f2f9ca1.tar.xz
ipxe-f1d92fa8865c281cb7da31f2e3b62ece3f2f9ca1.zip
[infiniband] Allow external QPN to differ from real QPN
Most IB hardware seems not to allow allocation of the genuine QPNs 0 and 1, so allow for the externally-visible QPN (as constructed and parsed by ib_packet, where used) to differ from the real hardware-allocated QPN.
Diffstat (limited to 'src/net/infiniband.c')
-rw-r--r--src/net/infiniband.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/net/infiniband.c b/src/net/infiniband.c
index 1444a12c..b15dcc61 100644
--- a/src/net/infiniband.c
+++ b/src/net/infiniband.c
@@ -196,7 +196,6 @@ struct ib_queue_pair * ib_create_qp ( struct ib_device *ibdev,
"%s\n", ibdev, strerror ( rc ) );
goto err_dev_create_qp;
}
-
DBGC ( ibdev, "IBDEV %p created queue pair %p (%p) with QPN %#lx\n",
ibdev, qp, ib_qp_get_drvdata ( qp ), qp->qpn );
DBGC ( ibdev, "IBDEV %p QPN %#lx has %d send entries at [%p,%p)\n",
@@ -205,6 +204,24 @@ struct ib_queue_pair * ib_create_qp ( struct ib_device *ibdev,
DBGC ( ibdev, "IBDEV %p QPN %#lx has %d receive entries at [%p,%p)\n",
ibdev, qp->qpn, num_recv_wqes, qp->recv.iobufs,
( ( ( void * ) qp ) + total_size ) );
+
+ /* Calculate externally-visible QPN */
+ switch ( type ) {
+ case IB_QPT_SMA:
+ qp->ext_qpn = IB_QPN_SMA;
+ break;
+ case IB_QPT_GMA:
+ qp->ext_qpn = IB_QPN_GMA;
+ break;
+ default:
+ qp->ext_qpn = qp->qpn;
+ break;
+ }
+ if ( qp->ext_qpn != qp->qpn ) {
+ DBGC ( ibdev, "IBDEV %p QPN %#lx has external QPN %#lx\n",
+ ibdev, qp->qpn, qp->ext_qpn );
+ }
+
return qp;
ibdev->op->destroy_qp ( ibdev, qp );
@@ -295,7 +312,7 @@ struct ib_queue_pair * ib_find_qp_qpn ( struct ib_device *ibdev,
struct ib_queue_pair *qp;
list_for_each_entry ( qp, &ibdev->qps, list ) {
- if ( qp->qpn == qpn )
+ if ( ( qpn == qp->qpn ) || ( qpn == qp->ext_qpn ) )
return qp;
}
return NULL;