@@ -270,11 +270,10 @@ static bool ixgbevf_clean_tx_irq(struct ixgbevf_adapter *adapter,
270
270
IXGBE_WRITE_REG (hw , IXGBE_VTEICS , tx_ring -> v_idx );
271
271
}
272
272
273
+ u64_stats_update_begin (& tx_ring -> syncp );
273
274
tx_ring -> total_bytes += total_bytes ;
274
275
tx_ring -> total_packets += total_packets ;
275
-
276
- netdev -> stats .tx_bytes += total_bytes ;
277
- netdev -> stats .tx_packets += total_packets ;
276
+ u64_stats_update_end (& tx_ring -> syncp );
278
277
279
278
return count < tx_ring -> work_limit ;
280
279
}
@@ -597,10 +596,10 @@ static bool ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector,
597
596
if (cleaned_count )
598
597
ixgbevf_alloc_rx_buffers (adapter , rx_ring , cleaned_count );
599
598
599
+ u64_stats_update_begin (& rx_ring -> syncp );
600
600
rx_ring -> total_packets += total_rx_packets ;
601
601
rx_ring -> total_bytes += total_rx_bytes ;
602
- adapter -> netdev -> stats .rx_bytes += total_rx_bytes ;
603
- adapter -> netdev -> stats .rx_packets += total_rx_packets ;
602
+ u64_stats_update_end (& rx_ring -> syncp );
604
603
605
604
return cleaned ;
606
605
}
@@ -2260,10 +2259,6 @@ void ixgbevf_update_stats(struct ixgbevf_adapter *adapter)
2260
2259
adapter -> stats .vfgotc );
2261
2260
UPDATE_VF_COUNTER_32bit (IXGBE_VFMPRC , adapter -> stats .last_vfmprc ,
2262
2261
adapter -> stats .vfmprc );
2263
-
2264
- /* Fill out the OS statistics structure */
2265
- adapter -> netdev -> stats .multicast = adapter -> stats .vfmprc -
2266
- adapter -> stats .base_vfmprc ;
2267
2262
}
2268
2263
2269
2264
/**
@@ -3220,11 +3215,50 @@ static void ixgbevf_shutdown(struct pci_dev *pdev)
3220
3215
pci_disable_device (pdev );
3221
3216
}
3222
3217
3218
+ static struct rtnl_link_stats64 * ixgbevf_get_stats (struct net_device * netdev ,
3219
+ struct rtnl_link_stats64 * stats )
3220
+ {
3221
+ struct ixgbevf_adapter * adapter = netdev_priv (netdev );
3222
+ unsigned int start ;
3223
+ u64 bytes , packets ;
3224
+ const struct ixgbevf_ring * ring ;
3225
+ int i ;
3226
+
3227
+ ixgbevf_update_stats (adapter );
3228
+
3229
+ stats -> multicast = adapter -> stats .vfmprc - adapter -> stats .base_vfmprc ;
3230
+
3231
+ for (i = 0 ; i < adapter -> num_rx_queues ; i ++ ) {
3232
+ ring = & adapter -> rx_ring [i ];
3233
+ do {
3234
+ start = u64_stats_fetch_begin_bh (& ring -> syncp );
3235
+ bytes = ring -> total_bytes ;
3236
+ packets = ring -> total_packets ;
3237
+ } while (u64_stats_fetch_retry_bh (& ring -> syncp , start ));
3238
+ stats -> rx_bytes += bytes ;
3239
+ stats -> rx_packets += packets ;
3240
+ }
3241
+
3242
+ for (i = 0 ; i < adapter -> num_tx_queues ; i ++ ) {
3243
+ ring = & adapter -> tx_ring [i ];
3244
+ do {
3245
+ start = u64_stats_fetch_begin_bh (& ring -> syncp );
3246
+ bytes = ring -> total_bytes ;
3247
+ packets = ring -> total_packets ;
3248
+ } while (u64_stats_fetch_retry_bh (& ring -> syncp , start ));
3249
+ stats -> tx_bytes += bytes ;
3250
+ stats -> tx_packets += packets ;
3251
+ }
3252
+
3253
+ return stats ;
3254
+ }
3255
+
3223
3256
static const struct net_device_ops ixgbe_netdev_ops = {
3224
3257
.ndo_open = ixgbevf_open ,
3225
3258
.ndo_stop = ixgbevf_close ,
3226
3259
.ndo_start_xmit = ixgbevf_xmit_frame ,
3227
3260
.ndo_set_rx_mode = ixgbevf_set_rx_mode ,
3261
+ .ndo_get_stats64 = ixgbevf_get_stats ,
3228
3262
.ndo_validate_addr = eth_validate_addr ,
3229
3263
.ndo_set_mac_address = ixgbevf_set_mac ,
3230
3264
.ndo_change_mtu = ixgbevf_change_mtu ,
0 commit comments