Browse Source

Add find_pci_netdev()

tags/v0.9.3
Michael Brown 18 years ago
parent
commit
1fa5cd0e2b
2 changed files with 20 additions and 0 deletions
  1. 2
    0
      src/include/gpxe/netdevice.h
  2. 18
    0
      src/net/netdevice.c

+ 2
- 0
src/include/gpxe/netdevice.h View File

264
 extern void unregister_netdev ( struct net_device *netdev );
264
 extern void unregister_netdev ( struct net_device *netdev );
265
 extern void free_netdev ( struct net_device *netdev );
265
 extern void free_netdev ( struct net_device *netdev );
266
 struct net_device * find_netdev ( const char *name );
266
 struct net_device * find_netdev ( const char *name );
267
+struct net_device * find_pci_netdev ( unsigned int busdevfn );
268
+
267
 extern int net_tx ( struct pk_buff *pkb, struct net_device *netdev,
269
 extern int net_tx ( struct pk_buff *pkb, struct net_device *netdev,
268
 		    struct net_protocol *net_protocol, const void *ll_dest );
270
 		    struct net_protocol *net_protocol, const void *ll_dest );
269
 extern int net_rx ( struct pk_buff *pkb, struct net_device *netdev,
271
 extern int net_rx ( struct pk_buff *pkb, struct net_device *netdev,

+ 18
- 0
src/net/netdevice.c View File

313
 	return NULL;
313
 	return NULL;
314
 }
314
 }
315
 
315
 
316
+/**
317
+ * Get network device by PCI bus:dev.fn address
318
+ *
319
+ * @v busdevfn		PCI bus:dev.fn address
320
+ * @ret netdev		Network device, or NULL
321
+ */
322
+struct net_device * find_pci_netdev ( unsigned int busdevfn ) {
323
+	struct net_device *netdev;
324
+
325
+	list_for_each_entry ( netdev, &net_devices, list ) {
326
+		if ( ( netdev->dev->desc.bus_type == BUS_TYPE_PCI ) &&
327
+		     ( netdev->dev->desc.pci.busdevfn == busdevfn ) )
328
+			return netdev;
329
+	}
330
+
331
+	return NULL;	
332
+}
333
+
316
 /**
334
 /**
317
  * Transmit network-layer packet
335
  * Transmit network-layer packet
318
  *
336
  *

Loading…
Cancel
Save