| 1 |
|
| 2 | |
| 3 | * Copyright(c) 2007 Intel Corporation. All rights reserved.
|
| 4 | *
|
| 5 | * Maintained at www.Open-FCoE.org
|
| 6 |
|
| 7 |
|
| 8 | #ifndef _FC_FS_H_
|
| 9 | #define _FC_FS_H_
|
| 10 |
|
| 11 | #include <linux/types.h>
|
| 12 |
|
| 13 | |
| 14 | * Fibre Channel Framing and Signalling definitions.
|
| 15 | * From T11 FC-FS-2 Rev 0.90 - 9 August 2005.
|
| 16 |
|
| 17 |
|
| 18 | |
| 19 | * Frame header
|
| 20 |
|
| 21 | struct fc_frame_header {
|
| 22 | __u8 fh_r_ctl;
|
| 23 | __u8 fh_d_id[3];
|
| 24 |
|
| 25 | __u8 fh_cs_ctl;
|
| 26 | __u8 fh_s_id[3];
|
| 27 |
|
| 28 | __u8 fh_type;
|
| 29 | __u8 fh_f_ctl[3];
|
| 30 |
|
| 31 | __u8 fh_seq_id;
|
| 32 | __u8 fh_df_ctl;
|
| 33 | __be16 fh_seq_cnt;
|
| 34 |
|
| 35 | __be16 fh_ox_id;
|
| 36 | __be16 fh_rx_id;
|
| 37 | __be32 fh_parm_offset;
|
| 38 | };
|
| 39 |
|
| 40 | #define FC_FRAME_HEADER_LEN 24
|
| 41 |
|
| 42 | #define FC_MAX_PAYLOAD 2112U
|
| 43 | #define FC_MIN_MAX_PAYLOAD 256U
|
| 44 |
|
| 45 | #define FC_MAX_FRAME (FC_MAX_PAYLOAD + FC_FRAME_HEADER_LEN)
|
| 46 | #define FC_MIN_MAX_FRAME (FC_MIN_MAX_PAYLOAD + FC_FRAME_HEADER_LEN)
|
| 47 |
|
| 48 | |
| 49 | * fh_r_ctl - Routing control definitions.
|
| 50 |
|
| 51 | |
| 52 | * FC-4 device_data.
|
| 53 |
|
| 54 | enum fc_rctl {
|
| 55 | FC_RCTL_DD_UNCAT = 0x00,
|
| 56 | FC_RCTL_DD_SOL_DATA = 0x01,
|
| 57 | FC_RCTL_DD_UNSOL_CTL = 0x02,
|
| 58 | FC_RCTL_DD_SOL_CTL = 0x03,
|
| 59 | FC_RCTL_DD_UNSOL_DATA = 0x04,
|
| 60 | FC_RCTL_DD_DATA_DESC = 0x05,
|
| 61 | FC_RCTL_DD_UNSOL_CMD = 0x06,
|
| 62 | FC_RCTL_DD_CMD_STATUS = 0x07,
|
| 63 |
|
| 64 | #define FC_RCTL_ILS_REQ FC_RCTL_DD_UNSOL_CTL
|
| 65 | #define FC_RCTL_ILS_REP FC_RCTL_DD_SOL_CTL
|
| 66 |
|
| 67 | |
| 68 | * Extended Link_Data
|
| 69 |
|
| 70 | FC_RCTL_ELS_REQ = 0x22,
|
| 71 | FC_RCTL_ELS_REP = 0x23,
|
| 72 | FC_RCTL_ELS4_REQ = 0x32,
|
| 73 | FC_RCTL_ELS4_REP = 0x33,
|
| 74 | |
| 75 | * Optional Extended Headers
|
| 76 |
|
| 77 | FC_RCTL_VFTH = 0x50,
|
| 78 | FC_RCTL_IFRH = 0x51,
|
| 79 | FC_RCTL_ENCH = 0x52,
|
| 80 | |
| 81 | * Basic Link Services fh_r_ctl values.
|
| 82 |
|
| 83 | FC_RCTL_BA_NOP = 0x80,
|
| 84 | FC_RCTL_BA_ABTS = 0x81,
|
| 85 | FC_RCTL_BA_RMC = 0x82,
|
| 86 | FC_RCTL_BA_ACC = 0x84,
|
| 87 | FC_RCTL_BA_RJT = 0x85,
|
| 88 | FC_RCTL_BA_PRMT = 0x86,
|
| 89 | |
| 90 | * Link Control Information.
|
| 91 |
|
| 92 | FC_RCTL_ACK_1 = 0xc0,
|
| 93 | FC_RCTL_ACK_0 = 0xc1,
|
| 94 | FC_RCTL_P_RJT = 0xc2,
|
| 95 | FC_RCTL_F_RJT = 0xc3,
|
| 96 | FC_RCTL_P_BSY = 0xc4,
|
| 97 | FC_RCTL_F_BSY = 0xc5,
|
| 98 | FC_RCTL_F_BSYL = 0xc6,
|
| 99 | FC_RCTL_LCR = 0xc7,
|
| 100 | FC_RCTL_END = 0xc9,
|
| 101 | };
|
| 102 |
|
| 103 |
|
| 104 | |
| 105 | * R_CTL names initializer.
|
| 106 | * Please keep this matching the above definitions.
|
| 107 |
|
| 108 | #define FC_RCTL_NAMES_INIT { \
|
| 109 | [FC_RCTL_DD_UNCAT] = "uncat", \
|
| 110 | [FC_RCTL_DD_SOL_DATA] = "sol data", \
|
| 111 | [FC_RCTL_DD_UNSOL_CTL] = "unsol ctl", \
|
| 112 | [FC_RCTL_DD_SOL_CTL] = "sol ctl/reply", \
|
| 113 | [FC_RCTL_DD_UNSOL_DATA] = "unsol data", \
|
| 114 | [FC_RCTL_DD_DATA_DESC] = "data desc", \
|
| 115 | [FC_RCTL_DD_UNSOL_CMD] = "unsol cmd", \
|
| 116 | [FC_RCTL_DD_CMD_STATUS] = "cmd status", \
|
| 117 | [FC_RCTL_ELS_REQ] = "ELS req", \
|
| 118 | [FC_RCTL_ELS_REP] = "ELS rep", \
|
| 119 | [FC_RCTL_ELS4_REQ] = "FC-4 ELS req", \
|
| 120 | [FC_RCTL_ELS4_REP] = "FC-4 ELS rep", \
|
| 121 | [FC_RCTL_BA_NOP] = "BLS NOP", \
|
| 122 | [FC_RCTL_BA_ABTS] = "BLS abort", \
|
| 123 | [FC_RCTL_BA_RMC] = "BLS remove connection", \
|
| 124 | [FC_RCTL_BA_ACC] = "BLS accept", \
|
| 125 | [FC_RCTL_BA_RJT] = "BLS reject", \
|
| 126 | [FC_RCTL_BA_PRMT] = "BLS dedicated connection preempted", \
|
| 127 | [FC_RCTL_ACK_1] = "LC ACK_1", \
|
| 128 | [FC_RCTL_ACK_0] = "LC ACK_0", \
|
| 129 | [FC_RCTL_P_RJT] = "LC port reject", \
|
| 130 | [FC_RCTL_F_RJT] = "LC fabric reject", \
|
| 131 | [FC_RCTL_P_BSY] = "LC port busy", \
|
| 132 | [FC_RCTL_F_BSY] = "LC fabric busy to data frame", \
|
| 133 | [FC_RCTL_F_BSYL] = "LC fabric busy to link control frame",\
|
| 134 | [FC_RCTL_LCR] = "LC link credit reset", \
|
| 135 | [FC_RCTL_END] = "LC end", \
|
| 136 | }
|
| 137 |
|
| 138 | |
| 139 | * Well-known fabric addresses.
|
| 140 |
|
| 141 | enum fc_well_known_fid {
|
| 142 | FC_FID_NONE = 0x000000,
|
| 143 | FC_FID_BCAST = 0xffffff,
|
| 144 | FC_FID_FLOGI = 0xfffffe,
|
| 145 | FC_FID_FCTRL = 0xfffffd,
|
| 146 | FC_FID_DIR_SERV = 0xfffffc,
|
| 147 | FC_FID_TIME_SERV = 0xfffffb,
|
| 148 | FC_FID_MGMT_SERV = 0xfffffa,
|
| 149 | FC_FID_QOS = 0xfffff9,
|
| 150 | FC_FID_ALIASES = 0xfffff8,
|
| 151 | FC_FID_SEC_KEY = 0xfffff7,
|
| 152 | FC_FID_CLOCK = 0xfffff6,
|
| 153 | FC_FID_MCAST_SERV = 0xfffff5,
|
| 154 | };
|
| 155 |
|
| 156 | #define FC_FID_WELL_KNOWN_MAX 0xffffff
|
| 157 | #define FC_FID_WELL_KNOWN_BASE 0xfffff5
|
| 158 |
|
| 159 | |
| 160 | * Other well-known addresses, outside the above contiguous range.
|
| 161 |
|
| 162 | #define FC_FID_DOM_MGR 0xfffc00
|
| 163 |
|
| 164 | |
| 165 | * Fabric ID bytes.
|
| 166 |
|
| 167 | #define FC_FID_DOMAIN 0
|
| 168 | #define FC_FID_PORT 1
|
| 169 | #define FC_FID_LINK 2
|
| 170 |
|
| 171 | |
| 172 | * fh_type codes
|
| 173 |
|
| 174 | enum fc_fh_type {
|
| 175 | FC_TYPE_BLS = 0x00,
|
| 176 | FC_TYPE_ELS = 0x01,
|
| 177 | FC_TYPE_IP = 0x05,
|
| 178 | FC_TYPE_FCP = 0x08,
|
| 179 | FC_TYPE_CT = 0x20,
|
| 180 | FC_TYPE_ILS = 0x22,
|
| 181 | FC_TYPE_NVME = 0x28,
|
| 182 | };
|
| 183 |
|
| 184 | |
| 185 | * FC_TYPE names initializer.
|
| 186 | * Please keep this matching the above definitions.
|
| 187 |
|
| 188 | #define FC_TYPE_NAMES_INIT { \
|
| 189 | [FC_TYPE_BLS] = "BLS", \
|
| 190 | [FC_TYPE_ELS] = "ELS", \
|
| 191 | [FC_TYPE_IP] = "IP", \
|
| 192 | [FC_TYPE_FCP] = "FCP", \
|
| 193 | [FC_TYPE_CT] = "CT", \
|
| 194 | [FC_TYPE_ILS] = "ILS", \
|
| 195 | [FC_TYPE_NVME] = "NVME", \
|
| 196 | }
|
| 197 |
|
| 198 | |
| 199 | * Exchange IDs.
|
| 200 |
|
| 201 | #define FC_XID_UNKNOWN 0xffff
|
| 202 | #define FC_XID_MIN 0x0
|
| 203 | #define FC_XID_MAX 0xfffe
|
| 204 |
|
| 205 | |
| 206 | * fh_f_ctl - Frame control flags.
|
| 207 |
|
| 208 | #define FC_FC_EX_CTX (1 << 23)
|
| 209 | #define FC_FC_SEQ_CTX (1 << 22)
|
| 210 | #define FC_FC_FIRST_SEQ (1 << 21)
|
| 211 | #define FC_FC_LAST_SEQ (1 << 20)
|
| 212 | #define FC_FC_END_SEQ (1 << 19)
|
| 213 | #define FC_FC_END_CONN (1 << 18)
|
| 214 | #define FC_FC_RES_B17 (1 << 17)
|
| 215 | #define FC_FC_SEQ_INIT (1 << 16)
|
| 216 | #define FC_FC_X_ID_REASS (1 << 15)
|
| 217 | #define FC_FC_X_ID_INVAL (1 << 14)
|
| 218 |
|
| 219 | #define FC_FC_ACK_1 (1 << 12)
|
| 220 | #define FC_FC_ACK_N (2 << 12)
|
| 221 | #define FC_FC_ACK_0 (3 << 12)
|
| 222 |
|
| 223 | #define FC_FC_RES_B11 (1 << 11)
|
| 224 | #define FC_FC_RES_B10 (1 << 10)
|
| 225 | #define FC_FC_RETX_SEQ (1 << 9)
|
| 226 | #define FC_FC_UNI_TX (1 << 8)
|
| 227 | #define FC_FC_CONT_SEQ(i) ((i) << 6)
|
| 228 | #define FC_FC_ABT_SEQ(i) ((i) << 4)
|
| 229 | #define FC_FC_REL_OFF (1 << 3)
|
| 230 | #define FC_FC_RES2 (1 << 2)
|
| 231 | #define FC_FC_FILL(i) ((i) & 3)
|
| 232 |
|
| 233 | |
| 234 | * BA_ACC payload.
|
| 235 |
|
| 236 | struct fc_ba_acc {
|
| 237 | __u8 ba_seq_id_val;
|
| 238 | #define FC_BA_SEQ_ID_VAL 0x80
|
| 239 | __u8 ba_seq_id;
|
| 240 | __u8 ba_resvd[2];
|
| 241 | __be16 ba_ox_id;
|
| 242 | __be16 ba_rx_id;
|
| 243 | __be16 ba_low_seq_cnt;
|
| 244 | __be16 ba_high_seq_cnt;
|
| 245 | };
|
| 246 |
|
| 247 | |
| 248 | * BA_RJT: Basic Reject payload.
|
| 249 |
|
| 250 | struct fc_ba_rjt {
|
| 251 | __u8 br_resvd;
|
| 252 | __u8 br_reason;
|
| 253 | __u8 br_explan;
|
| 254 | __u8 br_vendor;
|
| 255 | };
|
| 256 |
|
| 257 | |
| 258 | * BA_RJT reason codes.
|
| 259 | * From FS-2.
|
| 260 |
|
| 261 | enum fc_ba_rjt_reason {
|
| 262 | FC_BA_RJT_NONE = 0,
|
| 263 | FC_BA_RJT_INVL_CMD = 0x01,
|
| 264 | FC_BA_RJT_LOG_ERR = 0x03,
|
| 265 | FC_BA_RJT_LOG_BUSY = 0x05,
|
| 266 | FC_BA_RJT_PROTO_ERR = 0x07,
|
| 267 | FC_BA_RJT_UNABLE = 0x09,
|
| 268 | FC_BA_RJT_VENDOR = 0xff,
|
| 269 | };
|
| 270 |
|
| 271 | |
| 272 | * BA_RJT reason code explanations.
|
| 273 |
|
| 274 | enum fc_ba_rjt_explan {
|
| 275 | FC_BA_RJT_EXP_NONE = 0x00,
|
| 276 | FC_BA_RJT_INV_XID = 0x03,
|
| 277 | FC_BA_RJT_ABT = 0x05,
|
| 278 | };
|
| 279 |
|
| 280 | |
| 281 | * P_RJT or F_RJT: Port Reject or Fabric Reject parameter field.
|
| 282 |
|
| 283 | struct fc_pf_rjt {
|
| 284 | __u8 rj_action;
|
| 285 | __u8 rj_reason;
|
| 286 | __u8 rj_resvd;
|
| 287 | __u8 rj_vendor;
|
| 288 | };
|
| 289 |
|
| 290 | |
| 291 | * P_RJT and F_RJT reject reason codes.
|
| 292 |
|
| 293 | enum fc_pf_rjt_reason {
|
| 294 | FC_RJT_NONE = 0,
|
| 295 | FC_RJT_INVL_DID = 0x01,
|
| 296 | FC_RJT_INVL_SID = 0x02,
|
| 297 | FC_RJT_P_UNAV_T = 0x03,
|
| 298 | FC_RJT_P_UNAV = 0x04,
|
| 299 | FC_RJT_CLS_UNSUP = 0x05,
|
| 300 | FC_RJT_DEL_USAGE = 0x06,
|
| 301 | FC_RJT_TYPE_UNSUP = 0x07,
|
| 302 | FC_RJT_LINK_CTL = 0x08,
|
| 303 | FC_RJT_R_CTL = 0x09,
|
| 304 | FC_RJT_F_CTL = 0x0a,
|
| 305 | FC_RJT_OX_ID = 0x0b,
|
| 306 | FC_RJT_RX_ID = 0x0c,
|
| 307 | FC_RJT_SEQ_ID = 0x0d,
|
| 308 | FC_RJT_DF_CTL = 0x0e,
|
| 309 | FC_RJT_SEQ_CNT = 0x0f,
|
| 310 | FC_RJT_PARAM = 0x10,
|
| 311 | FC_RJT_EXCH_ERR = 0x11,
|
| 312 | FC_RJT_PROTO = 0x12,
|
| 313 | FC_RJT_LEN = 0x13,
|
| 314 | FC_RJT_UNEXP_ACK = 0x14,
|
| 315 | FC_RJT_FAB_CLASS = 0x15,
|
| 316 | FC_RJT_LOGI_REQ = 0x16,
|
| 317 | FC_RJT_SEQ_XS = 0x17,
|
| 318 | FC_RJT_EXCH_EST = 0x18,
|
| 319 | FC_RJT_FAB_UNAV = 0x1a,
|
| 320 | FC_RJT_VC_ID = 0x1b,
|
| 321 | FC_RJT_CS_CTL = 0x1c,
|
| 322 | FC_RJT_INSUF_RES = 0x1d,
|
| 323 | FC_RJT_INVL_CLS = 0x1f,
|
| 324 | FC_RJT_PREEMT_RJT = 0x20,
|
| 325 | FC_RJT_PREEMT_DIS = 0x21,
|
| 326 | FC_RJT_MCAST_ERR = 0x22,
|
| 327 | FC_RJT_MCAST_ET = 0x23,
|
| 328 | FC_RJT_PRLI_REQ = 0x24,
|
| 329 | FC_RJT_INVL_ATT = 0x25,
|
| 330 | FC_RJT_VENDOR = 0xff,
|
| 331 | };
|
| 332 |
|
| 333 |
|
| 334 |
|
| 335 | #define FC_DEF_E_D_TOV 2000UL
|
| 336 | #define FC_DEF_R_A_TOV 10000UL
|
| 337 |
|
| 338 | #endif
|