]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[infiniband] Add find_ibdev()
authorMichael Brown <mcb30@etherboot.org>
Sun, 9 Aug 2009 18:29:03 +0000 (19:29 +0100)
committerMichael Brown <mcb30@etherboot.org>
Mon, 10 Aug 2009 21:25:02 +0000 (22:25 +0100)
src/include/gpxe/infiniband.h
src/net/infiniband.c

index c4bc2ff468fcf2257a503dcab07dd205e7ebe0d1..771d2a07abee3072f41e29e350361031c2685563 100644 (file)
@@ -472,6 +472,7 @@ extern int ib_set_pkey_table ( struct ib_device *ibdev, union ib_mad *mad );
 extern struct ib_device * alloc_ibdev ( size_t priv_size );
 extern int register_ibdev ( struct ib_device *ibdev );
 extern void unregister_ibdev ( struct ib_device *ibdev );
+extern struct ib_device * find_ibdev ( struct ib_gid *gid );
 extern void ib_link_state_changed ( struct ib_device *ibdev );
 extern void ib_poll_eq ( struct ib_device *ibdev );
 extern struct list_head ib_devices;
index 539c529062629a87f030d96dc19e3094d13e059c..45f38d9cfc8602350051a74a774001b5d0f3f6e3 100644 (file)
@@ -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;
+}