2
0
mirror of https://github.com/xcat2/xNBA.git synced 2025-02-22 05:19:55 +00:00

[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

@ -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;

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