• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _MLX4_STATS_
3 #define _MLX4_STATS_
4 
5 #define NUM_PRIORITIES	9
6 #define NUM_PRIORITY_STATS 2
7 
8 struct mlx4_en_pkt_stats {
9 	unsigned long rx_multicast_packets;
10 	unsigned long rx_broadcast_packets;
11 	unsigned long rx_jabbers;
12 	unsigned long rx_in_range_length_error;
13 	unsigned long rx_out_range_length_error;
14 	unsigned long tx_multicast_packets;
15 	unsigned long tx_broadcast_packets;
16 	unsigned long rx_prio[NUM_PRIORITIES][NUM_PRIORITY_STATS];
17 	unsigned long tx_prio[NUM_PRIORITIES][NUM_PRIORITY_STATS];
18 #define NUM_PKT_STATS		43
19 };
20 
21 struct mlx4_en_counter_stats {
22 	unsigned long rx_packets;
23 	unsigned long rx_bytes;
24 	unsigned long tx_packets;
25 	unsigned long tx_bytes;
26 #define NUM_PF_STATS      4
27 };
28 
29 struct mlx4_en_port_stats {
30 	unsigned long tso_packets;
31 	unsigned long xmit_more;
32 	unsigned long queue_stopped;
33 	unsigned long wake_queue;
34 	unsigned long tx_timeout;
35 	unsigned long rx_alloc_pages;
36 	unsigned long rx_chksum_good;
37 	unsigned long rx_chksum_none;
38 	unsigned long rx_chksum_complete;
39 	unsigned long tx_chksum_offload;
40 #define NUM_PORT_STATS		10
41 };
42 
43 struct mlx4_en_xdp_stats {
44 	unsigned long rx_xdp_drop;
45 	unsigned long rx_xdp_tx;
46 	unsigned long rx_xdp_tx_full;
47 #define NUM_XDP_STATS		3
48 };
49 
50 struct mlx4_en_phy_stats {
51 	unsigned long rx_packets_phy;
52 	unsigned long rx_bytes_phy;
53 	unsigned long tx_packets_phy;
54 	unsigned long tx_bytes_phy;
55 #define NUM_PHY_STATS		4
56 };
57 
58 #define NUM_MAIN_STATS	21
59 
60 #define MLX4_NUM_PRIORITIES	8
61 
62 struct mlx4_en_flow_stats_rx {
63 	u64 rx_pause;
64 	u64 rx_pause_duration;
65 	u64 rx_pause_transition;
66 #define NUM_FLOW_STATS_RX	3
67 #define NUM_FLOW_PRIORITY_STATS_RX	(NUM_FLOW_STATS_RX * \
68 					 MLX4_NUM_PRIORITIES)
69 };
70 
71 #define FLOW_PRIORITY_STATS_IDX_RX_FRAMES	(NUM_MAIN_STATS +	\
72 						 NUM_PORT_STATS +	\
73 						 NUM_PF_STATS +		\
74 						 NUM_FLOW_PRIORITY_STATS_RX)
75 
76 struct mlx4_en_flow_stats_tx {
77 	u64 tx_pause;
78 	u64 tx_pause_duration;
79 	u64 tx_pause_transition;
80 #define NUM_FLOW_STATS_TX	3
81 #define NUM_FLOW_PRIORITY_STATS_TX	(NUM_FLOW_STATS_TX * \
82 					 MLX4_NUM_PRIORITIES)
83 };
84 
85 #define FLOW_PRIORITY_STATS_IDX_TX_FRAMES	(NUM_MAIN_STATS +	\
86 						 NUM_PORT_STATS +	\
87 						 NUM_PF_STATS +		\
88 						 NUM_FLOW_PRIORITY_STATS_RX + \
89 						 NUM_FLOW_STATS_RX +	\
90 						 NUM_FLOW_PRIORITY_STATS_TX)
91 
92 #define NUM_FLOW_STATS (NUM_FLOW_STATS_RX + NUM_FLOW_STATS_TX + \
93 			NUM_FLOW_PRIORITY_STATS_TX + \
94 			NUM_FLOW_PRIORITY_STATS_RX)
95 
96 struct mlx4_en_stat_out_flow_control_mbox {
97 	/* Total number of PAUSE frames received from the far-end port */
98 	__be64 rx_pause;
99 	/* Total number of microseconds that far-end port requested to pause
100 	* transmission of packets
101 	*/
102 	__be64 rx_pause_duration;
103 	/* Number of received transmission from XOFF state to XON state */
104 	__be64 rx_pause_transition;
105 	/* Total number of PAUSE frames sent from the far-end port */
106 	__be64 tx_pause;
107 	/* Total time in microseconds that transmission of packets has been
108 	* paused
109 	*/
110 	__be64 tx_pause_duration;
111 	/* Number of transmitter transitions from XOFF state to XON state */
112 	__be64 tx_pause_transition;
113 	/* Reserverd */
114 	__be64 reserved[2];
115 };
116 
117 enum {
118 	MLX4_DUMP_ETH_STATS_FLOW_CONTROL = 1 << 12
119 };
120 
121 #define NUM_ALL_STATS	(NUM_MAIN_STATS + NUM_PORT_STATS + NUM_PKT_STATS + \
122 			 NUM_FLOW_STATS + NUM_PF_STATS + \
123 			 NUM_XDP_STATS + NUM_PHY_STATS)
124 
125 #define MLX4_FIND_NETDEV_STAT(n) (offsetof(struct net_device_stats, n) / \
126 				  sizeof(((struct net_device_stats *)0)->n))
127 
128 #endif
129