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