ib_packet.h
Go to the documentation of this file.00001 #ifndef _GPXE_IB_PACKET_H
00002 #define _GPXE_IB_PACKET_H
00003
00004
00005
00006
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
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
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
00037 struct ib_local_route_header {
00038
00039 uint8_t vl__lver;
00040
00041 uint8_t sl__lnh;
00042
00043 uint16_t dlid;
00044
00045 uint16_t length;
00046
00047 uint16_t slid;
00048 } __attribute__ (( packed ));
00049
00050
00051 enum ib_vl {
00052 IB_VL_DEFAULT = 0,
00053 IB_VL_SMP = 15,
00054 };
00055
00056
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
00065 #define IB_LID_NONE 0xffff
00066
00067
00068 #define IB_LID_MULTICAST( lid ) ( ( (lid) >= 0xc000 ) && ( (lid) <= 0xfffe ) )
00069
00070
00071 struct ib_global_route_header {
00072
00073
00074
00075
00076
00077
00078 uint32_t ipver__tclass__flowlabel;
00079
00080 uint16_t paylen;
00081
00082 uint8_t nxthdr;
00083
00084 uint8_t hoplmt;
00085
00086 struct ib_gid sgid;
00087
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
00095 struct ib_base_transport_header {
00096
00097 uint8_t opcode;
00098
00099 uint8_t se__m__padcnt__tver;
00100
00101 uint16_t pkey;
00102
00103 uint32_t dest_qp;
00104
00105 uint32_t ack__psn;
00106 } __attribute__ (( packed ));
00107
00108
00109 enum ib_bth_opcode {
00110 BTH_OPCODE_UD_SEND = 0x64,
00111 };
00112
00113
00114 struct ib_datagram_extended_transport_header {
00115
00116 uint32_t qkey;
00117
00118 uint32_t src_qp;
00119 } __attribute__ (( packed ));
00120
00121
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
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