bfa_defs_pport.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  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_PPORT_H__
  18. #define __BFA_DEFS_PPORT_H__
  19. #include <bfa_os_inc.h>
  20. #include <protocol/fc.h>
  21. #include <defs/bfa_defs_types.h>
  22. #include <defs/bfa_defs_qos.h>
  23. #include <cna/pstats/phyport_defs.h>
  24. /* Modify char* port_stt[] in bfal_port.c if a new state was added */
  25. enum bfa_pport_states {
  26. BFA_PPORT_ST_UNINIT = 1,
  27. BFA_PPORT_ST_ENABLING_QWAIT = 2,
  28. BFA_PPORT_ST_ENABLING = 3,
  29. BFA_PPORT_ST_LINKDOWN = 4,
  30. BFA_PPORT_ST_LINKUP = 5,
  31. BFA_PPORT_ST_DISABLING_QWAIT = 6,
  32. BFA_PPORT_ST_DISABLING = 7,
  33. BFA_PPORT_ST_DISABLED = 8,
  34. BFA_PPORT_ST_STOPPED = 9,
  35. BFA_PPORT_ST_IOCDOWN = 10,
  36. BFA_PPORT_ST_IOCDIS = 11,
  37. BFA_PPORT_ST_FWMISMATCH = 12,
  38. BFA_PPORT_ST_PREBOOT_DISABLED = 13,
  39. BFA_PPORT_ST_MAX_STATE,
  40. };
  41. /**
  42. * Port speed settings. Each specific speed is a bit field. Use multiple
  43. * bits to specify speeds to be selected for auto-negotiation.
  44. */
  45. enum bfa_pport_speed {
  46. BFA_PPORT_SPEED_UNKNOWN = 0,
  47. BFA_PPORT_SPEED_1GBPS = 1,
  48. BFA_PPORT_SPEED_2GBPS = 2,
  49. BFA_PPORT_SPEED_4GBPS = 4,
  50. BFA_PPORT_SPEED_8GBPS = 8,
  51. BFA_PPORT_SPEED_10GBPS = 10,
  52. BFA_PPORT_SPEED_AUTO =
  53. (BFA_PPORT_SPEED_1GBPS | BFA_PPORT_SPEED_2GBPS |
  54. BFA_PPORT_SPEED_4GBPS | BFA_PPORT_SPEED_8GBPS),
  55. };
  56. /**
  57. * Port operational type (in sync with SNIA port type).
  58. */
  59. enum bfa_pport_type {
  60. BFA_PPORT_TYPE_UNKNOWN = 1, /* port type is unknown */
  61. BFA_PPORT_TYPE_TRUNKED = 2, /* Trunked mode */
  62. BFA_PPORT_TYPE_NPORT = 5, /* P2P with switched fabric */
  63. BFA_PPORT_TYPE_NLPORT = 6, /* public loop */
  64. BFA_PPORT_TYPE_LPORT = 20, /* private loop */
  65. BFA_PPORT_TYPE_P2P = 21, /* P2P with no switched fabric */
  66. BFA_PPORT_TYPE_VPORT = 22, /* NPIV - virtual port */
  67. };
  68. /**
  69. * Port topology setting. A port's topology and fabric login status
  70. * determine its operational type.
  71. */
  72. enum bfa_pport_topology {
  73. BFA_PPORT_TOPOLOGY_NONE = 0, /* No valid topology */
  74. BFA_PPORT_TOPOLOGY_P2P = 1, /* P2P only */
  75. BFA_PPORT_TOPOLOGY_LOOP = 2, /* LOOP topology */
  76. BFA_PPORT_TOPOLOGY_AUTO = 3, /* auto topology selection */
  77. };
  78. /**
  79. * Physical port loopback types.
  80. */
  81. enum bfa_pport_opmode {
  82. BFA_PPORT_OPMODE_NORMAL = 0x00, /* normal non-loopback mode */
  83. BFA_PPORT_OPMODE_LB_INT = 0x01, /* internal loop back */
  84. BFA_PPORT_OPMODE_LB_SLW = 0x02, /* serial link wrapback (serdes) */
  85. BFA_PPORT_OPMODE_LB_EXT = 0x04, /* external loop back (serdes) */
  86. BFA_PPORT_OPMODE_LB_CBL = 0x08, /* cabled loop back */
  87. BFA_PPORT_OPMODE_LB_NLINT = 0x20, /* NL_Port internal loopback */
  88. };
  89. #define BFA_PPORT_OPMODE_LB_HARD(_mode) \
  90. ((_mode == BFA_PPORT_OPMODE_LB_INT) || \
  91. (_mode == BFA_PPORT_OPMODE_LB_SLW) || \
  92. (_mode == BFA_PPORT_OPMODE_LB_EXT))
  93. /**
  94. Port State (in sync with SNIA port state).
  95. */
  96. enum bfa_pport_snia_state {
  97. BFA_PPORT_STATE_UNKNOWN = 1, /* port is not initialized */
  98. BFA_PPORT_STATE_ONLINE = 2, /* port is ONLINE */
  99. BFA_PPORT_STATE_DISABLED = 3, /* port is disabled by user */
  100. BFA_PPORT_STATE_BYPASSED = 4, /* port is bypassed (in LOOP) */
  101. BFA_PPORT_STATE_DIAG = 5, /* port diagnostics is active */
  102. BFA_PPORT_STATE_LINKDOWN = 6, /* link is down */
  103. BFA_PPORT_STATE_LOOPBACK = 8, /* port is looped back */
  104. };
  105. /**
  106. * Port link state
  107. */
  108. enum bfa_pport_linkstate {
  109. BFA_PPORT_LINKUP = 1, /* Physical port/Trunk link up */
  110. BFA_PPORT_LINKDOWN = 2, /* Physical port/Trunk link down */
  111. BFA_PPORT_TRUNK_LINKDOWN = 3, /* Trunk link down (new tmaster) */
  112. };
  113. /**
  114. * Port link state event
  115. */
  116. #define bfa_pport_event_t enum bfa_pport_linkstate
  117. /**
  118. * Port link state reason code
  119. */
  120. enum bfa_pport_linkstate_rsn {
  121. BFA_PPORT_LINKSTATE_RSN_NONE = 0,
  122. BFA_PPORT_LINKSTATE_RSN_DISABLED = 1,
  123. BFA_PPORT_LINKSTATE_RSN_RX_NOS = 2,
  124. BFA_PPORT_LINKSTATE_RSN_RX_OLS = 3,
  125. BFA_PPORT_LINKSTATE_RSN_RX_LIP = 4,
  126. BFA_PPORT_LINKSTATE_RSN_RX_LIPF7 = 5,
  127. BFA_PPORT_LINKSTATE_RSN_SFP_REMOVED = 6,
  128. BFA_PPORT_LINKSTATE_RSN_PORT_FAULT = 7,
  129. BFA_PPORT_LINKSTATE_RSN_RX_LOS = 8,
  130. BFA_PPORT_LINKSTATE_RSN_LOCAL_FAULT = 9,
  131. BFA_PPORT_LINKSTATE_RSN_REMOTE_FAULT = 10,
  132. BFA_PPORT_LINKSTATE_RSN_TIMEOUT = 11,
  133. /* CEE related reason codes/errors */
  134. CEE_LLDP_INFO_AGED_OUT = 20,
  135. CEE_LLDP_SHUTDOWN_TLV_RCVD = 21,
  136. CEE_PEER_NOT_ADVERTISE_DCBX = 22,
  137. CEE_PEER_NOT_ADVERTISE_PG = 23,
  138. CEE_PEER_NOT_ADVERTISE_PFC = 24,
  139. CEE_PEER_NOT_ADVERTISE_FCOE = 25,
  140. CEE_PG_NOT_COMPATIBLE = 26,
  141. CEE_PFC_NOT_COMPATIBLE = 27,
  142. CEE_FCOE_NOT_COMPATIBLE = 28,
  143. CEE_BAD_PG_RCVD = 29,
  144. CEE_BAD_BW_RCVD = 30,
  145. CEE_BAD_PFC_RCVD = 31,
  146. CEE_BAD_FCOE_PRI_RCVD = 32,
  147. CEE_FCOE_PRI_PFC_OFF = 33,
  148. CEE_DUP_CONTROL_TLV_RCVD = 34,
  149. CEE_DUP_FEAT_TLV_RCVD = 35,
  150. CEE_APPLY_NEW_CFG = 36, /* reason, not an error */
  151. CEE_PROTOCOL_INIT = 37, /* reason, not an error */
  152. CEE_PHY_LINK_DOWN = 38,
  153. CEE_LLS_FCOE_ABSENT = 39,
  154. CEE_LLS_FCOE_DOWN = 40
  155. };
  156. /**
  157. * Default Target Rate Limiting Speed.
  158. */
  159. #define BFA_PPORT_DEF_TRL_SPEED BFA_PPORT_SPEED_1GBPS
  160. /**
  161. * Physical port configuration
  162. */
  163. struct bfa_pport_cfg_s {
  164. u8 topology; /* bfa_pport_topology */
  165. u8 speed; /* enum bfa_pport_speed */
  166. u8 trunked; /* trunked or not */
  167. u8 qos_enabled; /* qos enabled or not */
  168. u8 trunk_ports; /* bitmap of trunked ports */
  169. u8 cfg_hardalpa; /* is hard alpa configured */
  170. u16 maxfrsize; /* maximum frame size */
  171. u8 hardalpa; /* configured hard alpa */
  172. u8 rx_bbcredit; /* receive buffer credits */
  173. u8 tx_bbcredit; /* transmit buffer credits */
  174. u8 ratelimit; /* ratelimit enabled or not */
  175. u8 trl_def_speed; /* ratelimit default speed */
  176. u8 rsvd[3];
  177. u16 path_tov; /* device path timeout */
  178. u16 q_depth; /* SCSI Queue depth */
  179. };
  180. /**
  181. * Port attribute values.
  182. */
  183. struct bfa_pport_attr_s {
  184. /*
  185. * Static fields
  186. */
  187. wwn_t nwwn; /* node wwn */
  188. wwn_t pwwn; /* port wwn */
  189. wwn_t factorynwwn; /* factory node wwn */
  190. wwn_t factorypwwn; /* factory port wwn */
  191. enum fc_cos cos_supported; /* supported class of services */
  192. u32 rsvd;
  193. struct fc_symname_s port_symname; /* port symbolic name */
  194. enum bfa_pport_speed speed_supported; /* supported speeds */
  195. bfa_boolean_t pbind_enabled; /* Will be set if Persistent binding
  196. * enabled. Relevant only in Windows
  197. */
  198. /*
  199. * Configured values
  200. */
  201. struct bfa_pport_cfg_s pport_cfg; /* pport cfg */
  202. /*
  203. * Dynamic field - info from BFA
  204. */
  205. enum bfa_pport_states port_state; /* current port state */
  206. enum bfa_pport_speed speed; /* current speed */
  207. enum bfa_pport_topology topology; /* current topology */
  208. bfa_boolean_t beacon; /* current beacon status */
  209. bfa_boolean_t link_e2e_beacon;/* set if link beacon on */
  210. bfa_boolean_t plog_enabled; /* set if portlog is enabled*/
  211. /*
  212. * Dynamic field - info from FCS
  213. */
  214. u32 pid; /* port ID */
  215. enum bfa_pport_type port_type; /* current topology */
  216. u32 loopback; /* external loopback */
  217. u32 authfail; /* auth fail state */
  218. u32 rsvd2; /* padding for 64 bit */
  219. };
  220. /**
  221. * FC Port statistics.
  222. */
  223. struct bfa_pport_fc_stats_s {
  224. u64 secs_reset; /* Seconds since stats is reset */
  225. u64 tx_frames; /* Tx frames */
  226. u64 tx_words; /* Tx words */
  227. u64 tx_lip; /* Tx LIP */
  228. u64 tx_nos; /* Tx NOS */
  229. u64 tx_ols; /* Tx OLS */
  230. u64 tx_lr; /* Tx LR */
  231. u64 tx_lrr; /* Tx LRR */
  232. u64 rx_frames; /* Rx frames */
  233. u64 rx_words; /* Rx words */
  234. u64 lip_count; /* Rx LIP */
  235. u64 nos_count; /* Rx NOS */
  236. u64 ols_count; /* Rx OLS */
  237. u64 lr_count; /* Rx LR */
  238. u64 lrr_count; /* Rx LRR */
  239. u64 invalid_crcs; /* Rx CRC err frames */
  240. u64 invalid_crc_gd_eof; /* Rx CRC err good EOF frames */
  241. u64 undersized_frm; /* Rx undersized frames */
  242. u64 oversized_frm; /* Rx oversized frames */
  243. u64 bad_eof_frm; /* Rx frames with bad EOF */
  244. u64 error_frames; /* Errored frames */
  245. u64 dropped_frames; /* Dropped frames */
  246. u64 link_failures; /* Link Failure (LF) count */
  247. u64 loss_of_syncs; /* Loss of sync count */
  248. u64 loss_of_signals;/* Loss of signal count */
  249. u64 primseq_errs; /* Primitive sequence protocol err. */
  250. u64 bad_os_count; /* Invalid ordered sets */
  251. u64 err_enc_out; /* Encoding err nonframe_8b10b */
  252. u64 err_enc; /* Encoding err frame_8b10b */
  253. };
  254. /**
  255. * Eth Port statistics.
  256. */
  257. struct bfa_pport_eth_stats_s {
  258. u64 secs_reset; /* Seconds since stats is reset */
  259. u64 frame_64; /* Frames 64 bytes */
  260. u64 frame_65_127; /* Frames 65-127 bytes */
  261. u64 frame_128_255; /* Frames 128-255 bytes */
  262. u64 frame_256_511; /* Frames 256-511 bytes */
  263. u64 frame_512_1023; /* Frames 512-1023 bytes */
  264. u64 frame_1024_1518; /* Frames 1024-1518 bytes */
  265. u64 frame_1519_1522; /* Frames 1519-1522 bytes */
  266. u64 tx_bytes; /* Tx bytes */
  267. u64 tx_packets; /* Tx packets */
  268. u64 tx_mcast_packets; /* Tx multicast packets */
  269. u64 tx_bcast_packets; /* Tx broadcast packets */
  270. u64 tx_control_frame; /* Tx control frame */
  271. u64 tx_drop; /* Tx drops */
  272. u64 tx_jabber; /* Tx jabber */
  273. u64 tx_fcs_error; /* Tx FCS error */
  274. u64 tx_fragments; /* Tx fragments */
  275. u64 rx_bytes; /* Rx bytes */
  276. u64 rx_packets; /* Rx packets */
  277. u64 rx_mcast_packets; /* Rx multicast packets */
  278. u64 rx_bcast_packets; /* Rx broadcast packets */
  279. u64 rx_control_frames; /* Rx control frames */
  280. u64 rx_unknown_opcode; /* Rx unknown opcode */
  281. u64 rx_drop; /* Rx drops */
  282. u64 rx_jabber; /* Rx jabber */
  283. u64 rx_fcs_error; /* Rx FCS errors */
  284. u64 rx_alignment_error; /* Rx alignment errors */
  285. u64 rx_frame_length_error; /* Rx frame len errors */
  286. u64 rx_code_error; /* Rx code errors */
  287. u64 rx_fragments; /* Rx fragments */
  288. u64 rx_pause; /* Rx pause */
  289. u64 rx_zero_pause; /* Rx zero pause */
  290. u64 tx_pause; /* Tx pause */
  291. u64 tx_zero_pause; /* Tx zero pause */
  292. u64 rx_fcoe_pause; /* Rx FCoE pause */
  293. u64 rx_fcoe_zero_pause; /* Rx FCoE zero pause */
  294. u64 tx_fcoe_pause; /* Tx FCoE pause */
  295. u64 tx_fcoe_zero_pause; /* Tx FCoE zero pause */
  296. };
  297. /**
  298. * Port statistics.
  299. */
  300. union bfa_pport_stats_u {
  301. struct bfa_pport_fc_stats_s fc;
  302. struct bfa_pport_eth_stats_s eth;
  303. };
  304. /**
  305. * Port FCP mappings.
  306. */
  307. struct bfa_pport_fcpmap_s {
  308. char osdevname[256];
  309. u32 bus;
  310. u32 target;
  311. u32 oslun;
  312. u32 fcid;
  313. wwn_t nwwn;
  314. wwn_t pwwn;
  315. u64 fcplun;
  316. char luid[256];
  317. };
  318. /**
  319. * Port RNI */
  320. struct bfa_pport_rnid_s {
  321. wwn_t wwn;
  322. u32 unittype;
  323. u32 portid;
  324. u32 attached_nodes_num;
  325. u16 ip_version;
  326. u16 udp_port;
  327. u8 ipaddr[16];
  328. u16 rsvd;
  329. u16 topologydiscoveryflags;
  330. };
  331. struct bfa_fcport_fcf_s {
  332. wwn_t name; /* FCF name */
  333. wwn_t fabric_name; /* Fabric Name */
  334. u8 fipenabled; /* FIP enabled or not */
  335. u8 fipfailed; /* FIP failed or not */
  336. u8 resv[2];
  337. u8 pri; /* FCF priority */
  338. u8 version; /* FIP version used */
  339. u8 available; /* Available for login */
  340. u8 fka_disabled; /* FKA is disabled */
  341. u8 maxsz_verified; /* FCoE max size verified */
  342. u8 fc_map[3]; /* FC map */
  343. u16 vlan; /* FCoE vlan tag/priority */
  344. u32 fka_adv_per; /* FIP ka advert. period */
  345. struct mac_s mac; /* FCF mac */
  346. };
  347. /**
  348. * Link state information
  349. */
  350. struct bfa_pport_link_s {
  351. u8 linkstate; /* Link state bfa_pport_linkstate */
  352. u8 linkstate_rsn; /* bfa_pport_linkstate_rsn_t */
  353. u8 topology; /* P2P/LOOP bfa_pport_topology */
  354. u8 speed; /* Link speed (1/2/4/8 G) */
  355. u32 linkstate_opt; /* Linkstate optional data (debug) */
  356. u8 trunked; /* Trunked or not (1 or 0) */
  357. u8 resvd[3];
  358. struct bfa_qos_attr_s qos_attr; /* QoS Attributes */
  359. union {
  360. struct bfa_qos_vc_attr_s qos_vc_attr; /* VC info from ELP */
  361. struct bfa_fcport_fcf_s fcf; /* FCF information (for FCoE) */
  362. } vc_fcf;
  363. };
  364. #endif /* __BFA_DEFS_PPORT_H__ */