mirror of
https://github.com/ipxe/ipxe
synced 2025-12-18 02:20:19 +03:00
[netdevice] Add find_netdev_by_index()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -684,6 +684,24 @@ struct net_device * find_netdev ( const char *name ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get network device by index
|
||||
*
|
||||
* @v index Network device index
|
||||
* @ret netdev Network device, or NULL
|
||||
*/
|
||||
struct net_device * find_netdev_by_index ( unsigned int index ) {
|
||||
struct net_device *netdev;
|
||||
|
||||
/* Identify network device by index */
|
||||
list_for_each_entry ( netdev, &net_devices, list ) {
|
||||
if ( netdev->index == index )
|
||||
return netdev;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get network device by PCI bus:dev.fn address
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user