summaryrefslogtreecommitdiffstats
path: root/src/include/gpxe/ethernet.h
diff options
context:
space:
mode:
authorMichael Brown2006-04-24 17:38:53 +0200
committerMichael Brown2006-04-24 17:38:53 +0200
commit53f78346bf65c7080da1c750c7590cc343d55726 (patch)
treee279237d8081272a0a9ca749a845c04093e17a13 /src/include/gpxe/ethernet.h
parentNetwork API now allows for multiple network devices (although the (diff)
downloadipxe-53f78346bf65c7080da1c750c7590cc343d55726.tar.gz
ipxe-53f78346bf65c7080da1c750c7590cc343d55726.tar.xz
ipxe-53f78346bf65c7080da1c750c7590cc343d55726.zip
Network API now allows for multiple network devices (although the
implementation allows for only one, and does so without compromising on the efficiency of static allocation). Link-layer protocols are cleanly separated from the device drivers. Network-layer protocols are cleanly separated from individual network devices. Link-layer and network-layer protocols are cleanly separated from each other.
Diffstat (limited to 'src/include/gpxe/ethernet.h')
-rw-r--r--src/include/gpxe/ethernet.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/include/gpxe/ethernet.h b/src/include/gpxe/ethernet.h
new file mode 100644
index 00000000..e62eb09b
--- /dev/null
+++ b/src/include/gpxe/ethernet.h
@@ -0,0 +1,28 @@
+#ifndef _GPXE_ETHERNET_H
+#define _GPXE_ETHERNET_H
+
+/** @file
+ *
+ * Ethernet protocol
+ *
+ */
+
+#include <stdint.h>
+#include <gpxe/netdevice.h>
+
+extern struct ll_protocol ethernet_protocol;
+
+/**
+ * Allocate Ethernet device
+ *
+ * @v priv_size Size of driver private data
+ * @ret netdev Network device, or NULL
+ */
+#define alloc_etherdev( priv_size ) ( { \
+ struct net_device *netdev; \
+ netdev = alloc_netdev ( priv_size ); \
+ if ( netdev ) \
+ netdev->ll_protocol = &ethernet_protocol; \
+ netdev; } )
+
+#endif /* _GPXE_ETHERNET_H */