ib_packet.h

Go to the documentation of this file.
00001 #ifndef _GPXE_IB_PACKET_H
00002 #define _GPXE_IB_PACKET_H
00003 
00004 /** @file
00005  *
00006  * Infiniband packet format
00007  *
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER );
00011 
00012 struct ib_device;
00013 struct ib_queue_pair;
00014 struct ib_address_vector;
00015 struct io_buffer;
00016 
00017 /** Half of an Infiniband Global Identifier */
00018 struct ib_gid_half {
00019         union {
00020                 uint8_t bytes[8];
00021                 uint16_t words[4];
00022                 uint32_t dwords[2];
00023         } u;
00024 };
00025 
00026 /** An Infiniband Global Identifier */
00027 struct ib_gid {
00028         union {
00029                 uint8_t bytes[16];
00030                 uint16_t words[8];
00031                 uint32_t dwords[4];
00032                 struct ib_gid_half half[2];
00033         } u;
00034 };
00035 
00036 /** An Infiniband Local Route Header */
00037 struct ib_local_route_header {
00038         /** Virtual lane and link version */
00039         uint8_t vl__lver;
00040         /** Service level and next link header */
00041         uint8_t sl__lnh;
00042         /** Destination LID */
00043         uint16_t dlid;
00044         /** Packet length */
00045         uint16_t length;
00046         /** Source LID */
00047         uint16_t slid;
00048 } __attribute__ (( packed ));
00049 
00050 /** Infiniband virtual lanes */
00051 enum ib_vl {
00052         IB_VL_DEFAULT = 0,
00053         IB_VL_SMP = 15,
00054 };
00055 
00056 /** An Infiniband Link Next Header value */
00057 enum ib_lnh {
00058         IB_LNH_RAW = 0,
00059         IB_LNH_IPv6 = 1,
00060         IB_LNH_BTH = 2,
00061         IB_LNH_GRH = 3
00062 };
00063 
00064 /** Default Infiniband LID */
00065 #define IB_LID_NONE 0xffff
00066 
00067 /** Test for multicast LID */
00068 #define IB_LID_MULTICAST( lid ) ( ( (lid) >= 0xc000 ) && ( (lid) <= 0xfffe ) )
00069 
00070 /** An Infiniband Global Route Header */
00071 struct ib_global_route_header {
00072         /** IP version, traffic class, and flow label
00073          *
00074          *  4 bits : Version of the GRH
00075          *  8 bits : Traffic class
00076          * 20 bits : Flow label
00077          */
00078         uint32_t ipver__tclass__flowlabel;
00079         /** Payload length */
00080         uint16_t paylen;
00081         /** Next header */
00082         uint8_t nxthdr;
00083         /** Hop limit */
00084         uint8_t hoplmt;
00085         /** Source GID */
00086         struct ib_gid sgid;
00087         /** Destiniation GID */
00088         struct ib_gid dgid;
00089 } __attribute__ (( packed ));
00090 
00091 #define IB_GRH_IPVER_IPv6 0x06
00092 #define IB_GRH_NXTHDR_IBA 0x1b
00093 
00094 /** An Infiniband Base Transport Header */
00095 struct ib_base_transport_header {
00096         /** Opcode */
00097         uint8_t opcode;
00098         /** Transport header version, pad count, migration and solicitation */
00099         uint8_t se__m__padcnt__tver;
00100         /** Partition key */
00101         uint16_t pkey;
00102         /** Destination queue pair */
00103         uint32_t dest_qp;
00104         /** Packet sequence number and acknowledge request */
00105         uint32_t ack__psn;
00106 } __attribute__ (( packed ));
00107 
00108 /** An Infiniband BTH opcode */
00109 enum ib_bth_opcode {
00110         BTH_OPCODE_UD_SEND = 0x64,
00111 };
00112 
00113 /** An Infiniband Datagram Extended Transport Header */
00114 struct ib_datagram_extended_transport_header {
00115         /** Queue key */
00116         uint32_t qkey;
00117         /** Source queue pair */
00118         uint32_t src_qp;
00119 } __attribute__ (( packed ));
00120 
00121 /** All known IB header formats */
00122 union ib_headers {
00123         struct ib_local_route_header lrh;
00124         struct {
00125                 struct ib_local_route_header lrh;
00126                 struct ib_global_route_header grh;
00127                 struct ib_base_transport_header bth;
00128                 struct ib_datagram_extended_transport_header deth;
00129         } __attribute__ (( packed )) lrh__grh__bth__deth;
00130         struct {
00131                 struct ib_local_route_header lrh;
00132                 struct ib_base_transport_header bth;
00133                 struct ib_datagram_extended_transport_header deth;
00134         } __attribute__ (( packed )) lrh__bth__deth;
00135 } __attribute__ (( packed ));
00136 
00137 /** Maximum size required for IB headers */
00138 #define IB_MAX_HEADER_SIZE sizeof ( union ib_headers )
00139 
00140 extern int ib_push ( struct ib_device *ibdev, struct io_buffer *iobuf,
00141                      struct ib_queue_pair *qp, size_t payload_len,
00142                      const struct ib_address_vector *av );
00143 extern int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
00144                      struct ib_queue_pair **qp, size_t *payload_len,
00145                      struct ib_address_vector *av );
00146 
00147 #endif /* _GPXE_IB_PACKET_H */

Generated on Tue Apr 6 20:01:08 2010 for gPXE by  doxygen 1.5.7.1