1171095Ssam/*-
2171095Ssam * Copyright (c) 2002-2007 Neterion, Inc.
3171095Ssam * All rights reserved.
4171095Ssam *
5171095Ssam * Redistribution and use in source and binary forms, with or without
6171095Ssam * modification, are permitted provided that the following conditions
7171095Ssam * are met:
8171095Ssam * 1. Redistributions of source code must retain the above copyright
9171095Ssam *    notice, this list of conditions and the following disclaimer.
10171095Ssam * 2. Redistributions in binary form must reproduce the above copyright
11171095Ssam *    notice, this list of conditions and the following disclaimer in the
12171095Ssam *    documentation and/or other materials provided with the distribution.
13171095Ssam *
14171095Ssam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15171095Ssam * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16171095Ssam * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17171095Ssam * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18171095Ssam * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19171095Ssam * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20171095Ssam * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21171095Ssam * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22171095Ssam * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23171095Ssam * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24171095Ssam * SUCH DAMAGE.
25171095Ssam *
26171095Ssam * $FreeBSD$
27171095Ssam */
28171095Ssam
29171095Ssam#ifndef XGE_HAL_STATS_H
30171095Ssam#define XGE_HAL_STATS_H
31171095Ssam
32171095Ssam#include <dev/nxge/include/xge-os-pal.h>
33171095Ssam#include <dev/nxge/include/xge-debug.h>
34171095Ssam#include <dev/nxge/include/xgehal-types.h>
35171095Ssam#include <dev/nxge/include/xgehal-config.h>
36171095Ssam
37171095Ssam__EXTERN_BEGIN_DECLS
38171095Ssam
39171095Ssam/**
40171095Ssam * struct xge_hal_stats_hw_info_t - Xframe hardware statistics.
41171095Ssam * Transmit MAC Statistics:
42171095Ssam *
43171095Ssam * @tmac_frms: Count of successfully transmitted MAC
44171095Ssam * frames Note that this statistic may be inaccurate. The correct statistic may
45171095Ssam * be derived by calcualating (tmac_ttl_octets - tmac_ttl_less_fb_octets) / 8
46171095Ssam *
47171095Ssam * @tmac_data_octets: Count of data and padding octets of successfully
48171095Ssam * transmitted frames.
49171095Ssam *
50171095Ssam * @tmac_drop_frms: Count of frames that could not be sent for no other reason
51171095Ssam * than internal MAC processing. Increments once whenever the
52171095Ssam * transmit buffer is flushed (due to an ECC error on a memory descriptor).
53171095Ssam *
54171095Ssam * @tmac_mcst_frms: Count of successfully transmitted frames to a multicast
55171095Ssam * address. Does not include frames sent to the broadcast address.
56171095Ssam *
57171095Ssam * @tmac_bcst_frms: Count of successfully transmitted frames to the broadcast
58171095Ssam * address.
59171095Ssam *
60171095Ssam * @tmac_pause_ctrl_frms: Count of MAC PAUSE control frames that are
61171095Ssam * transmitted. Since, the only control frames supported by this device
62171095Ssam * are PAUSE frames, this register is a count of all transmitted MAC control
63171095Ssam * frames.
64171095Ssam *
65171095Ssam * @tmac_ttl_octets: Count of total octets of transmitted frames, including
66171095Ssam * framing characters.
67171095Ssam *
68171095Ssam * @tmac_ucst_frms: Count of transmitted frames containing a unicast address.
69171095Ssam * @tmac_nucst_frms: Count of transmitted frames containing a non-unicast
70171095Ssam * (broadcast, multicast) address.
71171095Ssam *
72171095Ssam * @tmac_any_err_frms: Count of transmitted frames containing any error that
73171095Ssam * prevents them from being passed to the network. Increments if there is an ECC
74171095Ssam * while reading the frame out of the transmit buffer.
75171095Ssam *
76171095Ssam * @tmac_ttl_less_fb_octets: Count of total octets of transmitted
77171095Ssam * frames, not including framing characters (i.e. less framing bits)
78171095Ssam *
79171095Ssam * @tmac_vld_ip_octets: Count of total octets of transmitted IP datagrams that
80171095Ssam * were passed to the network. Frames that are padded by the host have
81171095Ssam * their padding counted as part of the IP datagram.
82171095Ssam *
83171095Ssam * @tmac_vld_ip: Count of transmitted IP datagrams that were passed to the
84171095Ssam * network.
85171095Ssam *
86171095Ssam * @tmac_drop_ip: Count of transmitted IP datagrams that could not be passed to
87171095Ssam * the network. Increments because of 1) an internal processing error (such as
88171095Ssam * an uncorrectable ECC error); 2) a frame parsing error during IP checksum
89171095Ssam * calculation.
90171095Ssam *
91171095Ssam * @tmac_icmp: Count of transmitted ICMP messages. Includes messages not sent
92171095Ssam * due to problems within ICMP.
93171095Ssam *
94171095Ssam * @tmac_rst_tcp: Count of transmitted TCP segments containing the RST flag.
95171095Ssam *
96171095Ssam * @tmac_tcp: Count of transmitted TCP segments. Note that Xena has
97171095Ssam * no knowledge of retransmission.
98171095Ssam *
99171095Ssam * @tmac_udp: Count of transmitted UDP datagrams.
100171095Ssam * @reserved_0: Reserved.
101171095Ssam *
102171095Ssam * Receive MAC Statistics:
103171095Ssam * @rmac_vld_frms: Count of successfully received MAC frames. Does not include
104171095Ssam * frames received with frame-too-long, FCS, or length errors.
105171095Ssam *
106171095Ssam * @rmac_data_octets: Count of data and padding octets of successfully received
107171095Ssam * frames. Does not include frames received with frame-too-long, FCS, or length
108171095Ssam * errors.
109171095Ssam *
110171095Ssam * @rmac_fcs_err_frms: Count of received MAC frames that do not pass FCS. Does
111171095Ssam * not include frames received with frame-too-long or frame-too-short error.
112171095Ssam *
113171095Ssam * @rmac_drop_frms: Count of received frames that could not be passed to the
114171095Ssam * host because of 1) Random Early Discard (RED); 2) Frame steering algorithm
115171095Ssam * found no available queue; 3) Receive ingress buffer overflow.
116171095Ssam *
117171095Ssam * @rmac_vld_mcst_frms: Count of successfully received MAC frames containing a
118171095Ssam * multicast address. Does not include frames received with frame-too-long, FCS,
119171095Ssam * or length errors.
120171095Ssam *
121171095Ssam * @rmac_vld_bcst_frms: Count of successfully received MAC frames containing a
122171095Ssam * broadcast address. Does not include frames received with frame-too-long, FCS,
123171095Ssam * or length errors.
124171095Ssam *
125171095Ssam * @rmac_in_rng_len_err_frms: Count of received frames with a length/type field
126171095Ssam * value between 46 (42 for VLANtagged frames) and 1500 (also 1500 for
127171095Ssam * VLAN-tagged frames), inclusive, that does not match the number of data octets
128171095Ssam * (including pad) received. Also contains a count of received frames with a
129171095Ssam * length/type field less than 46 (42 for VLAN-tagged frames) and the number of
130171095Ssam * data octets (including pad) received is greater than 46 (42 for VLAN-tagged
131171095Ssam * frames).
132171095Ssam *
133171095Ssam * @rmac_out_rng_len_err_frms: Count of received frames with length/type field
134171095Ssam * between 1501 and 1535 decimal, inclusive.
135171095Ssam *
136171095Ssam * @rmac_long_frms: Count of received frames that are longer than
137171095Ssam * rmac_max_pyld_len + 18 bytes (+22 bytes if VLAN-tagged).
138171095Ssam *
139171095Ssam * @rmac_pause_ctrl_frms: Count of received MAC PAUSE control frames.
140171095Ssam *
141171095Ssam * @rmac_unsup_ctrl_frms: Count of received MAC control frames
142171095Ssam * that do not contain the PAUSE opcode. The sum of MAC_PAUSE_CTRL_FRMS and this
143171095Ssam * register is a count of all received MAC control frames.
144171095Ssam *
145171095Ssam * @rmac_ttl_octets: Count of total octets of received frames, including framing
146171095Ssam * characters.
147171095Ssam *
148171095Ssam * @rmac_accepted_ucst_frms: Count of successfully received frames
149171095Ssam * containing a unicast address. Only includes frames that are passed to the
150171095Ssam * system.
151171095Ssam *
152171095Ssam * @rmac_accepted_nucst_frms: Count of successfully received frames
153171095Ssam * containing a non-unicast (broadcast or multicast) address. Only includes
154171095Ssam * frames that are passed to the system. Could include, for instance,
155171095Ssam * non-unicast frames that contain FCS errors if the MAC_ERROR_CFG register is
156171095Ssam * set to pass FCSerrored frames to the host.
157171095Ssam *
158171095Ssam * @rmac_discarded_frms: Count of received frames containing any error that
159171095Ssam * prevents them from being passed to the system. Includes, for example,
160171095Ssam * received pause frames that are discarded by the MAC and frames discarded
161171095Ssam * because of their destination address.
162171095Ssam *
163171095Ssam * @rmac_drop_events: Because the RMAC drops one frame at a time, this stat
164171095Ssam * matches rmac_drop_frms.
165171095Ssam *
166171095Ssam * @reserved_1: Reserved.
167171095Ssam * @rmac_ttl_less_fb_octets: Count of total octets of received frames,
168171095Ssam * not including framing characters (i.e. less framing bits).
169171095Ssam *
170171095Ssam * @rmac_ttl_frms: Count of all received MAC frames, including frames received
171171095Ssam * with frame-too-long, FCS, or length errors.
172171095Ssam *
173171095Ssam * @reserved_2: Reserved.
174171095Ssam * @reserved_3: Reserved.
175171095Ssam * @rmac_usized_frms: Count of received frames of length (including FCS, but not
176171095Ssam * framing bits) less than 64 octets, that are otherwise well-formed.
177171095Ssam *
178171095Ssam * @rmac_osized_frms: Count of received frames of length (including FCS, but not
179171095Ssam * framing bits) more than 1518 octets, that are otherwise well-formed.
180171095Ssam *
181171095Ssam * @rmac_frag_frms: Count of received frames of length (including FCS, but not
182171095Ssam * framing bits) less than 64 octets that had bad FCS. In other words, counts
183171095Ssam * fragments (i.e. runts).
184171095Ssam *
185171095Ssam * @rmac_jabber_frms: Count of received frames of length (including FCS, but not
186171095Ssam * framing bits) more than MTU octets that had bad FCS. In other words, counts
187171095Ssam * jabbers.
188171095Ssam *
189171095Ssam * @reserved_4: Reserved.
190171095Ssam * @rmac_ttl_64_frms: Count of all received MAC frames with length (including
191171095Ssam * FCS, but not framing bits) of exactly 64 octets. Includes frames received
192171095Ssam * with frame-too-long, FCS, or length errors.
193171095Ssam *
194171095Ssam * @rmac_ttl_65_127_frms: Count of all received MAC frames with length
195171095Ssam * (including FCS, but not framing bits) of between 65 and 127 octets
196171095Ssam * inclusive. Includes frames received with frame-too-long, FCS, or length
197171095Ssam * errors.
198171095Ssam * @reserved_5: Reserved.
199171095Ssam * @rmac_ttl_128_255_frms: Count of all received MAC frames with length
200171095Ssam * (including FCS, but not framing bits) of between 128 and 255 octets
201171095Ssam * inclusive. Includes frames received with frame-too-long, FCS, or length
202171095Ssam * errors.
203171095Ssam *
204171095Ssam * @rmac_ttl_256_511_frms: Count of all received MAC frames with length
205171095Ssam * (including FCS, but not framing bits) of between 256 and 511 octets
206171095Ssam * inclusive. Includes frames received with frame-too-long, FCS, or length
207171095Ssam * errors.
208171095Ssam *
209171095Ssam * @reserved_6: Reserved.
210171095Ssam * @rmac_ttl_512_1023_frms: Count of all received MAC frames with length
211171095Ssam * (including FCS, but not framing bits) of between 512 and 1023 octets
212171095Ssam * inclusive. Includes frames received with frame-too-long, FCS, or length
213171095Ssam * errors.
214171095Ssam *
215171095Ssam * @rmac_ttl_1024_1518_frms: Count of all received MAC frames with length
216171095Ssam * (including FCS, but not framing bits) of between 1024 and 1518 octets
217171095Ssam * inclusive. Includes frames received with frame-too-long, FCS, or length
218171095Ssam * errors.
219171095Ssam * @reserved_7: Reserved.
220171095Ssam * @rmac_ip: Count of received IP datagrams. Includes errored IP datagrams.
221171095Ssam *
222171095Ssam * @rmac_ip_octets: Count of number of octets in received IP datagrams. Includes
223171095Ssam * errored IP datagrams.
224171095Ssam *
225171095Ssam * @rmac_hdr_err_ip: Count of received IP datagrams that are discarded due to IP
226171095Ssam * header errors.
227171095Ssam *
228171095Ssam * @rmac_drop_ip: Count of received IP datagrams that could not be passed to the
229171095Ssam * host because of 1) Random Early Discard (RED); 2) Frame steering algorithm
230171095Ssam * found no available queue; 3) Receive ingress buffer overflow.
231171095Ssam * @rmac_icmp: Count of received ICMP messages. Includes errored ICMP messages
232171095Ssam * (due to ICMP checksum fail).
233171095Ssam *
234171095Ssam * @reserved_8: Reserved.
235171095Ssam * @rmac_tcp: Count of received TCP segments. Since Xena is unaware of
236171095Ssam * connection context, counts all received TCP segments, regardless of whether
237171095Ssam * or not they pertain to an established connection.
238171095Ssam *
239171095Ssam * @rmac_udp: Count of received UDP datagrams.
240171095Ssam * @rmac_err_drp_udp: Count of received UDP datagrams that were not delivered to
241171095Ssam * the system because of 1) Random Early Discard (RED); 2) Frame steering
242171095Ssam * algorithm found no available queue; 3) Receive ingress buffer overflow.
243171095Ssam *
244171095Ssam * @rmac_xgmii_err_sym: Count of the number of symbol errors in the received
245171095Ssam * XGMII data (i.e. PHY indicates "Receive Error" on the XGMII). Only includes
246171095Ssam * symbol errors that are observed between the XGMII Start Frame Delimiter
247171095Ssam * and End Frame Delimiter, inclusive. And only increments the count by one for
248171095Ssam * each frame.
249171095Ssam *
250171095Ssam * @rmac_frms_q0: Count of number of frames that pass through queue 0 of receive
251171095Ssam * buffer.
252171095Ssam * @rmac_frms_q1: Count of number of frames that pass through queue 1 of receive
253171095Ssam * buffer.
254171095Ssam * @rmac_frms_q2: Count of number of frames that pass through queue 2 of receive
255171095Ssam * buffer.
256171095Ssam * @rmac_frms_q3: Count of number of frames that pass through queue 3 of receive
257171095Ssam * buffer.
258171095Ssam * @rmac_frms_q4: Count of number of frames that pass through queue 4 of receive
259171095Ssam * buffer.
260171095Ssam * @rmac_frms_q5: Count of number of frames that pass through queue 5 of receive
261171095Ssam * buffer.
262171095Ssam * @rmac_frms_q6: Count of number of frames that pass through queue 6 of receive
263171095Ssam * buffer.
264171095Ssam * @rmac_frms_q7: Count of number of frames that pass through queue 7 of receive
265171095Ssam * buffer.
266171095Ssam * @rmac_full_q0: Count of number of times that receive buffer queue 0 has
267171095Ssam * filled up. If a queue is size 0, then this stat is incremented to a value of
268171095Ssam * 1 when MAC receives its first frame.
269171095Ssam *
270171095Ssam * @rmac_full_q1: Count of number of times that receive buffer queue 1 has
271171095Ssam * filled up. If a queue is size 0, then this stat is incremented to a value of
272171095Ssam * 1 when MAC receives its first frame.
273171095Ssam *
274171095Ssam * @rmac_full_q2: Count of number of times that receive buffer queue 2 has
275171095Ssam * filled up. If a queue is size 0, then this stat is incremented to a value of
276171095Ssam * 1 when MAC receives its first frame.
277171095Ssam *
278171095Ssam * @rmac_full_q3: Count of number of times that receive buffer queue 3 has
279171095Ssam * filled up. If a queue is size 0, then this stat is incremented to a value of
280171095Ssam * 1 when MAC receives its first frame.
281171095Ssam *
282171095Ssam * @rmac_full_q4: Count of number of times that receive buffer queue 4 has
283171095Ssam * filled up. If a queue is size 0, then this stat is incremented to a value of
284171095Ssam * 1 when MAC receives its first frame.
285171095Ssam *
286171095Ssam * @rmac_full_q5: Count of number of times that receive buffer queue 5 has
287171095Ssam * filled up. If a queue is size 0, then this stat is incremented to a value of
288171095Ssam * 1 when MAC receives its first frame.
289171095Ssam *
290171095Ssam * @rmac_full_q6: Count of number of times that receive buffer queue 6 has
291171095Ssam * filled up. If a queue is size 0, then this stat is incremented to a value of
292171095Ssam * 1 when MAC receives its first frame.
293171095Ssam *
294171095Ssam * @rmac_full_q7: Count of number of times that receive buffer queue 7 has
295171095Ssam * filled up. If a queue is size 0, then this stat is incremented to a value of
296171095Ssam * 1 when MAC receives its first frame.
297171095Ssam *
298171095Ssam * @rmac_pause_cnt: Count of number of pause quanta that the MAC has been in the
299171095Ssam * paused state. Recall, one pause quantum equates to 512 bit times.
300171095Ssam * @reserved_9: Reserved.
301171095Ssam * @rmac_xgmii_data_err_cnt: This counter is incremented when either 1) The
302171095Ssam * Reconcilliation Sublayer (RS) is expecting one control character and gets
303171095Ssam * another (i.e. expecting Start control character and gets another control
304171095Ssam * character); 2) Start control character is not in lane 0 or lane 4; 3) The RS
305171095Ssam * gets a Start control character, but the start frame delimiter is not found in
306171095Ssam * the correct location.
307171095Ssam * @rmac_xgmii_ctrl_err_cnt: Maintains a count of unexpected or
308171095Ssam * misplaced control characters occuring outside of normal data transmission
309171095Ssam * (i.e. not included in RMAC_XGMII_DATA_ERR_CNT).
310171095Ssam *
311171095Ssam * @rmac_accepted_ip: Count of received IP datagrams that were passed to the
312171095Ssam * system.
313171095Ssam *
314171095Ssam * @rmac_err_tcp: Count of received TCP segments containing errors. For example,
315171095Ssam * bad TCP checksum.
316171095Ssam *
317171095Ssam * PCI (bus) Statistics:
318171095Ssam * @rd_req_cnt: Counts the total number of read requests made by the device.
319171095Ssam * @new_rd_req_cnt: Counts the requests made for a new read sequence (request
320171095Ssam * made for the same sequence after a retry or disconnect response are not
321171095Ssam * counted).
322171095Ssam * @new_rd_req_rtry_cnt: Counts the Retry responses received on the start of
323171095Ssam * the new read sequences.
324171095Ssam * @rd_rtry_cnt: Counts the Retry responses received for read requests.
325171095Ssam * @wr_rtry_rd_ack_cnt: Increments whenever a read request is accepted by
326171095Ssam * the target after a write request was terminated with retry.
327171095Ssam * @wr_req_cnt: Counts the total number of Write requests made by the device.
328171095Ssam * @new_wr_req_cnt: Counts the requests made for a new write sequence (request
329171095Ssam * made for the same sequence after a retry or disconnect response are not
330171095Ssam * counted).
331171095Ssam * @new_wr_req_rtry_cnt: Counts the requests made for a new write sequence
332171095Ssam * (request made for the same sequence after a retry or disconnect response are
333171095Ssam * not counted).
334171095Ssam *
335171095Ssam * @wr_rtry_cnt: Counts the Retry responses received for write requests.
336171095Ssam * @wr_disc_cnt: Write Disconnect. Counts the target initiated disconnects
337171095Ssam * on write transactions.
338171095Ssam * @rd_rtry_wr_ack_cnt: Increments whenever a write request is accepted by the
339171095Ssam * target after a read request was terminated with retry.
340171095Ssam *
341171095Ssam * @txp_wr_cnt: Counts the host write transactions to the Tx Pointer
342171095Ssam * FIFOs.
343171095Ssam * @txd_rd_cnt: Count of the Transmit Descriptor (TxD) read requests.
344171095Ssam * @txd_wr_cnt: Count of the TxD write requests.
345171095Ssam * @rxd_rd_cnt: Count of the Receive Descriptor (RxD) read requests.
346171095Ssam * @rxd_wr_cnt: Count of the RxD write requests.
347171095Ssam * @txf_rd_cnt: Count of transmit frame read requests. This will not
348171095Ssam * equal the number of frames transmitted, as frame data is typically spread
349171095Ssam * across multiple PCI transactions.
350171095Ssam * @rxf_wr_cnt: Count of receive frame write requests.
351171095Ssam *
352171095Ssam * @tmac_frms_oflow: tbd
353171095Ssam * @tmac_data_octets_oflow: tbd
354171095Ssam * @tmac_mcst_frms_oflow: tbd
355171095Ssam * @tmac_bcst_frms_oflow: tbd
356171095Ssam * @tmac_ttl_octets_oflow: tbd
357171095Ssam * @tmac_ucst_frms_oflow: tbd
358171095Ssam * @tmac_nucst_frms_oflow: tbd
359171095Ssam * @tmac_any_err_frms_oflow: tbd
360171095Ssam * @tmac_vlan_frms: tbd
361171095Ssam * @tmac_vld_ip_oflow: tbd
362171095Ssam * @tmac_drop_ip_oflow: tbd
363171095Ssam * @tmac_icmp_oflow: tbd
364171095Ssam * @tmac_rst_tcp_oflow: tbd
365171095Ssam * @tmac_udp_oflow: tbd
366171095Ssam * @reserved_10: tbd
367171095Ssam * @tpa_unknown_protocol: tbd
368171095Ssam * @tpa_parse_failure: tbd
369171095Ssam * @rmac_vld_frms_oflow: tbd
370171095Ssam * @rmac_data_octets_oflow: tbd
371171095Ssam * @rmac_vld_mcst_frms_oflow: tbd
372171095Ssam * @rmac_vld_bcst_frms_oflow: tbd
373171095Ssam * @rmac_ttl_octets_oflow: tbd
374171095Ssam * @rmac_accepted_ucst_frms_oflow: tbd
375171095Ssam * @rmac_accepted_nucst_frms_oflow: tbd
376171095Ssam * @rmac_discarded_frms_oflow: tbd
377171095Ssam * @rmac_drop_events_oflow: tbd
378171095Ssam * @rmac_usized_frms_oflow: tbd
379171095Ssam * @rmac_osized_frms_oflow: tbd
380171095Ssam * @rmac_frag_frms_oflow: tbd
381171095Ssam * @rmac_jabber_frms_oflow: tbd
382171095Ssam * @rmac_ip_oflow: tbd
383171095Ssam * @rmac_drop_ip_oflow: tbd
384171095Ssam * @rmac_icmp_oflow: tbd
385171095Ssam * @rmac_udp_oflow: tbd
386171095Ssam * @reserved_11: tbd
387171095Ssam * @rmac_err_drp_udp_oflow: tbd
388171095Ssam * @rmac_pause_cnt_oflow: tbd
389171095Ssam * @rmac_ttl_1519_4095_frms: tbd
390171095Ssam * @rmac_ttl_4096_8191_frms: tbd
391171095Ssam * @rmac_ttl_8192_max_frms: tbd
392171095Ssam * @rmac_ttl_gt_max_frms: tbd
393171095Ssam * @rmac_osized_alt_frms: tbd
394171095Ssam * @rmac_jabber_alt_frms: tbd
395171095Ssam * @rmac_gt_max_alt_frms: tbd
396171095Ssam * @rmac_vlan_frms: tbd
397171095Ssam * @rmac_fcs_discard: tbd
398171095Ssam * @rmac_len_discard: tbd
399171095Ssam * @rmac_da_discard: tbd
400171095Ssam * @rmac_pf_discard: tbd
401171095Ssam * @rmac_rts_discard: tbd
402171095Ssam * @rmac_wol_discard: tbd
403171095Ssam * @rmac_red_discard: tbd
404171095Ssam * @rmac_ingm_full_discard: tbd
405171095Ssam * @rmac_accepted_ip_oflow: tbd
406171095Ssam * @reserved_12: tbd
407171095Ssam * @link_fault_cnt: TBD
408171095Ssam * @reserved_13: tbd
409171095Ssam * Xframe hardware statistics.
410171095Ssam */
411171095Ssamtypedef struct xge_hal_stats_hw_info_t {
412171095Ssam#ifdef  XGE_OS_HOST_BIG_ENDIAN
413171095Ssam/* Tx MAC statistics counters. */
414171095Ssam	u32 tmac_frms;
415171095Ssam	u32 tmac_data_octets;
416171095Ssam	u64 tmac_drop_frms;
417171095Ssam	u32 tmac_mcst_frms;
418171095Ssam	u32 tmac_bcst_frms;
419171095Ssam	u64 tmac_pause_ctrl_frms;
420171095Ssam	u32 tmac_ttl_octets;
421171095Ssam	u32 tmac_ucst_frms;
422171095Ssam	u32 tmac_nucst_frms;
423171095Ssam	u32 tmac_any_err_frms;
424171095Ssam	u64 tmac_ttl_less_fb_octets;
425171095Ssam	u64 tmac_vld_ip_octets;
426171095Ssam	u32 tmac_vld_ip;
427171095Ssam	u32 tmac_drop_ip;
428171095Ssam	u32 tmac_icmp;
429171095Ssam	u32 tmac_rst_tcp;
430171095Ssam	u64 tmac_tcp;
431171095Ssam	u32 tmac_udp;
432171095Ssam	u32 reserved_0;
433171095Ssam
434171095Ssam/* Rx MAC Statistics counters. */
435171095Ssam	u32 rmac_vld_frms;
436171095Ssam	u32 rmac_data_octets;
437171095Ssam	u64 rmac_fcs_err_frms;
438171095Ssam	u64 rmac_drop_frms;
439171095Ssam	u32 rmac_vld_mcst_frms;
440171095Ssam	u32 rmac_vld_bcst_frms;
441171095Ssam	u32 rmac_in_rng_len_err_frms;
442171095Ssam	u32 rmac_out_rng_len_err_frms;
443171095Ssam	u64 rmac_long_frms;
444171095Ssam	u64 rmac_pause_ctrl_frms;
445171095Ssam	u64 rmac_unsup_ctrl_frms;
446171095Ssam	u32 rmac_ttl_octets;
447171095Ssam	u32 rmac_accepted_ucst_frms;
448171095Ssam	u32 rmac_accepted_nucst_frms;
449171095Ssam	u32 rmac_discarded_frms;
450171095Ssam	u32 rmac_drop_events;
451171095Ssam	u32 reserved_1;
452171095Ssam	u64 rmac_ttl_less_fb_octets;
453171095Ssam	u64 rmac_ttl_frms;
454171095Ssam	u64 reserved_2;
455171095Ssam	u32 reserved_3;
456171095Ssam	u32 rmac_usized_frms;
457171095Ssam	u32 rmac_osized_frms;
458171095Ssam	u32 rmac_frag_frms;
459171095Ssam	u32 rmac_jabber_frms;
460171095Ssam	u32 reserved_4;
461171095Ssam	u64 rmac_ttl_64_frms;
462171095Ssam	u64 rmac_ttl_65_127_frms;
463171095Ssam	u64 reserved_5;
464171095Ssam	u64 rmac_ttl_128_255_frms;
465171095Ssam	u64 rmac_ttl_256_511_frms;
466171095Ssam	u64 reserved_6;
467171095Ssam	u64 rmac_ttl_512_1023_frms;
468171095Ssam	u64 rmac_ttl_1024_1518_frms;
469171095Ssam	u32 reserved_7;
470171095Ssam	u32 rmac_ip;
471171095Ssam	u64 rmac_ip_octets;
472171095Ssam	u32 rmac_hdr_err_ip;
473171095Ssam	u32 rmac_drop_ip;
474171095Ssam	u32 rmac_icmp;
475171095Ssam	u32 reserved_8;
476171095Ssam	u64 rmac_tcp;
477171095Ssam	u32 rmac_udp;
478171095Ssam	u32 rmac_err_drp_udp;
479171095Ssam	u64 rmac_xgmii_err_sym;
480171095Ssam	u64 rmac_frms_q0;
481171095Ssam	u64 rmac_frms_q1;
482171095Ssam	u64 rmac_frms_q2;
483171095Ssam	u64 rmac_frms_q3;
484171095Ssam	u64 rmac_frms_q4;
485171095Ssam	u64 rmac_frms_q5;
486171095Ssam	u64 rmac_frms_q6;
487171095Ssam	u64 rmac_frms_q7;
488171095Ssam	u16 rmac_full_q0;
489171095Ssam	u16 rmac_full_q1;
490171095Ssam	u16 rmac_full_q2;
491171095Ssam	u16 rmac_full_q3;
492171095Ssam	u16 rmac_full_q4;
493171095Ssam	u16 rmac_full_q5;
494171095Ssam	u16 rmac_full_q6;
495171095Ssam	u16 rmac_full_q7;
496171095Ssam	u32 rmac_pause_cnt;
497171095Ssam	u32 reserved_9;
498171095Ssam	u64 rmac_xgmii_data_err_cnt;
499171095Ssam	u64 rmac_xgmii_ctrl_err_cnt;
500171095Ssam	u32 rmac_accepted_ip;
501171095Ssam	u32 rmac_err_tcp;
502171095Ssam
503171095Ssam/* PCI/PCI-X Read transaction statistics. */
504171095Ssam	u32 rd_req_cnt;
505171095Ssam	u32 new_rd_req_cnt;
506171095Ssam	u32 new_rd_req_rtry_cnt;
507171095Ssam	u32 rd_rtry_cnt;
508171095Ssam	u32 wr_rtry_rd_ack_cnt;
509171095Ssam
510171095Ssam/* PCI/PCI-X write transaction statistics. */
511171095Ssam	u32 wr_req_cnt;
512171095Ssam	u32 new_wr_req_cnt;
513171095Ssam	u32 new_wr_req_rtry_cnt;
514171095Ssam	u32 wr_rtry_cnt;
515171095Ssam	u32 wr_disc_cnt;
516171095Ssam	u32 rd_rtry_wr_ack_cnt;
517171095Ssam
518173139Srwatson/*  DMA Transaction statistics. */
519171095Ssam	u32 txp_wr_cnt;
520171095Ssam	u32 txd_rd_cnt;
521171095Ssam	u32 txd_wr_cnt;
522171095Ssam	u32 rxd_rd_cnt;
523171095Ssam	u32 rxd_wr_cnt;
524171095Ssam	u32 txf_rd_cnt;
525171095Ssam	u32 rxf_wr_cnt;
526171095Ssam
527171095Ssam/* Enhanced Herc statistics */
528171095Ssam	u32 tmac_frms_oflow;
529171095Ssam	u32 tmac_data_octets_oflow;
530171095Ssam	u32 tmac_mcst_frms_oflow;
531171095Ssam	u32 tmac_bcst_frms_oflow;
532171095Ssam	u32 tmac_ttl_octets_oflow;
533171095Ssam	u32 tmac_ucst_frms_oflow;
534171095Ssam	u32 tmac_nucst_frms_oflow;
535171095Ssam	u32 tmac_any_err_frms_oflow;
536171095Ssam	u64 tmac_vlan_frms;
537171095Ssam	u32 tmac_vld_ip_oflow;
538171095Ssam	u32 tmac_drop_ip_oflow;
539171095Ssam	u32 tmac_icmp_oflow;
540171095Ssam	u32 tmac_rst_tcp_oflow;
541171095Ssam	u32 tmac_udp_oflow;
542171095Ssam	u32 tpa_unknown_protocol;
543171095Ssam	u32 tpa_parse_failure;
544171095Ssam	u32 reserved_10;
545171095Ssam	u32 rmac_vld_frms_oflow;
546171095Ssam	u32 rmac_data_octets_oflow;
547171095Ssam	u32 rmac_vld_mcst_frms_oflow;
548171095Ssam	u32 rmac_vld_bcst_frms_oflow;
549171095Ssam	u32 rmac_ttl_octets_oflow;
550171095Ssam	u32 rmac_accepted_ucst_frms_oflow;
551171095Ssam	u32 rmac_accepted_nucst_frms_oflow;
552171095Ssam	u32 rmac_discarded_frms_oflow;
553171095Ssam	u32 rmac_drop_events_oflow;
554171095Ssam	u32 rmac_usized_frms_oflow;
555171095Ssam	u32 rmac_osized_frms_oflow;
556171095Ssam	u32 rmac_frag_frms_oflow;
557171095Ssam	u32 rmac_jabber_frms_oflow;
558171095Ssam	u32 rmac_ip_oflow;
559171095Ssam	u32 rmac_drop_ip_oflow;
560171095Ssam	u32 rmac_icmp_oflow;
561171095Ssam	u32 rmac_udp_oflow;
562171095Ssam	u32 rmac_err_drp_udp_oflow;
563171095Ssam	u32 rmac_pause_cnt_oflow;
564171095Ssam	u32 reserved_11;
565171095Ssam	u64 rmac_ttl_1519_4095_frms;
566171095Ssam	u64 rmac_ttl_4096_8191_frms;
567171095Ssam	u64 rmac_ttl_8192_max_frms;
568171095Ssam	u64 rmac_ttl_gt_max_frms;
569171095Ssam	u64 rmac_osized_alt_frms;
570171095Ssam	u64 rmac_jabber_alt_frms;
571171095Ssam	u64 rmac_gt_max_alt_frms;
572171095Ssam	u64 rmac_vlan_frms;
573171095Ssam	u32 rmac_fcs_discard;
574171095Ssam	u32 rmac_len_discard;
575171095Ssam	u32 rmac_da_discard;
576171095Ssam	u32 rmac_pf_discard;
577171095Ssam	u32 rmac_rts_discard;
578171095Ssam	u32 rmac_wol_discard;
579171095Ssam	u32 rmac_red_discard;
580171095Ssam	u32 rmac_ingm_full_discard;
581171095Ssam	u32 rmac_accepted_ip_oflow;
582171095Ssam	u32 reserved_12;
583171095Ssam	u32 link_fault_cnt;
584171095Ssam	u32 reserved_13;
585171095Ssam#else
586171095Ssam/* Tx MAC statistics counters. */
587171095Ssam	u32 tmac_data_octets;
588171095Ssam	u32 tmac_frms;
589171095Ssam	u64 tmac_drop_frms;
590171095Ssam	u32 tmac_bcst_frms;
591171095Ssam	u32 tmac_mcst_frms;
592171095Ssam	u64 tmac_pause_ctrl_frms;
593171095Ssam	u32 tmac_ucst_frms;
594171095Ssam	u32 tmac_ttl_octets;
595171095Ssam	u32 tmac_any_err_frms;
596171095Ssam	u32 tmac_nucst_frms;
597171095Ssam	u64 tmac_ttl_less_fb_octets;
598171095Ssam	u64 tmac_vld_ip_octets;
599171095Ssam	u32 tmac_drop_ip;
600171095Ssam	u32 tmac_vld_ip;
601171095Ssam	u32 tmac_rst_tcp;
602171095Ssam	u32 tmac_icmp;
603171095Ssam	u64 tmac_tcp;
604171095Ssam	u32 reserved_0;
605171095Ssam	u32 tmac_udp;
606171095Ssam
607171095Ssam/* Rx MAC Statistics counters. */
608171095Ssam	u32 rmac_data_octets;
609171095Ssam	u32 rmac_vld_frms;
610171095Ssam	u64 rmac_fcs_err_frms;
611171095Ssam	u64 rmac_drop_frms;
612171095Ssam	u32 rmac_vld_bcst_frms;
613171095Ssam	u32 rmac_vld_mcst_frms;
614171095Ssam	u32 rmac_out_rng_len_err_frms;
615171095Ssam	u32 rmac_in_rng_len_err_frms;
616171095Ssam	u64 rmac_long_frms;
617171095Ssam	u64 rmac_pause_ctrl_frms;
618171095Ssam	u64 rmac_unsup_ctrl_frms;
619171095Ssam	u32 rmac_accepted_ucst_frms;
620171095Ssam	u32 rmac_ttl_octets;
621171095Ssam	u32 rmac_discarded_frms;
622171095Ssam	u32 rmac_accepted_nucst_frms;
623171095Ssam	u32 reserved_1;
624171095Ssam	u32 rmac_drop_events;
625171095Ssam	u64 rmac_ttl_less_fb_octets;
626171095Ssam	u64 rmac_ttl_frms;
627171095Ssam	u64 reserved_2;
628171095Ssam	u32 rmac_usized_frms;
629171095Ssam	u32 reserved_3;
630171095Ssam	u32 rmac_frag_frms;
631171095Ssam	u32 rmac_osized_frms;
632171095Ssam	u32 reserved_4;
633171095Ssam	u32 rmac_jabber_frms;
634171095Ssam	u64 rmac_ttl_64_frms;
635171095Ssam	u64 rmac_ttl_65_127_frms;
636171095Ssam	u64 reserved_5;
637171095Ssam	u64 rmac_ttl_128_255_frms;
638171095Ssam	u64 rmac_ttl_256_511_frms;
639171095Ssam	u64 reserved_6;
640171095Ssam	u64 rmac_ttl_512_1023_frms;
641171095Ssam	u64 rmac_ttl_1024_1518_frms;
642171095Ssam	u32 rmac_ip;
643171095Ssam	u32 reserved_7;
644171095Ssam	u64 rmac_ip_octets;
645171095Ssam	u32 rmac_drop_ip;
646171095Ssam	u32 rmac_hdr_err_ip;
647171095Ssam	u32 reserved_8;
648171095Ssam	u32 rmac_icmp;
649171095Ssam	u64 rmac_tcp;
650171095Ssam	u32 rmac_err_drp_udp;
651171095Ssam	u32 rmac_udp;
652171095Ssam	u64 rmac_xgmii_err_sym;
653171095Ssam	u64 rmac_frms_q0;
654171095Ssam	u64 rmac_frms_q1;
655171095Ssam	u64 rmac_frms_q2;
656171095Ssam	u64 rmac_frms_q3;
657171095Ssam	u64 rmac_frms_q4;
658171095Ssam	u64 rmac_frms_q5;
659171095Ssam	u64 rmac_frms_q6;
660171095Ssam	u64 rmac_frms_q7;
661171095Ssam	u16 rmac_full_q3;
662171095Ssam	u16 rmac_full_q2;
663171095Ssam	u16 rmac_full_q1;
664171095Ssam	u16 rmac_full_q0;
665171095Ssam	u16 rmac_full_q7;
666171095Ssam	u16 rmac_full_q6;
667171095Ssam	u16 rmac_full_q5;
668171095Ssam	u16 rmac_full_q4;
669171095Ssam	u32 reserved_9;
670171095Ssam	u32 rmac_pause_cnt;
671171095Ssam	u64 rmac_xgmii_data_err_cnt;
672171095Ssam	u64 rmac_xgmii_ctrl_err_cnt;
673171095Ssam	u32 rmac_err_tcp;
674171095Ssam	u32 rmac_accepted_ip;
675171095Ssam
676171095Ssam/* PCI/PCI-X Read transaction statistics. */
677171095Ssam	u32 new_rd_req_cnt;
678171095Ssam	u32 rd_req_cnt;
679171095Ssam	u32 rd_rtry_cnt;
680171095Ssam	u32 new_rd_req_rtry_cnt;
681171095Ssam
682171095Ssam/* PCI/PCI-X Write/Read transaction statistics. */
683171095Ssam	u32 wr_req_cnt;
684171095Ssam	u32 wr_rtry_rd_ack_cnt;
685171095Ssam	u32 new_wr_req_rtry_cnt;
686171095Ssam	u32 new_wr_req_cnt;
687171095Ssam	u32 wr_disc_cnt;
688171095Ssam	u32 wr_rtry_cnt;
689171095Ssam
690173139Srwatson/*  PCI/PCI-X Write / DMA Transaction statistics. */
691171095Ssam	u32 txp_wr_cnt;
692171095Ssam	u32 rd_rtry_wr_ack_cnt;
693171095Ssam	u32 txd_wr_cnt;
694171095Ssam	u32 txd_rd_cnt;
695171095Ssam	u32 rxd_wr_cnt;
696171095Ssam	u32 rxd_rd_cnt;
697171095Ssam	u32 rxf_wr_cnt;
698171095Ssam	u32 txf_rd_cnt;
699171095Ssam
700171095Ssam/* Enhanced Herc statistics */
701171095Ssam	u32 tmac_data_octets_oflow;
702171095Ssam	u32 tmac_frms_oflow;
703171095Ssam	u32 tmac_bcst_frms_oflow;
704171095Ssam	u32 tmac_mcst_frms_oflow;
705171095Ssam	u32 tmac_ucst_frms_oflow;
706171095Ssam	u32 tmac_ttl_octets_oflow;
707171095Ssam	u32 tmac_any_err_frms_oflow;
708171095Ssam	u32 tmac_nucst_frms_oflow;
709171095Ssam	u64 tmac_vlan_frms;
710171095Ssam	u32 tmac_drop_ip_oflow;
711171095Ssam	u32 tmac_vld_ip_oflow;
712171095Ssam	u32 tmac_rst_tcp_oflow;
713171095Ssam	u32 tmac_icmp_oflow;
714171095Ssam	u32 tpa_unknown_protocol;
715171095Ssam	u32 tmac_udp_oflow;
716171095Ssam	u32 reserved_10;
717171095Ssam	u32 tpa_parse_failure;
718171095Ssam	u32 rmac_data_octets_oflow;
719171095Ssam	u32 rmac_vld_frms_oflow;
720171095Ssam	u32 rmac_vld_bcst_frms_oflow;
721171095Ssam	u32 rmac_vld_mcst_frms_oflow;
722171095Ssam	u32 rmac_accepted_ucst_frms_oflow;
723171095Ssam	u32 rmac_ttl_octets_oflow;
724171095Ssam	u32 rmac_discarded_frms_oflow;
725171095Ssam	u32 rmac_accepted_nucst_frms_oflow;
726171095Ssam	u32 rmac_usized_frms_oflow;
727171095Ssam	u32 rmac_drop_events_oflow;
728171095Ssam	u32 rmac_frag_frms_oflow;
729171095Ssam	u32 rmac_osized_frms_oflow;
730171095Ssam	u32 rmac_ip_oflow;
731171095Ssam	u32 rmac_jabber_frms_oflow;
732171095Ssam	u32 rmac_icmp_oflow;
733171095Ssam	u32 rmac_drop_ip_oflow;
734171095Ssam	u32 rmac_err_drp_udp_oflow;
735171095Ssam	u32 rmac_udp_oflow;
736171095Ssam	u32 reserved_11;
737171095Ssam	u32 rmac_pause_cnt_oflow;
738171095Ssam	u64 rmac_ttl_1519_4095_frms;
739171095Ssam	u64 rmac_ttl_4096_8191_frms;
740171095Ssam	u64 rmac_ttl_8192_max_frms;
741171095Ssam	u64 rmac_ttl_gt_max_frms;
742171095Ssam	u64 rmac_osized_alt_frms;
743171095Ssam	u64 rmac_jabber_alt_frms;
744171095Ssam	u64 rmac_gt_max_alt_frms;
745171095Ssam	u64 rmac_vlan_frms;
746171095Ssam	u32 rmac_len_discard;
747171095Ssam	u32 rmac_fcs_discard;
748171095Ssam	u32 rmac_pf_discard;
749171095Ssam	u32 rmac_da_discard;
750171095Ssam	u32 rmac_wol_discard;
751171095Ssam	u32 rmac_rts_discard;
752171095Ssam	u32 rmac_ingm_full_discard;
753171095Ssam	u32 rmac_red_discard;
754171095Ssam	u32 reserved_12;
755171095Ssam	u32 rmac_accepted_ip_oflow;
756171095Ssam	u32 reserved_13;
757171095Ssam	u32 link_fault_cnt;
758171095Ssam#endif
759171095Ssam} xge_hal_stats_hw_info_t;
760171095Ssam
761171095Ssam/**
762171095Ssam * struct xge_hal_stats_channel_into_t - HAL channel statistics.
763171095Ssam * @full_cnt: TBD
764171095Ssam * @usage_max: TBD
765171095Ssam * @reserve_free_swaps_cnt: Reserve/free swap counter. Internal usage.
766171095Ssam * @max_compl_per_intr_cnt: Maximum number of completions per interrupt.
767171095Ssam * @avg_compl_per_intr_cnt: Average number of completions per interrupt.
768171095Ssam *           Note that a total number of completed descriptors
769171095Ssam *           for the given channel can be calculated as
770171095Ssam *           (@traffic_intr_cnt * @avg_compl_per_intr_cnt).
771171095Ssam * @total_compl_cnt: Total completion count.
772171095Ssam *        @total_compl_cnt == (@traffic_intr_cnt * @avg_compl_per_intr_cnt).
773171095Ssam * @total_posts: Total number of descriptor postings on the channel.
774171095Ssam *        Counts the number of xge_hal_ring_dtr_post()
775171095Ssam *        or xge_hal_fifo_dtr_post() calls by ULD, for ring and fifo
776171095Ssam *        channel, respectively.
777171095Ssam * @total_posts_many: Total number of posts on the channel that involved
778171095Ssam *        more than one descriptor. Counts the number of
779171095Ssam *        xge_hal_fifo_dtr_post_many() calls performed by ULD.
780171095Ssam * @total_buffers: Total number of buffers posted on the channel.
781171095Ssam * @copied_frags: TBD
782171095Ssam * @copied_buffers: TBD
783171095Ssam * @avg_buffers_per_post: Average number of buffers transferred in a single
784171095Ssam *        post operation.
785171095Ssam *        Calculated as @total_buffers/@total_posts.
786171095Ssam * @avg_buffer_size: Average buffer size transferred by a single post
787171095Ssam *       operation on a fifo channel. The counter is not supported for a ring
788171095Ssam *       channel. Calculated as a total number of transmitted octets divided
789171095Ssam *       by @total_buffers.
790171095Ssam * @avg_post_size: Average amount of data transferred by a single post.
791171095Ssam *       Calculated as a total number of transmitted octets divided by
792171095Ssam *       @total_posts.
793171095Ssam * @ring_bump_cnt: Ring "bump" count. Number of times the hardware could
794171095Ssam *       not post receive data (and had to continue keeping it on-board)
795171095Ssam *       because of unavailable receive descriptor(s).
796171095Ssam * @total_posts_dtrs_many: Total number of posts on the channel that involving
797171095Ssam *       more than one descriptor.
798171095Ssam * @total_posts_frags_many: Total number of fragments posted on the channel
799173139Srwatson *   during post requests of multiple descriptors.
800171095Ssam * @total_posts_dang_dtrs: Total number of posts on the channel involving
801171095Ssam *       dangling descriptors.
802171095Ssam * @total_posts_dang_frags: Total number of dangling fragments posted on the channel
803173139Srwatson *   during post request containing multiple descriptors.
804171095Ssam *
805171095Ssam * HAL channel counters.
806171095Ssam * See also: xge_hal_stats_device_info_t{}.
807171095Ssam */
808171095Ssamtypedef struct xge_hal_stats_channel_info_t {
809173139Srwatson	u32 full_cnt;
810173139Srwatson	u32 usage_max;
811173139Srwatson	u32 reserve_free_swaps_cnt;
812173139Srwatson	u32 avg_compl_per_intr_cnt;
813173139Srwatson	u32 total_compl_cnt;
814173139Srwatson	u32 total_posts;
815173139Srwatson	u32 total_posts_many;
816173139Srwatson	u32 total_buffers;
817173139Srwatson	u32 copied_frags;
818173139Srwatson	u32 copied_buffers;
819173139Srwatson	u32 avg_buffers_per_post;
820173139Srwatson	u32 avg_buffer_size;
821173139Srwatson	u32 avg_post_size;
822173139Srwatson	u32 ring_bump_cnt;
823173139Srwatson	u32 total_posts_dtrs_many;
824173139Srwatson	u32 total_posts_frags_many;
825173139Srwatson	u32 total_posts_dang_dtrs;
826173139Srwatson	u32 total_posts_dang_frags;
827171095Ssam} xge_hal_stats_channel_info_t;
828171095Ssam
829171095Ssam/**
830171095Ssam * struct xge_hal_xpak_counter_t - HAL xpak error counters
831171095Ssam * @excess_temp: excess transceiver_temperature count
832171095Ssam * @excess_bias_current: excess laser_bias_current count
833171095Ssam * @excess_laser_output: excess laser_output_power count
834171095Ssam * @tick_period: tick count for each cycle
835171095Ssam */
836171095Ssamtypedef struct xge_hal_xpak_counter_t {
837173139Srwatson	    u32     excess_temp;
838173139Srwatson	    u32     excess_bias_current;
839173139Srwatson	    u32     excess_laser_output;
840173139Srwatson	    u32     tick_period;
841171095Ssam} xge_hal_xpak_counter_t;
842171095Ssam
843171095Ssam/**
844171095Ssam * struct xge_hal_stats_xpak_t - HAL xpak stats
845171095Ssam * @alarm_transceiver_temp_high: alarm_transceiver_temp_high count value
846171095Ssam * @alarm_transceiver_temp_low : alarm_transceiver_temp_low count value
847171095Ssam * @alarm_laser_bias_current_high: alarm_laser_bias_current_high count value
848171095Ssam * @alarm_laser_bias_current_low: alarm_laser_bias_current_low count value
849171095Ssam * @alarm_laser_output_power_high: alarm_laser_output_power_high count value
850171095Ssam * @alarm_laser_output_power_low: alarm_laser_output_power_low count value
851171095Ssam * @warn_transceiver_temp_high: warn_transceiver_temp_high count value
852171095Ssam * @warn_transceiver_temp_low: warn_transceiver_temp_low count value
853171095Ssam * @warn_laser_bias_current_high: warn_laser_bias_current_high count value
854171095Ssam * @warn_laser_bias_current_low: warn_laser_bias_current_low count value
855171095Ssam * @warn_laser_output_power_high: warn_laser_output_power_high count value
856171095Ssam * @warn_laser_output_power_low: warn_laser_output_power_low count value
857171095Ssam */
858171095Ssamtypedef struct xge_hal_stats_xpak_t {
859173139Srwatson	    u16     alarm_transceiver_temp_high;
860173139Srwatson	    u16     alarm_transceiver_temp_low;
861173139Srwatson	    u16     alarm_laser_bias_current_high;
862173139Srwatson	    u16     alarm_laser_bias_current_low;
863173139Srwatson	    u16     alarm_laser_output_power_high;
864173139Srwatson	    u16     alarm_laser_output_power_low;
865173139Srwatson	    u16     warn_transceiver_temp_high;
866173139Srwatson	    u16     warn_transceiver_temp_low;
867173139Srwatson	    u16     warn_laser_bias_current_high;
868173139Srwatson	    u16     warn_laser_bias_current_low;
869173139Srwatson	    u16     warn_laser_output_power_high;
870173139Srwatson	    u16     warn_laser_output_power_low;
871171095Ssam} xge_hal_stats_xpak_t;
872171095Ssam
873171095Ssam
874171095Ssam
875171095Ssam/**
876171095Ssam * struct xge_hal_stats_sw_err_t - HAL device error statistics.
877171095Ssam * @sm_err_cnt: TBD
878171095Ssam * @single_ecc_err_cnt: TBD
879171095Ssam * @double_ecc_err_cnt: TBD
880171095Ssam * @ecc_err_cnt: ECC error count.
881171095Ssam * @parity_err_cnt: Parity error count.
882171095Ssam * @serr_cnt: Number of exceptions indicated to the host via PCI SERR#.
883171095Ssam * @rxd_t_code_err_cnt: Array of receive transfer codes. The position
884171095Ssam * (index) in this array reflects the transfer code type, for instance
885171095Ssam * 0x7 - for "invalid receive buffer size", or 0x8 - for ECC.
886171095Ssam * Value rxd_t_code_err_cnt[i] reflects the
887171095Ssam * number of times the corresponding transfer code was encountered.
888171095Ssam *
889171095Ssam * @txd_t_code_err_cnt: Array of transmit transfer codes. The position
890171095Ssam * (index) in this array reflects the transfer code type, for instance
891171095Ssam * 0xA - "loss of link".
892171095Ssam * Value txd_t_code_err_cnt[i] reflects the
893171095Ssam * number of times the corresponding transfer code was encountered.
894171095Ssam * @stats_xpak: TBD
895171095Ssam * @xpak_counter: TBD
896171095Ssam */
897171095Ssamtypedef struct xge_hal_stats_sw_err_t {
898171095Ssam	u32     sm_err_cnt;
899171095Ssam	u32     single_ecc_err_cnt;
900171095Ssam	u32     double_ecc_err_cnt;
901171095Ssam	u32     ecc_err_cnt;
902171095Ssam	u32     parity_err_cnt;
903171095Ssam	u32     serr_cnt;
904171095Ssam	u32     rxd_t_code_err_cnt[16];
905171095Ssam	u32     txd_t_code_err_cnt[16];
906171095Ssam	xge_hal_stats_xpak_t    stats_xpak;
907171095Ssam	xge_hal_xpak_counter_t  xpak_counter;
908171095Ssam} xge_hal_stats_sw_err_t;
909171095Ssam
910171095Ssam/**
911171095Ssam * struct xge_hal_stats_device_info_t - HAL own per-device statistics.
912171095Ssam *
913171095Ssam * @rx_traffic_intr_cnt: TBD
914171095Ssam * @tx_traffic_intr_cnt: TBD
915171095Ssam * @txpic_intr_cnt: TBD
916171095Ssam * @txdma_intr_cnt: TBD
917171095Ssam * @txmac_intr_cnt: TBD
918171095Ssam * @txxgxs_intr_cnt: TBD
919171095Ssam * @rxpic_intr_cnt: TBD
920171095Ssam * @rxdma_intr_cnt: TBD
921171095Ssam * @rxmac_intr_cnt: TBD
922171095Ssam * @rxxgxs_intr_cnt: TBD
923171095Ssam * @mc_intr_cnt: TBD
924171095Ssam * @not_traffic_intr_cnt: Number of times the host was interrupted
925171095Ssam *                        without new completions.
926171095Ssam *                        "Non-traffic interrupt counter".
927171095Ssam * @not_xge_intr_cnt: TBD
928171095Ssam * @traffic_intr_cnt: Number of traffic interrupts for the device.
929171095Ssam * @total_intr_cnt: Total number of traffic interrupts for the device.
930171095Ssam *                  @total_intr_cnt == @traffic_intr_cnt +
931171095Ssam *                              @not_traffic_intr_cnt
932171095Ssam * @soft_reset_cnt: Number of times soft reset is done on this device.
933171095Ssam * @rxufca_hi_adjust_cnt: TODO
934171095Ssam * @rxufca_lo_adjust_cnt: TODO
935171095Ssam * @bimodal_hi_adjust_cnt: TODO
936171095Ssam * @bimodal_lo_adjust_cnt: TODO
937171095Ssam *
938171095Ssam * @tot_frms_lroised: TBD
939171095Ssam * @tot_lro_sessions: TBD
940171095Ssam * @lro_frm_len_exceed_cnt: TBD
941171095Ssam * @lro_sg_exceed_cnt: TBD
942171095Ssam * @lro_out_of_seq_pkt_cnt: TBD
943171095Ssam * @lro_dup_pkt_cnt: TBD
944171095Ssam *
945171095Ssam * HAL per-device statistics.
946171095Ssam * See also: xge_hal_stats_channel_info_t{}.
947171095Ssam */
948171095Ssamtypedef struct xge_hal_stats_device_info_t {
949173139Srwatson	u32             rx_traffic_intr_cnt;
950173139Srwatson	u32             tx_traffic_intr_cnt;
951173139Srwatson	u32             txpic_intr_cnt;
952173139Srwatson	u32             txdma_intr_cnt;
953173139Srwatson	u32             pfc_err_cnt;
954173139Srwatson	u32             tda_err_cnt;
955173139Srwatson	u32             pcc_err_cnt;
956173139Srwatson	u32             tti_err_cnt;
957173139Srwatson	u32             lso_err_cnt;
958173139Srwatson	u32             tpa_err_cnt;
959173139Srwatson	u32             sm_err_cnt;
960173139Srwatson	u32             txmac_intr_cnt;
961173139Srwatson	u32             mac_tmac_err_cnt;
962173139Srwatson	u32             txxgxs_intr_cnt;
963173139Srwatson	u32             xgxs_txgxs_err_cnt;
964173139Srwatson	u32             rxpic_intr_cnt;
965173139Srwatson	u32             rxdma_intr_cnt;
966173139Srwatson	u32             rc_err_cnt;
967173139Srwatson	u32             rpa_err_cnt;
968173139Srwatson	u32             rda_err_cnt;
969173139Srwatson	u32             rti_err_cnt;
970173139Srwatson	u32             rxmac_intr_cnt;
971173139Srwatson	u32             mac_rmac_err_cnt;
972173139Srwatson	u32             rxxgxs_intr_cnt;
973173139Srwatson	u32             xgxs_rxgxs_err_cnt;
974173139Srwatson	u32             mc_intr_cnt;
975173139Srwatson	u32             not_traffic_intr_cnt;
976173139Srwatson	u32             not_xge_intr_cnt;
977173139Srwatson	u32             traffic_intr_cnt;
978173139Srwatson	u32             total_intr_cnt;
979173139Srwatson	u32             soft_reset_cnt;
980173139Srwatson	u32             rxufca_hi_adjust_cnt;
981173139Srwatson	u32             rxufca_lo_adjust_cnt;
982173139Srwatson	u32             bimodal_hi_adjust_cnt;
983173139Srwatson	u32             bimodal_lo_adjust_cnt;
984171095Ssam#ifdef XGE_HAL_CONFIG_LRO
985173139Srwatson	u32             tot_frms_lroised;
986173139Srwatson	u32             tot_lro_sessions;
987173139Srwatson	u32             lro_frm_len_exceed_cnt;
988173139Srwatson	u32             lro_sg_exceed_cnt;
989173139Srwatson	u32             lro_out_of_seq_pkt_cnt;
990173139Srwatson	u32             lro_dup_pkt_cnt;
991171095Ssam#endif
992171095Ssam} xge_hal_stats_device_info_t;
993171095Ssam
994171095Ssam/* ========================== XFRAME ER STATISTICS ======================== */
995173139Srwatson#define XGE_HAL_MAC_LINKS   3
996173139Srwatson#define XGE_HAL_MAC_AGGREGATORS 2
997173139Srwatson#define XGE_HAL_VPATHS      17
998171095Ssam/**
999171095Ssam * struct xge_hal_stats_link_info_t - XGMAC statistics for a link
1000171095Ssam *
1001171095Ssam * @tx_frms: Count of transmitted MAC frames for mac the link.
1002171095Ssam * @tx_ttl_eth_octets: Count of total octets of transmitted frames
1003171095Ssam * for mac the link.
1004171095Ssam * @tx_data_octets: Count of data and padding octets of transmitted
1005171095Ssam * frames for mac the link.
1006171095Ssam * @tx_mcst_frms: Count of multicast MAC frames for mac the link.
1007171095Ssam * @tx_bcst_frms: Count of broadcast MAC frames for mac the link.
1008171095Ssam * @tx_ucst_frms: Count of unicast MAC frames for mac the link.
1009171095Ssam * @tx_tagged_frms: Count of transmitted frames containing a VLAN tag
1010171095Ssam * for mac the link.
1011171095Ssam * @tx_vld_ip: Count of transmitted IP datagrams for mac the link.
1012171095Ssam * @tx_vld_ip_octets: Count of transmitted IP octets for mac the link.
1013171095Ssam * @tx_icmp: Count of transmitted ICMP messages for mac the link.
1014171095Ssam * @tx_tcp: Count of transmitted TCP segments for mac the link.
1015171095Ssam * @tx_rst_tcp: Count of transmitted TCP segments containing the RST
1016171095Ssam * flag mac the link.
1017171095Ssam * @tx_udp: Count of transmitted UDP datagrams for mac the link.
1018171095Ssam * @tx_unknown_protocol: Count of transmitted packets of unknown
1019171095Ssam * protocol for mac the link.
1020171095Ssam * @tx_parse_error: Count of transmitted packets with parsing errors
1021171095Ssam * for mac the link.
1022171095Ssam * @tx_pause_ctrl_frms: Count of MAC PAUSE control frames for mac
1023171095Ssam * the link.
1024171095Ssam * @tx_lacpdu_frms: Count of LACPDUs transmitted for mac the link.
1025171095Ssam * @tx_marker_pdu_frms: Count of Marker PDUs transmitted for mac the
1026171095Ssam * link.
1027171095Ssam * @tx_marker_resp_pdu_frms: Count of Marker Response PDUs transmitted
1028171095Ssam * for mac the link.
1029171095Ssam * @tx_drop_ip: Count of dropped IP packets from the transmission path
1030171095Ssam * for mac the link.
1031171095Ssam * @tx_xgmii_char1_match: Count of the number of transmitted XGMII
1032171095Ssam * characters that match first pattern, for mac the link.
1033171095Ssam * @tx_xgmii_char2_match: Count of the number of transmitted XGMII
1034171095Ssam * characters that match second pattern, for mac the link.
1035171095Ssam * @tx_xgmii_column1_match: Count of the number of transmitted XGMII
1036171095Ssam * columns that match first pattern, for mac the link.
1037171095Ssam * @tx_xgmii_column2_match: Count of the number of transmitted XGMII
1038171095Ssam * columns that match second pattern, for mac the link.
1039171095Ssam * @tx_drop_frms: Count of frames dropped due to internal errors during
1040171095Ssam * transmission for mac the link.
1041171095Ssam * @tx_any_err_frms: Count of frames dropped due to any error during
1042171095Ssam * transmission for mac the link.
1043171095Ssam * @rx_ttl_frms: Count of all received MAC frames for mac the link.
1044171095Ssam * @rx_vld_frms: Count of all successfully received MAC frames for mac
1045171095Ssam * the link.
1046171095Ssam * @rx_offld_frms: Count of all offloaded received MAC frames for mac
1047171095Ssam * the link.
1048171095Ssam * @rx_ttl_eth_octets: Count of total octets of received frames, not
1049171095Ssam * including framing characters for mac the link.
1050171095Ssam * @rx_data_octets: Count of data and padding octets of successfully
1051171095Ssam * received frames for mac the link.
1052171095Ssam * @rx_offld_octets: Count of total octets, not including framing
1053171095Ssam * characters, of offloaded received frames for mac the link.
1054171095Ssam * @rx_vld_mcst_frms: Count of successfully received multicast MAC
1055171095Ssam * frames for mac the link.
1056171095Ssam * @rx_vld_bcst_frms: Count of successfully received broadcast MAC
1057171095Ssam * frames for mac the link.
1058171095Ssam * @rx_accepted_ucst_frms: Count of successfully received unicast MAC
1059171095Ssam * frames for mac the link.
1060171095Ssam * @rx_accepted_nucst_frms: Count of successfully received non-unicast
1061171095Ssam * MAC frames for mac the link.
1062171095Ssam * @rx_tagged_frms: Count of received frames containing a VLAN tag for
1063171095Ssam * mac the link.
1064171095Ssam * @rx_long_frms: Count of received frames that are longer than
1065171095Ssam * RX_MAX_PYLD_LEN + 18 bytes (+ 22 bytes if VLAN-tagged) for mac the link.
1066171095Ssam * @rx_usized_frms: Count of received frames of length less than 64
1067171095Ssam * octets, for mac the link.
1068171095Ssam * @rx_osized_frms:  Count of received frames of length more than 1518
1069171095Ssam * octets for mac the link.
1070171095Ssam * @rx_frag_frms:  Count of received frames of length less than 64
1071171095Ssam * octets that had bad FCS, for mac the link.
1072171095Ssam * @rx_jabber_frms:  Count of received frames of length more than 1518
1073171095Ssam * octets that had bad FCS, for mac the link.
1074171095Ssam * @rx_ttl_64_frms: Count of all received MAC frames with length of
1075171095Ssam * exactly 64 octets, for mac the link.
1076171095Ssam * @rx_ttl_65_127_frms: Count of all received MAC frames with length
1077171095Ssam * of between 65 and 127 octets inclusive, for mac the link.
1078171095Ssam * @rx_ttl_128_255_frms: Count of all received MAC frames with length
1079171095Ssam * of between 128 and 255 octets inclusive, for mac the link.
1080171095Ssam * @rx_ttl_256_511_frms: Count of all received MAC frames with length
1081171095Ssam * of between 246 and 511 octets inclusive, for mac the link.
1082171095Ssam * @rx_ttl_512_1023_frms: Count of all received MAC frames with length
1083171095Ssam * of between 512 and 1023 octets inclusive, for mac the link.
1084171095Ssam * @rx_ttl_1024_1518_frms: Count of all received MAC frames with length
1085171095Ssam * of between 1024 and 1518 octets inclusive, for mac the link.
1086171095Ssam * @rx_ttl_1519_4095_frms: Count of all received MAC frames with length
1087171095Ssam * of between 1519 and 4095 octets inclusive, for mac the link.
1088171095Ssam * @rx_ttl_40956_8191_frms: Count of all received MAC frames with length
1089171095Ssam * of between 4096 and 8191 octets inclusive, for mac the link.
1090171095Ssam * @rx_ttl_8192_max_frms: Count of all received MAC frames with length
1091171095Ssam * of between 8192 and RX_MAX_PYLD_LEN+18 octets inclusive, for mac the link.
1092171095Ssam * @rx_ttl_gt_max_frms: Count of all received MAC frames with length
1093171095Ssam * exceeding RX_MAX_PYLD_LEN+18 octets inclusive, for mac the link.
1094171095Ssam * @rx_ip:  Count of received IP datagrams, for mac the link.
1095171095Ssam * @rx_accepted_ip:  Count of received  and accepted IP datagrams,
1096171095Ssam * for mac the link.
1097171095Ssam * @rx_ip_octets: Count of number of octets in received IP datagrams,
1098171095Ssam * for mac the link.
1099171095Ssam * @rx_hdr_err_ip: Count of received IP datagrams that are discarded
1100171095Ssam * due to IP header errors, for mac the link.
1101171095Ssam * @rx_icmp: Count of received ICMP messages for mac the link.
1102171095Ssam * @rx_tcp: Count of received TCP segments for mac the link.
1103171095Ssam * @rx_udp: Count of received UDP datagrams for mac the link.
1104171095Ssam * @rx_err_tcp: Count of received TCP segments containing errors for
1105171095Ssam * mac the link.
1106171095Ssam * @rx_pause_cnt: Count of number of pause quanta that the MAC has
1107171095Ssam * been in the paused state, for mac the link.
1108171095Ssam * @rx_pause_ctrl_frms: Count of received MAC PAUSE control frames for
1109171095Ssam * mac the link.
1110171095Ssam * @rx_unsup_ctrl_frms: Count of received MAC control frames that do
1111171095Ssam * not contain the PAUSE opcode for mac the link.
1112171095Ssam * @rx_fcs_err_frms: Count of received MAC frames that do not pass FCS
1113171095Ssam * for mac the link.
1114171095Ssam * @rx_in_rng_len_err_frms: Count of received frames with a length/type
1115171095Ssam * field value between 46 and 1500 inclusive, that does not match the number
1116171095Ssam * of data octets received, for mac the link.
1117171095Ssam * @rx_out_rng_len_err_frms: Count of received frames with length/type
1118171095Ssam * field between 1501 and 1535 decimal, inclusive. for mac the link.
1119171095Ssam * @rx_drop_frms: Count of dropped frames from receive path for mac
1120171095Ssam * the link.
1121171095Ssam * @rx_discarded_frms: Count of discarded frames from receive path for
1122171095Ssam * mac the link.
1123171095Ssam * @rx_drop_ip: Count of droppen IP datagrams from receive path for
1124171095Ssam * mac the link.
1125171095Ssam * @rx_err_drp_udp: Count of droppen UDP datagrams from receive path
1126171095Ssam * for mac the link.
1127171095Ssam * @rx_lacpdu_frms: Count of valid LACPDUs received for mac the link.
1128171095Ssam * @rx_marker_pdu_frms: Count of valid Marker PDUs received for mac
1129171095Ssam * the link.
1130171095Ssam * @rx_marker_resp_pdu_frms: Count of valid Marker Response PDUs
1131171095Ssam * received for mac the link.
1132171095Ssam * @rx_unknown_pdu_frms: Count of unknown PDUs received for mac the link.
1133171095Ssam * @rx_illegal_pdu_frms: Count of illegal PDUs received for mac the link.
1134171095Ssam * @rx_fcs_discard: Count of discarded PDUs received for mac the link.
1135171095Ssam * @rx_len_discard: Count of received frames that were discarded
1136171095Ssam * because of an invalid frame length, for mac the link.
1137171095Ssam * @rx_len_discard: Count of received frames that were discarded
1138171095Ssam * because of an invalid destination MAC address, for mac the link.
1139171095Ssam * @rx_pf_discard: Count of received frames that were discarded for
1140171095Ssam * mac the link.
1141171095Ssam * @rx_trash_discard: Count of received frames that were steered to the
1142171095Ssam * trash queue for mac the link.
1143171095Ssam * @rx_rts_discard: Count of received frames that were discarded by RTS
1144171095Ssam * logic for mac the link.
1145171095Ssam * @rx_wol_discard: Count of received frames that were discarded by WOL
1146171095Ssam * logic for mac the link.
1147171095Ssam * @rx_red_discard: Count of received frames that were discarded by RED
1148171095Ssam * logic for mac the link.
1149171095Ssam * @rx_ingm_full_discard: Count of received frames that were discarded
1150171095Ssam * because the internal ingress memory was full for mac the link.
1151171095Ssam * @rx_xgmii_data_err_cnt: Count of unexpected control characters
1152171095Ssam * during normal data transmission for mac the link.
1153171095Ssam * @rx_xgmii_ctrl_err_cnt: Count of unexpected or misplaced control
1154171095Ssam * characters occuring between times of normal data transmission for mac
1155171095Ssam * the link.
1156171095Ssam * @rx_xgmii_err_sym: Count of the number of symbol errors in the
1157171095Ssam * received XGMII data for mac the link.
1158171095Ssam * @rx_xgmii_char1_match: Count of the number of XGMII characters
1159171095Ssam * that match first pattern defined in MAC_STATS_RX_XGMII_CHAR_LINK_N.
1160171095Ssam * @rx_xgmii_char2_match: Count of the number of XGMII characters
1161171095Ssam * that match second pattern defined in MAC_STATS_RX_XGMII_CHAR_LINK_N.
1162171095Ssam * @rx_xgmii_column1_match: Count of the number of XGMII columns
1163171095Ssam * that match a pattern defined in MAC_STATS_RX_XGMII_COLUMN1_LINK_N.
1164171095Ssam * @rx_xgmii_column2_match: Count of the number of XGMII columns
1165171095Ssam * that match a pattern defined in MAC_STATS_RX_XGMII_COLUMN1_LINK_N.
1166171095Ssam * @rx_local_fault: Count of the number of local faults for mac the link.
1167171095Ssam * @rx_remote_fault: Count of the number of remote faults for mac the
1168171095Ssam * link.
1169171095Ssam * @rx_queue_full: Count of the number of frame destined for a full
1170171095Ssam * queue for mac the link.
1171171095Ssam */
1172171095Ssamtypedef struct xge_hal_stats_link_info_t {
1173173139Srwatson	u64 tx_frms;
1174173139Srwatson	u64 tx_ttl_eth_octets;
1175173139Srwatson	u64 tx_data_octets;
1176173139Srwatson	u64 tx_mcst_frms;
1177173139Srwatson	u64 tx_bcst_frms;
1178173139Srwatson	u64 tx_ucst_frms;
1179173139Srwatson	u64 tx_tagged_frms;
1180173139Srwatson	u64 tx_vld_ip;
1181173139Srwatson	u64 tx_vld_ip_octets;
1182173139Srwatson	u64 tx_icmp;
1183173139Srwatson	u64 tx_tcp;
1184173139Srwatson	u64 tx_rst_tcp;
1185173139Srwatson	u64 tx_udp;
1186173139Srwatson	u64 tx_unknown_protocol;
1187173139Srwatson	u64 tx_parse_error;
1188173139Srwatson	u64 tx_pause_ctrl_frms;
1189173139Srwatson	u64 tx_lacpdu_frms;
1190173139Srwatson	u64 tx_marker_pdu_frms;
1191173139Srwatson	u64 tx_marker_resp_pdu_frms;
1192173139Srwatson	u64 tx_drop_ip;
1193173139Srwatson	u64 tx_xgmii_char1_match;
1194173139Srwatson	u64 tx_xgmii_char2_match;
1195173139Srwatson	u64 tx_xgmii_column1_match;
1196173139Srwatson	u64 tx_xgmii_column2_match;
1197173139Srwatson	u64 tx_drop_frms;
1198173139Srwatson	u64 tx_any_err_frms;
1199173139Srwatson	u64 rx_ttl_frms;
1200173139Srwatson	u64 rx_vld_frms;
1201173139Srwatson	u64 rx_offld_frms;
1202173139Srwatson	u64 rx_ttl_eth_octets;
1203173139Srwatson	u64 rx_data_octets;
1204173139Srwatson	u64 rx_offld_octets;
1205173139Srwatson	u64 rx_vld_mcst_frms;
1206173139Srwatson	u64 rx_vld_bcst_frms;
1207173139Srwatson	u64 rx_accepted_ucst_frms;
1208173139Srwatson	u64 rx_accepted_nucst_frms;
1209173139Srwatson	u64 rx_tagged_frms;
1210173139Srwatson	u64 rx_long_frms;
1211173139Srwatson	u64 rx_usized_frms;
1212173139Srwatson	u64 rx_osized_frms;
1213173139Srwatson	u64 rx_frag_frms;
1214173139Srwatson	u64 rx_jabber_frms;
1215173139Srwatson	u64 rx_ttl_64_frms;
1216173139Srwatson	u64 rx_ttl_65_127_frms;
1217173139Srwatson	u64 rx_ttl_128_255_frms;
1218173139Srwatson	u64 rx_ttl_256_511_frms;
1219173139Srwatson	u64 rx_ttl_512_1023_frms;
1220173139Srwatson	u64 rx_ttl_1024_1518_frms;
1221173139Srwatson	u64 rx_ttl_1519_4095_frms;
1222173139Srwatson	u64 rx_ttl_40956_8191_frms;
1223173139Srwatson	u64 rx_ttl_8192_max_frms;
1224173139Srwatson	u64 rx_ttl_gt_max_frms;
1225173139Srwatson	u64 rx_ip;
1226173139Srwatson	u64 rx_ip_octets;
1227173139Srwatson	u64 rx_hdr_err_ip;
1228173139Srwatson	u64 rx_icmp;
1229173139Srwatson	u64 rx_tcp;
1230173139Srwatson	u64 rx_udp;
1231173139Srwatson	u64 rx_err_tcp;
1232173139Srwatson	u64 rx_pause_cnt;
1233173139Srwatson	u64 rx_pause_ctrl_frms;
1234173139Srwatson	u64 rx_unsup_ctrl_frms;
1235173139Srwatson	u64 rx_in_rng_len_err_frms;
1236173139Srwatson	u64 rx_out_rng_len_err_frms;
1237173139Srwatson	u64 rx_drop_frms;
1238173139Srwatson	u64 rx_discarded_frms;
1239173139Srwatson	u64 rx_drop_ip;
1240173139Srwatson	u64 rx_err_drp_udp;
1241173139Srwatson	u64 rx_lacpdu_frms;
1242173139Srwatson	u64 rx_marker_pdu_frms;
1243173139Srwatson	u64 rx_marker_resp_pdu_frms;
1244173139Srwatson	u64 rx_unknown_pdu_frms;
1245173139Srwatson	u64 rx_illegal_pdu_frms;
1246173139Srwatson	u64 rx_fcs_discard;
1247173139Srwatson	u64 rx_len_discard;
1248173139Srwatson	u64 rx_pf_discard;
1249173139Srwatson	u64 rx_trash_discard;
1250173139Srwatson	u64 rx_rts_discard;
1251173139Srwatson	u64 rx_wol_discard;
1252173139Srwatson	u64 rx_red_discard;
1253173139Srwatson	u64 rx_ingm_full_discard;
1254173139Srwatson	u64 rx_xgmii_data_err_cnt;
1255173139Srwatson	u64 rx_xgmii_ctrl_err_cnt;
1256173139Srwatson	u64 rx_xgmii_err_sym;
1257173139Srwatson	u64 rx_xgmii_char1_match;
1258173139Srwatson	u64 rx_xgmii_char2_match;
1259173139Srwatson	u64 rx_xgmii_column1_match;
1260173139Srwatson	u64 rx_xgmii_column2_match;
1261173139Srwatson	u64 rx_local_fault;
1262173139Srwatson	u64 rx_remote_fault;
1263173139Srwatson	u64 rx_queue_full;
1264171095Ssam}xge_hal_stats_link_info_t;
1265171095Ssam
1266171095Ssam/**
1267171095Ssam * struct xge_hal_stats_aggr_info_t - XGMAC statistics for an aggregator
1268171095Ssam *
1269171095Ssam * @tx_frms: Count of data frames transmitted for the aggregator.
1270171095Ssam * @tx_mcst_frms: Count of multicast data frames transmitted for
1271171095Ssam * the aggregator.
1272171095Ssam * @tx_bcst_frms: Count of broadcast data frames transmitted for
1273171095Ssam * the aggregator.
1274171095Ssam * @tx_discarded_frms: Count of discarded data frames transmitted for
1275171095Ssam * the aggregator.
1276171095Ssam * @tx_errored_frms: Count of errored data frames transmitted for
1277171095Ssam * the aggregator.
1278171095Ssam * @rx_frms: Count of received frames for aggregators
1279171095Ssam * @rx_data_octets: Count of data and padding octets of frames received
1280171095Ssam * the aggregator.
1281171095Ssam * @rx_mcst_frms: Count of multicast frames received the aggregator.
1282171095Ssam * @rx_bcst_frms: Count of broadast frames received the aggregator.
1283171095Ssam * @rx_discarded_frms: Count of discarded frames received the aggregator.
1284171095Ssam * @rx_errored_frms: Count of errored frames received the aggregator.
1285171095Ssam * @rx_unknown_protocol_frms: Count of unknown protocol frames received
1286171095Ssam * the aggregator.
1287171095Ssam*/
1288171095Ssamtypedef struct xge_hal_stats_aggr_info_t {
1289173139Srwatson	u64 tx_frms;
1290173139Srwatson	u64 tx_mcst_frms;
1291173139Srwatson	u64 tx_bcst_frms;
1292173139Srwatson	u64 tx_discarded_frms;
1293173139Srwatson	u64 tx_errored_frms;
1294173139Srwatson	u64 rx_frms;
1295173139Srwatson	u64 rx_data_octets;
1296173139Srwatson	u64 rx_mcst_frms;
1297173139Srwatson	u64 rx_bcst_frms;
1298173139Srwatson	u64 rx_discarded_frms;
1299173139Srwatson	u64 rx_errored_frms;
1300173139Srwatson	u64 rx_unknown_protocol_frms;
1301171095Ssam}xge_hal_stats_aggr_info_t;
1302171095Ssam
1303171095Ssam/**
1304171095Ssam * struct xge_hal_stats_vpath_info_t - XGMAC statistics for a vpath.
1305171095Ssam *
1306171095Ssam * @tx_frms: Count of transmitted MAC frames for the vpath.
1307171095Ssam * @tx_ttl_eth_octets: Count of total octets of transmitted frames
1308171095Ssam * for the vpath.
1309171095Ssam * @tx_data_octets: Count of data and padding octets of transmitted
1310171095Ssam * frames for the vpath.
1311171095Ssam * @tx_mcst_frms: Count of multicast MAC frames for the vpath.
1312171095Ssam * @tx_bcst_frms: Count of broadcast MAC frames for the vpath.
1313171095Ssam * @tx_ucst_frms: Count of unicast MAC frames for the vpath.
1314171095Ssam * @tx_tagged_frms: Count of transmitted frames containing a VLAN
1315171095Ssam * tag for the vpath.
1316171095Ssam * @tx_vld_ip: Count of transmitted IP datagrams for the vpath.
1317171095Ssam * @tx_vld_ip_octets: Count of transmitted IP octets for the vpath.
1318171095Ssam * @tx_icmp: Count of transmitted ICMP messages for the vpath.
1319171095Ssam * @tx_tcp: Count of transmitted TCP segments for the vpath.
1320171095Ssam * @tx_rst_tcp: Count of transmitted TCP segments containing the RST
1321171095Ssam * flag the vpath.
1322171095Ssam * @tx_udp: Count of transmitted UDP datagrams for the vpath.
1323171095Ssam * @tx_unknown_protocol: Count of transmitted packets of unknown
1324171095Ssam * protocol for the vpath.
1325171095Ssam * @tx_parse_error: Count of transmitted packets with parsing errors
1326171095Ssam * for the vpath.
1327171095Ssam * @rx_ttl_frms: Count of all received MAC frames for the vpath.
1328171095Ssam * @rx_vld_frms: Count of all successfully received MAC frames for
1329171095Ssam * the vpath.
1330171095Ssam * @rx_offld_frms: Count of all offloaded received MAC frames for
1331171095Ssam * the vpath.
1332171095Ssam * @rx_ttl_eth_octets: Count of total octets of received frames, not
1333171095Ssam * including framing characters for the vpath.
1334171095Ssam * @rx_data_octets: Count of data and padding octets of successfully
1335171095Ssam * received frames for the vpath.
1336171095Ssam * @rx_offld_octets: Count of total octets, not including framing
1337171095Ssam * characters, of offloaded received frames for the vpath.
1338171095Ssam * @rx_vld_mcst_frms: Count of successfully received multicast MAC
1339171095Ssam * frames for the vpath.
1340171095Ssam * @rx_vld_bcst_frms: Count of successfully received broadcast MAC
1341171095Ssam * frames for the vpath.
1342171095Ssam * @rx_accepted_ucst_frms: Count of successfully received unicast
1343171095Ssam * MAC frames for the vpath.
1344171095Ssam * @rx_accepted_nucst_frms: Count of successfully received
1345171095Ssam * non-unicast MAC frames for the vpath.
1346171095Ssam * @rx_tagged_frms: Count of received frames containing a VLAN tag
1347171095Ssam * for the vpath.
1348171095Ssam * @rx_long_frms: Count of received frames that are longer than
1349171095Ssam * RX_MAX_PYLD_LEN + 18 bytes (+ 22 bytes if VLAN-tagged) for the vpath.
1350171095Ssam * @rx_usized_frms: Count of received frames of length less than 64
1351171095Ssam * octets, for the vpath.
1352171095Ssam * @rx_usized_frms: Count of received frames of length more than
1353171095Ssam * 1518 octets, for the vpath.
1354171095Ssam * @rx_osized_frms:  Count of received frames of length more than
1355171095Ssam * 1518 octets for the vpath.
1356171095Ssam * @rx_frag_frms:  Count of received frames of length less than 64
1357171095Ssam * octets that had bad FCS, for the vpath.
1358171095Ssam * @rx_jabber_frms:  Count of received frames of length more than
1359171095Ssam * 1518 octets that had bad FCS, for the vpath.
1360171095Ssam * @rx_ttl_64_frms: Count of all received MAC frames with length of
1361171095Ssam * exactly 64 octets, for the vpath.
1362171095Ssam * @rx_ttl_65_127_frms: Count of all received MAC frames with length
1363171095Ssam * of between 65 and 127 octets inclusive, for the vpath.
1364171095Ssam * @rx_ttl_128_255_frms: Count of all received MAC frames with
1365171095Ssam * length of between 128 and 255 octets inclusive, for the vpath.
1366171095Ssam * @rx_ttl_256_511_frms: Count of all received MAC frames with
1367171095Ssam * length of between 246 and 511 octets inclusive, for the vpath.
1368171095Ssam * @rx_ttl_512_1023_frms: Count of all received MAC frames with
1369171095Ssam * length of between 512 and 1023 octets inclusive, for the vpath.
1370171095Ssam * @rx_ttl_1024_1518_frms: Count of all received MAC frames with
1371171095Ssam * length of between 1024 and 1518 octets inclusive, for the vpath.
1372171095Ssam * @rx_ttl_1519_4095_frms: Count of all received MAC frames with
1373171095Ssam * length of between 1519 and 4095 octets inclusive, for the vpath.
1374171095Ssam * @rx_ttl_40956_8191_frms: Count of all received MAC frames with
1375171095Ssam * of between 4096 and 8191 octets inclusive, for the vpath.
1376171095Ssam * @rx_ttl_8192_max_frms: Count of all received MAC frames with
1377171095Ssam * length of between 8192 and RX_MAX_PYLD_LEN+18 octets inclusive, for the
1378171095Ssam * vpath.
1379171095Ssam * @rx_ttl_gt_max_frms: Count of all received MAC frames with length
1380171095Ssam * exceeding RX_MAX_PYLD_LEN+18 octets inclusive, for the vpath.
1381171095Ssam * @rx_ip:  Count of received IP datagrams, for the vpath.
1382171095Ssam * @rx_accepted_ip: Count of received  and accepted IP datagrams,
1383171095Ssam * for the vpath.
1384171095Ssam * @rx_ip_octets: Count of number of octets in received IP datagrams
1385171095Ssam * for the vpath.
1386171095Ssam * @rx_hdr_err_ip: Count of received IP datagrams that are discarded
1387171095Ssam * due to IP header errors, for the vpath.
1388171095Ssam * @rx_icmp: Count of received ICMP messages for the vpath.
1389171095Ssam * @rx_tcp: Count of received TCP segments for the vpath.
1390171095Ssam * @rx_udp: Count of received UDP datagrams for the vpath.
1391171095Ssam * @rx_err_tcp: Count of received TCP segments containing errors for
1392171095Ssam * the vpath.
1393171095Ssam * @rx_mpa_ok_frms: Count of received frames that pass the MPA
1394171095Ssam * checks for vptah.
1395171095Ssam * @rx_mpa_crc_fail_frms: Count of received frames that fail the MPA
1396171095Ssam * CRC check for the vpath.
1397171095Ssam * @rx_mpa_mrk_fail_frms: Count of received frames that fail the
1398171095Ssam * MPA marker check for the vpath.
1399171095Ssam * @rx_mpa_len_fail_frms: Count of received frames that fail the MPA
1400171095Ssam * length check for the vpath.
1401171095Ssam * @rx_wol_frms: Count of received "magic packet" frames for
1402171095Ssam * the vpath.
1403171095Ssam */
1404171095Ssamtypedef struct xge_hal_stats_vpath_info_t {
1405173139Srwatson	u64 tx_frms;
1406173139Srwatson	u64 tx_ttl_eth_octets;
1407173139Srwatson	u64 tx_data_octets;
1408173139Srwatson	u64 tx_mcst_frms;
1409173139Srwatson	u64 tx_bcst_frms;
1410173139Srwatson	u64 tx_ucst_frms;
1411173139Srwatson	u64 tx_tagged_frms;
1412173139Srwatson	u64 tx_vld_ip;
1413173139Srwatson	u64 tx_vld_ip_octets;
1414173139Srwatson	u64 tx_icmp;
1415173139Srwatson	u64 tx_tcp;
1416173139Srwatson	u64 tx_rst_tcp;
1417173139Srwatson	u64 tx_udp;
1418173139Srwatson	u64 tx_unknown_protocol;
1419173139Srwatson	u64 tx_parse_error;
1420173139Srwatson	u64 rx_ttl_frms;
1421173139Srwatson	u64 rx_vld_frms;
1422173139Srwatson	u64 rx_offld_frms;
1423173139Srwatson	u64 rx_ttl_eth_octets;
1424173139Srwatson	u64 rx_data_octets;
1425173139Srwatson	u64 rx_offld_octets;
1426173139Srwatson	u64 rx_vld_mcst_frms;
1427173139Srwatson	u64 rx_vld_bcst_frms;
1428173139Srwatson	u64 rx_accepted_ucst_frms;
1429173139Srwatson	u64 rx_accepted_nucst_frms;
1430173139Srwatson	u64 rx_tagged_frms;
1431173139Srwatson	u64 rx_long_frms;
1432173139Srwatson	u64 rx_usized_frms;
1433173139Srwatson	u64 rx_osized_frms;
1434173139Srwatson	u64 rx_frag_frms;
1435173139Srwatson	u64 rx_jabber_frms;
1436173139Srwatson	u64 rx_ttl_64_frms;
1437173139Srwatson	u64 rx_ttl_65_127_frms;
1438173139Srwatson	u64 rx_ttl_128_255_frms;
1439173139Srwatson	u64 rx_ttl_256_511_frms;
1440173139Srwatson	u64 rx_ttl_512_1023_frms;
1441173139Srwatson	u64 rx_ttl_1024_1518_frms;
1442173139Srwatson	u64 rx_ttl_1519_4095_frms;
1443173139Srwatson	u64 rx_ttl_40956_8191_frms;
1444173139Srwatson	u64 rx_ttl_8192_max_frms;
1445173139Srwatson	u64 rx_ttl_gt_max_frms;
1446173139Srwatson	u64 rx_ip;
1447173139Srwatson	u64 rx_accepted_ip;
1448173139Srwatson	u64 rx_ip_octets;
1449173139Srwatson	u64 rx_hdr_err_ip;
1450173139Srwatson	u64 rx_icmp;
1451173139Srwatson	u64 rx_tcp;
1452173139Srwatson	u64 rx_udp;
1453173139Srwatson	u64 rx_err_tcp;
1454173139Srwatson	u64 rx_mpa_ok_frms;
1455173139Srwatson	u64 rx_mpa_crc_fail_frms;
1456173139Srwatson	u64 rx_mpa_mrk_fail_frms;
1457173139Srwatson	u64 rx_mpa_len_fail_frms;
1458173139Srwatson	u64 rx_wol_frms;
1459171095Ssam}xge_hal_stats_vpath_info_t;
1460171095Ssam
1461171095Ssam/**
1462171095Ssam * struct xge_hal_stats_pcim_info_t - Contains PCIM statistics
1463171095Ssam *
1464171095Ssam * @link_info: PCIM links info for link 0, 1, and 2.
1465171095Ssam * @aggr_info: PCIM aggregators info for aggregator 0 and 1.
1466171095Ssam * See also: xge_hal_stats_link_info_t{}, xge_hal_stats_aggr_info_t{}.
1467171095Ssam */
1468171095Ssamtypedef struct xge_hal_stats_pcim_info_t {
1469173139Srwatson	xge_hal_stats_link_info_t   link_info[XGE_HAL_MAC_LINKS];
1470173139Srwatson	xge_hal_stats_aggr_info_t   aggr_info[XGE_HAL_MAC_AGGREGATORS];
1471171095Ssam}xge_hal_stats_pcim_info_t;
1472171095Ssam
1473171095Ssam/**
1474171095Ssam * struct xge_hal_stats_t - Contains HAL per-device statistics,
1475171095Ssam * including hw.
1476171095Ssam * @devh: HAL device handle.
1477171095Ssam * @dma_addr: DMA addres of the %hw_info. Given to device to fill-in the stats.
1478171095Ssam * @hw_info_dmah: DMA handle used to map hw statistics onto the device memory
1479171095Ssam *                space.
1480171095Ssam * @hw_info_dma_acch: One more DMA handle used subsequently to free the
1481171095Ssam *                    DMA object. Note that this and the previous handle have
1482171095Ssam *                    physical meaning for Solaris; on Windows and Linux the
1483171095Ssam *                    corresponding value will be simply pointer to PCI device.
1484171095Ssam *
1485171095Ssam * @hw_info: Xframe statistics maintained by the hardware.
1486171095Ssam * @hw_info_saved: TBD
1487171095Ssam * @hw_info_latest: TBD
1488171095Ssam * @pcim_info: Xframe PCIM statistics maintained by the hardware.
1489171095Ssam * @pcim_info_saved: TBD
1490171095Ssam * @pcim_info_latest: TBD
1491171095Ssam * @sw_dev_info_stats: HAL's "soft" device informational statistics, e.g. number
1492171095Ssam *                     of completions per interrupt.
1493171095Ssam * @sw_dev_err_stats: HAL's "soft" device error statistics.
1494171095Ssam *
1495171095Ssam * @is_initialized: True, if all the subordinate structures are allocated and
1496171095Ssam *                  initialized.
1497171095Ssam * @is_enabled: True, if device stats collection is enabled.
1498171095Ssam *
1499171095Ssam * Structure-container of HAL per-device statistics. Note that per-channel
1500171095Ssam * statistics are kept in separate structures under HAL's fifo and ring
1501171095Ssam * channels.
1502171095Ssam * See also: xge_hal_stats_hw_info_t{}, xge_hal_stats_sw_err_t{},
1503171095Ssam * xge_hal_stats_device_info_t{}.
1504171095Ssam * See also: xge_hal_stats_channel_info_t{}.
1505171095Ssam */
1506171095Ssamtypedef struct xge_hal_stats_t {
1507173139Srwatson	    /* handles */
1508173139Srwatson	xge_hal_device_h        devh;
1509173139Srwatson	dma_addr_t          dma_addr;
1510173139Srwatson	pci_dma_h           hw_info_dmah;
1511173139Srwatson	pci_dma_acc_h           hw_info_dma_acch;
1512171095Ssam
1513173139Srwatson	    /* HAL device hardware statistics */
1514173139Srwatson	xge_hal_stats_hw_info_t     *hw_info;
1515173139Srwatson	xge_hal_stats_hw_info_t     hw_info_saved;
1516173139Srwatson	xge_hal_stats_hw_info_t     hw_info_latest;
1517171095Ssam
1518171095Ssam	/* HAL device hardware statistics for XFRAME ER */
1519173139Srwatson	xge_hal_stats_pcim_info_t   *pcim_info;
1520173139Srwatson	xge_hal_stats_pcim_info_t   *pcim_info_saved;
1521173139Srwatson	xge_hal_stats_pcim_info_t   *pcim_info_latest;
1522171095Ssam
1523173139Srwatson	    /* HAL device "soft" stats */
1524171095Ssam	xge_hal_stats_sw_err_t          sw_dev_err_stats;
1525171095Ssam	xge_hal_stats_device_info_t     sw_dev_info_stats;
1526171095Ssam
1527173139Srwatson	    /* flags */
1528173139Srwatson	int             is_initialized;
1529173139Srwatson	int             is_enabled;
1530171095Ssam} xge_hal_stats_t;
1531171095Ssam
1532171095Ssam/* ========================== STATS PRIVATE API ========================= */
1533171095Ssam
1534171095Ssamxge_hal_status_e __hal_stats_initialize(xge_hal_stats_t *stats,
1535173139Srwatson	        xge_hal_device_h devh);
1536171095Ssam
1537171095Ssamvoid __hal_stats_terminate(xge_hal_stats_t *stats);
1538171095Ssam
1539171095Ssamvoid __hal_stats_enable(xge_hal_stats_t *stats);
1540171095Ssam
1541171095Ssamvoid __hal_stats_disable(xge_hal_stats_t *stats);
1542171095Ssam
1543171095Ssamvoid __hal_stats_soft_reset(xge_hal_device_h devh, int reset_all);
1544171095Ssam
1545171095Ssam/* ========================== STATS PUBLIC API ========================= */
1546171095Ssam
1547171095Ssamxge_hal_status_e xge_hal_stats_hw(xge_hal_device_h devh,
1548173139Srwatson	        xge_hal_stats_hw_info_t **hw_info);
1549171095Ssam
1550171095Ssamxge_hal_status_e xge_hal_stats_pcim(xge_hal_device_h devh,
1551173139Srwatson	        xge_hal_stats_pcim_info_t   **pcim_info);
1552171095Ssam
1553171095Ssamxge_hal_status_e xge_hal_stats_device(xge_hal_device_h devh,
1554173139Srwatson	        xge_hal_stats_device_info_t **device_info);
1555171095Ssam
1556171095Ssamxge_hal_status_e xge_hal_stats_channel(xge_hal_channel_h channelh,
1557173139Srwatson	        xge_hal_stats_channel_info_t **channel_info);
1558171095Ssam
1559171095Ssamxge_hal_status_e xge_hal_stats_reset(xge_hal_device_h devh);
1560171095Ssam
1561171095Ssam
1562171095Ssam__EXTERN_END_DECLS
1563171095Ssam
1564171095Ssam#endif /* XGE_HAL_STATS_H */
1565