iPXE
ib_packet.h
Go to the documentation of this file.
1 #ifndef _IPXE_IB_PACKET_H
2 #define _IPXE_IB_PACKET_H
3 
4 /** @file
5  *
6  * Infiniband packet format
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 struct ib_device;
13 struct ib_queue_pair;
15 struct io_buffer;
16 
17 /** An Infiniband Globally Unique Identifier */
18 union ib_guid {
23 };
24 
25 /** Infiniband Globally Unique Identifier debug message format */
26 #define IB_GUID_FMT "%08x:%08x"
27 
28 /** Infiniband Globally Unique Identifier debug message arguments */
29 #define IB_GUID_ARGS( guid ) \
30  ntohl ( (guid)->dwords[0] ), ntohl ( (guid)->dwords[1] )
31 
32 /** An Infiniband Global Identifier */
33 union ib_gid {
38  struct {
39  union ib_guid prefix;
40  union ib_guid guid;
41  } s;
42 };
43 
44 /** Infiniband Global Identifier debug message format */
45 #define IB_GID_FMT IB_GUID_FMT ":" IB_GUID_FMT
46 
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 )
50 
51 /** Test for multicast GID */
52 #define IB_GID_MULTICAST( gid ) ( (gid)->bytes[0] == 0xff )
53 
54 /** An Infiniband Local Route Header */
56  /** Virtual lane and link version */
58  /** Service level and next link header */
60  /** Destination LID */
62  /** Packet length */
64  /** Source LID */
66 } __attribute__ (( packed ));
67 
68 /** Infiniband virtual lanes */
69 enum ib_vl {
71  IB_VL_SMP = 15,
72 };
73 
74 /** An Infiniband Link Next Header value */
75 enum ib_lnh {
80 };
81 
82 /** Default Infiniband LID */
83 #define IB_LID_NONE 0xffff
84 
85 /** Test for multicast LID */
86 #define IB_LID_MULTICAST( lid ) ( ( (lid) >= 0xc000 ) && ( (lid) <= 0xfffe ) )
87 
88 /** An Infiniband Global Route Header */
90  /** IP version, traffic class, and flow label
91  *
92  * 4 bits : Version of the GRH
93  * 8 bits : Traffic class
94  * 20 bits : Flow label
95  */
97  /** Payload length */
99  /** Next header */
101  /** Hop limit */
103  /** Source GID */
104  union ib_gid sgid;
105  /** Destiniation GID */
106  union ib_gid dgid;
107 } __attribute__ (( packed ));
108 
109 #define IB_GRH_IPVER_IPv6 0x06
110 #define IB_GRH_NXTHDR_IBA 0x1b
111 
112 /** An Infiniband Base Transport Header */
114  /** Opcode */
116  /** Transport header version, pad count, migration and solicitation */
118  /** Partition key */
120  /** Destination queue pair */
122  /** Packet sequence number and acknowledge request */
124 } __attribute__ (( packed ));
125 
126 /** An Infiniband BTH opcode */
129 };
130 
131 /** An Infiniband Datagram Extended Transport Header */
133  /** Queue key */
135  /** Source queue pair */
137 } __attribute__ (( packed ));
138 
139 /** All known IB header formats */
140 union ib_headers {
142  struct {
143  struct ib_local_route_header lrh;
147  } __attribute__ (( packed )) lrh__grh__bth__deth;
148  struct {
149  struct ib_local_route_header lrh;
152  } __attribute__ (( packed )) lrh__bth__deth;
153 } __attribute__ (( packed ));
154 
155 /** Maximum size required for IB headers */
156 #define IB_MAX_HEADER_SIZE sizeof ( union ib_headers )
157 
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 );
165 
166 #endif /* _IPXE_IB_PACKET_H */
An Infiniband Datagram Extended Transport Header.
Definition: ib_packet.h:132
unsigned short uint16_t
Definition: stdint.h:11
union ib_guid guid
Definition: ib_packet.h:40
struct ib_datagram_extended_transport_header deth
Definition: ib_packet.h:146
uint32_t dest_qp
Destination queue pair.
Definition: ib_packet.h:121
uint8_t nxthdr
Next header.
Definition: ib_packet.h:100
uint8_t se__m__padcnt__tver
Transport header version, pad count, migration and solicitation.
Definition: ib_packet.h:117
ib_bth_opcode
An Infiniband BTH opcode.
Definition: ib_packet.h:127
uint8_t sl__lnh
Service level and next link header.
Definition: ib_packet.h:59
All known IB header formats.
Definition: ib_packet.h:140
unsigned long long uint64_t
Definition: stdint.h:13
int ib_push(struct ib_device *ibdev, struct io_buffer *iobuf, struct ib_queue_pair *qp, size_t payload_len, const struct ib_address_vector *dest)
Add IB headers.
Definition: ib_packet.c:52
uint32_t dwords[2]
Definition: ib_packet.h:21
uint16_t pkey
Partition key.
Definition: ib_packet.h:119
An Infiniband Global Identifier.
Definition: ib_packet.h:33
ib_lnh
An Infiniband Link Next Header value.
Definition: ib_packet.h:75
union ib_gid dgid
Destiniation GID.
Definition: ib_packet.h:106
enum ib_vl __attribute__
An Infiniband device.
Definition: infiniband.h:398
uint16_t slid
Source LID.
Definition: ib_packet.h:65
uint8_t bytes[16]
Definition: ib_packet.h:34
An Infiniband Base Transport Header.
Definition: ib_packet.h:113
struct ib_global_route_header grh
Definition: ib_packet.h:144
struct ib_gid::@559 s
uint8_t hoplmt
Hop limit.
Definition: ib_packet.h:102
uint64_t qwords[2]
Definition: ib_packet.h:37
An Infiniband Global Route Header.
Definition: ib_packet.h:89
int ib_pull(struct ib_device *ibdev, struct io_buffer *iobuf, struct ib_queue_pair **qp, size_t *payload_len, struct ib_address_vector *dest, struct ib_address_vector *source)
Remove IB headers.
Definition: ib_packet.c:133
uint64_t qword
Definition: ib_packet.h:22
static void * dest
Definition: strings.h:176
uint8_t opcode
Opcode.
Definition: ib_packet.h:115
union ib_guid prefix
Definition: ib_packet.h:39
union ib_gid sgid
Source GID.
Definition: ib_packet.h:104
uint16_t words[8]
Definition: ib_packet.h:35
An Infiniband Local Route Header.
Definition: ib_packet.h:55
An Infiniband Globally Unique Identifier.
Definition: ib_packet.h:18
struct ib_headers::@560 __attribute__((packed)) lrh__grh__bth__deth
unsigned char uint8_t
Definition: stdint.h:10
uint16_t paylen
Payload length.
Definition: ib_packet.h:98
uint8_t vl__lver
Virtual lane and link version.
Definition: ib_packet.h:57
uint16_t dlid
Destination LID.
Definition: ib_packet.h:61
uint32_t ipver__tclass__flowlabel
IP version, traffic class, and flow label.
Definition: ib_packet.h:96
unsigned int uint32_t
Definition: stdint.h:12
uint16_t length
Packet length.
Definition: ib_packet.h:63
An Infiniband Queue Pair.
Definition: infiniband.h:157
struct ib_local_route_header lrh
Definition: ib_packet.h:141
struct arbelprm_qp_db_record qp
Definition: arbel.h:13
uint16_t words[4]
Definition: ib_packet.h:20
struct ib_base_transport_header bth
Definition: ib_packet.h:145
uint32_t src_qp
Source queue pair.
Definition: ib_packet.h:136
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
uint8_t bytes[8]
Definition: ib_packet.h:19
An Infiniband Address Vector.
Definition: infiniband.h:72
uint32_t dwords[4]
Definition: ib_packet.h:36
ib_vl
Infiniband virtual lanes.
Definition: ib_packet.h:69
uint32_t ack__psn
Packet sequence number and acknowledge request.
Definition: ib_packet.h:123
A persistent I/O buffer.
Definition: iobuf.h:33