| 1 |
/* |
| 2 |
* Copyright (c) 2013. Intel Corporation. All rights reserved. |
| 3 |
* Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. |
| 4 |
* Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. |
| 5 |
* |
| 6 |
* This software is available to you under a choice of one of two |
| 7 |
* licenses. You may choose to be licensed under the terms of the GNU |
| 8 |
* General Public License (GPL) Version 2, available from the file |
| 9 |
* COPYING in the main directory of this source tree, or the |
| 10 |
* OpenIB.org BSD license below: |
| 11 |
* |
| 12 |
* Redistribution and use in source and binary forms, with or |
| 13 |
* without modification, are permitted provided that the following |
| 14 |
* conditions are met: |
| 15 |
* |
| 16 |
* - Redistributions of source code must retain the above |
| 17 |
* copyright notice, this list of conditions and the following |
| 18 |
* disclaimer. |
| 19 |
* |
| 20 |
* - Redistributions in binary form must reproduce the above |
| 21 |
* copyright notice, this list of conditions and the following |
| 22 |
* disclaimer in the documentation and/or other materials |
| 23 |
* provided with the distribution. |
| 24 |
* |
| 25 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 26 |
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 27 |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 28 |
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 29 |
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 30 |
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 31 |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 32 |
* SOFTWARE. |
| 33 |
*/ |
| 34 |
|
| 35 |
#ifndef _IPS_PROTO_HEADER_H |
| 36 |
#define _IPS_PROTO_HEADER_H |
| 37 |
|
| 38 |
/* The actual size of the message header is determined by three paramters: |
| 39 |
* IPS_HEADER_QUEUE_IWORDS (fixed at 5 by hardware) |
| 40 |
* InfiniBand words contain LRH and BTH |
| 41 |
* IPS_HEADER_QUEUE_HWORDS (fixed at 7 by ips protocol) |
| 42 |
* IPS header words contain ips-protocol-specific data |
| 43 |
* IPS_HEADER_QUEUE_UWORDS (variable sized, from 2 to 32) |
| 44 |
* Size depends on the target. The connect protocol always assumes 2 |
| 45 |
* uwords, and post-connect communication will use a length determined at |
| 46 |
* connect time. |
| 47 |
* |
| 48 |
* The header message size is determined to as IWORDS + HWORDS + UWORDS |
| 49 |
*/ |
| 50 |
struct ips_message_header { |
| 51 |
__be16 lrh[4]; |
| 52 |
__be32 bth[3]; |
| 53 |
/* fields below this point are in host byte order */ |
| 54 |
struct ipath_header iph; |
| 55 |
__u8 sub_opcode; |
| 56 |
__u8 flags; |
| 57 |
__u16 commidx; |
| 58 |
/* 24 bits. The upper 8 bit is available for other use */ |
| 59 |
union { |
| 60 |
/* NOTE: always access src_context with HEADER_SRCCONTEXT macros. |
| 61 |
* actual context value is split to preserve wire compatibility */ |
| 62 |
struct { |
| 63 |
unsigned ack_seq_num:24; |
| 64 |
unsigned src_context:4; |
| 65 |
unsigned src_subcontext:2; |
| 66 |
unsigned src_context_ext:2; |
| 67 |
}; |
| 68 |
__u32 ack_seq_num_org; |
| 69 |
}; |
| 70 |
__u8 flowid; |
| 71 |
__u8 hdr_dlen; /* data length in header */ |
| 72 |
|
| 73 |
union { |
| 74 |
struct { |
| 75 |
__u16 mqhdr : 14; /* PSM matched queues */ |
| 76 |
__u16 dst_subcontext : 2; /* Destination subcontext */ |
| 77 |
}; |
| 78 |
struct { /* for PSM Active Messages */ |
| 79 |
__u16 amhdr_hidx : 8; |
| 80 |
__u16 amhdr_nargs : 3; |
| 81 |
__u16 amhdr_flags : 3; /* Reduced from 5 bits previously */ |
| 82 |
}; |
| 83 |
__u16 mqhdr_org; |
| 84 |
}; |
| 85 |
/* Access to uwords */ |
| 86 |
union { |
| 87 |
ptl_arg_t hdr_data[2]; |
| 88 |
ptl_arg_t data[0]; |
| 89 |
__u32 uwords[4]; |
| 90 |
}; |
| 91 |
}; |
| 92 |
|
| 93 |
#define IPS_HEADER_QUEUE_IWORDS 5 /* LRH+BTH (fixed) */ |
| 94 |
|
| 95 |
/* These two define the same thing, but they exist in sizeof and as a constant |
| 96 |
* for sanity checking */ |
| 97 |
#define IPS_HEADER_QUEUE_IPS_PROTOCOL_WORDS 5 |
| 98 |
#define IPS_HEADER_QUEUE_HWORDS 5 |
| 99 |
|
| 100 |
/* Min is used by the connect protocol. |
| 101 |
* Max bounds the size of the preallocated communication headers. |
| 102 |
* Req is the current desired receive header queue size. The actual size is |
| 103 |
* returned after userinit. */ |
| 104 |
#define IPS_HEADER_QUEUE_UWORDS_MIN 4 |
| 105 |
#define IPS_HEADER_QUEUE_UWORDS_MAX 32 |
| 106 |
#define IPS_HEADER_QUEUE_UWORDS_REQ 12 |
| 107 |
|
| 108 |
#define IPS_HEADER_QUEUE_PBC_WORDS 2 |
| 109 |
|
| 110 |
/* Figure out "real" size of ips_message_header given the size of the receive |
| 111 |
* header queue entry */ |
| 112 |
/* Actual message length includes iwords */ |
| 113 |
#define IPS_HEADER_MSGLEN(rcvhdrq_size) \ |
| 114 |
((IPS_HEADER_QUEUE_IWORDS+(rcvhdrq_size))<<2) |
| 115 |
|
| 116 |
/* Old define */ |
| 117 |
#define IPS_HEADER_QUEUE_WORDS \ |
| 118 |
((sizeof(struct ips_message_header) - \ |
| 119 |
offsetof(struct ips_message_header, iph)) >> 2) |
| 120 |
|
| 121 |
/* sub OpCodes - ips */ |
| 122 |
#define OPCODE_SEQ_DATA 0x01 |
| 123 |
#define OPCODE_SEQ_CTRL 0x02 |
| 124 |
|
| 125 |
#define OPCODE_SEQ_MQ_DATA 0x03 |
| 126 |
#define OPCODE_SEQ_MQ_CTRL 0x04 |
| 127 |
#define OPCODE_SEQ_MQ_HDR 0x05 |
| 128 |
#define OPCODE_SEQ_MQ_EXPTID 0x06 |
| 129 |
#define OPCODE_SEQ_MQ_EXPTID_UNALIGNED 0x07 |
| 130 |
|
| 131 |
#define OPCODE_ACK 0x10 |
| 132 |
#define OPCODE_NAK 0x11 |
| 133 |
|
| 134 |
#define OPCODE_ERR_CHK_OLD 0x20 |
| 135 |
#define OPCODE_ERR_CHK_PLS 0x21 |
| 136 |
#define OPCODE_ERR_CHK 0x22 /* error check with ip + pid */ |
| 137 |
#define OPCODE_ERR_CHK_BAD 0x23 /* error check out of context */ |
| 138 |
#define OPCODE_ERR_CHK_GEN 0x24 /* TF protocol error check */ |
| 139 |
|
| 140 |
/* Pre-2.0 startup */ |
| 141 |
#define OPCODE_STARTUP 0x30 |
| 142 |
#define OPCODE_STARTUP_ACK 0x31 |
| 143 |
#define OPCODE_STARTUP_NAK 0x32 |
| 144 |
#define OPCODE_STARTUP_EXT 0x34 |
| 145 |
#define OPCODE_STARTUP_ACK_EXT 0x35 |
| 146 |
#define OPCODE_STARTUP_NAK_EXT 0x36 |
| 147 |
/* 2.0+ startup */ |
| 148 |
#define OPCODE_CONNECT_REQUEST 0x60 |
| 149 |
#define OPCODE_CONNECT_REPLY 0x61 |
| 150 |
#define OPCODE_DISCONNECT_REQUEST 0x62 |
| 151 |
#define OPCODE_DISCONNECT_REPLY 0x63 |
| 152 |
|
| 153 |
#define OPCODE_AM_REQUEST 0x70 |
| 154 |
#define OPCODE_AM_REPLY 0x71 |
| 155 |
#define OPCODE_AM_REQUEST_NOREPLY 0x72 |
| 156 |
|
| 157 |
#define OPCODE_TIDS_RELEASE 0x40 |
| 158 |
#define OPCODE_TIDS_RELEASE_CONFIRM 0x41 |
| 159 |
#define OPCODE_TIDS_GRANT 0x42 |
| 160 |
#define OPCODE_TIDS_GRANT_ACK 0x43 |
| 161 |
|
| 162 |
#define OPCODE_CLOSE 0x50 |
| 163 |
#define OPCODE_CLOSE_ACK 0x51 |
| 164 |
|
| 165 |
/* Explicit CCA related messages */ |
| 166 |
#define OPCODE_FLOW_CCA_BECN 0x80 |
| 167 |
|
| 168 |
/* |
| 169 |
* like OPCODE_CLOSE, but no complaint if other side has already closed. |
| 170 |
* Used when doing abort(), MPI_Abort(), etc. |
| 171 |
*/ |
| 172 |
#define OPCODE_ABORT 0x52 |
| 173 |
|
| 174 |
#endif /* _IPS_PROTO_HEADER_H */ |