1 /* SPDX-License-Identifier: GPL-2.0 */
5 #ifdef MLX4_EN_PERF_STAT
6 #define NUM_PERF_STATS NUM_PERF_COUNTERS
8 #define NUM_PERF_STATS 0
11 #define NUM_PRIORITIES 9
12 #define NUM_PRIORITY_STATS 2
14 struct mlx4_en_pkt_stats
{
15 unsigned long rx_multicast_packets
;
16 unsigned long rx_broadcast_packets
;
17 unsigned long rx_jabbers
;
18 unsigned long rx_in_range_length_error
;
19 unsigned long rx_out_range_length_error
;
20 unsigned long tx_multicast_packets
;
21 unsigned long tx_broadcast_packets
;
22 unsigned long rx_prio
[NUM_PRIORITIES
][NUM_PRIORITY_STATS
];
23 unsigned long tx_prio
[NUM_PRIORITIES
][NUM_PRIORITY_STATS
];
24 #define NUM_PKT_STATS 43
27 struct mlx4_en_counter_stats
{
28 unsigned long rx_packets
;
29 unsigned long rx_bytes
;
30 unsigned long tx_packets
;
31 unsigned long tx_bytes
;
32 #define NUM_PF_STATS 4
35 struct mlx4_en_port_stats
{
36 unsigned long tso_packets
;
37 unsigned long xmit_more
;
38 unsigned long queue_stopped
;
39 unsigned long wake_queue
;
40 unsigned long tx_timeout
;
41 unsigned long rx_alloc_pages
;
42 unsigned long rx_chksum_good
;
43 unsigned long rx_chksum_none
;
44 unsigned long rx_chksum_complete
;
45 unsigned long tx_chksum_offload
;
46 #define NUM_PORT_STATS 10
49 struct mlx4_en_perf_stats
{
56 #define NUM_PERF_COUNTERS 6
59 struct mlx4_en_xdp_stats
{
60 unsigned long rx_xdp_drop
;
61 unsigned long rx_xdp_tx
;
62 unsigned long rx_xdp_tx_full
;
63 #define NUM_XDP_STATS 3
66 #define NUM_MAIN_STATS 21
68 #define MLX4_NUM_PRIORITIES 8
70 struct mlx4_en_flow_stats_rx
{
72 u64 rx_pause_duration
;
73 u64 rx_pause_transition
;
74 #define NUM_FLOW_STATS_RX 3
75 #define NUM_FLOW_PRIORITY_STATS_RX (NUM_FLOW_STATS_RX * \
79 struct mlx4_en_flow_stats_tx
{
81 u64 tx_pause_duration
;
82 u64 tx_pause_transition
;
83 #define NUM_FLOW_STATS_TX 3
84 #define NUM_FLOW_PRIORITY_STATS_TX (NUM_FLOW_STATS_TX * \
88 #define NUM_FLOW_STATS (NUM_FLOW_STATS_RX + NUM_FLOW_STATS_TX + \
89 NUM_FLOW_PRIORITY_STATS_TX + \
90 NUM_FLOW_PRIORITY_STATS_RX)
92 struct mlx4_en_stat_out_flow_control_mbox
{
93 /* Total number of PAUSE frames received from the far-end port */
95 /* Total number of microseconds that far-end port requested to pause
96 * transmission of packets
98 __be64 rx_pause_duration
;
99 /* Number of received transmission from XOFF state to XON state */
100 __be64 rx_pause_transition
;
101 /* Total number of PAUSE frames sent from the far-end port */
103 /* Total time in microseconds that transmission of packets has been
106 __be64 tx_pause_duration
;
107 /* Number of transmitter transitions from XOFF state to XON state */
108 __be64 tx_pause_transition
;
114 MLX4_DUMP_ETH_STATS_FLOW_CONTROL
= 1 << 12
117 #define NUM_ALL_STATS (NUM_MAIN_STATS + NUM_PORT_STATS + NUM_PKT_STATS + \
118 NUM_FLOW_STATS + NUM_PERF_STATS + NUM_PF_STATS + \
121 #define MLX4_FIND_NETDEV_STAT(n) (offsetof(struct net_device_stats, n) / \
122 sizeof(((struct net_device_stats *)0)->n))