iPXE
ib_mi.h
Go to the documentation of this file.
1 #ifndef _IPXE_IB_MI_H
2 #define _IPXE_IB_MI_H
3 
4 /** @file
5  *
6  * Infiniband management interfaces
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include <ipxe/list.h>
13 #include <ipxe/retry.h>
14 #include <ipxe/tables.h>
15 #include <ipxe/infiniband.h>
16 
17 struct ib_mad_interface;
18 struct ib_mad_transaction;
19 
20 /** An Infiniband management agent */
21 struct ib_mad_agent {
22  /** Management class */
24  /** Class version */
26  /** Attribute (in network byte order) */
28  /** Handle MAD
29  *
30  * @v ibdev Infiniband device
31  * @v mi Management interface
32  * @v mad Received MAD
33  * @v av Source address vector
34  * @ret rc Return status code
35  */
36  void ( * handle ) ( struct ib_device *ibdev,
37  struct ib_mad_interface *mi,
38  union ib_mad *mad,
39  struct ib_address_vector *av );
40 };
41 
42 /** Infiniband management agents */
43 #define IB_MAD_AGENTS __table ( struct ib_mad_agent, "ib_mad_agents" )
44 
45 /** Declare an Infiniband management agent */
46 #define __ib_mad_agent __table_entry ( IB_MAD_AGENTS, 01 )
47 
48 /** Infiniband management transaction operations */
50  /** Handle transaction completion
51  *
52  * @v ibdev Infiniband device
53  * @v mi Management interface
54  * @v madx Management transaction
55  * @v rc Status code
56  * @v mad Received MAD (or NULL on error)
57  * @v av Source address vector (or NULL on error)
58  *
59  * The completion handler should in most cases call
60  * ib_destroy_madx() to free up the completed transaction.
61  */
62  void ( * complete ) ( struct ib_device *ibdev,
63  struct ib_mad_interface *mi,
64  struct ib_mad_transaction *madx,
65  int rc, union ib_mad *mad,
66  struct ib_address_vector *av );
67 };
68 
69 /** An Infiniband management transaction */
71  /** Associated management interface */
73  /** List of transactions */
74  struct list_head list;
75  /** Retry timer */
77  /** Destination address vector */
79  /** MAD being sent */
80  union ib_mad mad;
81  /** Transaction operations */
83  /** Owner private data */
84  void *owner_priv;
85 };
86 
87 /** An Infiniband management interface */
89  /** Infiniband device */
90  struct ib_device *ibdev;
91  /** Completion queue */
93  /** Queue pair */
94  struct ib_queue_pair *qp;
95  /** List of management transactions */
96  struct list_head madx;
97 };
98 
99 /**
100  * Set Infiniband management transaction owner-private data
101  *
102  * @v madx Management transaction
103  * @v priv Private data
104  */
105 static inline __always_inline void
107  madx->owner_priv = priv;
108 }
109 
110 /**
111  * Get Infiniband management transaction owner-private data
112  *
113  * @v madx Management transaction
114  * @ret priv Private data
115  */
116 static inline __always_inline void *
118  return madx->owner_priv;
119 }
120 
121 extern int ib_mi_send ( struct ib_device *ibdev, struct ib_mad_interface *mi,
122  union ib_mad *mad, struct ib_address_vector *av );
123 extern struct ib_mad_transaction *
124 ib_create_madx ( struct ib_device *ibdev, struct ib_mad_interface *mi,
125  union ib_mad *mad, struct ib_address_vector *av,
127 extern void ib_destroy_madx ( struct ib_device *ibdev,
128  struct ib_mad_interface *mi,
129  struct ib_mad_transaction *madx );
130 extern int ib_create_mi ( struct ib_device *ibdev,
132  struct ib_mad_interface **new_mi );
133 extern void ib_destroy_mi ( struct ib_device *ibdev,
134  struct ib_mad_interface *mi );
135 
136 #endif /* _IPXE_IB_MI_H */
struct ib_device * ibdev
Infiniband device.
Definition: ib_mi.h:90
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
Infiniband protocol.
unsigned short uint16_t
Definition: stdint.h:11
struct ib_address_vector av
Destination address vector.
Definition: ib_mi.h:78
int ib_create_mi(struct ib_device *ibdev, enum ib_queue_pair_type type, struct ib_mad_interface **new_mi)
Create management interface.
Definition: ib_mi.c:347
uint8_t type
Type.
Definition: ena.h:16
Retry timers.
void ib_destroy_mi(struct ib_device *ibdev, struct ib_mad_interface *mi)
Destroy management interface.
Definition: ib_mi.c:411
void(* handle)(struct ib_device *ibdev, struct ib_mad_interface *mi, union ib_mad *mad, struct ib_address_vector *av)
Handle MAD.
Definition: ib_mi.h:36
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
int ib_mi_send(struct ib_device *ibdev, struct ib_mad_interface *mi, union ib_mad *mad, struct ib_address_vector *av)
Transmit MAD.
Definition: ib_mi.c:187
struct list_head list
List of transactions.
Definition: ib_mi.h:74
A retry timer.
Definition: retry.h:21
uint16_t attr_id
Attribute (in network byte order)
Definition: ib_mi.h:27
An Infiniband management interface.
Definition: ib_mi.h:88
A doubly-linked list entry (or list head)
Definition: list.h:18
struct ib_queue_pair * qp
Queue pair.
Definition: ib_mi.h:94
void ib_destroy_madx(struct ib_device *ibdev, struct ib_mad_interface *mi, struct ib_mad_transaction *madx)
A timer.
Definition: timer.h:28
An Infiniband device.
Definition: infiniband.h:398
struct ib_completion_queue * cq
Completion queue.
Definition: ib_mi.h:92
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)
Create management transaction.
Definition: ib_mi.c:287
An Infiniband management transaction.
Definition: ib_mi.h:70
An Infiniband management agent.
Definition: ib_mi.h:21
static __always_inline void ib_madx_set_ownerdata(struct ib_mad_transaction *madx, void *priv)
Set Infiniband management transaction owner-private data.
Definition: ib_mi.h:106
uint8_t class_version
Class version.
Definition: ib_mi.h:25
Linked lists.
ib_queue_pair_type
An Infiniband queue pair type.
Definition: infiniband.h:138
#define __always_inline
Declare a function to be always inline.
Definition: compiler.h:611
An Infiniband Completion Queue.
Definition: infiniband.h:224
unsigned char uint8_t
Definition: stdint.h:10
struct ib_mad_transaction_operations * op
Transaction operations.
Definition: ib_mi.h:82
static __always_inline void * ib_madx_get_ownerdata(struct ib_mad_transaction *madx)
Get Infiniband management transaction owner-private data.
Definition: ib_mi.h:117
An Infiniband Queue Pair.
Definition: infiniband.h:157
static uint16_t struct vmbus_xfer_pages_operations * op
Definition: netvsc.h:327
struct ib_mad_interface * mi
Associated management interface.
Definition: ib_mi.h:72
static struct tlan_private * priv
Definition: tlan.c:224
uint8_t mgmt_class
Management class.
Definition: ib_mi.h:23
void * owner_priv
Owner private data.
Definition: ib_mi.h:84
Linker tables.
A management datagram.
Definition: ib_mad.h:610
An Infiniband Address Vector.
Definition: infiniband.h:72
union ib_mad mad
MAD being sent.
Definition: ib_mi.h:80
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)
Handle transaction completion.
Definition: ib_mi.h:62
Infiniband management transaction operations.
Definition: ib_mi.h:49
struct list_head madx
List of management transactions.
Definition: ib_mi.h:96
union ib_mad mad
Definition: arbel.h:12