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 */
22 /** An Infiniband Global Identifier */
28 struct ib_gid_half half[2];
32 /** An Infiniband Local Route Header */
33 struct ib_local_route_header {
34 /** Virtual lane and link version */
36 /** Service level and next link header */
38 /** Destination LID */
44 } __attribute__ (( packed ));
46 /** Infiniband virtual lanes */
52 /** An Infiniband Link Next Header value */
60 /** Default Infiniband LID */
61 #define IB_LID_NONE 0xffff
63 /** Test for multicast LID */
64 #define IB_LID_MULTICAST( lid ) ( ( (lid) >= 0xc000 ) && ( (lid) <= 0xfffe ) )
66 /** An Infiniband Global Route Header */
67 struct ib_global_route_header {
68 /** IP version, traffic class, and flow label
70 * 4 bits : Version of the GRH
71 * 8 bits : Traffic class
72 * 20 bits : Flow label
74 uint32_t ipver__tclass__flowlabel;
83 /** Destiniation GID */
85 } __attribute__ (( packed ));
87 #define IB_GRH_IPVER_IPv6 0x06
88 #define IB_GRH_NXTHDR_IBA 0x1b
90 /** An Infiniband Base Transport Header */
91 struct ib_base_transport_header {
94 /** Transport header version, pad count, migration and solicitation */
95 uint8_t se__m__padcnt__tver;
98 /** Destination queue pair */
100 /** Packet sequence number and acknowledge request */
102 } __attribute__ (( packed ));
104 /** An Infiniband BTH opcode */
106 BTH_OPCODE_UD_SEND = 0x64,
109 /** Default Infiniband partition key */
110 #define IB_PKEY_NONE 0xffff
112 /** Subnet management queue pair number */
115 /** An Infiniband Datagram Extended Transport Header */
116 struct ib_datagram_extended_transport_header {
119 /** Source queue pair */
121 } __attribute__ (( packed ));
123 /** All known IB header formats */
125 struct ib_local_route_header lrh;
127 struct ib_local_route_header lrh;
128 struct ib_global_route_header grh;
129 struct ib_base_transport_header bth;
130 struct ib_datagram_extended_transport_header deth;
131 } __attribute__ (( packed )) lrh__grh__bth__deth;
133 struct ib_local_route_header lrh;
134 struct ib_base_transport_header bth;
135 struct ib_datagram_extended_transport_header deth;
136 } __attribute__ (( packed )) lrh__bth__deth;
137 } __attribute__ (( packed ));
139 /** Maximum size required for IB headers */
140 #define IB_MAX_HEADER_SIZE sizeof ( union ib_headers )
142 extern int ib_push ( struct ib_device *ibdev, struct io_buffer *iobuf,
143 struct ib_queue_pair *qp, size_t payload_len,
144 const struct ib_address_vector *av );
145 extern int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
146 struct ib_queue_pair **qp, size_t *payload_len,
147 struct ib_address_vector *av );
149 #endif /* _GPXE_IB_PACKET_H */