diff options
| author | Michael Brown | 2016-03-20 10:22:55 +0100 |
|---|---|---|
| committer | Michael Brown | 2016-03-20 10:22:55 +0100 |
| commit | 750a2efeb2814623e1355885874e93cb7578ef73 (patch) | |
| tree | d39c9d7699a9ee3a4c398d9fdd812649f724c41e /src/drivers/net | |
| parent | [libc] Allow container_of() to be used on volatile pointers (diff) | |
| download | ipxe-750a2efeb2814623e1355885874e93cb7578ef73.tar.gz ipxe-750a2efeb2814623e1355885874e93cb7578ef73.tar.xz ipxe-750a2efeb2814623e1355885874e93cb7578ef73.zip | |
[ipoib] Allow external code to identify IPoIB network devices
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/net')
| -rw-r--r-- | src/drivers/net/ipoib.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/drivers/net/ipoib.c b/src/drivers/net/ipoib.c index 4106c208c..a245cce1b 100644 --- a/src/drivers/net/ipoib.c +++ b/src/drivers/net/ipoib.c @@ -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; +} |
