aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/net_driver.h
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2012-12-14 16:52:56 -0500
committerBen Hutchings <bhutchings@solarflare.com>2013-08-27 17:25:55 -0400
commitcd0ecc9a6d279c8c5c5336f576330c45f5c80939 (patch)
treedb74cbf4e4e4e46e413d9d8cf53ce9f804670380 /drivers/net/ethernet/sfc/net_driver.h
parentb681e57c38d81eee45f8bd7465d2a2af872800e3 (diff)
sfc: Delegate MAC/NIC statistic description to efx_nic_type
Various hardware statistics that are available for Siena are unavailable or meaningless for Falcon. Huntington adds further to the NIC-type-specific statistics, as it has different MAC blocks from Falcon/Siena. All NIC types still provide most statistics by DMA, and use little-endian byte order. Therefore: 1. Add some general utility functions for reporting hardware statistics, efx_nic_describe_stats() and efx_nic_update_stats(). 2. Add an efx_nic_type::describe_stats operation to get the number and names of statistics, implemented using efx_nic_describe_stats() 3. Change efx_nic_type::update_stats to store the core statistics (struct rtnl_link_stats64) or full statistics (array of u64) in a caller-provided buffer. Use efx_nic_update_stats() to aid in the implementation. 4. Rename struct efx_ethtool_stat to struct efx_sw_stat_desc and EFX_ETHTOOL_NUM_STATS to EFX_ETHTOOL_SW_STAT_COUNT. 5. Remove efx_nic::mac_stats and struct efx_mac_stats. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net/ethernet/sfc/net_driver.h')
-rw-r--r--drivers/net/ethernet/sfc/net_driver.h96
1 files changed, 18 insertions, 78 deletions
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index fa881cdd9dcc..d33656bc4060 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -595,75 +595,17 @@ static inline bool efx_phy_mode_disabled(enum efx_phy_mode mode)
595 return !!(mode & ~PHY_MODE_TX_DISABLED); 595 return !!(mode & ~PHY_MODE_TX_DISABLED);
596} 596}
597 597
598/* 598/**
599 * Efx extended statistics 599 * struct efx_hw_stat_desc - Description of a hardware statistic
600 * 600 * @name: Name of the statistic as visible through ethtool, or %NULL if
601 * Not all statistics are provided by all supported MACs. The purpose 601 * it should not be exposed
602 * is this structure is to contain the raw statistics provided by each 602 * @dma_width: Width in bits (0 for non-DMA statistics)
603 * MAC. 603 * @offset: Offset within stats (ignored for non-DMA statistics)
604 */ 604 */
605struct efx_mac_stats { 605struct efx_hw_stat_desc {
606 u64 tx_bytes; 606 const char *name;
607 u64 tx_good_bytes; 607 u16 dma_width;
608 u64 tx_bad_bytes; 608 u16 offset;
609 u64 tx_packets;
610 u64 tx_bad;
611 u64 tx_pause;
612 u64 tx_control;
613 u64 tx_unicast;
614 u64 tx_multicast;
615 u64 tx_broadcast;
616 u64 tx_lt64;
617 u64 tx_64;
618 u64 tx_65_to_127;
619 u64 tx_128_to_255;
620 u64 tx_256_to_511;
621 u64 tx_512_to_1023;
622 u64 tx_1024_to_15xx;
623 u64 tx_15xx_to_jumbo;
624 u64 tx_gtjumbo;
625 u64 tx_collision;
626 u64 tx_single_collision;
627 u64 tx_multiple_collision;
628 u64 tx_excessive_collision;
629 u64 tx_deferred;
630 u64 tx_late_collision;
631 u64 tx_excessive_deferred;
632 u64 tx_non_tcpudp;
633 u64 tx_mac_src_error;
634 u64 tx_ip_src_error;
635 u64 rx_bytes;
636 u64 rx_good_bytes;
637 u64 rx_bad_bytes;
638 u64 rx_packets;
639 u64 rx_good;
640 u64 rx_bad;
641 u64 rx_pause;
642 u64 rx_control;
643 u64 rx_unicast;
644 u64 rx_multicast;
645 u64 rx_broadcast;
646 u64 rx_lt64;
647 u64 rx_64;
648 u64 rx_65_to_127;
649 u64 rx_128_to_255;
650 u64 rx_256_to_511;
651 u64 rx_512_to_1023;
652 u64 rx_1024_to_15xx;
653 u64 rx_15xx_to_jumbo;
654 u64 rx_gtjumbo;
655 u64 rx_bad_lt64;
656 u64 rx_bad_64_to_15xx;
657 u64 rx_bad_15xx_to_jumbo;
658 u64 rx_bad_gtjumbo;
659 u64 rx_overflow;
660 u64 rx_missed;
661 u64 rx_false_carrier;
662 u64 rx_symbol_error;
663 u64 rx_align_error;
664 u64 rx_length_error;
665 u64 rx_internal_error;
666 u64 rx_good_lt64;
667}; 609};
668 610
669/* Number of bits used in a multicast filter hash address */ 611/* Number of bits used in a multicast filter hash address */
@@ -795,12 +737,8 @@ struct vfdi_status;
795 * @last_irq_cpu: Last CPU to handle a possible test interrupt. This 737 * @last_irq_cpu: Last CPU to handle a possible test interrupt. This
796 * field is used by efx_test_interrupts() to verify that an 738 * field is used by efx_test_interrupts() to verify that an
797 * interrupt has occurred. 739 * interrupt has occurred.
798 * @n_rx_nodesc_drop_cnt: RX no descriptor drop count 740 * @stats_lock: Statistics update lock. Must be held when calling
799 * @mac_stats: MAC statistics. These include all statistics the MACs 741 * efx_nic_type::{update,start,stop}_stats.
800 * can provide. Generic code converts these into a standard
801 * &struct net_device_stats.
802 * @stats_lock: Statistics update lock. Serialises statistics fetches
803 * and access to @mac_stats.
804 * 742 *
805 * This is stored in the private area of the &struct net_device. 743 * This is stored in the private area of the &struct net_device.
806 */ 744 */
@@ -939,8 +877,6 @@ struct efx_nic {
939 struct delayed_work monitor_work ____cacheline_aligned_in_smp; 877 struct delayed_work monitor_work ____cacheline_aligned_in_smp;
940 spinlock_t biu_lock; 878 spinlock_t biu_lock;
941 int last_irq_cpu; 879 int last_irq_cpu;
942 unsigned n_rx_nodesc_drop_cnt;
943 struct efx_mac_stats mac_stats;
944 spinlock_t stats_lock; 880 spinlock_t stats_lock;
945}; 881};
946 882
@@ -984,7 +920,9 @@ struct efx_mtd_partition {
984 * (for Falcon architecture) 920 * (for Falcon architecture)
985 * @finish_flush: Clean up after flushing the DMA queues (for Falcon 921 * @finish_flush: Clean up after flushing the DMA queues (for Falcon
986 * architecture) 922 * architecture)
987 * @update_stats: Update statistics not provided by event handling 923 * @describe_stats: Describe statistics for ethtool
924 * @update_stats: Update statistics not provided by event handling.
925 * Either argument may be %NULL.
988 * @start_stats: Start the regular fetching of statistics 926 * @start_stats: Start the regular fetching of statistics
989 * @stop_stats: Stop the regular fetching of statistics 927 * @stop_stats: Stop the regular fetching of statistics
990 * @set_id_led: Set state of identifying LED or revert to automatic function 928 * @set_id_led: Set state of identifying LED or revert to automatic function
@@ -1098,7 +1036,9 @@ struct efx_nic_type {
1098 int (*fini_dmaq)(struct efx_nic *efx); 1036 int (*fini_dmaq)(struct efx_nic *efx);
1099 void (*prepare_flush)(struct efx_nic *efx); 1037 void (*prepare_flush)(struct efx_nic *efx);
1100 void (*finish_flush)(struct efx_nic *efx); 1038 void (*finish_flush)(struct efx_nic *efx);
1101 void (*update_stats)(struct efx_nic *efx); 1039 size_t (*describe_stats)(struct efx_nic *efx, u8 *names);
1040 size_t (*update_stats)(struct efx_nic *efx, u64 *full_stats,
1041 struct rtnl_link_stats64 *core_stats);
1102 void (*start_stats)(struct efx_nic *efx); 1042 void (*start_stats)(struct efx_nic *efx);
1103 void (*stop_stats)(struct efx_nic *efx); 1043 void (*stop_stats)(struct efx_nic *efx);
1104 void (*set_id_led)(struct efx_nic *efx, enum efx_led_mode mode); 1044 void (*set_id_led)(struct efx_nic *efx, enum efx_led_mode mode);