1 #ifndef _IPXE_IB_PACKET_H
2 #define _IPXE_IB_PACKET_H
6 * Infiniband packet format
10 FILE_LICENCE ( GPL2_OR_LATER );
14 struct ib_address_vector;
17 /** An Infiniband Globally Unique Identifier */
24 /** Infiniband Globally Unique Identifier debug message format */
25 #define IB_GUID_FMT "%08x:%08x"
27 /** Infiniband Globally Unique Identifier debug message arguments */
28 #define IB_GUID_ARGS( guid ) \
29 ntohl ( (guid)->dwords[0] ), ntohl ( (guid)->dwords[1] )
31 /** An Infiniband Global Identifier */
42 /** Infiniband Global Identifier debug message format */
43 #define IB_GID_FMT IB_GUID_FMT ":" IB_GUID_FMT
45 /** Infiniband Global Identifier debug message arguments */
46 #define IB_GID_ARGS( gid ) \
47 IB_GUID_ARGS ( &(gid)->s.prefix ), IB_GUID_ARGS ( &(gid)->s.guid )
49 /** An Infiniband Local Route Header */
50 struct ib_local_route_header {
51 /** Virtual lane and link version */
53 /** Service level and next link header */
55 /** Destination LID */
61 } __attribute__ (( packed ));
63 /** Infiniband virtual lanes */
69 /** An Infiniband Link Next Header value */
77 /** Default Infiniband LID */
78 #define IB_LID_NONE 0xffff
80 /** Test for multicast LID */
81 #define IB_LID_MULTICAST( lid ) ( ( (lid) >= 0xc000 ) && ( (lid) <= 0xfffe ) )
83 /** An Infiniband Global Route Header */
84 struct ib_global_route_header {
85 /** IP version, traffic class, and flow label
87 * 4 bits : Version of the GRH
88 * 8 bits : Traffic class
89 * 20 bits : Flow label
91 uint32_t ipver__tclass__flowlabel;
100 /** Destiniation GID */
102 } __attribute__ (( packed ));
104 #define IB_GRH_IPVER_IPv6 0x06
105 #define IB_GRH_NXTHDR_IBA 0x1b
107 /** An Infiniband Base Transport Header */
108 struct ib_base_transport_header {
111 /** Transport header version, pad count, migration and solicitation */
112 uint8_t se__m__padcnt__tver;
115 /** Destination queue pair */
117 /** Packet sequence number and acknowledge request */
119 } __attribute__ (( packed ));
121 /** An Infiniband BTH opcode */
123 BTH_OPCODE_UD_SEND = 0x64,
126 /** An Infiniband Datagram Extended Transport Header */
127 struct ib_datagram_extended_transport_header {
130 /** Source queue pair */
132 } __attribute__ (( packed ));
134 /** All known IB header formats */
136 struct ib_local_route_header lrh;
138 struct ib_local_route_header lrh;
139 struct ib_global_route_header grh;
140 struct ib_base_transport_header bth;
141 struct ib_datagram_extended_transport_header deth;
142 } __attribute__ (( packed )) lrh__grh__bth__deth;
144 struct ib_local_route_header lrh;
145 struct ib_base_transport_header bth;
146 struct ib_datagram_extended_transport_header deth;
147 } __attribute__ (( packed )) lrh__bth__deth;
148 } __attribute__ (( packed ));
150 /** Maximum size required for IB headers */
151 #define IB_MAX_HEADER_SIZE sizeof ( union ib_headers )
153 extern int ib_push ( struct ib_device *ibdev, struct io_buffer *iobuf,
154 struct ib_queue_pair *qp, size_t payload_len,
155 const struct ib_address_vector *dest );
156 extern int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
157 struct ib_queue_pair **qp, size_t *payload_len,
158 struct ib_address_vector *dest,
159 struct ib_address_vector *source );
161 #endif /* _IPXE_IB_PACKET_H */