[infiniband] Add find_ibdev()

This commit is contained in:
Michael Brown
2009-08-09 19:29:03 +01:00
parent 4be11f523c
commit 419243e7f1
2 changed files with 17 additions and 0 deletions

View 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;
}