fc_ns.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. //
  2. // Copyright 2026 Aarav Ravindra Kharade
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //
  16. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  17. /*
  18. * Copyright(c) 2007 Intel Corporation. All rights reserved.
  19. *
  20. * Maintained at www.Open-FCoE.org
  21. */
  22. #ifndef _FC_NS_H_
  23. #define _FC_NS_H_
  24. #include <linux/types.h>
  25. /*
  26. * Fibre Channel Services - Name Service (dNS)
  27. * From T11.org FC-GS-2 Rev 5.3 November 1998.
  28. */
  29. /*
  30. * Common-transport sub-type for Name Server.
  31. */
  32. #define FC_NS_SUBTYPE 2 /* fs_ct_hdr.ct_fs_subtype */
  33. /*
  34. * Name server Requests.
  35. * Note: this is an incomplete list, some unused requests are omitted.
  36. */
  37. enum fc_ns_req {
  38. FC_NS_GA_NXT = 0x0100, /* get all next */
  39. FC_NS_GI_A = 0x0101, /* get identifiers - scope */
  40. FC_NS_GPN_ID = 0x0112, /* get port name by ID */
  41. FC_NS_GNN_ID = 0x0113, /* get node name by ID */
  42. FC_NS_GSPN_ID = 0x0118, /* get symbolic port name */
  43. FC_NS_GID_PN = 0x0121, /* get ID for port name */
  44. FC_NS_GID_NN = 0x0131, /* get IDs for node name */
  45. FC_NS_GID_FT = 0x0171, /* get IDs by FC4 type */
  46. FC_NS_GPN_FT = 0x0172, /* get port names by FC4 type */
  47. FC_NS_GID_PT = 0x01a1, /* get IDs by port type */
  48. FC_NS_RPN_ID = 0x0212, /* reg port name for ID */
  49. FC_NS_RNN_ID = 0x0213, /* reg node name for ID */
  50. FC_NS_RFT_ID = 0x0217, /* reg FC4 type for ID */
  51. FC_NS_RSPN_ID = 0x0218, /* reg symbolic port name */
  52. FC_NS_RFF_ID = 0x021f, /* reg FC4 Features for ID */
  53. FC_NS_RSNN_NN = 0x0239, /* reg symbolic node name */
  54. };
  55. /*
  56. * Port type values.
  57. */
  58. enum fc_ns_pt {
  59. FC_NS_UNID_PORT = 0x00, /* unidentified */
  60. FC_NS_N_PORT = 0x01, /* N port */
  61. FC_NS_NL_PORT = 0x02, /* NL port */
  62. FC_NS_FNL_PORT = 0x03, /* F/NL port */
  63. FC_NS_NX_PORT = 0x7f, /* Nx port */
  64. FC_NS_F_PORT = 0x81, /* F port */
  65. FC_NS_FL_PORT = 0x82, /* FL port */
  66. FC_NS_E_PORT = 0x84, /* E port */
  67. FC_NS_B_PORT = 0x85, /* B port */
  68. };
  69. /*
  70. * Port type object.
  71. */
  72. struct fc_ns_pt_obj {
  73. __u8 pt_type;
  74. };
  75. /*
  76. * Port ID object
  77. */
  78. struct fc_ns_fid {
  79. __u8 fp_flags; /* flags for responses only */
  80. __u8 fp_fid[3];
  81. };
  82. /*
  83. * fp_flags in port ID object, for responses only.
  84. */
  85. #define FC_NS_FID_LAST 0x80 /* last object */
  86. /*
  87. * FC4-types object.
  88. */
  89. #define FC_NS_TYPES 256 /* number of possible FC-4 types */
  90. #define FC_NS_BPW 32 /* bits per word in bitmap */
  91. struct fc_ns_fts {
  92. __be32 ff_type_map[FC_NS_TYPES / FC_NS_BPW]; /* bitmap of FC-4 types */
  93. };
  94. /*
  95. * FC4-features object.
  96. */
  97. struct fc_ns_ff {
  98. __be32 fd_feat[FC_NS_TYPES * 4 / FC_NS_BPW]; /* 4-bits per FC-type */
  99. };
  100. /*
  101. * GID_PT request.
  102. */
  103. struct fc_ns_gid_pt {
  104. __u8 fn_pt_type;
  105. __u8 fn_domain_id_scope;
  106. __u8 fn_area_id_scope;
  107. __u8 fn_resvd;
  108. };
  109. /*
  110. * GID_FT or GPN_FT request.
  111. */
  112. struct fc_ns_gid_ft {
  113. __u8 fn_resvd;
  114. __u8 fn_domain_id_scope;
  115. __u8 fn_area_id_scope;
  116. __u8 fn_fc4_type;
  117. };
  118. /*
  119. * GPN_FT response.
  120. */
  121. struct fc_gpn_ft_resp {
  122. __u8 fp_flags; /* see fp_flags definitions above */
  123. __u8 fp_fid[3]; /* port ID */
  124. __be32 fp_resvd;
  125. __be64 fp_wwpn; /* port name */
  126. };
  127. /*
  128. * GID_PN request
  129. */
  130. struct fc_ns_gid_pn {
  131. __be64 fn_wwpn; /* port name */
  132. };
  133. /*
  134. * GID_PN response or GSPN_ID request
  135. */
  136. struct fc_gid_pn_resp {
  137. __u8 fp_resvd;
  138. __u8 fp_fid[3]; /* port ID */
  139. };
  140. /*
  141. * GSPN_ID response
  142. */
  143. struct fc_gspn_resp {
  144. __u8 fp_name_len;
  145. char fp_name[];
  146. };
  147. /*
  148. * RFT_ID request - register FC-4 types for ID.
  149. */
  150. struct fc_ns_rft_id {
  151. struct fc_ns_fid fr_fid; /* port ID object */
  152. struct fc_ns_fts fr_fts; /* FC-4 types object */
  153. };
  154. /*
  155. * RPN_ID request - register port name for ID.
  156. * RNN_ID request - register node name for ID.
  157. */
  158. struct fc_ns_rn_id {
  159. struct fc_ns_fid fr_fid; /* port ID object */
  160. __be64 fr_wwn; /* node name or port name */
  161. } __attribute__((__packed__));
  162. /*
  163. * RSNN_NN request - register symbolic node name
  164. */
  165. struct fc_ns_rsnn {
  166. __be64 fr_wwn; /* node name */
  167. __u8 fr_name_len;
  168. char fr_name[];
  169. } __attribute__((__packed__));
  170. /*
  171. * RSPN_ID request - register symbolic port name
  172. */
  173. struct fc_ns_rspn {
  174. struct fc_ns_fid fr_fid; /* port ID object */
  175. __u8 fr_name_len;
  176. char fr_name[];
  177. } __attribute__((__packed__));
  178. /*
  179. * RFF_ID request - register FC-4 Features for ID.
  180. */
  181. struct fc_ns_rff_id {
  182. struct fc_ns_fid fr_fid; /* port ID object */
  183. __u8 fr_resvd[2];
  184. __u8 fr_feat; /* FC-4 Feature bits */
  185. __u8 fr_type; /* FC-4 type */
  186. } __attribute__((__packed__));
  187. #endif /* _FC_NS_H_ */