bfa_defs_port.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. /*
  2. * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
  3. * All rights reserved
  4. * www.brocade.com
  5. *
  6. * Linux driver for Brocade Fibre Channel Host Bus Adapter.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License (GPL) Version 2 as
  10. * published by the Free Software Foundation
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. */
  17. #ifndef __BFA_DEFS_PORT_H__
  18. #define __BFA_DEFS_PORT_H__
  19. #include <bfa_os_inc.h>
  20. #include <protocol/types.h>
  21. #include <defs/bfa_defs_pport.h>
  22. #include <defs/bfa_defs_ioc.h>
  23. #define BFA_FCS_FABRIC_IPADDR_SZ 16
  24. /**
  25. * symbolic names for base port/virtual port
  26. */
  27. #define BFA_SYMNAME_MAXLEN 128 /* vmware/windows uses 128 bytes */
  28. struct bfa_port_symname_s {
  29. char symname[BFA_SYMNAME_MAXLEN];
  30. };
  31. /**
  32. * Roles of FCS port:
  33. * - FCP IM and FCP TM roles cannot be enabled together for a FCS port
  34. * - Create multiple ports if both IM and TM functions required.
  35. * - Atleast one role must be specified.
  36. */
  37. enum bfa_port_role {
  38. BFA_PORT_ROLE_FCP_IM = 0x01, /* FCP initiator role */
  39. BFA_PORT_ROLE_FCP_TM = 0x02, /* FCP target role */
  40. BFA_PORT_ROLE_FCP_IPFC = 0x04, /* IP over FC role */
  41. BFA_PORT_ROLE_FCP_MAX = BFA_PORT_ROLE_FCP_IPFC | BFA_PORT_ROLE_FCP_IM
  42. };
  43. /**
  44. * FCS port configuration.
  45. */
  46. struct bfa_port_cfg_s {
  47. wwn_t pwwn; /* port wwn */
  48. wwn_t nwwn; /* node wwn */
  49. struct bfa_port_symname_s sym_name; /* vm port symbolic name */
  50. enum bfa_port_role roles; /* FCS port roles */
  51. u32 rsvd;
  52. u8 tag[16]; /* opaque tag from application */
  53. };
  54. /**
  55. * FCS port states
  56. */
  57. enum bfa_port_state {
  58. BFA_PORT_UNINIT = 0, /* PORT is not yet initialized */
  59. BFA_PORT_FDISC = 1, /* FDISC is in progress */
  60. BFA_PORT_ONLINE = 2, /* login to fabric is complete */
  61. BFA_PORT_OFFLINE = 3, /* No login to fabric */
  62. };
  63. /**
  64. * FCS port type. Required for VmWare.
  65. */
  66. enum bfa_port_type {
  67. BFA_PORT_TYPE_PHYSICAL = 0,
  68. BFA_PORT_TYPE_VIRTUAL,
  69. };
  70. /**
  71. * FCS port offline reason. Required for VmWare.
  72. */
  73. enum bfa_port_offline_reason {
  74. BFA_PORT_OFFLINE_UNKNOWN = 0,
  75. BFA_PORT_OFFLINE_LINKDOWN,
  76. BFA_PORT_OFFLINE_FAB_UNSUPPORTED, /* NPIV not supported by the
  77. * fabric */
  78. BFA_PORT_OFFLINE_FAB_NORESOURCES,
  79. BFA_PORT_OFFLINE_FAB_LOGOUT,
  80. };
  81. /**
  82. * FCS lport info. Required for VmWare.
  83. */
  84. struct bfa_port_info_s {
  85. u8 port_type; /* bfa_port_type_t : physical or
  86. * virtual */
  87. u8 port_state; /* one of bfa_port_state values */
  88. u8 offline_reason; /* one of bfa_port_offline_reason_t
  89. * values */
  90. wwn_t port_wwn;
  91. wwn_t node_wwn;
  92. /*
  93. * following 4 feilds are valid for Physical Ports only
  94. */
  95. u32 max_vports_supp; /* Max supported vports */
  96. u32 num_vports_inuse; /* Num of in use vports */
  97. u32 max_rports_supp; /* Max supported rports */
  98. u32 num_rports_inuse; /* Num of doscovered rports */
  99. };
  100. /**
  101. * FCS port statistics
  102. */
  103. struct bfa_port_stats_s {
  104. u32 ns_plogi_sent;
  105. u32 ns_plogi_rsp_err;
  106. u32 ns_plogi_acc_err;
  107. u32 ns_plogi_accepts;
  108. u32 ns_rejects; /* NS command rejects */
  109. u32 ns_plogi_unknown_rsp;
  110. u32 ns_plogi_alloc_wait;
  111. u32 ns_retries; /* NS command retries */
  112. u32 ns_timeouts; /* NS command timeouts */
  113. u32 ns_rspnid_sent;
  114. u32 ns_rspnid_accepts;
  115. u32 ns_rspnid_rsp_err;
  116. u32 ns_rspnid_rejects;
  117. u32 ns_rspnid_alloc_wait;
  118. u32 ns_rftid_sent;
  119. u32 ns_rftid_accepts;
  120. u32 ns_rftid_rsp_err;
  121. u32 ns_rftid_rejects;
  122. u32 ns_rftid_alloc_wait;
  123. u32 ns_rffid_sent;
  124. u32 ns_rffid_accepts;
  125. u32 ns_rffid_rsp_err;
  126. u32 ns_rffid_rejects;
  127. u32 ns_rffid_alloc_wait;
  128. u32 ns_gidft_sent;
  129. u32 ns_gidft_accepts;
  130. u32 ns_gidft_rsp_err;
  131. u32 ns_gidft_rejects;
  132. u32 ns_gidft_unknown_rsp;
  133. u32 ns_gidft_alloc_wait;
  134. /*
  135. * Mgmt Server stats
  136. */
  137. u32 ms_retries; /* MS command retries */
  138. u32 ms_timeouts; /* MS command timeouts */
  139. u32 ms_plogi_sent;
  140. u32 ms_plogi_rsp_err;
  141. u32 ms_plogi_acc_err;
  142. u32 ms_plogi_accepts;
  143. u32 ms_rejects; /* NS command rejects */
  144. u32 ms_plogi_unknown_rsp;
  145. u32 ms_plogi_alloc_wait;
  146. u32 num_rscn; /* Num of RSCN received */
  147. u32 num_portid_rscn;/* Num portid format RSCN
  148. * received */
  149. u32 uf_recvs; /* unsolicited recv frames */
  150. u32 uf_recv_drops; /* dropped received frames */
  151. u32 rsvd; /* padding for 64 bit alignment */
  152. };
  153. /**
  154. * BFA port attribute returned in queries
  155. */
  156. struct bfa_port_attr_s {
  157. enum bfa_port_state state; /* port state */
  158. u32 pid; /* port ID */
  159. struct bfa_port_cfg_s port_cfg; /* port configuration */
  160. enum bfa_pport_type port_type; /* current topology */
  161. u32 loopback; /* cable is externally looped back */
  162. wwn_t fabric_name; /* attached switch's nwwn */
  163. u8 fabric_ip_addr[BFA_FCS_FABRIC_IPADDR_SZ]; /* attached
  164. * fabric's ip addr */
  165. };
  166. /**
  167. * BFA physical port Level events
  168. * Arguments below are in BFAL context from Mgmt
  169. * BFA_PORT_AEN_ONLINE: [in]: pwwn [out]: pwwn
  170. * BFA_PORT_AEN_OFFLINE: [in]: pwwn [out]: pwwn
  171. * BFA_PORT_AEN_RLIR: [in]: None [out]: pwwn, rlir_data, rlir_len
  172. * BFA_PORT_AEN_SFP_INSERT: [in]: pwwn [out]: port_id, pwwn
  173. * BFA_PORT_AEN_SFP_REMOVE: [in]: pwwn [out]: port_id, pwwn
  174. * BFA_PORT_AEN_SFP_POM: [in]: pwwn [out]: level, port_id, pwwn
  175. * BFA_PORT_AEN_ENABLE: [in]: pwwn [out]: pwwn
  176. * BFA_PORT_AEN_DISABLE: [in]: pwwn [out]: pwwn
  177. * BFA_PORT_AEN_AUTH_ON: [in]: pwwn [out]: pwwn
  178. * BFA_PORT_AEN_AUTH_OFF: [in]: pwwn [out]: pwwn
  179. * BFA_PORT_AEN_DISCONNECT: [in]: pwwn [out]: pwwn
  180. * BFA_PORT_AEN_QOS_NEG: [in]: pwwn [out]: pwwn
  181. * BFA_PORT_AEN_FABRIC_NAME_CHANGE: [in]: pwwn, [out]: pwwn, fwwn
  182. *
  183. */
  184. enum bfa_port_aen_event {
  185. BFA_PORT_AEN_ONLINE = 1, /* Physical Port online event */
  186. BFA_PORT_AEN_OFFLINE = 2, /* Physical Port offline event */
  187. BFA_PORT_AEN_RLIR = 3, /* RLIR event, not supported */
  188. BFA_PORT_AEN_SFP_INSERT = 4, /* SFP inserted event */
  189. BFA_PORT_AEN_SFP_REMOVE = 5, /* SFP removed event */
  190. BFA_PORT_AEN_SFP_POM = 6, /* SFP POM event */
  191. BFA_PORT_AEN_ENABLE = 7, /* Physical Port enable event */
  192. BFA_PORT_AEN_DISABLE = 8, /* Physical Port disable event */
  193. BFA_PORT_AEN_AUTH_ON = 9, /* Physical Port auth success event */
  194. BFA_PORT_AEN_AUTH_OFF = 10, /* Physical Port auth fail event */
  195. BFA_PORT_AEN_DISCONNECT = 11, /* Physical Port disconnect event */
  196. BFA_PORT_AEN_QOS_NEG = 12, /* Base Port QOS negotiation event */
  197. BFA_PORT_AEN_FABRIC_NAME_CHANGE = 13, /* Fabric Name/WWN change
  198. * event */
  199. BFA_PORT_AEN_SFP_ACCESS_ERROR = 14, /* SFP read error event */
  200. BFA_PORT_AEN_SFP_UNSUPPORT = 15, /* Unsupported SFP event */
  201. };
  202. enum bfa_port_aen_sfp_pom {
  203. BFA_PORT_AEN_SFP_POM_GREEN = 1, /* Normal */
  204. BFA_PORT_AEN_SFP_POM_AMBER = 2, /* Warning */
  205. BFA_PORT_AEN_SFP_POM_RED = 3, /* Critical */
  206. BFA_PORT_AEN_SFP_POM_MAX = BFA_PORT_AEN_SFP_POM_RED
  207. };
  208. struct bfa_port_aen_data_s {
  209. enum bfa_ioc_type_e ioc_type;
  210. wwn_t pwwn; /* WWN of the physical port */
  211. wwn_t fwwn; /* WWN of the fabric port */
  212. mac_t mac; /* MAC addres of the ethernet port,
  213. * applicable to CNA port only */
  214. int phy_port_num; /*! For SFP related events */
  215. enum bfa_port_aen_sfp_pom level; /* Only transitions will
  216. * be informed */
  217. };
  218. #endif /* __BFA_DEFS_PORT_H__ */