18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright(c) 2011 Intel Corporation. All rights reserved.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Maintained at www.Open-FCoE.org
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef _FC_MS_H_
98c2ecf20Sopenharmony_ci#define	_FC_MS_H_
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/types.h>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci/*
148c2ecf20Sopenharmony_ci * Fibre Channel Services - Management Service (MS)
158c2ecf20Sopenharmony_ci * From T11.org FC-GS-4 Rev 7.91 February 4, 2004
168c2ecf20Sopenharmony_ci */
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/*
198c2ecf20Sopenharmony_ci * Fabric Device Management Interface
208c2ecf20Sopenharmony_ci */
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/*
238c2ecf20Sopenharmony_ci * Common-transport sub-type for FDMI
248c2ecf20Sopenharmony_ci */
258c2ecf20Sopenharmony_ci#define	FC_FDMI_SUBTYPE	    0x10 /* fs_ct_hdr.ct_fs_subtype */
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci/*
288c2ecf20Sopenharmony_ci * Management server FDMI Requests.
298c2ecf20Sopenharmony_ci */
308c2ecf20Sopenharmony_cienum fc_fdmi_req {
318c2ecf20Sopenharmony_ci	FC_FDMI_GRHL = 0x0100,	/* Get Registered HBA List */
328c2ecf20Sopenharmony_ci	FC_FDMI_GHAT = 0x0101,	/* Get HBA Attributes */
338c2ecf20Sopenharmony_ci	FC_FDMI_GRPL = 0x0102,	/* Get Registered Port List */
348c2ecf20Sopenharmony_ci	FC_FDMI_GPAT = 0x0110,	/* Get Port Attributes */
358c2ecf20Sopenharmony_ci	FC_FDMI_RHBA = 0x0200,	/* Register HBA */
368c2ecf20Sopenharmony_ci	FC_FDMI_RHAT = 0x0201,	/* Register HBA Attributes */
378c2ecf20Sopenharmony_ci	FC_FDMI_RPRT = 0x0210,	/* Register Port */
388c2ecf20Sopenharmony_ci	FC_FDMI_RPA = 0x0211,	/* Register Port Attributes */
398c2ecf20Sopenharmony_ci	FC_FDMI_DHBA = 0x0300,	/* Deregister HBA */
408c2ecf20Sopenharmony_ci	FC_FDMI_DHAT = 0x0301,	/* Deregister HBA Attributes */
418c2ecf20Sopenharmony_ci	FC_FDMI_DPRT = 0x0310,	/* Deregister Port */
428c2ecf20Sopenharmony_ci	FC_FDMI_DPA = 0x0311,	/* Deregister Port Attributes */
438c2ecf20Sopenharmony_ci};
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci/*
468c2ecf20Sopenharmony_ci * HBA Attribute Entry Type
478c2ecf20Sopenharmony_ci */
488c2ecf20Sopenharmony_cienum fc_fdmi_hba_attr_type {
498c2ecf20Sopenharmony_ci	FC_FDMI_HBA_ATTR_NODENAME = 0x0001,
508c2ecf20Sopenharmony_ci	FC_FDMI_HBA_ATTR_MANUFACTURER = 0x0002,
518c2ecf20Sopenharmony_ci	FC_FDMI_HBA_ATTR_SERIALNUMBER = 0x0003,
528c2ecf20Sopenharmony_ci	FC_FDMI_HBA_ATTR_MODEL = 0x0004,
538c2ecf20Sopenharmony_ci	FC_FDMI_HBA_ATTR_MODELDESCRIPTION = 0x0005,
548c2ecf20Sopenharmony_ci	FC_FDMI_HBA_ATTR_HARDWAREVERSION = 0x0006,
558c2ecf20Sopenharmony_ci	FC_FDMI_HBA_ATTR_DRIVERVERSION = 0x0007,
568c2ecf20Sopenharmony_ci	FC_FDMI_HBA_ATTR_OPTIONROMVERSION = 0x0008,
578c2ecf20Sopenharmony_ci	FC_FDMI_HBA_ATTR_FIRMWAREVERSION = 0x0009,
588c2ecf20Sopenharmony_ci	FC_FDMI_HBA_ATTR_OSNAMEVERSION = 0x000A,
598c2ecf20Sopenharmony_ci	FC_FDMI_HBA_ATTR_MAXCTPAYLOAD = 0x000B,
608c2ecf20Sopenharmony_ci};
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci/*
638c2ecf20Sopenharmony_ci * HBA Attribute Length
648c2ecf20Sopenharmony_ci */
658c2ecf20Sopenharmony_ci#define FC_FDMI_HBA_ATTR_NODENAME_LEN		8
668c2ecf20Sopenharmony_ci#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN	64
678c2ecf20Sopenharmony_ci#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN	64
688c2ecf20Sopenharmony_ci#define FC_FDMI_HBA_ATTR_MODEL_LEN		256
698c2ecf20Sopenharmony_ci#define FC_FDMI_HBA_ATTR_MODELDESCR_LEN		256
708c2ecf20Sopenharmony_ci#define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN	256
718c2ecf20Sopenharmony_ci#define FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN	256
728c2ecf20Sopenharmony_ci#define FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN	256
738c2ecf20Sopenharmony_ci#define FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN	256
748c2ecf20Sopenharmony_ci#define FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN	256
758c2ecf20Sopenharmony_ci#define FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN	4
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci/*
788c2ecf20Sopenharmony_ci * Port Attribute Type
798c2ecf20Sopenharmony_ci */
808c2ecf20Sopenharmony_cienum fc_fdmi_port_attr_type {
818c2ecf20Sopenharmony_ci	FC_FDMI_PORT_ATTR_FC4TYPES = 0x0001,
828c2ecf20Sopenharmony_ci	FC_FDMI_PORT_ATTR_SUPPORTEDSPEED = 0x0002,
838c2ecf20Sopenharmony_ci	FC_FDMI_PORT_ATTR_CURRENTPORTSPEED = 0x0003,
848c2ecf20Sopenharmony_ci	FC_FDMI_PORT_ATTR_MAXFRAMESIZE = 0x0004,
858c2ecf20Sopenharmony_ci	FC_FDMI_PORT_ATTR_OSDEVICENAME = 0x0005,
868c2ecf20Sopenharmony_ci	FC_FDMI_PORT_ATTR_HOSTNAME = 0x0006,
878c2ecf20Sopenharmony_ci};
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci/*
908c2ecf20Sopenharmony_ci * Port Attribute Length
918c2ecf20Sopenharmony_ci */
928c2ecf20Sopenharmony_ci#define FC_FDMI_PORT_ATTR_FC4TYPES_LEN		32
938c2ecf20Sopenharmony_ci#define FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN	4
948c2ecf20Sopenharmony_ci#define FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN	4
958c2ecf20Sopenharmony_ci#define FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN	4
968c2ecf20Sopenharmony_ci#define FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN	256
978c2ecf20Sopenharmony_ci#define FC_FDMI_PORT_ATTR_HOSTNAME_LEN		256
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci/*
1008c2ecf20Sopenharmony_ci * HBA Attribute ID
1018c2ecf20Sopenharmony_ci */
1028c2ecf20Sopenharmony_cistruct fc_fdmi_hba_identifier {
1038c2ecf20Sopenharmony_ci	__be64		id;
1048c2ecf20Sopenharmony_ci};
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci/*
1078c2ecf20Sopenharmony_ci * Port Name
1088c2ecf20Sopenharmony_ci */
1098c2ecf20Sopenharmony_cistruct fc_fdmi_port_name {
1108c2ecf20Sopenharmony_ci	__be64		portname;
1118c2ecf20Sopenharmony_ci};
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci/*
1148c2ecf20Sopenharmony_ci * Attribute Entry Block for HBA/Port Attributes
1158c2ecf20Sopenharmony_ci */
1168c2ecf20Sopenharmony_ci#define FC_FDMI_ATTR_ENTRY_HEADER_LEN	4
1178c2ecf20Sopenharmony_cistruct fc_fdmi_attr_entry {
1188c2ecf20Sopenharmony_ci	__be16		type;
1198c2ecf20Sopenharmony_ci	__be16		len;
1208c2ecf20Sopenharmony_ci	__u8		value[1];
1218c2ecf20Sopenharmony_ci} __attribute__((__packed__));
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci/*
1248c2ecf20Sopenharmony_ci * Common for HBA/Port Attributes
1258c2ecf20Sopenharmony_ci */
1268c2ecf20Sopenharmony_cistruct fs_fdmi_attrs {
1278c2ecf20Sopenharmony_ci	__be32				numattrs;
1288c2ecf20Sopenharmony_ci	struct fc_fdmi_attr_entry	attr[1];
1298c2ecf20Sopenharmony_ci} __attribute__((__packed__));
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci/*
1328c2ecf20Sopenharmony_ci * Registered Port List
1338c2ecf20Sopenharmony_ci */
1348c2ecf20Sopenharmony_cistruct fc_fdmi_rpl {
1358c2ecf20Sopenharmony_ci	__be32				numport;
1368c2ecf20Sopenharmony_ci	struct fc_fdmi_port_name	port[1];
1378c2ecf20Sopenharmony_ci} __attribute__((__packed__));
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci/*
1408c2ecf20Sopenharmony_ci * Register HBA (RHBA)
1418c2ecf20Sopenharmony_ci */
1428c2ecf20Sopenharmony_cistruct fc_fdmi_rhba {
1438c2ecf20Sopenharmony_ci	struct fc_fdmi_hba_identifier hbaid;
1448c2ecf20Sopenharmony_ci	struct fc_fdmi_rpl		 port;
1458c2ecf20Sopenharmony_ci	struct fs_fdmi_attrs		 hba_attrs;
1468c2ecf20Sopenharmony_ci} __attribute__((__packed__));
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci/*
1498c2ecf20Sopenharmony_ci * Register HBA Attributes (RHAT)
1508c2ecf20Sopenharmony_ci */
1518c2ecf20Sopenharmony_cistruct fc_fdmi_rhat {
1528c2ecf20Sopenharmony_ci	struct fc_fdmi_hba_identifier hbaid;
1538c2ecf20Sopenharmony_ci	struct fs_fdmi_attrs		 hba_attrs;
1548c2ecf20Sopenharmony_ci} __attribute__((__packed__));
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci/*
1578c2ecf20Sopenharmony_ci * Register Port (RPRT)
1588c2ecf20Sopenharmony_ci */
1598c2ecf20Sopenharmony_cistruct fc_fdmi_rprt {
1608c2ecf20Sopenharmony_ci	struct fc_fdmi_hba_identifier hbaid;
1618c2ecf20Sopenharmony_ci	struct fc_fdmi_port_name	 port;
1628c2ecf20Sopenharmony_ci	struct fs_fdmi_attrs		 hba_attrs;
1638c2ecf20Sopenharmony_ci} __attribute__((__packed__));
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci/*
1668c2ecf20Sopenharmony_ci * Register Port Attributes (RPA)
1678c2ecf20Sopenharmony_ci */
1688c2ecf20Sopenharmony_cistruct fc_fdmi_rpa {
1698c2ecf20Sopenharmony_ci	struct fc_fdmi_port_name	 port;
1708c2ecf20Sopenharmony_ci	struct fs_fdmi_attrs		 hba_attrs;
1718c2ecf20Sopenharmony_ci} __attribute__((__packed__));
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci/*
1748c2ecf20Sopenharmony_ci * Deregister Port (DPRT)
1758c2ecf20Sopenharmony_ci */
1768c2ecf20Sopenharmony_cistruct fc_fdmi_dprt {
1778c2ecf20Sopenharmony_ci	struct fc_fdmi_port_name	 port;
1788c2ecf20Sopenharmony_ci} __attribute__((__packed__));
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ci/*
1818c2ecf20Sopenharmony_ci * Deregister Port Attributes (DPA)
1828c2ecf20Sopenharmony_ci */
1838c2ecf20Sopenharmony_cistruct fc_fdmi_dpa {
1848c2ecf20Sopenharmony_ci	struct fc_fdmi_port_name	 port;
1858c2ecf20Sopenharmony_ci	struct fs_fdmi_attrs		 hba_attrs;
1868c2ecf20Sopenharmony_ci} __attribute__((__packed__));
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_ci/*
1898c2ecf20Sopenharmony_ci * Deregister HBA Attributes (DHAT)
1908c2ecf20Sopenharmony_ci */
1918c2ecf20Sopenharmony_cistruct fc_fdmi_dhat {
1928c2ecf20Sopenharmony_ci	struct fc_fdmi_hba_identifier hbaid;
1938c2ecf20Sopenharmony_ci} __attribute__((__packed__));
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_ci/*
1968c2ecf20Sopenharmony_ci * Deregister HBA (DHBA)
1978c2ecf20Sopenharmony_ci */
1988c2ecf20Sopenharmony_cistruct fc_fdmi_dhba {
1998c2ecf20Sopenharmony_ci	struct fc_fdmi_hba_identifier hbaid;
2008c2ecf20Sopenharmony_ci} __attribute__((__packed__));
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_ci#endif /* _FC_MS_H_ */
203