1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright 2008 Cisco Systems, Inc. All rights reserved. 4 */ 5 #ifndef _FC_FIP_H_ 6 #define _FC_FIP_H_ 7 8 #include <scsi/fc/fc_ns.h> 9 10 /* 11 * This version is based on: 12 * http://www.t11.org/ftp/t11/pub/fc/bb-5/08-543v1.pdf 13 * and T11 FC-BB-6 13-091v5.pdf (December 2013 VN2VN proposal) 14 */ 15 16 #define FIP_DEF_PRI 128 /* default selection priority */ 17 #define FIP_DEF_FC_MAP 0x0efc00 /* default FCoE MAP (MAC OUI) value */ 18 #define FIP_DEF_FKA 8000 /* default FCF keep-alive/advert period (mS) */ 19 #define FIP_VN_KA_PERIOD 90000 /* required VN_port keep-alive period (mS) */ 20 #define FIP_FCF_FUZZ 100 /* random time added by FCF (mS) */ 21 22 /* 23 * VN2VN proposed-standard values. 24 */ 25 #define FIP_VN_FC_MAP 0x0efd00 /* MAC OUI for VN2VN use */ 26 #define FIP_VN_PROBE_WAIT 100 /* interval between VN2VN probes (ms) */ 27 #define FIP_VN_ANN_WAIT 400 /* interval between VN2VN announcements (ms) */ 28 #define FIP_VN_RLIM_INT 10000 /* interval between probes when rate limited */ 29 #define FIP_VN_RLIM_COUNT 10 /* number of probes before rate limiting */ 30 #define FIP_VN_BEACON_INT 8000 /* interval between VN2VN beacons */ 31 #define FIP_VN_BEACON_FUZZ 100 /* random time to add to beacon period (ms) */ 32 33 /* 34 * Multicast MAC addresses. T11-adopted. 35 */ 36 #define FIP_ALL_FCOE_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 0 }) 37 #define FIP_ALL_ENODE_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 1 }) 38 #define FIP_ALL_FCF_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 2 }) 39 #define FIP_ALL_VN2VN_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 4 }) 40 #define FIP_ALL_P2P_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 5 }) 41 42 #define FIP_VER 1 /* version for fip_header */ 43 44 struct fip_header { 45 __u8 fip_ver; /* upper 4 bits are the version */ 46 __u8 fip_resv1; /* reserved */ 47 __be16 fip_op; /* operation code */ 48 __u8 fip_resv2; /* reserved */ 49 __u8 fip_subcode; /* lower 4 bits are sub-code */ 50 __be16 fip_dl_len; /* length of descriptors in words */ 51 __be16 fip_flags; /* header flags */ 52 } __attribute__((packed)); 53 54 #define FIP_VER_SHIFT 4 55 #define FIP_VER_ENCAPS(v) ((v) << FIP_VER_SHIFT) 56 #define FIP_VER_DECAPS(v) ((v) >> FIP_VER_SHIFT) 57 #define FIP_BPW 4 /* bytes per word for lengths */ 58 59 /* 60 * fip_op. 61 */ 62 enum fip_opcode { 63 FIP_OP_DISC = 1, /* discovery, advertisement, etc. */ 64 FIP_OP_LS = 2, /* Link Service request or reply */ 65 FIP_OP_CTRL = 3, /* Keep Alive / Link Reset */ 66 FIP_OP_VLAN = 4, /* VLAN discovery */ 67 FIP_OP_VN2VN = 5, /* VN2VN operation */ 68 FIP_OP_VENDOR_MIN = 0xfff8, /* min vendor-specific opcode */ 69 FIP_OP_VENDOR_MAX = 0xfffe, /* max vendor-specific opcode */ 70 }; 71 72 /* 73 * Subcodes for FIP_OP_DISC. 74 */ 75 enum fip_disc_subcode { 76 FIP_SC_SOL = 1, /* solicitation */ 77 FIP_SC_ADV = 2, /* advertisement */ 78 }; 79 80 /* 81 * Subcodes for FIP_OP_LS. 82 */ 83 enum fip_trans_subcode { 84 FIP_SC_REQ = 1, /* request */ 85 FIP_SC_REP = 2, /* reply */ 86 }; 87 88 /* 89 * Subcodes for FIP_OP_RESET. 90 */ 91 enum fip_reset_subcode { 92 FIP_SC_KEEP_ALIVE = 1, /* keep-alive from VN_Port */ 93 FIP_SC_CLR_VLINK = 2, /* clear virtual link from VF_Port */ 94 }; 95 96 /* 97 * Subcodes for FIP_OP_VLAN. 98 */ 99 enum fip_vlan_subcode { 100 FIP_SC_VL_REQ = 1, /* vlan request */ 101 FIP_SC_VL_NOTE = 2, /* vlan notification */ 102 FIP_SC_VL_VN2VN_NOTE = 3, /* VN2VN vlan notification */ 103 }; 104 105 /* 106 * Subcodes for FIP_OP_VN2VN. 107 */ 108 enum fip_vn2vn_subcode { 109 FIP_SC_VN_PROBE_REQ = 1, /* probe request */ 110 FIP_SC_VN_PROBE_REP = 2, /* probe reply */ 111 FIP_SC_VN_CLAIM_NOTIFY = 3, /* claim notification */ 112 FIP_SC_VN_CLAIM_REP = 4, /* claim response */ 113 FIP_SC_VN_BEACON = 5, /* beacon */ 114 }; 115 116 /* 117 * flags in header fip_flags. 118 */ 119 enum fip_flag { 120 FIP_FL_FPMA = 0x8000, /* supports FPMA fabric-provided MACs */ 121 FIP_FL_SPMA = 0x4000, /* supports SPMA server-provided MACs */ 122 FIP_FL_FCF = 0x0020, /* originated from a controlling FCF */ 123 FIP_FL_FDF = 0x0010, /* originated from an FDF */ 124 FIP_FL_REC_OR_P2P = 0x0008, /* configured addr or point-to-point */ 125 FIP_FL_AVAIL = 0x0004, /* available for FLOGI/ELP */ 126 FIP_FL_SOL = 0x0002, /* this is a solicited message */ 127 FIP_FL_FPORT = 0x0001, /* sent from an F port */ 128 }; 129 130 /* 131 * Common descriptor header format. 132 */ 133 struct fip_desc { 134 __u8 fip_dtype; /* type - see below */ 135 __u8 fip_dlen; /* length - in 32-bit words */ 136 }; 137 138 enum fip_desc_type { 139 FIP_DT_PRI = 1, /* priority for forwarder selection */ 140 FIP_DT_MAC = 2, /* MAC address */ 141 FIP_DT_MAP_OUI = 3, /* FC-MAP OUI */ 142 FIP_DT_NAME = 4, /* switch name or node name */ 143 FIP_DT_FAB = 5, /* fabric descriptor */ 144 FIP_DT_FCOE_SIZE = 6, /* max FCoE frame size */ 145 FIP_DT_FLOGI = 7, /* FLOGI request or response */ 146 FIP_DT_FDISC = 8, /* FDISC request or response */ 147 FIP_DT_LOGO = 9, /* LOGO request or response */ 148 FIP_DT_ELP = 10, /* ELP request or response */ 149 FIP_DT_VN_ID = 11, /* VN_Node Identifier */ 150 FIP_DT_FKA = 12, /* advertisement keep-alive period */ 151 FIP_DT_VENDOR = 13, /* vendor ID */ 152 FIP_DT_VLAN = 14, /* vlan number */ 153 FIP_DT_FC4F = 15, /* FC-4 features */ 154 FIP_DT_LIMIT, /* max defined desc_type + 1 */ 155 FIP_DT_NON_CRITICAL = 128, /* First non-critical descriptor */ 156 FIP_DT_CLR_VLINKS = 128, /* Clear virtual links reason code */ 157 FIP_DT_VENDOR_BASE = 241, /* first vendor-specific desc_type */ 158 }; 159 160 /* 161 * FIP_DT_PRI - priority descriptor. 162 */ 163 struct fip_pri_desc { 164 struct fip_desc fd_desc; 165 __u8 fd_resvd; 166 __u8 fd_pri; /* FCF priority: higher is better */ 167 } __attribute__((packed)); 168 169 /* 170 * FIP_DT_MAC - MAC address descriptor. 171 */ 172 struct fip_mac_desc { 173 struct fip_desc fd_desc; 174 __u8 fd_mac[ETH_ALEN]; 175 } __attribute__((packed)); 176 177 /* 178 * FIP_DT_MAP - descriptor. 179 */ 180 struct fip_map_desc { 181 struct fip_desc fd_desc; 182 __u8 fd_resvd[3]; 183 __u8 fd_map[3]; 184 } __attribute__((packed)); 185 186 /* 187 * FIP_DT_NAME descriptor. 188 */ 189 struct fip_wwn_desc { 190 struct fip_desc fd_desc; 191 __u8 fd_resvd[2]; 192 __be64 fd_wwn; /* 64-bit WWN, unaligned */ 193 } __attribute__((packed)); 194 195 /* 196 * FIP_DT_FAB descriptor. 197 */ 198 struct fip_fab_desc { 199 struct fip_desc fd_desc; 200 __be16 fd_vfid; /* virtual fabric ID */ 201 __u8 fd_resvd; 202 __u8 fd_map[3]; /* FC-MAP value */ 203 __be64 fd_wwn; /* fabric name, unaligned */ 204 } __attribute__((packed)); 205 206 /* 207 * FIP_DT_FCOE_SIZE descriptor. 208 */ 209 struct fip_size_desc { 210 struct fip_desc fd_desc; 211 __be16 fd_size; 212 } __attribute__((packed)); 213 214 /* 215 * Descriptor that encapsulates an ELS or ILS frame. 216 * The encapsulated frame immediately follows this header, without 217 * SOF, EOF, or CRC. 218 */ 219 struct fip_encaps { 220 struct fip_desc fd_desc; 221 __u8 fd_resvd[2]; 222 } __attribute__((packed)); 223 224 /* 225 * FIP_DT_VN_ID - VN_Node Identifier descriptor. 226 */ 227 struct fip_vn_desc { 228 struct fip_desc fd_desc; 229 __u8 fd_mac[ETH_ALEN]; 230 __u8 fd_resvd; 231 __u8 fd_fc_id[3]; 232 __be64 fd_wwpn; /* port name, unaligned */ 233 } __attribute__((packed)); 234 235 /* 236 * FIP_DT_FKA - Advertisement keep-alive period. 237 */ 238 struct fip_fka_desc { 239 struct fip_desc fd_desc; 240 __u8 fd_resvd; 241 __u8 fd_flags; /* bit0 is fka disable flag */ 242 __be32 fd_fka_period; /* adv./keep-alive period in mS */ 243 } __attribute__((packed)); 244 245 /* 246 * flags for fip_fka_desc.fd_flags 247 */ 248 enum fip_fka_flags { 249 FIP_FKA_ADV_D = 0x01, /* no need for FKA from ENode */ 250 }; 251 252 /* FIP_DT_FKA flags */ 253 254 /* 255 * FIP_DT_VLAN descriptor 256 */ 257 struct fip_vlan_desc { 258 struct fip_desc fd_desc; 259 __be16 fd_vlan; /* Note: highest 4 bytes are unused */ 260 } __attribute__((packed)); 261 262 /* 263 * FIP_DT_FC4F - FC-4 features. 264 */ 265 struct fip_fc4_feat { 266 struct fip_desc fd_desc; 267 __u8 fd_resvd[2]; 268 struct fc_ns_fts fd_fts; 269 struct fc_ns_ff fd_ff; 270 } __attribute__((packed)); 271 272 /* 273 * FIP_DT_VENDOR descriptor. 274 */ 275 struct fip_vendor_desc { 276 struct fip_desc fd_desc; 277 __u8 fd_resvd[2]; 278 __u8 fd_vendor_id[8]; 279 } __attribute__((packed)); 280 281 #endif /* _FC_FIP_H_ */ 282
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.