/drivers/scsi/bfa/include/defs/bfa_defs_pport.h

https://bitbucket.org/abioy/linux · C Header · 406 lines · 288 code · 30 blank · 88 comment · 3 complexity · 098d6b1e33591ba448529c229bee76ba MD5 · raw file

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