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 Requests. 29 */ 30enum fc_fdmi_req { 31 FC_FDMI_GRHL = 0x0100, /* Get Registered HBA List */ 32 FC_FDMI_GHAT = 0x0101, /* Get HBA Attributes */ 33 FC_FDMI_GRPL = 0x0102, /* Get Registered Port List */ 34 FC_FDMI_GPAT = 0x0110, /* Get Port Attributes */ 35 FC_FDMI_RHBA = 0x0200, /* Register HBA */ 36 FC_FDMI_RHAT = 0x0201, /* Register HBA Attributes */ 37 FC_FDMI_RPRT = 0x0210, /* Register Port */ 38 FC_FDMI_RPA = 0x0211, /* Register Port Attributes */ 39 FC_FDMI_DHBA = 0x0300, /* Deregister HBA */ 40 FC_FDMI_DHAT = 0x0301, /* Deregister HBA Attributes */ 41 FC_FDMI_DPRT = 0x0310, /* Deregister Port */ 42 FC_FDMI_DPA = 0x0311, /* Deregister Port Attributes */ 43}; 44 45/* 46 * HBA Attribute Entry Type 47 */ 48enum fc_fdmi_hba_attr_type { 49 FC_FDMI_HBA_ATTR_NODENAME = 0x0001, 50 FC_FDMI_HBA_ATTR_MANUFACTURER = 0x0002, 51 FC_FDMI_HBA_ATTR_SERIALNUMBER = 0x0003, 52 FC_FDMI_HBA_ATTR_MODEL = 0x0004, 53 FC_FDMI_HBA_ATTR_MODELDESCRIPTION = 0x0005, 54 FC_FDMI_HBA_ATTR_HARDWAREVERSION = 0x0006, 55 FC_FDMI_HBA_ATTR_DRIVERVERSION = 0x0007, 56 FC_FDMI_HBA_ATTR_OPTIONROMVERSION = 0x0008, 57 FC_FDMI_HBA_ATTR_FIRMWAREVERSION = 0x0009, 58 FC_FDMI_HBA_ATTR_OSNAMEVERSION = 0x000A, 59 FC_FDMI_HBA_ATTR_MAXCTPAYLOAD = 0x000B, 60}; 61 62/* 63 * HBA Attribute Length 64 */ 65#define FC_FDMI_HBA_ATTR_NODENAME_LEN 8 66#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 64 67#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 64 68#define FC_FDMI_HBA_ATTR_MODEL_LEN 256 69#define FC_FDMI_HBA_ATTR_MODELDESCR_LEN 256 70#define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN 256 71#define FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN 256 72#define FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN 256 73#define FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN 256 74#define FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN 256 75#define FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN 4 76 77/* 78 * Port Attribute Type 79 */ 80enum fc_fdmi_port_attr_type { 81 FC_FDMI_PORT_ATTR_FC4TYPES = 0x0001, 82 FC_FDMI_PORT_ATTR_SUPPORTEDSPEED = 0x0002, 83 FC_FDMI_PORT_ATTR_CURRENTPORTSPEED = 0x0003, 84 FC_FDMI_PORT_ATTR_MAXFRAMESIZE = 0x0004, 85 FC_FDMI_PORT_ATTR_OSDEVICENAME = 0x0005, 86 FC_FDMI_PORT_ATTR_HOSTNAME = 0x0006, 87}; 88 89/* 90 * Port Attribute Length 91 */ 92#define FC_FDMI_PORT_ATTR_FC4TYPES_LEN 32 93#define FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN 4 94#define FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN 4 95#define FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN 4 96#define FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN 256 97#define FC_FDMI_PORT_ATTR_HOSTNAME_LEN 256 98 99/* 100 * HBA Attribute ID 101 */ 102struct fc_fdmi_hba_identifier { 103 __be64 id; 104}; 105 106/* 107 * Port Name 108 */ 109struct fc_fdmi_port_name { 110 __be64 portname; 111}; 112 113/* 114 * Attribute Entry Block for HBA/Port Attributes 115 */ 116#define FC_FDMI_ATTR_ENTRY_HEADER_LEN 4 117struct fc_fdmi_attr_entry { 118 __be16 type; 119 __be16 len; 120 __u8 value[1]; 121} __attribute__((__packed__)); 122 123/* 124 * Common for HBA/Port Attributes 125 */ 126struct fs_fdmi_attrs { 127 __be32 numattrs; 128 struct fc_fdmi_attr_entry attr[1]; 129} __attribute__((__packed__)); 130 131/* 132 * Registered Port List 133 */ 134struct fc_fdmi_rpl { 135 __be32 numport; 136 struct fc_fdmi_port_name port[1]; 137} __attribute__((__packed__)); 138 139/* 140 * Register HBA (RHBA) 141 */ 142struct fc_fdmi_rhba { 143 struct fc_fdmi_hba_identifier hbaid; 144 struct fc_fdmi_rpl port; 145 struct fs_fdmi_attrs hba_attrs; 146} __attribute__((__packed__)); 147 148/* 149 * Register HBA Attributes (RHAT) 150 */ 151struct fc_fdmi_rhat { 152 struct fc_fdmi_hba_identifier hbaid; 153 struct fs_fdmi_attrs hba_attrs; 154} __attribute__((__packed__)); 155 156/* 157 * Register Port (RPRT) 158 */ 159struct fc_fdmi_rprt { 160 struct fc_fdmi_hba_identifier hbaid; 161 struct fc_fdmi_port_name port; 162 struct fs_fdmi_attrs hba_attrs; 163} __attribute__((__packed__)); 164 165/* 166 * Register Port Attributes (RPA) 167 */ 168struct fc_fdmi_rpa { 169 struct fc_fdmi_port_name port; 170 struct fs_fdmi_attrs hba_attrs; 171} __attribute__((__packed__)); 172 173/* 174 * Deregister Port (DPRT) 175 */ 176struct fc_fdmi_dprt { 177 struct fc_fdmi_port_name port; 178} __attribute__((__packed__)); 179 180/* 181 * Deregister Port Attributes (DPA) 182 */ 183struct fc_fdmi_dpa { 184 struct fc_fdmi_port_name port; 185 struct fs_fdmi_attrs hba_attrs; 186} __attribute__((__packed__)); 187 188/* 189 * Deregister HBA Attributes (DHAT) 190 */ 191struct fc_fdmi_dhat { 192 struct fc_fdmi_hba_identifier hbaid; 193} __attribute__((__packed__)); 194 195/* 196 * Deregister HBA (DHBA) 197 */ 198struct fc_fdmi_dhba { 199 struct fc_fdmi_hba_identifier hbaid; 200} __attribute__((__packed__)); 201 202#endif /* _FC_MS_H_ */ 203