summaryrefslogtreecommitdiffstats
path: root/src/include/gpxe/ipoib.h
diff options
context:
space:
mode:
authorMichael Brown2007-09-17 06:04:58 +0200
committerMichael Brown2007-09-17 06:04:58 +0200
commit4e78a53cf26b85736123eee29d23d637b4a3883f (patch)
tree319b933d03e9095460ff53ee22e5619f93f81a70 /src/include/gpxe/ipoib.h
parentRead port GID directly using MAD IFC. (diff)
downloadipxe-4e78a53cf26b85736123eee29d23d637b4a3883f.tar.gz
ipxe-4e78a53cf26b85736123eee29d23d637b4a3883f.tar.xz
ipxe-4e78a53cf26b85736123eee29d23d637b4a3883f.zip
IPoIB code separated out to ipoib.c.
Diffstat (limited to 'src/include/gpxe/ipoib.h')
-rw-r--r--src/include/gpxe/ipoib.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/include/gpxe/ipoib.h b/src/include/gpxe/ipoib.h
new file mode 100644
index 00000000..0551687d
--- /dev/null
+++ b/src/include/gpxe/ipoib.h
@@ -0,0 +1,78 @@
+#ifndef _GPXE_IPOIB_H
+#define _GPXE_IPOIB_H
+
+/** @file
+ *
+ * IP over Infiniband
+ */
+
+#include <gpxe/infiniband.h>
+
+/** IPoIB MAC address length */
+#define IPOIB_ALEN 20
+
+/** An IPoIB MAC address */
+struct ipoib_mac {
+ /** Queue pair number
+ *
+ * MSB must be zero; QPNs are only 24-bit.
+ */
+ uint32_t qpn;
+ /** Port GID */
+ struct ib_gid gid;
+} __attribute__ (( packed ));
+
+/** IPoIB link-layer header length */
+#define IPOIB_HLEN 24
+
+/**
+ * IPoIB link-layer header pseudo portion
+ *
+ * This part doesn't actually exist on the wire, but it provides a
+ * convenient way to fit into the typical network device model.
+ */
+struct ipoib_pseudo_hdr {
+ /** Peer address */
+ struct ipoib_mac peer;
+} __attribute__ (( packed ));
+
+/** IPoIB link-layer header real portion */
+struct ipoib_real_hdr {
+ /** Network-layer protocol */
+ uint16_t proto;
+ /** Reserved, must be zero */
+ uint16_t reserved;
+} __attribute__ (( packed ));
+
+/** An IPoIB link-layer header */
+struct ipoib_hdr {
+ /** Pseudo portion */
+ struct ipoib_pseudo_hdr pseudo;
+ /** Real portion */
+ struct ipoib_real_hdr real;
+} __attribute__ (( packed ));
+
+extern struct ll_protocol ipoib_protocol;
+
+extern const char * ipoib_ntoa ( const void *ll_addr );
+
+/**
+ * Allocate IPoIB device
+ *
+ * @v priv_size Size of driver private data
+ * @ret netdev Network device, or NULL
+ */
+static inline struct net_device * alloc_ipoibdev ( size_t priv_size ) {
+ struct net_device *netdev;
+
+ netdev = alloc_netdev ( priv_size );
+ if ( netdev ) {
+ netdev->ll_protocol = &ipoib_protocol;
+ }
+ return netdev;
+}
+
+extern int ipoib_probe ( struct ib_device *ibdev );
+extern void ipoib_remove ( struct ib_device *ibdev );
+
+#endif /* _GPXE_IPOIB_H */