summaryrefslogtreecommitdiffstats
path: root/src/net/infiniband.c
diff options
context:
space:
mode:
authorMichael Brown2009-07-09 04:49:37 +0200
committerMichael Brown2009-07-18 00:06:34 +0200
commit92cf24002018a19aec65c4a5f99cffb78e34d4c4 (patch)
tree00791d024122b382cdbee5c5f8df362c83ea7b66 /src/net/infiniband.c
parent[infiniband] Add notion of a queue pair type (diff)
downloadipxe-92cf24002018a19aec65c4a5f99cffb78e34d4c4.tar.gz
ipxe-92cf24002018a19aec65c4a5f99cffb78e34d4c4.tar.xz
ipxe-92cf24002018a19aec65c4a5f99cffb78e34d4c4.zip
[infiniband] Always create an SMA and a GMA
Diffstat (limited to 'src/net/infiniband.c')
-rw-r--r--src/net/infiniband.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/net/infiniband.c b/src/net/infiniband.c
index 42ffbcec..1444a12c 100644
--- a/src/net/infiniband.c
+++ b/src/net/infiniband.c
@@ -33,6 +33,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <gpxe/ipoib.h>
#include <gpxe/process.h>
#include <gpxe/infiniband.h>
+#include <gpxe/ib_gma.h>
/** @file
*
@@ -510,6 +511,22 @@ int ib_open ( struct ib_device *ibdev ) {
return 0;
}
+ /* Create subnet management agent */
+ ibdev->sma = ib_create_gma ( ibdev, IB_QPT_SMA );
+ if ( ! ibdev->sma ) {
+ DBGC ( ibdev, "IBDEV %p could not create SMA\n", ibdev );
+ rc = -ENOMEM;
+ goto err_create_sma;
+ }
+
+ /* Create general management agent */
+ ibdev->gma = ib_create_gma ( ibdev, IB_QPT_GMA );
+ if ( ! ibdev->gma ) {
+ DBGC ( ibdev, "IBDEV %p could not create GMA\n", ibdev );
+ rc = -ENOMEM;
+ goto err_create_gma;
+ }
+
/* Open device */
if ( ( rc = ibdev->op->open ( ibdev ) ) != 0 ) {
DBGC ( ibdev, "IBDEV %p could not open: %s\n",
@@ -517,20 +534,15 @@ int ib_open ( struct ib_device *ibdev ) {
goto err_open;
}
- /* Create general management agent */
- if ( ( rc = ib_create_gma ( &ibdev->gma, ibdev, IB_QPT_GMA ) ) != 0 ) {
- DBGC ( ibdev, "IBDEV %p could not create GMA: %s\n",
- ibdev, strerror ( rc ) );
- goto err_create_gma;
- }
-
assert ( ibdev->open_count == 1 );
return 0;
- ib_destroy_gma ( &ibdev->gma );
- err_create_gma:
ibdev->op->close ( ibdev );
err_open:
+ ib_destroy_gma ( ibdev->gma );
+ err_create_gma:
+ ib_destroy_gma ( ibdev->sma );
+ err_create_sma:
assert ( ibdev->open_count == 1 );
ibdev->open_count = 0;
return rc;
@@ -548,7 +560,8 @@ void ib_close ( struct ib_device *ibdev ) {
/* Close device if this was the last remaining requested opening */
if ( ibdev->open_count == 0 ) {
- ib_destroy_gma ( &ibdev->gma );
+ ib_destroy_gma ( ibdev->gma );
+ ib_destroy_gma ( ibdev->sma );
ibdev->op->close ( ibdev );
}
}