162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright(c) 2011 Intel Corporation. All rights reserved.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Maintained at www.Open-FCoE.org
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef _FC_MS_H_
962306a36Sopenharmony_ci#define	_FC_MS_H_
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include <linux/types.h>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci/*
1462306a36Sopenharmony_ci * Fibre Channel Services - Management Service (MS)
1562306a36Sopenharmony_ci * From T11.org FC-GS-4 Rev 7.91 February 4, 2004
1662306a36Sopenharmony_ci */
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci/*
1962306a36Sopenharmony_ci * Fabric Device Management Interface
2062306a36Sopenharmony_ci */
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci/*
2362306a36Sopenharmony_ci * Common-transport sub-type for FDMI
2462306a36Sopenharmony_ci */
2562306a36Sopenharmony_ci#define	FC_FDMI_SUBTYPE	    0x10 /* fs_ct_hdr.ct_fs_subtype */
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci/*
2862306a36Sopenharmony_ci * Management server FDMI specifications.
2962306a36Sopenharmony_ci */
3062306a36Sopenharmony_ci#define	FDMI_V1	    1 /* FDMI version 1 specifications */
3162306a36Sopenharmony_ci#define	FDMI_V2	    2 /* FDMI version 2 specifications */
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci/*
3462306a36Sopenharmony_ci * Management server FDMI Requests.
3562306a36Sopenharmony_ci */
3662306a36Sopenharmony_cienum fc_fdmi_req {
3762306a36Sopenharmony_ci	FC_FDMI_GRHL = 0x0100,	/* Get Registered HBA List */
3862306a36Sopenharmony_ci	FC_FDMI_GHAT = 0x0101,	/* Get HBA Attributes */
3962306a36Sopenharmony_ci	FC_FDMI_GRPL = 0x0102,	/* Get Registered Port List */
4062306a36Sopenharmony_ci	FC_FDMI_GPAT = 0x0110,	/* Get Port Attributes */
4162306a36Sopenharmony_ci	FC_FDMI_RHBA = 0x0200,	/* Register HBA */
4262306a36Sopenharmony_ci	FC_FDMI_RHAT = 0x0201,	/* Register HBA Attributes */
4362306a36Sopenharmony_ci	FC_FDMI_RPRT = 0x0210,	/* Register Port */
4462306a36Sopenharmony_ci	FC_FDMI_RPA = 0x0211,	/* Register Port Attributes */
4562306a36Sopenharmony_ci	FC_FDMI_DHBA = 0x0300,	/* Deregister HBA */
4662306a36Sopenharmony_ci	FC_FDMI_DHAT = 0x0301,	/* Deregister HBA Attributes */
4762306a36Sopenharmony_ci	FC_FDMI_DPRT = 0x0310,	/* Deregister Port */
4862306a36Sopenharmony_ci	FC_FDMI_DPA = 0x0311,	/* Deregister Port Attributes */
4962306a36Sopenharmony_ci};
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci/*
5262306a36Sopenharmony_ci * HBA Attribute Entry Type
5362306a36Sopenharmony_ci */
5462306a36Sopenharmony_cienum fc_fdmi_hba_attr_type {
5562306a36Sopenharmony_ci	FC_FDMI_HBA_ATTR_NODENAME = 0x0001,
5662306a36Sopenharmony_ci	FC_FDMI_HBA_ATTR_MANUFACTURER = 0x0002,
5762306a36Sopenharmony_ci	FC_FDMI_HBA_ATTR_SERIALNUMBER = 0x0003,
5862306a36Sopenharmony_ci	FC_FDMI_HBA_ATTR_MODEL = 0x0004,
5962306a36Sopenharmony_ci	FC_FDMI_HBA_ATTR_MODELDESCRIPTION = 0x0005,
6062306a36Sopenharmony_ci	FC_FDMI_HBA_ATTR_HARDWAREVERSION = 0x0006,
6162306a36Sopenharmony_ci	FC_FDMI_HBA_ATTR_DRIVERVERSION = 0x0007,
6262306a36Sopenharmony_ci	FC_FDMI_HBA_ATTR_OPTIONROMVERSION = 0x0008,
6362306a36Sopenharmony_ci	FC_FDMI_HBA_ATTR_FIRMWAREVERSION = 0x0009,
6462306a36Sopenharmony_ci	FC_FDMI_HBA_ATTR_OSNAMEVERSION = 0x000A,
6562306a36Sopenharmony_ci	FC_FDMI_HBA_ATTR_MAXCTPAYLOAD = 0x000B,
6662306a36Sopenharmony_ci	FC_FDMI_HBA_ATTR_NODESYMBLNAME = 0x000C,
6762306a36Sopenharmony_ci	FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO = 0x000D,
6862306a36Sopenharmony_ci	FC_FDMI_HBA_ATTR_NUMBEROFPORTS = 0x000E,
6962306a36Sopenharmony_ci	FC_FDMI_HBA_ATTR_FABRICNAME = 0x000F,
7062306a36Sopenharmony_ci	FC_FDMI_HBA_ATTR_BIOSVERSION = 0x0010,
7162306a36Sopenharmony_ci	FC_FDMI_HBA_ATTR_BIOSSTATE = 0x0011,
7262306a36Sopenharmony_ci	FC_FDMI_HBA_ATTR_VENDORIDENTIFIER = 0x00E0,
7362306a36Sopenharmony_ci};
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci/*
7662306a36Sopenharmony_ci * HBA Attribute Length
7762306a36Sopenharmony_ci */
7862306a36Sopenharmony_ci#define FC_FDMI_HBA_ATTR_NODENAME_LEN		8
7962306a36Sopenharmony_ci#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN	64
8062306a36Sopenharmony_ci#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN	64
8162306a36Sopenharmony_ci#define FC_FDMI_HBA_ATTR_MODEL_LEN		64
8262306a36Sopenharmony_ci#define FC_FDMI_HBA_ATTR_MODELDESCR_LEN		64
8362306a36Sopenharmony_ci#define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN	64
8462306a36Sopenharmony_ci#define FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN	64
8562306a36Sopenharmony_ci#define FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN	64
8662306a36Sopenharmony_ci#define FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN	64
8762306a36Sopenharmony_ci#define FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN	128
8862306a36Sopenharmony_ci#define FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN	4
8962306a36Sopenharmony_ci#define FC_FDMI_HBA_ATTR_NODESYMBLNAME_LEN	64
9062306a36Sopenharmony_ci#define FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO_LEN	4
9162306a36Sopenharmony_ci#define FC_FDMI_HBA_ATTR_NUMBEROFPORTS_LEN	4
9262306a36Sopenharmony_ci#define FC_FDMI_HBA_ATTR_FABRICNAME_LEN	8
9362306a36Sopenharmony_ci#define FC_FDMI_HBA_ATTR_BIOSVERSION_LEN	64
9462306a36Sopenharmony_ci#define FC_FDMI_HBA_ATTR_BIOSSTATE_LEN    4
9562306a36Sopenharmony_ci#define FC_FDMI_HBA_ATTR_VENDORIDENTIFIER_LEN 8
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci/*
9862306a36Sopenharmony_ci * Port Attribute Type
9962306a36Sopenharmony_ci */
10062306a36Sopenharmony_cienum fc_fdmi_port_attr_type {
10162306a36Sopenharmony_ci	FC_FDMI_PORT_ATTR_FC4TYPES = 0x0001,
10262306a36Sopenharmony_ci	FC_FDMI_PORT_ATTR_SUPPORTEDSPEED = 0x0002,
10362306a36Sopenharmony_ci	FC_FDMI_PORT_ATTR_CURRENTPORTSPEED = 0x0003,
10462306a36Sopenharmony_ci	FC_FDMI_PORT_ATTR_MAXFRAMESIZE = 0x0004,
10562306a36Sopenharmony_ci	FC_FDMI_PORT_ATTR_OSDEVICENAME = 0x0005,
10662306a36Sopenharmony_ci	FC_FDMI_PORT_ATTR_HOSTNAME = 0x0006,
10762306a36Sopenharmony_ci	FC_FDMI_PORT_ATTR_NODENAME = 0x0007,
10862306a36Sopenharmony_ci	FC_FDMI_PORT_ATTR_PORTNAME = 0x0008,
10962306a36Sopenharmony_ci	FC_FDMI_PORT_ATTR_SYMBOLICNAME = 0x0009,
11062306a36Sopenharmony_ci	FC_FDMI_PORT_ATTR_PORTTYPE = 0x000A,
11162306a36Sopenharmony_ci	FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC = 0x000B,
11262306a36Sopenharmony_ci	FC_FDMI_PORT_ATTR_FABRICNAME = 0x000C,
11362306a36Sopenharmony_ci	FC_FDMI_PORT_ATTR_CURRENTFC4TYPE = 0x000D,
11462306a36Sopenharmony_ci	FC_FDMI_PORT_ATTR_PORTSTATE = 0x101,
11562306a36Sopenharmony_ci	FC_FDMI_PORT_ATTR_DISCOVEREDPORTS = 0x102,
11662306a36Sopenharmony_ci	FC_FDMI_PORT_ATTR_PORTID = 0x103,
11762306a36Sopenharmony_ci};
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ci/*
12062306a36Sopenharmony_ci * Port Attribute Length
12162306a36Sopenharmony_ci */
12262306a36Sopenharmony_ci#define FC_FDMI_PORT_ATTR_FC4TYPES_LEN		32
12362306a36Sopenharmony_ci#define FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN	4
12462306a36Sopenharmony_ci#define FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN	4
12562306a36Sopenharmony_ci#define FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN	4
12662306a36Sopenharmony_ci#define FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN	256
12762306a36Sopenharmony_ci#define FC_FDMI_PORT_ATTR_HOSTNAME_LEN		256
12862306a36Sopenharmony_ci#define FC_FDMI_PORT_ATTR_NODENAME_LEN		8
12962306a36Sopenharmony_ci#define FC_FDMI_PORT_ATTR_PORTNAME_LEN		8
13062306a36Sopenharmony_ci#define FC_FDMI_PORT_ATTR_SYMBOLICNAME_LEN	256
13162306a36Sopenharmony_ci#define FC_FDMI_PORT_ATTR_PORTTYPE_LEN		4
13262306a36Sopenharmony_ci#define FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC_LEN	4
13362306a36Sopenharmony_ci#define FC_FDMI_PORT_ATTR_FABRICNAME_LEN	8
13462306a36Sopenharmony_ci#define FC_FDMI_PORT_ATTR_CURRENTFC4TYPE_LEN	32
13562306a36Sopenharmony_ci#define FC_FDMI_PORT_ATTR_PORTSTATE_LEN		4
13662306a36Sopenharmony_ci#define FC_FDMI_PORT_ATTR_DISCOVEREDPORTS_LEN	4
13762306a36Sopenharmony_ci#define FC_FDMI_PORT_ATTR_PORTID_LEN		4
13862306a36Sopenharmony_ci
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ci/*
14162306a36Sopenharmony_ci * HBA Attribute ID
14262306a36Sopenharmony_ci */
14362306a36Sopenharmony_cistruct fc_fdmi_hba_identifier {
14462306a36Sopenharmony_ci	__be64		id;
14562306a36Sopenharmony_ci};
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci/*
14862306a36Sopenharmony_ci * Port Name
14962306a36Sopenharmony_ci */
15062306a36Sopenharmony_cistruct fc_fdmi_port_name {
15162306a36Sopenharmony_ci	__be64		portname;
15262306a36Sopenharmony_ci};
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ci/*
15562306a36Sopenharmony_ci * Attribute Entry Block for HBA/Port Attributes
15662306a36Sopenharmony_ci */
15762306a36Sopenharmony_ci#define FC_FDMI_ATTR_ENTRY_HEADER_LEN	4
15862306a36Sopenharmony_cistruct fc_fdmi_attr_entry {
15962306a36Sopenharmony_ci	__be16		type;
16062306a36Sopenharmony_ci	__be16		len;
16162306a36Sopenharmony_ci	__u8		value[];
16262306a36Sopenharmony_ci} __attribute__((__packed__));
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_ci/*
16562306a36Sopenharmony_ci * Common for HBA/Port Attributes
16662306a36Sopenharmony_ci */
16762306a36Sopenharmony_cistruct fs_fdmi_attrs {
16862306a36Sopenharmony_ci	__be32				numattrs;
16962306a36Sopenharmony_ci	struct fc_fdmi_attr_entry	attr[];
17062306a36Sopenharmony_ci} __attribute__((__packed__));
17162306a36Sopenharmony_ci
17262306a36Sopenharmony_ci/*
17362306a36Sopenharmony_ci * Registered Port List
17462306a36Sopenharmony_ci */
17562306a36Sopenharmony_cistruct fc_fdmi_rpl {
17662306a36Sopenharmony_ci	__be32				numport;
17762306a36Sopenharmony_ci	struct fc_fdmi_port_name	port[1];
17862306a36Sopenharmony_ci} __attribute__((__packed__));
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci/*
18162306a36Sopenharmony_ci * Register HBA (RHBA)
18262306a36Sopenharmony_ci */
18362306a36Sopenharmony_cistruct fc_fdmi_rhba {
18462306a36Sopenharmony_ci	struct fc_fdmi_hba_identifier hbaid;
18562306a36Sopenharmony_ci	struct fc_fdmi_rpl		 port;
18662306a36Sopenharmony_ci	struct fs_fdmi_attrs		 hba_attrs;
18762306a36Sopenharmony_ci} __attribute__((__packed__));
18862306a36Sopenharmony_ci
18962306a36Sopenharmony_ci/*
19062306a36Sopenharmony_ci * Register HBA Attributes (RHAT)
19162306a36Sopenharmony_ci */
19262306a36Sopenharmony_cistruct fc_fdmi_rhat {
19362306a36Sopenharmony_ci	struct fc_fdmi_hba_identifier hbaid;
19462306a36Sopenharmony_ci	struct fs_fdmi_attrs		 hba_attrs;
19562306a36Sopenharmony_ci} __attribute__((__packed__));
19662306a36Sopenharmony_ci
19762306a36Sopenharmony_ci/*
19862306a36Sopenharmony_ci * Register Port (RPRT)
19962306a36Sopenharmony_ci */
20062306a36Sopenharmony_cistruct fc_fdmi_rprt {
20162306a36Sopenharmony_ci	struct fc_fdmi_hba_identifier hbaid;
20262306a36Sopenharmony_ci	struct fc_fdmi_port_name	 port;
20362306a36Sopenharmony_ci	struct fs_fdmi_attrs		 hba_attrs;
20462306a36Sopenharmony_ci} __attribute__((__packed__));
20562306a36Sopenharmony_ci
20662306a36Sopenharmony_ci/*
20762306a36Sopenharmony_ci * Register Port Attributes (RPA)
20862306a36Sopenharmony_ci */
20962306a36Sopenharmony_cistruct fc_fdmi_rpa {
21062306a36Sopenharmony_ci	struct fc_fdmi_port_name	 port;
21162306a36Sopenharmony_ci	struct fs_fdmi_attrs		 hba_attrs;
21262306a36Sopenharmony_ci} __attribute__((__packed__));
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_ci/*
21562306a36Sopenharmony_ci * Deregister Port (DPRT)
21662306a36Sopenharmony_ci */
21762306a36Sopenharmony_cistruct fc_fdmi_dprt {
21862306a36Sopenharmony_ci	struct fc_fdmi_port_name	 port;
21962306a36Sopenharmony_ci} __attribute__((__packed__));
22062306a36Sopenharmony_ci
22162306a36Sopenharmony_ci/*
22262306a36Sopenharmony_ci * Deregister Port Attributes (DPA)
22362306a36Sopenharmony_ci */
22462306a36Sopenharmony_cistruct fc_fdmi_dpa {
22562306a36Sopenharmony_ci	struct fc_fdmi_port_name	 port;
22662306a36Sopenharmony_ci	struct fs_fdmi_attrs		 hba_attrs;
22762306a36Sopenharmony_ci} __attribute__((__packed__));
22862306a36Sopenharmony_ci
22962306a36Sopenharmony_ci/*
23062306a36Sopenharmony_ci * Deregister HBA Attributes (DHAT)
23162306a36Sopenharmony_ci */
23262306a36Sopenharmony_cistruct fc_fdmi_dhat {
23362306a36Sopenharmony_ci	struct fc_fdmi_hba_identifier hbaid;
23462306a36Sopenharmony_ci} __attribute__((__packed__));
23562306a36Sopenharmony_ci
23662306a36Sopenharmony_ci/*
23762306a36Sopenharmony_ci * Deregister HBA (DHBA)
23862306a36Sopenharmony_ci */
23962306a36Sopenharmony_cistruct fc_fdmi_dhba {
24062306a36Sopenharmony_ci	struct fc_fdmi_hba_identifier hbaid;
24162306a36Sopenharmony_ci} __attribute__((__packed__));
24262306a36Sopenharmony_ci
24362306a36Sopenharmony_ci#endif /* _FC_MS_H_ */
244