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