summaryrefslogtreecommitdiffstats
path: root/src/net/infiniband.c
diff options
context:
space:
mode:
authorMichael Brown2009-08-09 20:29:03 +0200
committerMichael Brown2009-08-10 23:25:02 +0200
commit419243e7f1ab37c9e7867080e17dcd745fa4f9c0 (patch)
treeca31e5d7fb1b76d225632b959d8e7309e45b75f3 /src/net/infiniband.c
parent[infiniband] Add a "communication-managed reliable connection" protocol (diff)
downloadipxe-419243e7f1ab37c9e7867080e17dcd745fa4f9c0.tar.gz
ipxe-419243e7f1ab37c9e7867080e17dcd745fa4f9c0.tar.xz
ipxe-419243e7f1ab37c9e7867080e17dcd745fa4f9c0.zip
[infiniband] Add find_ibdev()
Diffstat (limited to 'src/net/infiniband.c')
-rw-r--r--src/net/infiniband.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/net/infiniband.c b/src/net/infiniband.c
index 539c5290..45f38d9c 100644
--- a/src/net/infiniband.c
+++ b/src/net/infiniband.c
@@ -882,3 +882,19 @@ void unregister_ibdev ( struct ib_device *ibdev ) {
ibdev_put ( ibdev );
DBGC ( ibdev, "IBDEV %p unregistered\n", ibdev );
}
+
+/**
+ * Find Infiniband device by GID
+ *
+ * @v gid GID
+ * @ret ibdev Infiniband device, or NULL
+ */
+struct ib_device * find_ibdev ( struct ib_gid *gid ) {
+ struct ib_device *ibdev;
+
+ for_each_ibdev ( ibdev ) {
+ if ( memcmp ( gid, &ibdev->gid, sizeof ( *gid ) ) == 0 )
+ return ibdev;
+ }
+ return NULL;
+}