diff options
author | Michael Brown <mcb30@etherboot.org> | 2009-07-02 12:54:36 +0100 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2009-07-17 23:06:33 +0100 |
commit | 7ba33f78263ba17633cf6c264e99b4a4140abfcb (patch) | |
tree | 3ce2ef77e4aef89f705c49219ca5ebda9f80333f /src/net/infiniband.c | |
parent | b25a4b6c8a7f311f639bf999050dbad5e50ede4d (diff) | |
download | ipxe-7ba33f78263ba17633cf6c264e99b4a4140abfcb.tar.gz |
[infiniband] Provide ib_get_hca_info() as a commonly-available function
Diffstat (limited to 'src/net/infiniband.c')
-rw-r--r-- | src/net/infiniband.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/net/infiniband.c b/src/net/infiniband.c index 1c584d83..1c19fada 100644 --- a/src/net/infiniband.c +++ b/src/net/infiniband.c @@ -488,6 +488,32 @@ void ib_mcast_detach ( struct ib_device *ibdev, struct ib_queue_pair *qp, } } +/** + * Get Infiniband HCA information + * + * @v ibdev Infiniband device + * @ret hca_guid HCA GUID + * @ret num_ports Number of ports + */ +int ib_get_hca_info ( struct ib_device *ibdev, + struct ib_gid_half *hca_guid ) { + struct ib_device *tmp; + int num_ports = 0; + + /* Search for IB devices with the same physical device to + * identify port count and a suitable Node GUID. + */ + for_each_ibdev ( tmp ) { + if ( tmp->dev != ibdev->dev ) + continue; + if ( num_ports == 0 ) { + memcpy ( hca_guid, &tmp->gid.u.half[1], + sizeof ( *hca_guid ) ); + } + num_ports++; + } + return num_ports; +} /*************************************************************************** * |