Skip to content

Commit

Permalink
[infiniband] Add find_ibdev()
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Brown committed Aug 10, 2009
1 parent 4be11f5 commit 419243e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/include/gpxe/infiniband.h
Expand Up @@ -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;
Expand Down
16 changes: 16 additions & 0 deletions src/net/infiniband.c
Expand Up @@ -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;
}

0 comments on commit 419243e

Please sign in to comment.