Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[ipoib] Allow external code to identify IPoIB network devices
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Mar 20, 2016
1 parent ef0297b commit 750a2ef
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/drivers/net/ipoib.c
Expand Up @@ -1027,3 +1027,21 @@ struct ib_driver ipoib_driver __ib_driver = {
.notify = ipoib_notify,
.remove = ipoib_remove,
};

/**
* Find IPoIB network device
*
* @v ibdev Infiniband device
* @ret netdev IPoIB network device, or NULL if not found
*/
struct net_device * ipoib_netdev ( struct ib_device *ibdev ) {
struct ipoib_device *ipoib;

/* Find matching IPoIB device */
list_for_each_entry ( ipoib, &ipoib_devices, list ) {
if ( ipoib->ibdev != ibdev )
continue;
return ipoib->netdev;
}
return NULL;
}
1 change: 1 addition & 0 deletions src/include/ipxe/ipoib.h
Expand Up @@ -62,5 +62,6 @@ struct ipoib_remac {

extern const char * ipoib_ntoa ( const void *ll_addr );
extern struct net_device * alloc_ipoibdev ( size_t priv_size );
extern struct net_device * ipoib_netdev ( struct ib_device *ibdev );

#endif /* _IPXE_IPOIB_H */

0 comments on commit 750a2ef

Please sign in to comment.