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