mlx4: /dev/ -> /dev_vfs/
[akaros.git] / kern / drivers / net / mlx4 / mlx4_stats.h
1 #pragma once
2
3 #ifdef MLX4_EN_PERF_STAT
4 #define NUM_PERF_STATS                  NUM_PERF_COUNTERS
5 #else
6 #define NUM_PERF_STATS                  0
7 #endif
8
9 #define NUM_PRIORITIES  9
10 #define NUM_PRIORITY_STATS 2
11
12 struct mlx4_en_pkt_stats {
13         unsigned long rx_multicast_packets;
14         unsigned long rx_broadcast_packets;
15         unsigned long rx_jabbers;
16         unsigned long rx_in_range_length_error;
17         unsigned long rx_out_range_length_error;
18         unsigned long tx_multicast_packets;
19         unsigned long tx_broadcast_packets;
20         unsigned long rx_prio[NUM_PRIORITIES][NUM_PRIORITY_STATS];
21         unsigned long tx_prio[NUM_PRIORITIES][NUM_PRIORITY_STATS];
22 #define NUM_PKT_STATS           43
23 };
24
25 struct mlx4_en_port_stats {
26         unsigned long tso_packets;
27         unsigned long xmit_more;
28         unsigned long queue_stopped;
29         unsigned long wake_queue;
30         unsigned long tx_timeout;
31         unsigned long rx_alloc_failed;
32         unsigned long rx_chksum_good;
33         unsigned long rx_chksum_none;
34         unsigned long rx_chksum_complete;
35         unsigned long tx_chksum_offload;
36 #define NUM_PORT_STATS          10
37 };
38
39 struct mlx4_en_perf_stats {
40         uint32_t tx_poll;
41         uint64_t tx_pktsz_avg;
42         uint32_t inflight_avg;
43         uint16_t tx_coal_avg;
44         uint16_t rx_coal_avg;
45         uint32_t napi_quota;
46 #define NUM_PERF_COUNTERS               6
47 };
48
49 #define NUM_MAIN_STATS  21
50
51 #define MLX4_NUM_PRIORITIES     8
52
53 struct mlx4_en_flow_stats_rx {
54         uint64_t rx_pause;
55         uint64_t rx_pause_duration;
56         uint64_t rx_pause_transition;
57 #define NUM_FLOW_STATS_RX       3
58 #define NUM_FLOW_PRIORITY_STATS_RX      (NUM_FLOW_STATS_RX * \
59                                          MLX4_NUM_PRIORITIES)
60 };
61
62 struct mlx4_en_flow_stats_tx {
63         uint64_t tx_pause;
64         uint64_t tx_pause_duration;
65         uint64_t tx_pause_transition;
66 #define NUM_FLOW_STATS_TX       3
67 #define NUM_FLOW_PRIORITY_STATS_TX      (NUM_FLOW_STATS_TX * \
68                                          MLX4_NUM_PRIORITIES)
69 };
70
71 #define NUM_FLOW_STATS (NUM_FLOW_STATS_RX + NUM_FLOW_STATS_TX + \
72                         NUM_FLOW_PRIORITY_STATS_TX + \
73                         NUM_FLOW_PRIORITY_STATS_RX)
74
75 struct mlx4_en_stat_out_flow_control_mbox {
76         /* Total number of PAUSE frames received from the far-end port */
77         __be64 rx_pause;
78         /* Total number of microseconds that far-end port requested to pause
79         * transmission of packets
80         */
81         __be64 rx_pause_duration;
82         /* Number of received transmission from XOFF state to XON state */
83         __be64 rx_pause_transition;
84         /* Total number of PAUSE frames sent from the far-end port */
85         __be64 tx_pause;
86         /* Total time in microseconds that transmission of packets has been
87         * paused
88         */
89         __be64 tx_pause_duration;
90         /* Number of transmitter transitions from XOFF state to XON state */
91         __be64 tx_pause_transition;
92         /* Reserverd */
93         __be64 reserved[2];
94 };
95
96 enum {
97         MLX4_DUMP_ETH_STATS_FLOW_CONTROL = 1 << 12
98 };
99
100 #define NUM_ALL_STATS   (NUM_MAIN_STATS + NUM_PORT_STATS + NUM_PKT_STATS + \
101                          NUM_FLOW_STATS + NUM_PERF_STATS)
102
103 #define MLX4_FIND_NETDEV_STAT(n) (offsetof(struct net_device_stats, n) / \
104                                   sizeof(((struct net_device_stats *)0)->n))