diff options
| author | Michael Brown | 2008-11-07 09:39:40 +0100 |
|---|---|---|
| committer | Michael Brown | 2008-11-11 06:31:19 +0100 |
| commit | 9e5fd8ec59cd44dc9ba349d4feee37830fca6a14 (patch) | |
| tree | e2e7c3583f99c6414e1452171eca19c56ab3e532 /src/include/gpxe/ib_packet.h | |
| parent | [infiniband] Add a standalone subnet management agent (diff) | |
| download | ipxe-9e5fd8ec59cd44dc9ba349d4feee37830fca6a14.tar.gz ipxe-9e5fd8ec59cd44dc9ba349d4feee37830fca6a14.tar.xz ipxe-9e5fd8ec59cd44dc9ba349d4feee37830fca6a14.zip | |
[infiniband] Add raw packet parser and constructor
This can be used with cards that require the driver to construct and
parse packet headers manually. Headers are optionally handled
out-of-line from the packet payload, since some such cards will split
received headers into a separate ring buffer.
Diffstat (limited to 'src/include/gpxe/ib_packet.h')
| -rw-r--r-- | src/include/gpxe/ib_packet.h | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/include/gpxe/ib_packet.h b/src/include/gpxe/ib_packet.h index f9ef2f6ec..5374802c6 100644 --- a/src/include/gpxe/ib_packet.h +++ b/src/include/gpxe/ib_packet.h @@ -7,6 +7,11 @@ * */ +struct ib_device; +struct ib_queue_pair; +struct ib_address_vector; +struct io_buffer; + /** Half of an Infiniband Global Identifier */ struct ib_gid_half { uint8_t bytes[8]; @@ -53,6 +58,9 @@ enum ib_lnh { /** Default Infiniband LID */ #define IB_LID_NONE 0xffff +/** Test for multicast LID */ +#define IB_LID_MULTICAST( lid ) ( ( (lid) >= 0xc000 ) && ( (lid) <= 0xfffe ) ) + /** An Infiniband Global Route Header */ struct ib_global_route_header { /** IP version, traffic class, and flow label @@ -76,7 +84,6 @@ struct ib_global_route_header { #define IB_GRH_IPVER_IPv6 0x06 #define IB_GRH_NXTHDR_IBA 0x1b -#define IB_GRH_HOPLMT_MAX 0xff /** An Infiniband Base Transport Header */ struct ib_base_transport_header { @@ -111,4 +118,30 @@ struct ib_datagram_extended_transport_header { uint32_t src_qp; } __attribute__ (( packed )); +/** All known IB header formats */ +union ib_headers { + struct ib_local_route_header lrh; + struct { + struct ib_local_route_header lrh; + struct ib_global_route_header grh; + struct ib_base_transport_header bth; + struct ib_datagram_extended_transport_header deth; + } __attribute__ (( packed )) lrh__grh__bth__deth; + struct { + struct ib_local_route_header lrh; + struct ib_base_transport_header bth; + struct ib_datagram_extended_transport_header deth; + } __attribute__ (( packed )) lrh__bth__deth; +} __attribute__ (( packed )); + +/** Maximum size required for IB headers */ +#define IB_MAX_HEADER_SIZE sizeof ( union ib_headers ) + +extern 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 *av ); +extern int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf, + struct ib_queue_pair **qp, size_t *payload_len, + struct ib_address_vector *av ); + #endif /* _GPXE_IB_PACKET_H */ |
