| Robert Love | f032c2f | 2008-12-09 15:10:11 -0800 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright(c) 2007 Intel Corporation. All rights reserved. | 
|  | 3 | * | 
|  | 4 | * This program is free software; you can redistribute it and/or modify it | 
|  | 5 | * under the terms and conditions of the GNU General Public License, | 
|  | 6 | * version 2, as published by the Free Software Foundation. | 
|  | 7 | * | 
|  | 8 | * This program is distributed in the hope it will be useful, but WITHOUT | 
|  | 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 
|  | 10 | * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for | 
|  | 11 | * more details. | 
|  | 12 | * | 
|  | 13 | * You should have received a copy of the GNU General Public License along with | 
|  | 14 | * this program; if not, write to the Free Software Foundation, Inc., | 
|  | 15 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | 
|  | 16 | * | 
|  | 17 | * Maintained at www.Open-FCoE.org | 
|  | 18 | */ | 
|  | 19 |  | 
|  | 20 | #ifndef _FC_NS_H_ | 
|  | 21 | #define	_FC_NS_H_ | 
|  | 22 |  | 
| Robert Love | 07aac32 | 2009-11-03 11:47:23 -0800 | [diff] [blame] | 23 | #include <linux/types.h> | 
|  | 24 |  | 
| Robert Love | f032c2f | 2008-12-09 15:10:11 -0800 | [diff] [blame] | 25 | /* | 
|  | 26 | * Fibre Channel Services - Name Service (dNS) | 
|  | 27 | * From T11.org FC-GS-2 Rev 5.3 November 1998. | 
|  | 28 | */ | 
|  | 29 |  | 
|  | 30 | /* | 
|  | 31 | * Common-transport sub-type for Name Server. | 
|  | 32 | */ | 
|  | 33 | #define	FC_NS_SUBTYPE	    2	/* fs_ct_hdr.ct_fs_subtype */ | 
|  | 34 |  | 
|  | 35 | /* | 
|  | 36 | * Name server Requests. | 
|  | 37 | * Note:  this is an incomplete list, some unused requests are omitted. | 
|  | 38 | */ | 
|  | 39 | enum fc_ns_req { | 
|  | 40 | FC_NS_GA_NXT =	0x0100,		/* get all next */ | 
|  | 41 | FC_NS_GI_A =	0x0101,		/* get identifiers - scope */ | 
|  | 42 | FC_NS_GPN_ID =	0x0112,		/* get port name by ID */ | 
|  | 43 | FC_NS_GNN_ID =	0x0113,		/* get node name by ID */ | 
|  | 44 | FC_NS_GID_PN =	0x0121,		/* get ID for port name */ | 
|  | 45 | FC_NS_GID_NN =	0x0131,		/* get IDs for node name */ | 
|  | 46 | FC_NS_GID_FT =	0x0171,		/* get IDs by FC4 type */ | 
|  | 47 | FC_NS_GPN_FT =	0x0172,		/* get port names by FC4 type */ | 
|  | 48 | FC_NS_GID_PT =	0x01a1,		/* get IDs by port type */ | 
| Robert Love | f032c2f | 2008-12-09 15:10:11 -0800 | [diff] [blame] | 49 | FC_NS_RPN_ID =	0x0212,		/* reg port name for ID */ | 
|  | 50 | FC_NS_RNN_ID =	0x0213,		/* reg node name for ID */ | 
| Joe Eykholt | ab593b1 | 2009-11-03 11:49:27 -0800 | [diff] [blame] | 51 | FC_NS_RFT_ID =	0x0217,		/* reg FC4 type for ID */ | 
| Chris Leech | c9866a5 | 2009-11-03 11:47:01 -0800 | [diff] [blame] | 52 | FC_NS_RSPN_ID =	0x0218,		/* reg symbolic port name */ | 
| Joe Eykholt | ab593b1 | 2009-11-03 11:49:27 -0800 | [diff] [blame] | 53 | FC_NS_RFF_ID =	0x021f,		/* reg FC4 Features for ID */ | 
| Chris Leech | 5baa17c | 2009-11-03 11:46:56 -0800 | [diff] [blame] | 54 | FC_NS_RSNN_NN =	0x0239,		/* reg symbolic node name */ | 
| Robert Love | f032c2f | 2008-12-09 15:10:11 -0800 | [diff] [blame] | 55 | }; | 
|  | 56 |  | 
|  | 57 | /* | 
|  | 58 | * Port type values. | 
|  | 59 | */ | 
|  | 60 | enum fc_ns_pt { | 
|  | 61 | FC_NS_UNID_PORT = 0x00,	/* unidentified */ | 
|  | 62 | FC_NS_N_PORT =	0x01,	/* N port */ | 
|  | 63 | FC_NS_NL_PORT =	0x02,	/* NL port */ | 
|  | 64 | FC_NS_FNL_PORT = 0x03,	/* F/NL port */ | 
|  | 65 | FC_NS_NX_PORT =	0x7f,	/* Nx port */ | 
|  | 66 | FC_NS_F_PORT =	0x81,	/* F port */ | 
|  | 67 | FC_NS_FL_PORT =	0x82,	/* FL port */ | 
|  | 68 | FC_NS_E_PORT =	0x84,	/* E port */ | 
|  | 69 | FC_NS_B_PORT =	0x85,	/* B port */ | 
|  | 70 | }; | 
|  | 71 |  | 
|  | 72 | /* | 
|  | 73 | * Port type object. | 
|  | 74 | */ | 
|  | 75 | struct fc_ns_pt_obj { | 
|  | 76 | __u8		pt_type; | 
|  | 77 | }; | 
|  | 78 |  | 
|  | 79 | /* | 
|  | 80 | * Port ID object | 
|  | 81 | */ | 
|  | 82 | struct fc_ns_fid { | 
|  | 83 | __u8		fp_flags;	/* flags for responses only */ | 
|  | 84 | __u8		fp_fid[3]; | 
|  | 85 | }; | 
|  | 86 |  | 
|  | 87 | /* | 
|  | 88 | * fp_flags in port ID object, for responses only. | 
|  | 89 | */ | 
|  | 90 | #define	FC_NS_FID_LAST	0x80		/* last object */ | 
|  | 91 |  | 
|  | 92 | /* | 
|  | 93 | * FC4-types object. | 
|  | 94 | */ | 
|  | 95 | #define	FC_NS_TYPES	256	/* number of possible FC-4 types */ | 
|  | 96 | #define	FC_NS_BPW	32	/* bits per word in bitmap */ | 
|  | 97 |  | 
|  | 98 | struct fc_ns_fts { | 
|  | 99 | __be32	ff_type_map[FC_NS_TYPES / FC_NS_BPW]; /* bitmap of FC-4 types */ | 
|  | 100 | }; | 
|  | 101 |  | 
|  | 102 | /* | 
| Joe Eykholt | edcbb43 | 2010-07-20 15:20:19 -0700 | [diff] [blame] | 103 | * FC4-features object. | 
|  | 104 | */ | 
|  | 105 | struct fc_ns_ff	{ | 
|  | 106 | __be32	fd_feat[FC_NS_TYPES * 4 / FC_NS_BPW]; /* 4-bits per FC-type */ | 
|  | 107 | }; | 
|  | 108 |  | 
|  | 109 | /* | 
| Robert Love | f032c2f | 2008-12-09 15:10:11 -0800 | [diff] [blame] | 110 | * GID_PT request. | 
|  | 111 | */ | 
|  | 112 | struct fc_ns_gid_pt { | 
|  | 113 | __u8		fn_pt_type; | 
|  | 114 | __u8		fn_domain_id_scope; | 
|  | 115 | __u8		fn_area_id_scope; | 
|  | 116 | __u8		fn_resvd; | 
|  | 117 | }; | 
|  | 118 |  | 
|  | 119 | /* | 
|  | 120 | * GID_FT or GPN_FT request. | 
|  | 121 | */ | 
|  | 122 | struct fc_ns_gid_ft { | 
|  | 123 | __u8		fn_resvd; | 
|  | 124 | __u8		fn_domain_id_scope; | 
|  | 125 | __u8		fn_area_id_scope; | 
|  | 126 | __u8		fn_fc4_type; | 
|  | 127 | }; | 
|  | 128 |  | 
|  | 129 | /* | 
|  | 130 | * GPN_FT response. | 
|  | 131 | */ | 
|  | 132 | struct fc_gpn_ft_resp { | 
|  | 133 | __u8		fp_flags;	/* see fp_flags definitions above */ | 
|  | 134 | __u8		fp_fid[3];	/* port ID */ | 
|  | 135 | __be32		fp_resvd; | 
|  | 136 | __be64		fp_wwpn;	/* port name */ | 
|  | 137 | }; | 
|  | 138 |  | 
|  | 139 | /* | 
|  | 140 | * GID_PN request | 
|  | 141 | */ | 
|  | 142 | struct fc_ns_gid_pn { | 
|  | 143 | __be64     fn_wwpn;    /* port name */ | 
|  | 144 | }; | 
|  | 145 |  | 
|  | 146 | /* | 
|  | 147 | * GID_PN response | 
|  | 148 | */ | 
|  | 149 | struct fc_gid_pn_resp { | 
|  | 150 | __u8      fp_resvd; | 
|  | 151 | __u8      fp_fid[3];     /* port ID */ | 
|  | 152 | }; | 
|  | 153 |  | 
|  | 154 | /* | 
|  | 155 | * RFT_ID request - register FC-4 types for ID. | 
|  | 156 | */ | 
|  | 157 | struct fc_ns_rft_id { | 
|  | 158 | struct fc_ns_fid fr_fid;	/* port ID object */ | 
|  | 159 | struct fc_ns_fts fr_fts;	/* FC-4 types object */ | 
|  | 160 | }; | 
|  | 161 |  | 
|  | 162 | /* | 
|  | 163 | * RPN_ID request - register port name for ID. | 
|  | 164 | * RNN_ID request - register node name for ID. | 
|  | 165 | */ | 
|  | 166 | struct fc_ns_rn_id { | 
|  | 167 | struct fc_ns_fid fr_fid;	/* port ID object */ | 
|  | 168 | __be64		fr_wwn;		/* node name or port name */ | 
|  | 169 | } __attribute__((__packed__)); | 
|  | 170 |  | 
| Chris Leech | 5baa17c | 2009-11-03 11:46:56 -0800 | [diff] [blame] | 171 | /* | 
|  | 172 | * RSNN_NN request - register symbolic node name | 
|  | 173 | */ | 
|  | 174 | struct fc_ns_rsnn { | 
|  | 175 | __be64		fr_wwn;		/* node name */ | 
|  | 176 | __u8		fr_name_len; | 
|  | 177 | char		fr_name[]; | 
|  | 178 | } __attribute__((__packed__)); | 
|  | 179 |  | 
| Chris Leech | c9866a5 | 2009-11-03 11:47:01 -0800 | [diff] [blame] | 180 | /* | 
|  | 181 | * RSPN_ID request - register symbolic port name | 
|  | 182 | */ | 
|  | 183 | struct fc_ns_rspn { | 
|  | 184 | struct fc_ns_fid fr_fid;	/* port ID object */ | 
|  | 185 | __u8		fr_name_len; | 
|  | 186 | char		fr_name[]; | 
|  | 187 | } __attribute__((__packed__)); | 
|  | 188 |  | 
| Joe Eykholt | ab593b1 | 2009-11-03 11:49:27 -0800 | [diff] [blame] | 189 | /* | 
|  | 190 | * RFF_ID request - register FC-4 Features for ID. | 
|  | 191 | */ | 
|  | 192 | struct fc_ns_rff_id { | 
|  | 193 | struct fc_ns_fid fr_fid;	/* port ID object */ | 
|  | 194 | __u8		fr_resvd[2]; | 
|  | 195 | __u8		fr_feat;	/* FC-4 Feature bits */ | 
|  | 196 | __u8		fr_type;	/* FC-4 type */ | 
|  | 197 | } __attribute__((__packed__)); | 
|  | 198 |  | 
| Robert Love | f032c2f | 2008-12-09 15:10:11 -0800 | [diff] [blame] | 199 | #endif /* _FC_NS_H_ */ |