]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/blob - sys/ofed/drivers/net/mlx4/mlx4_stats.h
MFC r322248:
[FreeBSD/stable/9.git] / sys / ofed / drivers / net / mlx4 / mlx4_stats.h
1 /*
2  * Copyright (c) 2014 Mellanox Technologies Ltd.  All rights reserved.
3  *
4  * This software is available to you under a choice of one of two
5  * licenses.  You may choose to be licensed under the terms of the GNU
6  * General Public License (GPL) Version 2, available from the file
7  * COPYING in the main directory of this source tree, or the
8  * OpenIB.org BSD license below:
9  *
10  *     Redistribution and use in source and binary forms, with or
11  *     without modification, are permitted provided that the following
12  *     conditions are met:
13  *
14  *      - Redistributions of source code must retain the above
15  *        copyright notice, this list of conditions and the following
16  *        disclaimer.
17  *
18  *      - Redistributions in binary form must reproduce the above
19  *        copyright notice, this list of conditions and the following
20  *        disclaimer in the documentation and/or other materials
21  *        provided with the distribution.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30  * SOFTWARE.
31  */
32
33 #ifndef _MLX4_STATS_
34 #define _MLX4_STATS_
35
36
37 #ifdef MLX4_EN_PERF_STAT
38 #define NUM_PERF_STATS                  NUM_PERF_COUNTERS
39 #else
40 #define NUM_PERF_STATS                  0
41 #endif
42
43 #define NUM_PRIORITIES  9
44 #define NUM_PRIORITY_STATS 2
45
46 struct mlx4_en_pkt_stats {
47         unsigned long rx_packets;
48         unsigned long rx_bytes;
49         unsigned long rx_multicast_packets;
50         unsigned long rx_broadcast_packets;
51         unsigned long rx_errors;
52         unsigned long rx_dropped;
53         unsigned long rx_length_errors;
54         unsigned long rx_over_errors;
55         unsigned long rx_crc_errors;
56         unsigned long rx_jabbers;
57         unsigned long rx_in_range_length_error;
58         unsigned long rx_out_range_length_error;
59         unsigned long rx_lt_64_bytes_packets;
60         unsigned long rx_127_bytes_packets;
61         unsigned long rx_255_bytes_packets;
62         unsigned long rx_511_bytes_packets;
63         unsigned long rx_1023_bytes_packets;
64         unsigned long rx_1518_bytes_packets;
65         unsigned long rx_1522_bytes_packets;
66         unsigned long rx_1548_bytes_packets;
67         unsigned long rx_gt_1548_bytes_packets;
68         unsigned long tx_packets;
69         unsigned long tx_bytes;
70         unsigned long tx_multicast_packets;
71         unsigned long tx_broadcast_packets;
72         unsigned long tx_errors;
73         unsigned long tx_dropped;
74         unsigned long tx_lt_64_bytes_packets;
75         unsigned long tx_127_bytes_packets;
76         unsigned long tx_255_bytes_packets;
77         unsigned long tx_511_bytes_packets;
78         unsigned long tx_1023_bytes_packets;
79         unsigned long tx_1518_bytes_packets;
80         unsigned long tx_1522_bytes_packets;
81         unsigned long tx_1548_bytes_packets;
82         unsigned long tx_gt_1548_bytes_packets;
83         unsigned long rx_prio[NUM_PRIORITIES][NUM_PRIORITY_STATS];
84         unsigned long tx_prio[NUM_PRIORITIES][NUM_PRIORITY_STATS];
85 };
86
87 struct mlx4_en_vf_stats {
88         unsigned long rx_packets;
89         unsigned long rx_bytes;
90         unsigned long rx_multicast_packets;
91         unsigned long rx_broadcast_packets;
92         unsigned long rx_errors;
93         unsigned long rx_dropped;
94         unsigned long tx_packets;
95         unsigned long tx_bytes;
96         unsigned long tx_multicast_packets;
97         unsigned long tx_broadcast_packets;
98         unsigned long tx_errors;
99 };
100
101 struct mlx4_en_vport_stats {
102         unsigned long rx_unicast_packets;
103         unsigned long rx_unicast_bytes;
104         unsigned long rx_multicast_packets;
105         unsigned long rx_multicast_bytes;
106         unsigned long rx_broadcast_packets;
107         unsigned long rx_broadcast_bytes;
108         unsigned long rx_dropped;
109         unsigned long rx_errors;
110         unsigned long tx_unicast_packets;
111         unsigned long tx_unicast_bytes;
112         unsigned long tx_multicast_packets;
113         unsigned long tx_multicast_bytes;
114         unsigned long tx_broadcast_packets;
115         unsigned long tx_broadcast_bytes;
116         unsigned long tx_errors;
117 };
118
119 struct mlx4_en_port_stats {
120         unsigned long tso_packets;
121         unsigned long queue_stopped;
122         unsigned long wake_queue;
123         unsigned long tx_timeout;
124         unsigned long oversized_packets;
125         unsigned long rx_alloc_failed;
126         unsigned long rx_chksum_good;
127         unsigned long rx_chksum_none;
128         unsigned long tx_chksum_offload;
129         unsigned long defrag_attempts;
130 };
131
132 struct mlx4_en_perf_stats {
133         u32 tx_poll;
134         u64 tx_pktsz_avg;
135         u32 inflight_avg;
136         u16 tx_coal_avg;
137         u16 rx_coal_avg;
138         u32 napi_quota;
139 };
140
141 struct mlx4_en_flow_stats {
142         u64 rx_pause;
143         u64 rx_pause_duration;
144         u64 rx_pause_transition;
145         u64 tx_pause;
146         u64 tx_pause_duration;
147         u64 tx_pause_transition;
148 };
149 #define MLX4_NUM_PRIORITIES     8
150
151
152 struct mlx4_en_stat_out_flow_control_mbox {
153         /* Total number of PAUSE frames received from the far-end port */
154         __be64 rx_pause;
155         /* Total number of microseconds that far-end port requested to pause
156          * transmission of packets
157          */
158         __be64 rx_pause_duration;
159         /* Number of received transmission from XOFF state to XON state */
160         __be64 rx_pause_transition;
161         /* Total number of PAUSE frames sent from the far-end port */
162         __be64 tx_pause;
163         /* Total time in microseconds that transmission of packets has been
164          * paused
165          */
166         __be64 tx_pause_duration;
167         /* Number of transmitter transitions from XOFF state to XON state */
168         __be64 tx_pause_transition;
169         /* Reserverd */
170         __be64 reserved[2];
171 };
172
173 int mlx4_get_vport_ethtool_stats(struct mlx4_dev *dev, int port,
174                          struct mlx4_en_vport_stats *vport_stats,
175                          int reset);
176
177 #endif