| 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_PARAMS_H |
| 36 |
#define _IPS_PROTO_PARAMS_H |
| 37 |
|
| 38 |
/* Packet header formats */ |
| 39 |
#define CRC_SIZE_IN_BYTES 4 |
| 40 |
#define PCB_SIZE_IN_BYTES 8 |
| 41 |
#define LRH_VL_SHIFT 12 |
| 42 |
#define BTH_OPCODE_SHIFT 24 |
| 43 |
#define BTH_EXTRA_BYTE_SHIFT 20 |
| 44 |
#define BTH_BECN_SHIFT 30 |
| 45 |
#define BTH_FECN_SHIFT 31 |
| 46 |
#define BYTE2WORD_SHIFT 2 |
| 47 |
#define LOWER_24_BITS 0xFFFFFF |
| 48 |
#define LOWER_16_BITS 0xFFFF |
| 49 |
#define LOWER_8_BITS 0xFF |
| 50 |
#define MAX_VL_SUPPORTED 8 |
| 51 |
#define PSM_CRC_SIZE_IN_BYTES 8 /* Change in ipath_user.h as well */ |
| 52 |
#define PSM_CACHE_LINE_BYTES 64 |
| 53 |
#define PSM_FLOW_CREDITS 64 |
| 54 |
|
| 55 |
#ifndef BITS_PER_BYTE |
| 56 |
# define BITS_PER_BYTE 8 |
| 57 |
#endif |
| 58 |
|
| 59 |
/* Send retransmission */ |
| 60 |
#define IPS_PROTO_SPIO_RETRY_US_DEFAULT 2 /* in uS */ |
| 61 |
|
| 62 |
#define IPS_PROTO_ERRCHK_MS_MIN_DEFAULT 8 /* in millisecs */ |
| 63 |
#define IPS_PROTO_ERRCHK_MS_MAX_DEFAULT 32 /* in millisecs */ |
| 64 |
#define IPS_PROTO_ERRCHK_FACTOR_DEFAULT 2 |
| 65 |
#define PSM_TID_TIMEOUT_DEFAULT "8:32:2" /* update from above params */ |
| 66 |
|
| 67 |
#define IPS_HDR_TID(p_hdr) \ |
| 68 |
((__le32_to_cpu((p_hdr)->iph.ver_context_tid_offset) >> \ |
| 69 |
INFINIPATH_I_TID_SHIFT) & INFINIPATH_I_TID_MASK) |
| 70 |
|
| 71 |
/* time conversion macros */ |
| 72 |
#define us_2_cycles(us) nanosecs_to_cycles(1000ULL*(us)) |
| 73 |
#define ms_2_cycles(ms) nanosecs_to_cycles(1000000ULL*(ms)) |
| 74 |
#define sec_2_cycles(sec) nanosecs_to_cycles(1000000000ULL*(sec)) |
| 75 |
|
| 76 |
/* Per-flow flags */ |
| 77 |
#define IPS_FLOW_FLAG_NAK_SEND 0x01 |
| 78 |
#define IPS_FLOW_FLAG_WRITEV 0x02 |
| 79 |
#define IPS_FLOW_FLAG_PENDING_ACK 0x04 |
| 80 |
#define IPS_FLOW_FLAG_GEN_BECN 0x08 |
| 81 |
#define IPS_FLOW_FLAG_CONGESTED 0x10 |
| 82 |
#define IPS_FLOW_FLAG_PENDING_NAK 0x20 |
| 83 |
|
| 84 |
/* per-ipsaddr Flags (sess is ipsaddr) */ |
| 85 |
#define SESS_FLAG_HAS_RCVTHREAD 0x2 |
| 86 |
#define SESS_FLAG_LOCK_SESS 0x4 |
| 87 |
#define SESS_FLAG_HAS_FLOWID 0x8 |
| 88 |
|
| 89 |
/* tid session expected send flags */ |
| 90 |
#define EXP_SEND_FLAG_CLEAR_ALL 0x00 |
| 91 |
#define EXP_SEND_FLAG_FREE_TIDS 0x01 |
| 92 |
|
| 93 |
#define TIMEOUT_INFINITE 0xFFFFFFFFFFFFFFFFULL /* 64 bit all-one's */ |
| 94 |
|
| 95 |
/* ips_scb_t flags, powers of 2, and disjoint from SEND_FLAG_* values. |
| 96 |
* Only the lower 8 bytes are wire-protocol options */ |
| 97 |
#define IPS_SEND_FLAG_NONE 0x00 |
| 98 |
// Unused -- future use maybe. |
| 99 |
//#define IPS_SEND_FLAG_ACK_REQ_INTR 0x02 /* request ack with intr */ |
| 100 |
#define IPS_SEND_FLAG_ACK_REQ 0x04 /* request ack (normal) */ |
| 101 |
#define IPS_SEND_FLAG_UNALIGNED_DATA 0x08 /* unaligned data in hdr */ |
| 102 |
#define IPS_SEND_FLAG_HAS_CKSUM 0x10 /* Has checksum */ |
| 103 |
#define IPS_SEND_FLAG_EXPECTED_DONE 0x20 /* Last expected packet */ |
| 104 |
#define IPS_SEND_FLAG_CCA_BECN 0x40 /* BECN bit for congestion */ |
| 105 |
#define IPS_SEND_FLAG_PROTO_OPTS 0xff |
| 106 |
|
| 107 |
#define IPS_SEND_FLAG_PENDING 0x0100 |
| 108 |
#define IPS_SEND_FLAG_PERSISTENT 0x0200 |
| 109 |
#define IPS_SEND_FLAG_INTR 0x0400 |
| 110 |
#define IPS_SEND_FLAG_WAIT_SDMA 0x0800 |
| 111 |
#define IPS_SEND_FLAG_HDR_SUPPRESS 0x1000 |
| 112 |
|
| 113 |
#define IPS_PROTO_FLAG_MQ_ENVELOPE_SDMA 0x01 |
| 114 |
#define IPS_PROTO_FLAG_MQ_EAGER_SDMA 0x02 |
| 115 |
#define IPS_PROTO_FLAG_MQ_EXPECTED_SDMA 0x04 |
| 116 |
#define IPS_PROTO_FLAG_MQ_MASK 0x0f /* contains all MQ proto flags */ |
| 117 |
#define IPS_PROTO_FLAG_CTRL_SDMA 0x10 |
| 118 |
|
| 119 |
/* Alias for use send dma for everything */ |
| 120 |
#define IPS_PROTO_FLAGS_ALL_SDMA 0x17 |
| 121 |
|
| 122 |
#define IPS_PROTO_FLAG_CKSUM 0x20 |
| 123 |
/* Coalesced ACKs (On by default) */ |
| 124 |
#define IPS_PROTO_FLAG_COALESCE_ACKS 0x80 |
| 125 |
|
| 126 |
/* Use Path Record query (off by default) */ |
| 127 |
#define IPS_PROTO_FLAG_QUERY_PATH_REC 0x100 |
| 128 |
|
| 129 |
/* Path selection policies: |
| 130 |
* |
| 131 |
* (a) Adaptive - Dynamically determine the least loaded paths using various |
| 132 |
* feedback mechanism - Completion time via ACKs, NAKs, CCA using BECNs. |
| 133 |
* |
| 134 |
* (b) Static schemes - |
| 135 |
* (i) static_src - Use path keyed off source context |
| 136 |
* (ii) static_dest - Use path keyed off destination context |
| 137 |
* (iii) static_base - Use only the base lid path - default till Oct'09. |
| 138 |
* |
| 139 |
* The default is adaptive. If a zero lmc network is used then there exists |
| 140 |
* just one path between endpoints the (b)(iii) case above. |
| 141 |
* |
| 142 |
*/ |
| 143 |
|
| 144 |
#define IPS_PROTO_FLAG_PPOLICY_ADAPTIVE 0x200 |
| 145 |
#define IPS_PROTO_FLAG_PPOLICY_STATIC_SRC 0x400 |
| 146 |
#define IPS_PROTO_FLAG_PPOLICY_STATIC_DST 0x800 |
| 147 |
#define IPS_PROTO_FLAG_PPOLICY_STATIC_BASE 0x1000 |
| 148 |
|
| 149 |
/* All static policies */ |
| 150 |
#define IPS_PROTO_FLAG_PPOLICY_STATIC 0x1c00 |
| 151 |
|
| 152 |
/* IBTA CCA Protocol support */ |
| 153 |
#define IPS_PROTO_FLAG_CCA 0x2000 |
| 154 |
|
| 155 |
/* By default, we use dma in eager (based on PSM_MQ_EAGER_SDMA_SZ) and |
| 156 |
* always use it in expected. |
| 157 |
*/ |
| 158 |
#define IPS_PROTO_FLAGS_DEFAULT (IPS_PROTO_FLAG_MQ_EAGER_SDMA | \ |
| 159 |
IPS_PROTO_FLAG_MQ_EXPECTED_SDMA | \ |
| 160 |
IPS_PROTO_FLAG_COALESCE_ACKS) |
| 161 |
|
| 162 |
#define IPS_PROTOEXP_FLAG_ENABLED 0x01 /* default */ |
| 163 |
//#define IPS_PROTOEXP_FLAG_NAKOPT 0x02 /* *not* default, broken */ |
| 164 |
#define IPS_PROTOEXP_FLAG_TID_DEBUG 0x04 /* *not* default */ |
| 165 |
#define IPS_PROTOEXP_FLAG_HDR_SUPP 0x08 /* Header suppression enabled */ |
| 166 |
|
| 167 |
#define IPS_PROTOEXP_FLAGS_DEFAULT (IPS_PROTOEXP_FLAG_ENABLED | \ |
| 168 |
IPS_PROTOEXP_FLAG_HDR_SUPP) |
| 169 |
|
| 170 |
/* We have to get an MTU of at least 2K, or else this breaks some assumptions |
| 171 |
* in the packets that handle tid descriptors |
| 172 |
*/ |
| 173 |
#define IPS_PROTOEXP_MIN_MTU 2048 |
| 174 |
|
| 175 |
/* Bound on the number of packets to feed to send dma at a time. This ensures |
| 176 |
* we don't "disappear" in the kernel for too long. |
| 177 |
*/ |
| 178 |
#define IPS_SDMA_MAX_SCB 32 |
| 179 |
|
| 180 |
/* Fault injection, becomes parameters to psmi_faultinj_getspec so |
| 181 |
* a comma-delimited list of |
| 182 |
* "spec_name", num, denom |
| 183 |
* Where num/denom means fault num out of every denom. |
| 184 |
* The defines set 'denum' and assume that num is set to 1 |
| 185 |
* |
| 186 |
* These values are all defaults, each is overridable via |
| 187 |
* PSM_FI_<spec_name> in the environment (and yes, spec_name is in lowercase |
| 188 |
* *in the environment* just to minimize it appearing in the wild). The format |
| 189 |
* there is <num:denom:initial_seed> so the same thing except that one can set |
| 190 |
* a specific seed to the random number generator. |
| 191 |
*/ |
| 192 |
#if 1 |
| 193 |
#define IPS_FAULTINJ_DMALOST 20 /* 1 every 20 dma writev get lost */ |
| 194 |
#define IPS_FAULTINJ_PIOLOST 100 /* 1 every 100 pio writes get lost */ |
| 195 |
#define IPS_FAULTINJ_PIOBUSY 10 /* 1 every 10 pio sends get busy */ |
| 196 |
#define IPS_FAULTINJ_RECVLOST 200 /* 1 every 200 pkts dropped at recv */ |
| 197 |
#else |
| 198 |
#define IPS_FAULTINJ_DMALOST 500 /* 1 every 500 dma writev get lost */ |
| 199 |
#define IPS_FAULTINJ_PIOLOST 3000 /* 1 every 3000 pio writes get lost */ |
| 200 |
#define IPS_FAULTINJ_PIOBUSY 100 /* 1 every 100 pio sends get busy */ |
| 201 |
#define IPS_FAULTINJ_RECVLOST 500 /* 1 every 500 pkts dropped at recv */ |
| 202 |
#endif |
| 203 |
|
| 204 |
#endif /* _IPS_PROTO_PARAMS_H */ |