summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe
diff options
context:
space:
mode:
authorMichael Brown2010-09-05 00:35:09 +0200
committerMichael Brown2010-09-05 04:06:16 +0200
commit35b19d8848c5141aff8ef858f908e9f7a7cf0b1d (patch)
treed877ea90a56a0bb5c61a0e0c34c2d6cbe7ef6b7d /src/include/ipxe
parent[netdevice] Add the concept of a network upper-layer driver (diff)
downloadipxe-35b19d8848c5141aff8ef858f908e9f7a7cf0b1d.tar.gz
ipxe-35b19d8848c5141aff8ef858f908e9f7a7cf0b1d.tar.xz
ipxe-35b19d8848c5141aff8ef858f908e9f7a7cf0b1d.zip
[infiniband] Add the concept of an Infiniband upper-layer driver
Replace the explicit calls from the Infiniband core to the IPoIB layer with the general concept of an Infiniband upper-layer driver (analogous to a PCI driver) which can create arbitrary devices on top of Infiniband devices. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe')
-rw-r--r--src/include/ipxe/infiniband.h42
-rw-r--r--src/include/ipxe/ipoib.h3
2 files changed, 41 insertions, 4 deletions
diff --git a/src/include/ipxe/infiniband.h b/src/include/ipxe/infiniband.h
index f2eb57cd5..edcce371c 100644
--- a/src/include/ipxe/infiniband.h
+++ b/src/include/ipxe/infiniband.h
@@ -12,6 +12,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
#include <ipxe/refcnt.h>
#include <ipxe/device.h>
+#include <ipxe/tables.h>
#include <ipxe/ib_packet.h>
#include <ipxe/ib_mad.h>
@@ -432,6 +433,34 @@ struct ib_device {
void *owner_priv;
};
+/** An Infiniband upper-layer driver */
+struct ib_driver {
+ /** Name */
+ const char *name;
+ /** Probe device
+ *
+ * @v ibdev Infiniband device
+ * @ret rc Return status code
+ */
+ int ( * probe ) ( struct ib_device *ibdev );
+ /** Notify of device or link state change
+ *
+ * @v ibdev Infiniband device
+ */
+ void ( * notify ) ( struct ib_device *ibdev );
+ /** Remove device
+ *
+ * @v ibdev Infiniband device
+ */
+ void ( * remove ) ( struct ib_device *ibdev );
+};
+
+/** Infiniband driver table */
+#define IB_DRIVERS __table ( struct ib_driver, "ib_drivers" )
+
+/** Declare an Infiniband driver */
+#define __ib_driver __table_entry ( IB_DRIVERS, 01 )
+
extern struct ib_completion_queue *
ib_create_cq ( struct ib_device *ibdev, unsigned int num_cqes,
struct ib_completion_queue_operations *op );
@@ -492,7 +521,7 @@ extern struct list_head ib_devices;
list_for_each_entry ( (ibdev), &ib_devices, list )
/**
- * Check link state
+ * Check link state of Infiniband device
*
* @v ibdev Infiniband device
* @ret link_up Link is up
@@ -503,6 +532,17 @@ ib_link_ok ( struct ib_device *ibdev ) {
}
/**
+ * Check whether or not Infiniband device is open
+ *
+ * @v ibdev Infiniband device
+ * @v is_open Infiniband device is open
+ */
+static inline __attribute__ (( always_inline )) int
+ib_is_open ( struct ib_device *ibdev ) {
+ return ( ibdev->open_count > 0 );
+}
+
+/**
* Get reference to Infiniband device
*
* @v ibdev Infiniband device
diff --git a/src/include/ipxe/ipoib.h b/src/include/ipxe/ipoib.h
index 31b0c1b6d..6a3fd607a 100644
--- a/src/include/ipxe/ipoib.h
+++ b/src/include/ipxe/ipoib.h
@@ -53,9 +53,6 @@ struct ipoib_hdr {
} __attribute__ (( packed ));
extern const char * ipoib_ntoa ( const void *ll_addr );
-extern void ipoib_link_state_changed ( struct ib_device *ibdev );
-extern int ipoib_probe ( struct ib_device *ibdev );
-extern void ipoib_remove ( struct ib_device *ibdev );
extern struct net_device * alloc_ipoibdev ( size_t priv_size );
#endif /* _IPXE_IPOIB_H */