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