bfa_defs_cna.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Linux network driver for QLogic BR-series Converged Network Adapter.
  4. */
  5. /*
  6. * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
  7. * Copyright (c) 2014-2015 QLogic Corporation
  8. * All rights reserved
  9. * www.qlogic.com
  10. */
  11. #ifndef __BFA_DEFS_CNA_H__
  12. #define __BFA_DEFS_CNA_H__
  13. #include "bfa_defs.h"
  14. /* FC physical port statistics. */
  15. struct bfa_port_fc_stats {
  16. u64 secs_reset; /*!< Seconds since stats is reset */
  17. u64 tx_frames; /*!< Tx frames */
  18. u64 tx_words; /*!< Tx words */
  19. u64 tx_lip; /*!< Tx LIP */
  20. u64 tx_nos; /*!< Tx NOS */
  21. u64 tx_ols; /*!< Tx OLS */
  22. u64 tx_lr; /*!< Tx LR */
  23. u64 tx_lrr; /*!< Tx LRR */
  24. u64 rx_frames; /*!< Rx frames */
  25. u64 rx_words; /*!< Rx words */
  26. u64 lip_count; /*!< Rx LIP */
  27. u64 nos_count; /*!< Rx NOS */
  28. u64 ols_count; /*!< Rx OLS */
  29. u64 lr_count; /*!< Rx LR */
  30. u64 lrr_count; /*!< Rx LRR */
  31. u64 invalid_crcs; /*!< Rx CRC err frames */
  32. u64 invalid_crc_gd_eof; /*!< Rx CRC err good EOF frames */
  33. u64 undersized_frm; /*!< Rx undersized frames */
  34. u64 oversized_frm; /*!< Rx oversized frames */
  35. u64 bad_eof_frm; /*!< Rx frames with bad EOF */
  36. u64 error_frames; /*!< Errored frames */
  37. u64 dropped_frames; /*!< Dropped frames */
  38. u64 link_failures; /*!< Link Failure (LF) count */
  39. u64 loss_of_syncs; /*!< Loss of sync count */
  40. u64 loss_of_signals; /*!< Loss of signal count */
  41. u64 primseq_errs; /*!< Primitive sequence protocol err. */
  42. u64 bad_os_count; /*!< Invalid ordered sets */
  43. u64 err_enc_out; /*!< Encoding err nonframe_8b10b */
  44. u64 err_enc; /*!< Encoding err frame_8b10b */
  45. u64 bbsc_frames_lost; /*!< Credit Recovery-Frames Lost */
  46. u64 bbsc_credits_lost; /*!< Credit Recovery-Credits Lost */
  47. u64 bbsc_link_resets; /*!< Credit Recovery-Link Resets */
  48. };
  49. /* Eth Physical Port statistics. */
  50. struct bfa_port_eth_stats {
  51. u64 secs_reset; /*!< Seconds since stats is reset */
  52. u64 frame_64; /*!< Frames 64 bytes */
  53. u64 frame_65_127; /*!< Frames 65-127 bytes */
  54. u64 frame_128_255; /*!< Frames 128-255 bytes */
  55. u64 frame_256_511; /*!< Frames 256-511 bytes */
  56. u64 frame_512_1023; /*!< Frames 512-1023 bytes */
  57. u64 frame_1024_1518; /*!< Frames 1024-1518 bytes */
  58. u64 frame_1519_1522; /*!< Frames 1519-1522 bytes */
  59. u64 tx_bytes; /*!< Tx bytes */
  60. u64 tx_packets; /*!< Tx packets */
  61. u64 tx_mcast_packets; /*!< Tx multicast packets */
  62. u64 tx_bcast_packets; /*!< Tx broadcast packets */
  63. u64 tx_control_frame; /*!< Tx control frame */
  64. u64 tx_drop; /*!< Tx drops */
  65. u64 tx_jabber; /*!< Tx jabber */
  66. u64 tx_fcs_error; /*!< Tx FCS errors */
  67. u64 tx_fragments; /*!< Tx fragments */
  68. u64 rx_bytes; /*!< Rx bytes */
  69. u64 rx_packets; /*!< Rx packets */
  70. u64 rx_mcast_packets; /*!< Rx multicast packets */
  71. u64 rx_bcast_packets; /*!< Rx broadcast packets */
  72. u64 rx_control_frames; /*!< Rx control frames */
  73. u64 rx_unknown_opcode; /*!< Rx unknown opcode */
  74. u64 rx_drop; /*!< Rx drops */
  75. u64 rx_jabber; /*!< Rx jabber */
  76. u64 rx_fcs_error; /*!< Rx FCS errors */
  77. u64 rx_alignment_error; /*!< Rx alignment errors */
  78. u64 rx_frame_length_error; /*!< Rx frame len errors */
  79. u64 rx_code_error; /*!< Rx code errors */
  80. u64 rx_fragments; /*!< Rx fragments */
  81. u64 rx_pause; /*!< Rx pause */
  82. u64 rx_zero_pause; /*!< Rx zero pause */
  83. u64 tx_pause; /*!< Tx pause */
  84. u64 tx_zero_pause; /*!< Tx zero pause */
  85. u64 rx_fcoe_pause; /*!< Rx FCoE pause */
  86. u64 rx_fcoe_zero_pause; /*!< Rx FCoE zero pause */
  87. u64 tx_fcoe_pause; /*!< Tx FCoE pause */
  88. u64 tx_fcoe_zero_pause; /*!< Tx FCoE zero pause */
  89. u64 rx_iscsi_pause; /*!< Rx iSCSI pause */
  90. u64 rx_iscsi_zero_pause; /*!< Rx iSCSI zero pause */
  91. u64 tx_iscsi_pause; /*!< Tx iSCSI pause */
  92. u64 tx_iscsi_zero_pause; /*!< Tx iSCSI zero pause */
  93. };
  94. /* Port statistics. */
  95. union bfa_port_stats_u {
  96. struct bfa_port_fc_stats fc;
  97. struct bfa_port_eth_stats eth;
  98. };
  99. #define BFA_CEE_LLDP_MAX_STRING_LEN (128)
  100. #define BFA_CEE_DCBX_MAX_PRIORITY (8)
  101. #define BFA_CEE_DCBX_MAX_PGID (8)
  102. #define BFA_CEE_LLDP_SYS_CAP_OTHER 0x0001
  103. #define BFA_CEE_LLDP_SYS_CAP_REPEATER 0x0002
  104. #define BFA_CEE_LLDP_SYS_CAP_MAC_BRIDGE 0x0004
  105. #define BFA_CEE_LLDP_SYS_CAP_WLAN_AP 0x0008
  106. #define BFA_CEE_LLDP_SYS_CAP_ROUTER 0x0010
  107. #define BFA_CEE_LLDP_SYS_CAP_TELEPHONE 0x0020
  108. #define BFA_CEE_LLDP_SYS_CAP_DOCSIS_CD 0x0040
  109. #define BFA_CEE_LLDP_SYS_CAP_STATION 0x0080
  110. #define BFA_CEE_LLDP_SYS_CAP_CVLAN 0x0100
  111. #define BFA_CEE_LLDP_SYS_CAP_SVLAN 0x0200
  112. #define BFA_CEE_LLDP_SYS_CAP_TPMR 0x0400
  113. /* LLDP string type */
  114. struct bfa_cee_lldp_str {
  115. u8 sub_type;
  116. u8 len;
  117. u8 rsvd[2];
  118. u8 value[BFA_CEE_LLDP_MAX_STRING_LEN];
  119. } __packed;
  120. /* LLDP parameters */
  121. struct bfa_cee_lldp_cfg {
  122. struct bfa_cee_lldp_str chassis_id;
  123. struct bfa_cee_lldp_str port_id;
  124. struct bfa_cee_lldp_str port_desc;
  125. struct bfa_cee_lldp_str sys_name;
  126. struct bfa_cee_lldp_str sys_desc;
  127. struct bfa_cee_lldp_str mgmt_addr;
  128. u16 time_to_live;
  129. u16 enabled_system_cap;
  130. } __packed;
  131. enum bfa_cee_dcbx_version {
  132. DCBX_PROTOCOL_PRECEE = 1,
  133. DCBX_PROTOCOL_CEE = 2,
  134. };
  135. enum bfa_cee_lls {
  136. /* LLS is down because the TLV not sent by the peer */
  137. CEE_LLS_DOWN_NO_TLV = 0,
  138. /* LLS is down as advertised by the peer */
  139. CEE_LLS_DOWN = 1,
  140. CEE_LLS_UP = 2,
  141. };
  142. /* CEE/DCBX parameters */
  143. struct bfa_cee_dcbx_cfg {
  144. u8 pgid[BFA_CEE_DCBX_MAX_PRIORITY];
  145. u8 pg_percentage[BFA_CEE_DCBX_MAX_PGID];
  146. u8 pfc_primap; /* bitmap of priorties with PFC enabled */
  147. u8 fcoe_primap; /* bitmap of priorities used for FcoE traffic */
  148. u8 iscsi_primap; /* bitmap of priorities used for iSCSI traffic */
  149. u8 dcbx_version; /* operating version:CEE or preCEE */
  150. u8 lls_fcoe; /* FCoE Logical Link Status */
  151. u8 lls_lan; /* LAN Logical Link Status */
  152. u8 rsvd[2];
  153. } __packed;
  154. /* CEE status */
  155. /* Making this to tri-state for the benefit of port list command */
  156. enum bfa_cee_status {
  157. CEE_UP = 0,
  158. CEE_PHY_UP = 1,
  159. CEE_LOOPBACK = 2,
  160. CEE_PHY_DOWN = 3,
  161. };
  162. /* CEE Query */
  163. struct bfa_cee_attr {
  164. u8 cee_status;
  165. u8 error_reason;
  166. struct bfa_cee_lldp_cfg lldp_remote;
  167. struct bfa_cee_dcbx_cfg dcbx_remote;
  168. u8 src_mac[ETH_ALEN];
  169. u8 link_speed;
  170. u8 nw_priority;
  171. u8 filler[2];
  172. } __packed;
  173. /* LLDP/DCBX/CEE Statistics */
  174. struct bfa_cee_stats {
  175. u32 lldp_tx_frames; /*!< LLDP Tx Frames */
  176. u32 lldp_rx_frames; /*!< LLDP Rx Frames */
  177. u32 lldp_rx_frames_invalid; /*!< LLDP Rx Frames invalid */
  178. u32 lldp_rx_frames_new; /*!< LLDP Rx Frames new */
  179. u32 lldp_tlvs_unrecognized; /*!< LLDP Rx unrecognized TLVs */
  180. u32 lldp_rx_shutdown_tlvs; /*!< LLDP Rx shutdown TLVs */
  181. u32 lldp_info_aged_out; /*!< LLDP remote info aged out */
  182. u32 dcbx_phylink_ups; /*!< DCBX phy link ups */
  183. u32 dcbx_phylink_downs; /*!< DCBX phy link downs */
  184. u32 dcbx_rx_tlvs; /*!< DCBX Rx TLVs */
  185. u32 dcbx_rx_tlvs_invalid; /*!< DCBX Rx TLVs invalid */
  186. u32 dcbx_control_tlv_error; /*!< DCBX control TLV errors */
  187. u32 dcbx_feature_tlv_error; /*!< DCBX feature TLV errors */
  188. u32 dcbx_cee_cfg_new; /*!< DCBX new CEE cfg rcvd */
  189. u32 cee_status_down; /*!< CEE status down */
  190. u32 cee_status_up; /*!< CEE status up */
  191. u32 cee_hw_cfg_changed; /*!< CEE hw cfg changed */
  192. u32 cee_rx_invalid_cfg; /*!< CEE invalid cfg */
  193. } __packed;
  194. #endif /* __BFA_DEFS_CNA_H__ */