diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gpxe/ib_cm.h | 60 | ||||
-rw-r--r-- | src/include/gpxe/ib_gma.h | 65 | ||||
-rw-r--r-- | src/include/gpxe/ib_mad.h | 11 | ||||
-rw-r--r-- | src/include/gpxe/ib_mcast.h | 33 | ||||
-rw-r--r-- | src/include/gpxe/ib_pathrec.h | 59 | ||||
-rw-r--r-- | src/include/gpxe/infiniband.h | 5 |
6 files changed, 157 insertions, 76 deletions
diff --git a/src/include/gpxe/ib_cm.h b/src/include/gpxe/ib_cm.h index a4446224..07f5b716 100644 --- a/src/include/gpxe/ib_cm.h +++ b/src/include/gpxe/ib_cm.h @@ -10,12 +10,60 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include <gpxe/infiniband.h> +#include <gpxe/retry.h> -extern int ib_cm_connect ( struct ib_queue_pair *qp, struct ib_gid *dgid, - struct ib_gid_half *service_id, - void *private_data, size_t private_data_len, - void ( * notify ) ( struct ib_queue_pair *qp, - int rc, void *private_data, - size_t private_data_len ) ); +struct ib_mad_transaction; +struct ib_connection; + +/** Infiniband connection operations */ +struct ib_connection_operations { + /** Handle change of connection status + * + * @v ibdev Infiniband device + * @v qp Queue pair + * @v conn Connection + * @v rc Connection status code + * @v private_data Private data, if available + * @v private_data_len Length of private data + */ + void ( * changed ) ( struct ib_device *ibdev, struct ib_queue_pair *qp, + struct ib_connection *conn, int rc, + void *private_data, size_t private_data_len ); +}; + +/** An Infiniband connection */ +struct ib_connection { + /** Infiniband device */ + struct ib_device *ibdev; + /** Queue pair */ + struct ib_queue_pair *qp; + /** Local communication ID */ + uint32_t local_id; + /** Remote communication ID */ + uint32_t remote_id; + /** Target service ID */ + struct ib_gid_half service_id; + /** Connection operations */ + struct ib_connection_operations *op; + + /** Path to target */ + struct ib_path *path; + /** Connection request management transaction */ + struct ib_mad_transaction *madx; + + /** Length of connection request private data */ + size_t private_data_len; + /** Connection request private data */ + uint8_t private_data[0]; +}; + +extern struct ib_connection * +ib_create_conn ( struct ib_device *ibdev, struct ib_queue_pair *qp, + struct ib_gid *dgid, struct ib_gid_half *service_id, + void *req_private_data, size_t req_private_data_len, + struct ib_connection_operations *op ); +extern void ib_destroy_conn ( struct ib_device *ibdev, + struct ib_queue_pair *qp, + struct ib_connection *conn ); #endif /* _GPXE_IB_CM_H */ diff --git a/src/include/gpxe/ib_gma.h b/src/include/gpxe/ib_gma.h deleted file mode 100644 index 1b33514b..00000000 --- a/src/include/gpxe/ib_gma.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef _GPXE_IB_GMA_H -#define _GPXE_IB_GMA_H - -/** @file - * - * Infiniband General Management Agent - * - */ - -FILE_LICENCE ( GPL2_OR_LATER ); - -#include <gpxe/list.h> -#include <gpxe/retry.h> -#include <gpxe/tables.h> -#include <gpxe/infiniband.h> - -struct ib_gma; - -/** A GMA attribute handler */ -struct ib_gma_handler { - /** Management class */ - uint8_t mgmt_class; - /** Management class don't-care bits */ - uint8_t mgmt_class_ignore; - /** Class version */ - uint8_t class_version; - /** Method */ - uint8_t method; - /** Attribute (in network byte order) */ - uint16_t attr_id; - /** Handle attribute - * - * @v gma General management agent - * @v mad MAD - * @ret response MAD response, or NULL to send no response - */ - union ib_mad * ( * handle ) ( struct ib_gma *gma, union ib_mad *mad ); -}; - -/** GMA attribute handlers */ -#define IB_GMA_HANDLERS __table ( struct ib_gma_handler, "ib_gma_handlers" ) - -/** Declare a GMA attribute handler */ -#define __ib_gma_handler __table_entry ( IB_GMA_HANDLERS, 01 ) - -/** An Infiniband General Management Agent */ -struct ib_gma { - /** Infiniband device */ - struct ib_device *ibdev; - /** Completion queue */ - struct ib_completion_queue *cq; - /** Queue pair */ - struct ib_queue_pair *qp; - - /** List of outstanding MAD requests */ - struct list_head requests; -}; - -extern int ib_gma_request ( struct ib_gma *gma, union ib_mad *mad, - struct ib_address_vector *av, int retry ); -extern struct ib_gma * ib_create_gma ( struct ib_device *ibdev, - enum ib_queue_pair_type type ); -extern void ib_destroy_gma ( struct ib_gma *gma ); - -#endif /* _GPXE_IB_GMA_H */ diff --git a/src/include/gpxe/ib_mad.h b/src/include/gpxe/ib_mad.h index ac9a1d4b..54d0a2af 100644 --- a/src/include/gpxe/ib_mad.h +++ b/src/include/gpxe/ib_mad.h @@ -303,6 +303,16 @@ union ib_sa_data { #define IB_CM_ATTR_LOAD_ALTERNATE_PATH 0x0019 #define IB_CM_ATTR_ALTERNATE_PATH_RESPONSE 0x001a +/** Communication management common fields */ +struct ib_cm_common { + /** Local communication ID */ + uint32_t local_id; + /** Remote communication ID */ + uint32_t remote_id; + /** Reserved */ + uint8_t reserved[224]; +} __attribute__ (( packed )); + /** A communication management path */ struct ib_cm_path { /** Local port LID */ @@ -438,6 +448,7 @@ struct ib_cm_ready_to_use { /** A communication management attribute */ union ib_cm_data { + struct ib_cm_common common; struct ib_cm_connect_request connect_request; struct ib_cm_connect_reject connect_reject; struct ib_cm_connect_reply connect_reply; diff --git a/src/include/gpxe/ib_mcast.h b/src/include/gpxe/ib_mcast.h index 2ca3382b..74eccd0b 100644 --- a/src/include/gpxe/ib_mcast.h +++ b/src/include/gpxe/ib_mcast.h @@ -11,9 +11,38 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include <gpxe/infiniband.h> +struct ib_mad_transaction; + +/** An Infiniband multicast group membership */ +struct ib_mc_membership { + /** Queue pair */ + struct ib_queue_pair *qp; + /** Multicast GID */ + struct ib_gid gid; + /** Multicast group join transaction */ + struct ib_mad_transaction *madx; + /** Handle join success/failure + * + * @v ibdev Infiniband device + * @v qp Queue pair + * @v membership Multicast group membership + * @v rc Status code + * @v mad Response MAD (or NULL on error) + */ + void ( * complete ) ( struct ib_device *ibdev, struct ib_queue_pair *qp, + struct ib_mc_membership *membership, int rc, + union ib_mad *mad ); +}; + extern int ib_mcast_join ( struct ib_device *ibdev, struct ib_queue_pair *qp, - struct ib_gid *gid ); + struct ib_mc_membership *membership, + struct ib_gid *gid, + void ( * joined ) ( struct ib_device *ibdev, + struct ib_queue_pair *qp, + struct ib_mc_membership *memb, + int rc, union ib_mad *mad ) ); + extern void ib_mcast_leave ( struct ib_device *ibdev, struct ib_queue_pair *qp, - struct ib_gid *gid ); + struct ib_mc_membership *membership ); #endif /* _GPXE_IB_MCAST_H */ diff --git a/src/include/gpxe/ib_pathrec.h b/src/include/gpxe/ib_pathrec.h index 44515563..5884d536 100644 --- a/src/include/gpxe/ib_pathrec.h +++ b/src/include/gpxe/ib_pathrec.h @@ -11,6 +11,65 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include <gpxe/infiniband.h> +struct ib_mad_transaction; +struct ib_path; + +/** Infiniband path operations */ +struct ib_path_operations { + /** Handle path transaction completion + * + * @v ibdev Infiniband device + * @v path Path + * @v rc Status code + * @v av Address vector, or NULL on error + */ + void ( * complete ) ( struct ib_device *ibdev, + struct ib_path *path, int rc, + struct ib_address_vector *av ); +}; + +/** An Infiniband path */ +struct ib_path { + /** Infiniband device */ + struct ib_device *ibdev; + /** Address vector */ + struct ib_address_vector av; + /** Management transaction */ + struct ib_mad_transaction *madx; + /** Path operations */ + struct ib_path_operations *op; + /** Owner private data */ + void *owner_priv; +}; + +/** + * Set Infiniband path owner-private data + * + * @v path Path + * @v priv Private data + */ +static inline __always_inline void +ib_path_set_ownerdata ( struct ib_path *path, void *priv ) { + path->owner_priv = priv; +} + +/** + * Get Infiniband path owner-private data + * + * @v path Path + * @ret priv Private data + */ +static inline __always_inline void * +ib_path_get_ownerdata ( struct ib_path *path ) { + return path->owner_priv; +} + +extern struct ib_path * +ib_create_path ( struct ib_device *ibdev, struct ib_address_vector *av, + struct ib_path_operations *op ); +extern void ib_destroy_path ( struct ib_device *ibdev, + struct ib_path *path ); + extern int ib_resolve_path ( struct ib_device *ibdev, struct ib_address_vector *av ); diff --git a/src/include/gpxe/infiniband.h b/src/include/gpxe/infiniband.h index d300a77b..c4bc2ff4 100644 --- a/src/include/gpxe/infiniband.h +++ b/src/include/gpxe/infiniband.h @@ -46,7 +46,6 @@ struct ib_queue_pair; struct ib_address_vector; struct ib_completion_queue; struct ib_mad_interface; -struct ib_gma; /** Infiniband transmission rates */ enum ib_rate { @@ -416,8 +415,8 @@ struct ib_device { /** Subnet management interface */ struct ib_mad_interface *smi; - /** General management agent */ - struct ib_gma *gma; + /** General services interface */ + struct ib_mad_interface *gsi; /** Driver private data */ void *drv_priv; |