ib_mi.h
Go to the documentation of this file.00001 #ifndef _GPXE_IB_MI_H
00002 #define _GPXE_IB_MI_H
00003
00004
00005
00006
00007
00008
00009
00010 FILE_LICENCE ( GPL2_OR_LATER );
00011
00012 #include <gpxe/list.h>
00013 #include <gpxe/retry.h>
00014 #include <gpxe/tables.h>
00015 #include <gpxe/infiniband.h>
00016
00017 struct ib_mad_interface;
00018 struct ib_mad_transaction;
00019
00020
00021 struct ib_mad_agent {
00022
00023 uint8_t mgmt_class;
00024
00025 uint8_t class_version;
00026
00027 uint16_t attr_id;
00028
00029
00030
00031
00032
00033
00034
00035
00036 void ( * handle ) ( struct ib_device *ibdev,
00037 struct ib_mad_interface *mi,
00038 union ib_mad *mad,
00039 struct ib_address_vector *av );
00040 };
00041
00042
00043 #define IB_MAD_AGENTS __table ( struct ib_mad_agent, "ib_mad_agents" )
00044
00045
00046 #define __ib_mad_agent __table_entry ( IB_MAD_AGENTS, 01 )
00047
00048
00049 struct ib_mad_transaction_operations {
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 void ( * complete ) ( struct ib_device *ibdev,
00063 struct ib_mad_interface *mi,
00064 struct ib_mad_transaction *madx,
00065 int rc, union ib_mad *mad,
00066 struct ib_address_vector *av );
00067 };
00068
00069
00070 struct ib_mad_transaction {
00071
00072 struct ib_mad_interface *mi;
00073
00074 struct list_head list;
00075
00076 struct retry_timer timer;
00077
00078 struct ib_address_vector av;
00079
00080 union ib_mad mad;
00081
00082 struct ib_mad_transaction_operations *op;
00083
00084 void *owner_priv;
00085 };
00086
00087
00088 struct ib_mad_interface {
00089
00090 struct ib_device *ibdev;
00091
00092 struct ib_completion_queue *cq;
00093
00094 struct ib_queue_pair *qp;
00095
00096 struct list_head madx;
00097 };
00098
00099
00100
00101
00102
00103
00104
00105 static inline __always_inline void
00106 ib_madx_set_ownerdata ( struct ib_mad_transaction *madx, void *priv ) {
00107 madx->owner_priv = priv;
00108 }
00109
00110
00111
00112
00113
00114
00115
00116 static inline __always_inline void *
00117 ib_madx_get_ownerdata ( struct ib_mad_transaction *madx ) {
00118 return madx->owner_priv;
00119 }
00120
00121 extern int ib_mi_send ( struct ib_device *ibdev, struct ib_mad_interface *mi,
00122 union ib_mad *mad, struct ib_address_vector *av );
00123 extern struct ib_mad_transaction *
00124 ib_create_madx ( struct ib_device *ibdev, struct ib_mad_interface *mi,
00125 union ib_mad *mad, struct ib_address_vector *av,
00126 struct ib_mad_transaction_operations *op );
00127 extern void ib_destroy_madx ( struct ib_device *ibdev,
00128 struct ib_mad_interface *mi,
00129 struct ib_mad_transaction *madx );
00130 extern struct ib_mad_interface * ib_create_mi ( struct ib_device *ibdev,
00131 enum ib_queue_pair_type type );
00132 extern void ib_destroy_mi ( struct ib_device *ibdev,
00133 struct ib_mad_interface *mi );
00134
00135 #endif