fc_ns.h 4.2 KB

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