aboutsummaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/infiniband.h
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2010-09-04 23:35:09 +0100
committerMichael Brown <mcb30@ipxe.org>2010-09-05 03:06:16 +0100
commit35b19d8848c5141aff8ef858f908e9f7a7cf0b1d (patch)
treed877ea90a56a0bb5c61a0e0c34c2d6cbe7ef6b7d /src/include/ipxe/infiniband.h
parentca4df90a6383d47617038328fb506bf273f1e80e (diff)
downloadipxe-35b19d8848c5141aff8ef858f908e9f7a7cf0b1d.tar.gz
[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/infiniband.h')
-rw-r--r--src/include/ipxe/infiniband.h42
1 files changed, 41 insertions, 1 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