1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright(c) 2011 Intel Corporation. All rights reserved. 4 * 5 * Maintained at www.Open-FCoE.org 6 */ 7 8 #ifndef _FC_MS_H_ 9 #define _FC_MS_H_ 10 11 #include <linux/types.h> 12 13 /* 14 * Fibre Channel Services - Management Service (MS) 15 * From T11.org FC-GS-4 Rev 7.91 February 4, 2004 16 */ 17 18 /* 19 * Fabric Device Management Interface 20 */ 21 22 /* 23 * Common-transport sub-type for FDMI 24 */ 25 #define FC_FDMI_SUBTYPE 0x10 /* fs_ct_hdr.ct_fs_subtype */ 26 27 /* 28 * Management server FDMI specifications. 29 */ 30 #define FDMI_V1 1 /* FDMI version 1 specifications */ 31 #define FDMI_V2 2 /* FDMI version 2 specifications */ 32 33 /* 34 * Management server FDMI Requests. 35 */ 36 enum fc_fdmi_req { 37 FC_FDMI_GRHL = 0x0100, /* Get Registered HBA List */ 38 FC_FDMI_GHAT = 0x0101, /* Get HBA Attributes */ 39 FC_FDMI_GRPL = 0x0102, /* Get Registered Port List */ 40 FC_FDMI_GPAT = 0x0110, /* Get Port Attributes */ 41 FC_FDMI_RHBA = 0x0200, /* Register HBA */ 42 FC_FDMI_RHAT = 0x0201, /* Register HBA Attributes */ 43 FC_FDMI_RPRT = 0x0210, /* Register Port */ 44 FC_FDMI_RPA = 0x0211, /* Register Port Attributes */ 45 FC_FDMI_DHBA = 0x0300, /* Deregister HBA */ 46 FC_FDMI_DHAT = 0x0301, /* Deregister HBA Attributes */ 47 FC_FDMI_DPRT = 0x0310, /* Deregister Port */ 48 FC_FDMI_DPA = 0x0311, /* Deregister Port Attributes */ 49 }; 50 51 /* 52 * HBA Attribute Entry Type 53 */ 54 enum fc_fdmi_hba_attr_type { 55 FC_FDMI_HBA_ATTR_NODENAME = 0x0001, 56 FC_FDMI_HBA_ATTR_MANUFACTURER = 0x0002, 57 FC_FDMI_HBA_ATTR_SERIALNUMBER = 0x0003, 58 FC_FDMI_HBA_ATTR_MODEL = 0x0004, 59 FC_FDMI_HBA_ATTR_MODELDESCRIPTION = 0x0005, 60 FC_FDMI_HBA_ATTR_HARDWAREVERSION = 0x0006, 61 FC_FDMI_HBA_ATTR_DRIVERVERSION = 0x0007, 62 FC_FDMI_HBA_ATTR_OPTIONROMVERSION = 0x0008, 63 FC_FDMI_HBA_ATTR_FIRMWAREVERSION = 0x0009, 64 FC_FDMI_HBA_ATTR_OSNAMEVERSION = 0x000A, 65 FC_FDMI_HBA_ATTR_MAXCTPAYLOAD = 0x000B, 66 FC_FDMI_HBA_ATTR_NODESYMBLNAME = 0x000C, 67 FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO = 0x000D, 68 FC_FDMI_HBA_ATTR_NUMBEROFPORTS = 0x000E, 69 FC_FDMI_HBA_ATTR_FABRICNAME = 0x000F, 70 FC_FDMI_HBA_ATTR_BIOSVERSION = 0x0010, 71 FC_FDMI_HBA_ATTR_BIOSSTATE = 0x0011, 72 FC_FDMI_HBA_ATTR_VENDORIDENTIFIER = 0x00E0, 73 }; 74 75 /* 76 * HBA Attribute Length 77 */ 78 #define FC_FDMI_HBA_ATTR_NODENAME_LEN 8 79 #define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 64 80 #define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 64 81 #define FC_FDMI_HBA_ATTR_MODEL_LEN 64 82 #define FC_FDMI_HBA_ATTR_MODELDESCR_LEN 64 83 #define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN 64 84 #define FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN 64 85 #define FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN 64 86 #define FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN 64 87 #define FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN 128 88 #define FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN 4 89 #define FC_FDMI_HBA_ATTR_NODESYMBLNAME_LEN 64 90 #define FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO_LEN 4 91 #define FC_FDMI_HBA_ATTR_NUMBEROFPORTS_LEN 4 92 #define FC_FDMI_HBA_ATTR_FABRICNAME_LEN 8 93 #define FC_FDMI_HBA_ATTR_BIOSVERSION_LEN 64 94 #define FC_FDMI_HBA_ATTR_BIOSSTATE_LEN 4 95 #define FC_FDMI_HBA_ATTR_VENDORIDENTIFIER_LEN 8 96 97 /* 98 * Port Attribute Type 99 */ 100 enum fc_fdmi_port_attr_type { 101 FC_FDMI_PORT_ATTR_FC4TYPES = 0x0001, 102 FC_FDMI_PORT_ATTR_SUPPORTEDSPEED = 0x0002, 103 FC_FDMI_PORT_ATTR_CURRENTPORTSPEED = 0x0003, 104 FC_FDMI_PORT_ATTR_MAXFRAMESIZE = 0x0004, 105 FC_FDMI_PORT_ATTR_OSDEVICENAME = 0x0005, 106 FC_FDMI_PORT_ATTR_HOSTNAME = 0x0006, 107 FC_FDMI_PORT_ATTR_NODENAME = 0x0007, 108 FC_FDMI_PORT_ATTR_PORTNAME = 0x0008, 109 FC_FDMI_PORT_ATTR_SYMBOLICNAME = 0x0009, 110 FC_FDMI_PORT_ATTR_PORTTYPE = 0x000A, 111 FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC = 0x000B, 112 FC_FDMI_PORT_ATTR_FABRICNAME = 0x000C, 113 FC_FDMI_PORT_ATTR_CURRENTFC4TYPE = 0x000D, 114 FC_FDMI_PORT_ATTR_PORTSTATE = 0x101, 115 FC_FDMI_PORT_ATTR_DISCOVEREDPORTS = 0x102, 116 FC_FDMI_PORT_ATTR_PORTID = 0x103, 117 }; 118 119 /* 120 * Port Attribute Length 121 */ 122 #define FC_FDMI_PORT_ATTR_FC4TYPES_LEN 32 123 #define FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN 4 124 #define FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN 4 125 #define FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN 4 126 #define FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN 256 127 #define FC_FDMI_PORT_ATTR_HOSTNAME_LEN 256 128 #define FC_FDMI_PORT_ATTR_NODENAME_LEN 8 129 #define FC_FDMI_PORT_ATTR_PORTNAME_LEN 8 130 #define FC_FDMI_PORT_ATTR_SYMBOLICNAME_LEN 256 131 #define FC_FDMI_PORT_ATTR_PORTTYPE_LEN 4 132 #define FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC_LEN 4 133 #define FC_FDMI_PORT_ATTR_FABRICNAME_LEN 8 134 #define FC_FDMI_PORT_ATTR_CURRENTFC4TYPE_LEN 32 135 #define FC_FDMI_PORT_ATTR_PORTSTATE_LEN 4 136 #define FC_FDMI_PORT_ATTR_DISCOVEREDPORTS_LEN 4 137 #define FC_FDMI_PORT_ATTR_PORTID_LEN 4 138 139 140 /* 141 * HBA Attribute ID 142 */ 143 struct fc_fdmi_hba_identifier { 144 __be64 id; 145 }; 146 147 /* 148 * Port Name 149 */ 150 struct fc_fdmi_port_name { 151 __be64 portname; 152 }; 153 154 /* 155 * Attribute Entry Block for HBA/Port Attributes 156 */ 157 #define FC_FDMI_ATTR_ENTRY_HEADER_LEN 4 158 struct fc_fdmi_attr_entry { 159 __be16 type; 160 __be16 len; 161 __u8 value[1]; 162 } __attribute__((__packed__)); 163 164 /* 165 * Common for HBA/Port Attributes 166 */ 167 struct fs_fdmi_attrs { 168 __be32 numattrs; 169 struct fc_fdmi_attr_entry attr[1]; 170 } __attribute__((__packed__)); 171 172 /* 173 * Registered Port List 174 */ 175 struct fc_fdmi_rpl { 176 __be32 numport; 177 struct fc_fdmi_port_name port[1]; 178 } __attribute__((__packed__)); 179 180 /* 181 * Register HBA (RHBA) 182 */ 183 struct fc_fdmi_rhba { 184 struct fc_fdmi_hba_identifier hbaid; 185 struct fc_fdmi_rpl port; 186 struct fs_fdmi_attrs hba_attrs; 187 } __attribute__((__packed__)); 188 189 /* 190 * Register HBA Attributes (RHAT) 191 */ 192 struct fc_fdmi_rhat { 193 struct fc_fdmi_hba_identifier hbaid; 194 struct fs_fdmi_attrs hba_attrs; 195 } __attribute__((__packed__)); 196 197 /* 198 * Register Port (RPRT) 199 */ 200 struct fc_fdmi_rprt { 201 struct fc_fdmi_hba_identifier hbaid; 202 struct fc_fdmi_port_name port; 203 struct fs_fdmi_attrs hba_attrs; 204 } __attribute__((__packed__)); 205 206 /* 207 * Register Port Attributes (RPA) 208 */ 209 struct fc_fdmi_rpa { 210 struct fc_fdmi_port_name port; 211 struct fs_fdmi_attrs hba_attrs; 212 } __attribute__((__packed__)); 213 214 /* 215 * Deregister Port (DPRT) 216 */ 217 struct fc_fdmi_dprt { 218 struct fc_fdmi_port_name port; 219 } __attribute__((__packed__)); 220 221 /* 222 * Deregister Port Attributes (DPA) 223 */ 224 struct fc_fdmi_dpa { 225 struct fc_fdmi_port_name port; 226 struct fs_fdmi_attrs hba_attrs; 227 } __attribute__((__packed__)); 228 229 /* 230 * Deregister HBA Attributes (DHAT) 231 */ 232 struct fc_fdmi_dhat { 233 struct fc_fdmi_hba_identifier hbaid; 234 } __attribute__((__packed__)); 235 236 /* 237 * Deregister HBA (DHBA) 238 */ 239 struct fc_fdmi_dhba { 240 struct fc_fdmi_hba_identifier hbaid; 241 } __attribute__((__packed__)); 242 243 #endif /* _FC_MS_H_ */ 244