aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ixgbe')
-rw-r--r--drivers/net/ixgbe/ixgbe.h3
-rw-r--r--drivers/net/ixgbe/ixgbe_ethtool.c29
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c40
3 files changed, 56 insertions, 16 deletions
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h
index 5e38de79fbb..ed8703cfffb 100644
--- a/drivers/net/ixgbe/ixgbe.h
+++ b/drivers/net/ixgbe/ixgbe.h
@@ -182,8 +182,9 @@ struct ixgbe_ring {
182 */ 182 */
183 183
184 struct ixgbe_queue_stats stats; 184 struct ixgbe_queue_stats stats;
185 unsigned long reinit_state; 185 struct u64_stats_sync syncp;
186 int numa_node; 186 int numa_node;
187 unsigned long reinit_state;
187 u64 rsc_count; /* stat for coalesced packets */ 188 u64 rsc_count; /* stat for coalesced packets */
188 u64 rsc_flush; /* stats for flushed packets */ 189 u64 rsc_flush; /* stats for flushed packets */
189 u32 restart_queue; /* track tx queue restarts */ 190 u32 restart_queue; /* track tx queue restarts */
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index dbfd62fd40e..3dc731c22ff 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -999,12 +999,11 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev,
999 struct ethtool_stats *stats, u64 *data) 999 struct ethtool_stats *stats, u64 *data)
1000{ 1000{
1001 struct ixgbe_adapter *adapter = netdev_priv(netdev); 1001 struct ixgbe_adapter *adapter = netdev_priv(netdev);
1002 u64 *queue_stat;
1003 int stat_count = sizeof(struct ixgbe_queue_stats) / sizeof(u64);
1004 struct rtnl_link_stats64 temp; 1002 struct rtnl_link_stats64 temp;
1005 const struct rtnl_link_stats64 *net_stats; 1003 const struct rtnl_link_stats64 *net_stats;
1006 int j, k; 1004 unsigned int start;
1007 int i; 1005 struct ixgbe_ring *ring;
1006 int i, j;
1008 char *p = NULL; 1007 char *p = NULL;
1009 1008
1010 ixgbe_update_stats(adapter); 1009 ixgbe_update_stats(adapter);
@@ -1025,16 +1024,22 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev,
1025 sizeof(u64)) ? *(u64 *)p : *(u32 *)p; 1024 sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
1026 } 1025 }
1027 for (j = 0; j < adapter->num_tx_queues; j++) { 1026 for (j = 0; j < adapter->num_tx_queues; j++) {
1028 queue_stat = (u64 *)&adapter->tx_ring[j]->stats; 1027 ring = adapter->tx_ring[j];
1029 for (k = 0; k < stat_count; k++) 1028 do {
1030 data[i + k] = queue_stat[k]; 1029 start = u64_stats_fetch_begin_bh(&ring->syncp);
1031 i += k; 1030 data[i] = ring->stats.packets;
1031 data[i+1] = ring->stats.bytes;
1032 } while (u64_stats_fetch_retry_bh(&ring->syncp, start));
1033 i += 2;
1032 } 1034 }
1033 for (j = 0; j < adapter->num_rx_queues; j++) { 1035 for (j = 0; j < adapter->num_rx_queues; j++) {
1034 queue_stat = (u64 *)&adapter->rx_ring[j]->stats; 1036 ring = adapter->rx_ring[j];
1035 for (k = 0; k < stat_count; k++) 1037 do {
1036 data[i + k] = queue_stat[k]; 1038 start = u64_stats_fetch_begin_bh(&ring->syncp);
1037 i += k; 1039 data[i] = ring->stats.packets;
1040 data[i+1] = ring->stats.bytes;
1041 } while (u64_stats_fetch_retry_bh(&ring->syncp, start));
1042 i += 2;
1038 } 1043 }
1039 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { 1044 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
1040 for (j = 0; j < MAX_TX_PACKET_BUFFERS; j++) { 1045 for (j = 0; j < MAX_TX_PACKET_BUFFERS; j++) {
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 56f6b80e108..f85631263af 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -824,8 +824,10 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
824 824
825 tx_ring->total_bytes += total_bytes; 825 tx_ring->total_bytes += total_bytes;
826 tx_ring->total_packets += total_packets; 826 tx_ring->total_packets += total_packets;
827 u64_stats_update_begin(&tx_ring->syncp);
827 tx_ring->stats.packets += total_packets; 828 tx_ring->stats.packets += total_packets;
828 tx_ring->stats.bytes += total_bytes; 829 tx_ring->stats.bytes += total_bytes;
830 u64_stats_update_end(&tx_ring->syncp);
829 return count < tx_ring->work_limit; 831 return count < tx_ring->work_limit;
830} 832}
831 833
@@ -1168,7 +1170,6 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
1168 int *work_done, int work_to_do) 1170 int *work_done, int work_to_do)
1169{ 1171{
1170 struct ixgbe_adapter *adapter = q_vector->adapter; 1172 struct ixgbe_adapter *adapter = q_vector->adapter;
1171 struct net_device *netdev = adapter->netdev;
1172 struct pci_dev *pdev = adapter->pdev; 1173 struct pci_dev *pdev = adapter->pdev;
1173 union ixgbe_adv_rx_desc *rx_desc, *next_rxd; 1174 union ixgbe_adv_rx_desc *rx_desc, *next_rxd;
1174 struct ixgbe_rx_buffer *rx_buffer_info, *next_buffer; 1175 struct ixgbe_rx_buffer *rx_buffer_info, *next_buffer;
@@ -1294,8 +1295,10 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
1294 rx_ring->rsc_count++; 1295 rx_ring->rsc_count++;
1295 rx_ring->rsc_flush++; 1296 rx_ring->rsc_flush++;
1296 } 1297 }
1298 u64_stats_update_begin(&rx_ring->syncp);
1297 rx_ring->stats.packets++; 1299 rx_ring->stats.packets++;
1298 rx_ring->stats.bytes += skb->len; 1300 rx_ring->stats.bytes += skb->len;
1301 u64_stats_update_end(&rx_ring->syncp);
1299 } else { 1302 } else {
1300 if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) { 1303 if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) {
1301 rx_buffer_info->skb = next_buffer->skb; 1304 rx_buffer_info->skb = next_buffer->skb;
@@ -1371,8 +1374,6 @@ next_desc:
1371 1374
1372 rx_ring->total_packets += total_rx_packets; 1375 rx_ring->total_packets += total_rx_packets;
1373 rx_ring->total_bytes += total_rx_bytes; 1376 rx_ring->total_bytes += total_rx_bytes;
1374 netdev->stats.rx_bytes += total_rx_bytes;
1375 netdev->stats.rx_packets += total_rx_packets;
1376 1377
1377 return cleaned; 1378 return cleaned;
1378} 1379}
@@ -6542,6 +6543,38 @@ static void ixgbe_netpoll(struct net_device *netdev)
6542} 6543}
6543#endif 6544#endif
6544 6545
6546static struct rtnl_link_stats64 *ixgbe_get_stats64(struct net_device *netdev,
6547 struct rtnl_link_stats64 *stats)
6548{
6549 struct ixgbe_adapter *adapter = netdev_priv(netdev);
6550 int i;
6551
6552 /* accurate rx/tx bytes/packets stats */
6553 dev_txq_stats_fold(netdev, stats);
6554 for (i = 0; i < adapter->num_rx_queues; i++) {
6555 struct ixgbe_ring *ring = adapter->rx_ring[i];
6556 u64 bytes, packets;
6557 unsigned int start;
6558
6559 do {
6560 start = u64_stats_fetch_begin_bh(&ring->syncp);
6561 packets = ring->stats.packets;
6562 bytes = ring->stats.bytes;
6563 } while (u64_stats_fetch_retry_bh(&ring->syncp, start));
6564 stats->rx_packets += packets;
6565 stats->rx_bytes += bytes;
6566 }
6567
6568 /* following stats updated by ixgbe_watchdog_task() */
6569 stats->multicast = netdev->stats.multicast;
6570 stats->rx_errors = netdev->stats.rx_errors;
6571 stats->rx_length_errors = netdev->stats.rx_length_errors;
6572 stats->rx_crc_errors = netdev->stats.rx_crc_errors;
6573 stats->rx_missed_errors = netdev->stats.rx_missed_errors;
6574 return stats;
6575}
6576
6577
6545static const struct net_device_ops ixgbe_netdev_ops = { 6578static const struct net_device_ops ixgbe_netdev_ops = {
6546 .ndo_open = ixgbe_open, 6579 .ndo_open = ixgbe_open,
6547 .ndo_stop = ixgbe_close, 6580 .ndo_stop = ixgbe_close,
@@ -6560,6 +6593,7 @@ static const struct net_device_ops ixgbe_netdev_ops = {
6560 .ndo_set_vf_vlan = ixgbe_ndo_set_vf_vlan, 6593 .ndo_set_vf_vlan = ixgbe_ndo_set_vf_vlan,
6561 .ndo_set_vf_tx_rate = ixgbe_ndo_set_vf_bw, 6594 .ndo_set_vf_tx_rate = ixgbe_ndo_set_vf_bw,
6562 .ndo_get_vf_config = ixgbe_ndo_get_vf_config, 6595 .ndo_get_vf_config = ixgbe_ndo_get_vf_config,
6596 .ndo_get_stats64 = ixgbe_get_stats64,
6563#ifdef CONFIG_NET_POLL_CONTROLLER 6597#ifdef CONFIG_NET_POLL_CONTROLLER
6564 .ndo_poll_controller = ixgbe_netpoll, 6598 .ndo_poll_controller = ixgbe_netpoll,
6565#endif 6599#endif