1
#ifndef _IPXE_IB_PACKET_H
2
#define _IPXE_IB_PACKET_H
6
* Infiniband packet format
10
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
14
struct ib_address_vector;
17
/** An Infiniband Globally Unique Identifier */
25
/** Infiniband Globally Unique Identifier debug message format */
26
#define IB_GUID_FMT "%08x:%08x"
28
/** Infiniband Globally Unique Identifier debug message arguments */
29
#define IB_GUID_ARGS( guid ) \
30
ntohl ( (guid)->dwords[0] ), ntohl ( (guid)->dwords[1] )
32
/** An Infiniband Global Identifier */
44
/** Infiniband Global Identifier debug message format */
45
#define IB_GID_FMT IB_GUID_FMT ":" IB_GUID_FMT
47
/** Infiniband Global Identifier debug message arguments */
48
#define IB_GID_ARGS( gid ) \
49
IB_GUID_ARGS ( &(gid)->s.prefix ), IB_GUID_ARGS ( &(gid)->s.guid )
51
/** Test for multicast GID */
52
#define IB_GID_MULTICAST( gid ) ( (gid)->bytes[0] == 0xff )
54
/** An Infiniband Local Route Header */
55
struct ib_local_route_header {
56
/** Virtual lane and link version */
58
/** Service level and next link header */
60
/** Destination LID */
66
} __attribute__ (( packed ));
68
/** Infiniband virtual lanes */
74
/** An Infiniband Link Next Header value */
82
/** Default Infiniband LID */
83
#define IB_LID_NONE 0xffff
85
/** Test for multicast LID */
86
#define IB_LID_MULTICAST( lid ) ( ( (lid) >= 0xc000 ) && ( (lid) <= 0xfffe ) )
88
/** An Infiniband Global Route Header */
89
struct ib_global_route_header {
90
/** IP version, traffic class, and flow label
92
* 4 bits : Version of the GRH
93
* 8 bits : Traffic class
94
* 20 bits : Flow label
96
uint32_t ipver__tclass__flowlabel;
105
/** Destiniation GID */
107
} __attribute__ (( packed ));
109
#define IB_GRH_IPVER_IPv6 0x06
110
#define IB_GRH_NXTHDR_IBA 0x1b
112
/** An Infiniband Base Transport Header */
113
struct ib_base_transport_header {
116
/** Transport header version, pad count, migration and solicitation */
117
uint8_t se__m__padcnt__tver;
120
/** Destination queue pair */
122
/** Packet sequence number and acknowledge request */
124
} __attribute__ (( packed ));
126
/** An Infiniband BTH opcode */
128
BTH_OPCODE_UD_SEND = 0x64,
131
/** An Infiniband Datagram Extended Transport Header */
132
struct ib_datagram_extended_transport_header {
135
/** Source queue pair */
137
} __attribute__ (( packed ));
139
/** All known IB header formats */
141
struct ib_local_route_header lrh;
143
struct ib_local_route_header lrh;
144
struct ib_global_route_header grh;
145
struct ib_base_transport_header bth;
146
struct ib_datagram_extended_transport_header deth;
147
} __attribute__ (( packed )) lrh__grh__bth__deth;
149
struct ib_local_route_header lrh;
150
struct ib_base_transport_header bth;
151
struct ib_datagram_extended_transport_header deth;
152
} __attribute__ (( packed )) lrh__bth__deth;
153
} __attribute__ (( packed ));
155
/** Maximum size required for IB headers */
156
#define IB_MAX_HEADER_SIZE sizeof ( union ib_headers )
158
extern int ib_push ( struct ib_device *ibdev, struct io_buffer *iobuf,
159
struct ib_queue_pair *qp, size_t payload_len,
160
const struct ib_address_vector *dest );
161
extern int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
162
struct ib_queue_pair **qp, size_t *payload_len,
163
struct ib_address_vector *dest,
164
struct ib_address_vector *source );
166
#endif /* _IPXE_IB_PACKET_H */