diff options
| author | Michael Brown | 2009-08-03 16:56:56 +0200 |
|---|---|---|
| committer | Michael Brown | 2009-08-09 00:51:27 +0200 |
| commit | 0e07516f62db32ff5fd4cc26c9881e2bb0e374d5 (patch) | |
| tree | 6e97c2d9d859c4d74049809feb4da1f50d1c7c84 /src/include | |
| parent | [hermon] Allow for multiple calls to ib_modify_qp() (diff) | |
| download | ipxe-0e07516f62db32ff5fd4cc26c9881e2bb0e374d5.tar.gz ipxe-0e07516f62db32ff5fd4cc26c9881e2bb0e374d5.tar.xz ipxe-0e07516f62db32ff5fd4cc26c9881e2bb0e374d5.zip | |
[infiniband] Add the concept of a management interface
A management interface is the component through which both local and
remote management agents are accessed.
This new implementation of a management interface allows for the user
to react to timed-out transactions, and also allows for cancellation
of in-progress transactions.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/gpxe/errfile.h | 1 | ||||
| -rw-r--r-- | src/include/gpxe/ib_mad.h | 4 | ||||
| -rw-r--r-- | src/include/gpxe/ib_mi.h | 135 |
3 files changed, 139 insertions, 1 deletions
diff --git a/src/include/gpxe/errfile.h b/src/include/gpxe/errfile.h index b7f63fc5d..46a75d9a7 100644 --- a/src/include/gpxe/errfile.h +++ b/src/include/gpxe/errfile.h @@ -151,6 +151,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); #define ERRFILE_ib_mcast ( ERRFILE_NET | 0x001d0000 ) #define ERRFILE_ib_cm ( ERRFILE_NET | 0x001e0000 ) #define ERRFILE_net80211 ( ERRFILE_NET | 0x001f0000 ) +#define ERRFILE_ib_mi ( ERRFILE_NET | 0x00200000 ) #define ERRFILE_image ( ERRFILE_IMAGE | 0x00000000 ) #define ERRFILE_elf ( ERRFILE_IMAGE | 0x00010000 ) diff --git a/src/include/gpxe/ib_mad.h b/src/include/gpxe/ib_mad.h index a628cea54..cfd8ef9aa 100644 --- a/src/include/gpxe/ib_mad.h +++ b/src/include/gpxe/ib_mad.h @@ -491,7 +491,9 @@ struct ib_mad_hdr { #define IB_MGMT_CLASS_CM 0x07 #define IB_MGMT_CLASS_SNMP 0x08 #define IB_MGMT_CLASS_VENDOR_RANGE2_START 0x30 -#define IB_MGMT_CLASS_VENDOR_RANGE2_END 0x4F +#define IB_MGMT_CLASS_VENDOR_RANGE2_END 0x4f + +#define IB_MGMT_CLASS_MASK 0x7f /* Management methods */ #define IB_MGMT_METHOD_GET 0x01 diff --git a/src/include/gpxe/ib_mi.h b/src/include/gpxe/ib_mi.h new file mode 100644 index 000000000..b1cf686da --- /dev/null +++ b/src/include/gpxe/ib_mi.h @@ -0,0 +1,135 @@ +#ifndef _GPXE_IB_MI_H +#define _GPXE_IB_MI_H + +/** @file + * + * Infiniband management interfaces + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#include <gpxe/list.h> +#include <gpxe/retry.h> +#include <gpxe/tables.h> +#include <gpxe/infiniband.h> + +struct ib_mad_interface; +struct ib_mad_transaction; + +/** An Infiniband management agent */ +struct ib_mad_agent { + /** Management class */ + uint8_t mgmt_class; + /** Class version */ + uint8_t class_version; + /** Attribute (in network byte order) */ + uint16_t attr_id; + /** Handle MAD + * + * @v ibdev Infiniband device + * @v mi Management interface + * @v mad Received MAD + * @v av Source address vector + * @ret rc Return status code + */ + void ( * handle ) ( struct ib_device *ibdev, + struct ib_mad_interface *mi, + union ib_mad *mad, + struct ib_address_vector *av ); +}; + +/** Infiniband management agents */ +#define IB_MAD_AGENTS __table ( struct ib_mad_agent, "ib_mad_agents" ) + +/** Declare an Infiniband management agent */ +#define __ib_mad_agent __table_entry ( IB_MAD_AGENTS, 01 ) + +/** Infiniband management transaction operations */ +struct ib_mad_transaction_operations { + /** Handle transaction completion + * + * @v ibdev Infiniband device + * @v mi Management interface + * @v madx Management transaction + * @v rc Status code + * @v mad Received MAD (or NULL on error) + * @v av Source address vector (or NULL on error) + * + * The completion handler should in most cases call + * ib_destroy_madx() to free up the completed transaction. + */ + void ( * complete ) ( struct ib_device *ibdev, + struct ib_mad_interface *mi, + struct ib_mad_transaction *madx, + int rc, union ib_mad *mad, + struct ib_address_vector *av ); +}; + +/** An Infiniband management transaction */ +struct ib_mad_transaction { + /** Associated management interface */ + struct ib_mad_interface *mi; + /** List of transactions */ + struct list_head list; + /** Retry timer */ + struct retry_timer timer; + /** Destination address vector */ + struct ib_address_vector av; + /** MAD being sent */ + union ib_mad mad; + /** Transaction operations */ + struct ib_mad_transaction_operations *op; + /** Owner private data */ + void *owner_priv; +}; + +/** An Infiniband management interface */ +struct ib_mad_interface { + /** Infiniband device */ + struct ib_device *ibdev; + /** Completion queue */ + struct ib_completion_queue *cq; + /** Queue pair */ + struct ib_queue_pair *qp; + /** List of management transactions */ + struct list_head madx; +}; + +/** + * Set Infiniband management transaction owner-private data + * + * @v madx Management transaction + * @v priv Private data + */ +static inline __always_inline void +ib_madx_set_ownerdata ( struct ib_mad_transaction *madx, void *priv ) { + madx->owner_priv = priv; +} + +/** + * Get Infiniband management transaction owner-private data + * + * @v madx Management transaction + * @ret priv Private data + */ +static inline __always_inline void * +ib_madx_get_ownerdata ( struct ib_mad_transaction *madx ) { + return madx->owner_priv; +} + +extern int ib_mi_send ( struct ib_device *ibdev, struct ib_mad_interface *mi, + union ib_mad *mad, struct ib_address_vector *av ); +extern struct ib_mad_transaction * +ib_create_madx ( struct ib_device *ibdev, struct ib_mad_interface *mi, + union ib_mad *mad, struct ib_address_vector *av, + struct ib_mad_transaction_operations *op ); +extern void ib_destroy_madx ( struct ib_device *ibdev, + struct ib_mad_interface *mi, + struct ib_mad_transaction *madx ); +extern struct ib_mad_interface * ib_create_mi ( struct ib_device *ibdev, + enum ib_queue_pair_type type ); +extern void ib_destroy_mi ( struct ib_device *ibdev, + struct ib_mad_interface *mi ); + +#endif /* _GPXE_IB_MI_H */ |
