diff options
Diffstat (limited to 'drivers/net/ethernet/nvidia/forcedeth.c')
-rw-r--r-- | drivers/net/ethernet/nvidia/forcedeth.c | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c index 1dca57013cb2..1c61d36e6570 100644 --- a/drivers/net/ethernet/nvidia/forcedeth.c +++ b/drivers/net/ethernet/nvidia/forcedeth.c | |||
@@ -609,7 +609,7 @@ struct nv_ethtool_str { | |||
609 | }; | 609 | }; |
610 | 610 | ||
611 | static const struct nv_ethtool_str nv_estats_str[] = { | 611 | static const struct nv_ethtool_str nv_estats_str[] = { |
612 | { "tx_bytes" }, | 612 | { "tx_bytes" }, /* includes Ethernet FCS CRC */ |
613 | { "tx_zero_rexmt" }, | 613 | { "tx_zero_rexmt" }, |
614 | { "tx_one_rexmt" }, | 614 | { "tx_one_rexmt" }, |
615 | { "tx_many_rexmt" }, | 615 | { "tx_many_rexmt" }, |
@@ -637,7 +637,7 @@ static const struct nv_ethtool_str nv_estats_str[] = { | |||
637 | /* version 2 stats */ | 637 | /* version 2 stats */ |
638 | { "tx_deferral" }, | 638 | { "tx_deferral" }, |
639 | { "tx_packets" }, | 639 | { "tx_packets" }, |
640 | { "rx_bytes" }, | 640 | { "rx_bytes" }, /* includes Ethernet FCS CRC */ |
641 | { "tx_pause" }, | 641 | { "tx_pause" }, |
642 | { "rx_pause" }, | 642 | { "rx_pause" }, |
643 | { "rx_drop_frame" }, | 643 | { "rx_drop_frame" }, |
@@ -649,7 +649,7 @@ static const struct nv_ethtool_str nv_estats_str[] = { | |||
649 | }; | 649 | }; |
650 | 650 | ||
651 | struct nv_ethtool_stats { | 651 | struct nv_ethtool_stats { |
652 | u64 tx_bytes; | 652 | u64 tx_bytes; /* should be ifconfig->tx_bytes + 4*tx_packets */ |
653 | u64 tx_zero_rexmt; | 653 | u64 tx_zero_rexmt; |
654 | u64 tx_one_rexmt; | 654 | u64 tx_one_rexmt; |
655 | u64 tx_many_rexmt; | 655 | u64 tx_many_rexmt; |
@@ -670,14 +670,14 @@ struct nv_ethtool_stats { | |||
670 | u64 rx_unicast; | 670 | u64 rx_unicast; |
671 | u64 rx_multicast; | 671 | u64 rx_multicast; |
672 | u64 rx_broadcast; | 672 | u64 rx_broadcast; |
673 | u64 rx_packets; | 673 | u64 rx_packets; /* should be ifconfig->rx_packets */ |
674 | u64 rx_errors_total; | 674 | u64 rx_errors_total; |
675 | u64 tx_errors_total; | 675 | u64 tx_errors_total; |
676 | 676 | ||
677 | /* version 2 stats */ | 677 | /* version 2 stats */ |
678 | u64 tx_deferral; | 678 | u64 tx_deferral; |
679 | u64 tx_packets; | 679 | u64 tx_packets; /* should be ifconfig->tx_packets */ |
680 | u64 rx_bytes; | 680 | u64 rx_bytes; /* should be ifconfig->rx_bytes + 4*rx_packets */ |
681 | u64 tx_pause; | 681 | u64 tx_pause; |
682 | u64 rx_pause; | 682 | u64 rx_pause; |
683 | u64 rx_drop_frame; | 683 | u64 rx_drop_frame; |
@@ -1706,10 +1706,17 @@ static struct net_device_stats *nv_get_stats(struct net_device *dev) | |||
1706 | if (np->driver_data & (DEV_HAS_STATISTICS_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_STATISTICS_V3)) { | 1706 | if (np->driver_data & (DEV_HAS_STATISTICS_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_STATISTICS_V3)) { |
1707 | nv_get_hw_stats(dev); | 1707 | nv_get_hw_stats(dev); |
1708 | 1708 | ||
1709 | /* | ||
1710 | * Note: because HW stats are not always available and | ||
1711 | * for consistency reasons, the following ifconfig | ||
1712 | * stats are managed by software: rx_bytes, tx_bytes, | ||
1713 | * rx_packets and tx_packets. The related hardware | ||
1714 | * stats reported by ethtool should be equivalent to | ||
1715 | * these ifconfig stats, with 4 additional bytes per | ||
1716 | * packet (Ethernet FCS CRC). | ||
1717 | */ | ||
1718 | |||
1709 | /* copy to net_device stats */ | 1719 | /* copy to net_device stats */ |
1710 | dev->stats.tx_packets = np->estats.tx_packets; | ||
1711 | dev->stats.rx_bytes = np->estats.rx_bytes; | ||
1712 | dev->stats.tx_bytes = np->estats.tx_bytes; | ||
1713 | dev->stats.tx_fifo_errors = np->estats.tx_fifo_errors; | 1720 | dev->stats.tx_fifo_errors = np->estats.tx_fifo_errors; |
1714 | dev->stats.tx_carrier_errors = np->estats.tx_carrier_errors; | 1721 | dev->stats.tx_carrier_errors = np->estats.tx_carrier_errors; |
1715 | dev->stats.rx_crc_errors = np->estats.rx_crc_errors; | 1722 | dev->stats.rx_crc_errors = np->estats.rx_crc_errors; |
@@ -2380,6 +2387,9 @@ static int nv_tx_done(struct net_device *dev, int limit) | |||
2380 | if (flags & NV_TX_ERROR) { | 2387 | if (flags & NV_TX_ERROR) { |
2381 | if ((flags & NV_TX_RETRYERROR) && !(flags & NV_TX_RETRYCOUNT_MASK)) | 2388 | if ((flags & NV_TX_RETRYERROR) && !(flags & NV_TX_RETRYCOUNT_MASK)) |
2382 | nv_legacybackoff_reseed(dev); | 2389 | nv_legacybackoff_reseed(dev); |
2390 | } else { | ||
2391 | dev->stats.tx_packets++; | ||
2392 | dev->stats.tx_bytes += np->get_tx_ctx->skb->len; | ||
2383 | } | 2393 | } |
2384 | dev_kfree_skb_any(np->get_tx_ctx->skb); | 2394 | dev_kfree_skb_any(np->get_tx_ctx->skb); |
2385 | np->get_tx_ctx->skb = NULL; | 2395 | np->get_tx_ctx->skb = NULL; |
@@ -2390,6 +2400,9 @@ static int nv_tx_done(struct net_device *dev, int limit) | |||
2390 | if (flags & NV_TX2_ERROR) { | 2400 | if (flags & NV_TX2_ERROR) { |
2391 | if ((flags & NV_TX2_RETRYERROR) && !(flags & NV_TX2_RETRYCOUNT_MASK)) | 2401 | if ((flags & NV_TX2_RETRYERROR) && !(flags & NV_TX2_RETRYCOUNT_MASK)) |
2392 | nv_legacybackoff_reseed(dev); | 2402 | nv_legacybackoff_reseed(dev); |
2403 | } else { | ||
2404 | dev->stats.tx_packets++; | ||
2405 | dev->stats.tx_bytes += np->get_tx_ctx->skb->len; | ||
2393 | } | 2406 | } |
2394 | dev_kfree_skb_any(np->get_tx_ctx->skb); | 2407 | dev_kfree_skb_any(np->get_tx_ctx->skb); |
2395 | np->get_tx_ctx->skb = NULL; | 2408 | np->get_tx_ctx->skb = NULL; |
@@ -2429,6 +2442,9 @@ static int nv_tx_done_optimized(struct net_device *dev, int limit) | |||
2429 | else | 2442 | else |
2430 | nv_legacybackoff_reseed(dev); | 2443 | nv_legacybackoff_reseed(dev); |
2431 | } | 2444 | } |
2445 | } else { | ||
2446 | dev->stats.tx_packets++; | ||
2447 | dev->stats.tx_bytes += np->get_tx_ctx->skb->len; | ||
2432 | } | 2448 | } |
2433 | 2449 | ||
2434 | dev_kfree_skb_any(np->get_tx_ctx->skb); | 2450 | dev_kfree_skb_any(np->get_tx_ctx->skb); |
@@ -2678,6 +2694,7 @@ static int nv_rx_process(struct net_device *dev, int limit) | |||
2678 | skb->protocol = eth_type_trans(skb, dev); | 2694 | skb->protocol = eth_type_trans(skb, dev); |
2679 | napi_gro_receive(&np->napi, skb); | 2695 | napi_gro_receive(&np->napi, skb); |
2680 | dev->stats.rx_packets++; | 2696 | dev->stats.rx_packets++; |
2697 | dev->stats.rx_bytes += len; | ||
2681 | next_pkt: | 2698 | next_pkt: |
2682 | if (unlikely(np->get_rx.orig++ == np->last_rx.orig)) | 2699 | if (unlikely(np->get_rx.orig++ == np->last_rx.orig)) |
2683 | np->get_rx.orig = np->first_rx.orig; | 2700 | np->get_rx.orig = np->first_rx.orig; |
@@ -2761,6 +2778,7 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit) | |||
2761 | } | 2778 | } |
2762 | napi_gro_receive(&np->napi, skb); | 2779 | napi_gro_receive(&np->napi, skb); |
2763 | dev->stats.rx_packets++; | 2780 | dev->stats.rx_packets++; |
2781 | dev->stats.rx_bytes += len; | ||
2764 | } else { | 2782 | } else { |
2765 | dev_kfree_skb(skb); | 2783 | dev_kfree_skb(skb); |
2766 | } | 2784 | } |