@@ -40,35 +40,6 @@ static const struct fbnic_stat fbnic_gstrings_hw_stats[] = {
40
40
#define FBNIC_HW_FIXED_STATS_LEN ARRAY_SIZE(fbnic_gstrings_hw_stats)
41
41
#define FBNIC_HW_STATS_LEN FBNIC_HW_FIXED_STATS_LEN
42
42
43
- static int
44
- fbnic_get_ts_info (struct net_device * netdev ,
45
- struct kernel_ethtool_ts_info * tsinfo )
46
- {
47
- struct fbnic_net * fbn = netdev_priv (netdev );
48
-
49
- tsinfo -> phc_index = ptp_clock_index (fbn -> fbd -> ptp );
50
-
51
- tsinfo -> so_timestamping =
52
- SOF_TIMESTAMPING_TX_SOFTWARE |
53
- SOF_TIMESTAMPING_TX_HARDWARE |
54
- SOF_TIMESTAMPING_RX_HARDWARE |
55
- SOF_TIMESTAMPING_RAW_HARDWARE ;
56
-
57
- tsinfo -> tx_types =
58
- BIT (HWTSTAMP_TX_OFF ) |
59
- BIT (HWTSTAMP_TX_ON );
60
-
61
- tsinfo -> rx_filters =
62
- BIT (HWTSTAMP_FILTER_NONE ) |
63
- BIT (HWTSTAMP_FILTER_PTP_V1_L4_EVENT ) |
64
- BIT (HWTSTAMP_FILTER_PTP_V2_L4_EVENT ) |
65
- BIT (HWTSTAMP_FILTER_PTP_V2_L2_EVENT ) |
66
- BIT (HWTSTAMP_FILTER_PTP_V2_EVENT ) |
67
- BIT (HWTSTAMP_FILTER_ALL );
68
-
69
- return 0 ;
70
- }
71
-
72
43
static void
73
44
fbnic_get_drvinfo (struct net_device * netdev , struct ethtool_drvinfo * drvinfo )
74
45
{
@@ -79,10 +50,19 @@ fbnic_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
79
50
sizeof (drvinfo -> fw_version ));
80
51
}
81
52
82
- static void fbnic_set_counter ( u64 * stat , struct fbnic_stat_counter * counter )
53
+ static int fbnic_get_regs_len ( struct net_device * netdev )
83
54
{
84
- if (counter -> reported )
85
- * stat = counter -> value ;
55
+ struct fbnic_net * fbn = netdev_priv (netdev );
56
+
57
+ return fbnic_csr_regs_len (fbn -> fbd ) * sizeof (u32 );
58
+ }
59
+
60
+ static void fbnic_get_regs (struct net_device * netdev ,
61
+ struct ethtool_regs * regs , void * data )
62
+ {
63
+ struct fbnic_net * fbn = netdev_priv (netdev );
64
+
65
+ fbnic_csr_get_regs (fbn -> fbd , data , & regs -> version );
86
66
}
87
67
88
68
static void fbnic_get_strings (struct net_device * dev , u32 sset , u8 * data )
@@ -97,6 +77,21 @@ static void fbnic_get_strings(struct net_device *dev, u32 sset, u8 *data)
97
77
}
98
78
}
99
79
80
+ static void fbnic_get_ethtool_stats (struct net_device * dev ,
81
+ struct ethtool_stats * stats , u64 * data )
82
+ {
83
+ struct fbnic_net * fbn = netdev_priv (dev );
84
+ const struct fbnic_stat * stat ;
85
+ int i ;
86
+
87
+ fbnic_get_hw_stats (fbn -> fbd );
88
+
89
+ for (i = 0 ; i < FBNIC_HW_STATS_LEN ; i ++ ) {
90
+ stat = & fbnic_gstrings_hw_stats [i ];
91
+ data [i ] = * (u64 * )((u8 * )& fbn -> fbd -> hw_stats + stat -> offset );
92
+ }
93
+ }
94
+
100
95
static int fbnic_get_sset_count (struct net_device * dev , int sset )
101
96
{
102
97
switch (sset ) {
@@ -107,21 +102,64 @@ static int fbnic_get_sset_count(struct net_device *dev, int sset)
107
102
}
108
103
}
109
104
110
- static void fbnic_get_ethtool_stats (struct net_device * dev ,
111
- struct ethtool_stats * stats , u64 * data )
105
+ static int
106
+ fbnic_get_ts_info (struct net_device * netdev ,
107
+ struct kernel_ethtool_ts_info * tsinfo )
112
108
{
113
- struct fbnic_net * fbn = netdev_priv (dev );
114
- const struct fbnic_stat * stat ;
115
- int i ;
109
+ struct fbnic_net * fbn = netdev_priv (netdev );
116
110
117
- fbnic_get_hw_stats (fbn -> fbd );
111
+ tsinfo -> phc_index = ptp_clock_index (fbn -> fbd -> ptp );
118
112
119
- for (i = 0 ; i < FBNIC_HW_STATS_LEN ; i ++ ) {
120
- stat = & fbnic_gstrings_hw_stats [i ];
121
- data [i ] = * (u64 * )((u8 * )& fbn -> fbd -> hw_stats + stat -> offset );
113
+ tsinfo -> so_timestamping =
114
+ SOF_TIMESTAMPING_TX_SOFTWARE |
115
+ SOF_TIMESTAMPING_TX_HARDWARE |
116
+ SOF_TIMESTAMPING_RX_HARDWARE |
117
+ SOF_TIMESTAMPING_RAW_HARDWARE ;
118
+
119
+ tsinfo -> tx_types =
120
+ BIT (HWTSTAMP_TX_OFF ) |
121
+ BIT (HWTSTAMP_TX_ON );
122
+
123
+ tsinfo -> rx_filters =
124
+ BIT (HWTSTAMP_FILTER_NONE ) |
125
+ BIT (HWTSTAMP_FILTER_PTP_V1_L4_EVENT ) |
126
+ BIT (HWTSTAMP_FILTER_PTP_V2_L4_EVENT ) |
127
+ BIT (HWTSTAMP_FILTER_PTP_V2_L2_EVENT ) |
128
+ BIT (HWTSTAMP_FILTER_PTP_V2_EVENT ) |
129
+ BIT (HWTSTAMP_FILTER_ALL );
130
+
131
+ return 0 ;
132
+ }
133
+
134
+ static void fbnic_get_ts_stats (struct net_device * netdev ,
135
+ struct ethtool_ts_stats * ts_stats )
136
+ {
137
+ struct fbnic_net * fbn = netdev_priv (netdev );
138
+ u64 ts_packets , ts_lost ;
139
+ struct fbnic_ring * ring ;
140
+ unsigned int start ;
141
+ int i ;
142
+
143
+ ts_stats -> pkts = fbn -> tx_stats .ts_packets ;
144
+ ts_stats -> lost = fbn -> tx_stats .ts_lost ;
145
+ for (i = 0 ; i < fbn -> num_tx_queues ; i ++ ) {
146
+ ring = fbn -> tx [i ];
147
+ do {
148
+ start = u64_stats_fetch_begin (& ring -> stats .syncp );
149
+ ts_packets = ring -> stats .ts_packets ;
150
+ ts_lost = ring -> stats .ts_lost ;
151
+ } while (u64_stats_fetch_retry (& ring -> stats .syncp , start ));
152
+ ts_stats -> pkts += ts_packets ;
153
+ ts_stats -> lost += ts_lost ;
122
154
}
123
155
}
124
156
157
+ static void fbnic_set_counter (u64 * stat , struct fbnic_stat_counter * counter )
158
+ {
159
+ if (counter -> reported )
160
+ * stat = counter -> value ;
161
+ }
162
+
125
163
static void
126
164
fbnic_get_eth_mac_stats (struct net_device * netdev ,
127
165
struct ethtool_eth_mac_stats * eth_mac_stats )
@@ -164,44 +202,6 @@ fbnic_get_eth_mac_stats(struct net_device *netdev,
164
202
& mac_stats -> eth_mac .FrameTooLongErrors );
165
203
}
166
204
167
- static void fbnic_get_ts_stats (struct net_device * netdev ,
168
- struct ethtool_ts_stats * ts_stats )
169
- {
170
- struct fbnic_net * fbn = netdev_priv (netdev );
171
- u64 ts_packets , ts_lost ;
172
- struct fbnic_ring * ring ;
173
- unsigned int start ;
174
- int i ;
175
-
176
- ts_stats -> pkts = fbn -> tx_stats .ts_packets ;
177
- ts_stats -> lost = fbn -> tx_stats .ts_lost ;
178
- for (i = 0 ; i < fbn -> num_tx_queues ; i ++ ) {
179
- ring = fbn -> tx [i ];
180
- do {
181
- start = u64_stats_fetch_begin (& ring -> stats .syncp );
182
- ts_packets = ring -> stats .ts_packets ;
183
- ts_lost = ring -> stats .ts_lost ;
184
- } while (u64_stats_fetch_retry (& ring -> stats .syncp , start ));
185
- ts_stats -> pkts += ts_packets ;
186
- ts_stats -> lost += ts_lost ;
187
- }
188
- }
189
-
190
- static void fbnic_get_regs (struct net_device * netdev ,
191
- struct ethtool_regs * regs , void * data )
192
- {
193
- struct fbnic_net * fbn = netdev_priv (netdev );
194
-
195
- fbnic_csr_get_regs (fbn -> fbd , data , & regs -> version );
196
- }
197
-
198
- static int fbnic_get_regs_len (struct net_device * netdev )
199
- {
200
- struct fbnic_net * fbn = netdev_priv (netdev );
201
-
202
- return fbnic_csr_regs_len (fbn -> fbd ) * sizeof (u32 );
203
- }
204
-
205
205
static const struct ethtool_ops fbnic_ethtool_ops = {
206
206
.get_drvinfo = fbnic_get_drvinfo ,
207
207
.get_regs_len = fbnic_get_regs_len ,
0 commit comments