1 #ifndef _GPXE_IB_PACKET_H
2 #define _GPXE_IB_PACKET_H
6 * Infiniband packet format
10 FILE_LICENCE ( GPL2_OR_LATER
);
14 struct ib_address_vector
;
17 /** Half of an Infiniband Global Identifier */
26 /** An Infiniband Global Identifier */
32 struct ib_gid_half half
[2];
36 /** An Infiniband Local Route Header */
37 struct ib_local_route_header
{
38 /** Virtual lane and link version */
40 /** Service level and next link header */
42 /** Destination LID */
48 } __attribute__ (( packed
));
50 /** Infiniband virtual lanes */
56 /** An Infiniband Link Next Header value */
64 /** Default Infiniband LID */
65 #define IB_LID_NONE 0xffff
67 /** Test for multicast LID */
68 #define IB_LID_MULTICAST( lid ) ( ( (lid) >= 0xc000 ) && ( (lid) <= 0xfffe ) )
70 /** An Infiniband Global Route Header */
71 struct ib_global_route_header
{
72 /** IP version, traffic class, and flow label
74 * 4 bits : Version of the GRH
75 * 8 bits : Traffic class
76 * 20 bits : Flow label
78 uint32_t ipver__tclass__flowlabel
;
87 /** Destiniation GID */
89 } __attribute__ (( packed
));
91 #define IB_GRH_IPVER_IPv6 0x06
92 #define IB_GRH_NXTHDR_IBA 0x1b
94 /** An Infiniband Base Transport Header */
95 struct ib_base_transport_header
{
98 /** Transport header version, pad count, migration and solicitation */
99 uint8_t se__m__padcnt__tver
;
102 /** Destination queue pair */
104 /** Packet sequence number and acknowledge request */
106 } __attribute__ (( packed
));
108 /** An Infiniband BTH opcode */
110 BTH_OPCODE_UD_SEND
= 0x64,
113 /** An Infiniband Datagram Extended Transport Header */
114 struct ib_datagram_extended_transport_header
{
117 /** Source queue pair */
119 } __attribute__ (( packed
));
121 /** All known IB header formats */
123 struct ib_local_route_header lrh
;
125 struct ib_local_route_header lrh
;
126 struct ib_global_route_header grh
;
127 struct ib_base_transport_header bth
;
128 struct ib_datagram_extended_transport_header deth
;
129 } __attribute__ (( packed
)) lrh__grh__bth__deth
;
131 struct ib_local_route_header lrh
;
132 struct ib_base_transport_header bth
;
133 struct ib_datagram_extended_transport_header deth
;
134 } __attribute__ (( packed
)) lrh__bth__deth
;
135 } __attribute__ (( packed
));
137 /** Maximum size required for IB headers */
138 #define IB_MAX_HEADER_SIZE sizeof ( union ib_headers )
140 extern int ib_push ( struct ib_device
*ibdev
, struct io_buffer
*iobuf
,
141 struct ib_queue_pair
*qp
, size_t payload_len
,
142 const struct ib_address_vector
*av
);
143 extern int ib_pull ( struct ib_device
*ibdev
, struct io_buffer
*iobuf
,
144 struct ib_queue_pair
**qp
, size_t *payload_len
,
145 struct ib_address_vector
*av
);
147 #endif /* _GPXE_IB_PACKET_H */