bxe_stats.h revision 255736
10SN/A/*- 22362SN/A * Copyright (c) 2007-2013 Broadcom Corporation. All rights reserved. 30SN/A * 40SN/A * Eric Davis <edavis@broadcom.com> 50SN/A * David Christensen <davidch@broadcom.com> 60SN/A * Gary Zambrano <zambrano@broadcom.com> 72362SN/A * 80SN/A * Redistribution and use in source and binary forms, with or without 92362SN/A * modification, are permitted provided that the following conditions 100SN/A * are met: 110SN/A * 120SN/A * 1. Redistributions of source code must retain the above copyright 130SN/A * notice, this list of conditions and the following disclaimer. 140SN/A * 2. Redistributions in binary form must reproduce the above copyright 150SN/A * notice, this list of conditions and the following disclaimer in the 160SN/A * documentation and/or other materials provided with the distribution. 170SN/A * 3. Neither the name of Broadcom Corporation nor the name of its contributors 180SN/A * may be used to endorse or promote products derived from this software 190SN/A * without specific prior written consent. 200SN/A * 212362SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS' 222362SN/A * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 232362SN/A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 240SN/A * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 250SN/A * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 260SN/A * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 270SN/A * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 280SN/A * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 290SN/A * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 300SN/A * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 310SN/A * THE POSSIBILITY OF SUCH DAMAGE. 320SN/A */ 330SN/A 340SN/A#ifndef BXE_STATS_H 350SN/A#define BXE_STATS_H 360SN/A 370SN/A#include <sys/cdefs.h> 380SN/A__FBSDID("$FreeBSD: head/sys/dev/bxe/bxe_stats.h 255736 2013-09-20 20:18:49Z davidch $"); 390SN/A 400SN/A#include <sys/types.h> 410SN/A 420SN/Astruct nig_stats { 430SN/A uint32_t brb_discard; 440SN/A uint32_t brb_packet; 450SN/A uint32_t brb_truncate; 460SN/A uint32_t flow_ctrl_discard; 470SN/A uint32_t flow_ctrl_octets; 480SN/A uint32_t flow_ctrl_packet; 490SN/A uint32_t mng_discard; 500SN/A uint32_t mng_octet_inp; 510SN/A uint32_t mng_octet_out; 520SN/A uint32_t mng_packet_inp; 530SN/A uint32_t mng_packet_out; 540SN/A uint32_t pbf_octets; 550SN/A uint32_t pbf_packet; 560SN/A uint32_t safc_inp; 570SN/A uint32_t egress_mac_pkt0_lo; 580SN/A uint32_t egress_mac_pkt0_hi; 590SN/A uint32_t egress_mac_pkt1_lo; 600SN/A uint32_t egress_mac_pkt1_hi; 610SN/A}; 620SN/A 630SN/A 640SN/Aenum bxe_stats_event { 650SN/A STATS_EVENT_PMF = 0, 660SN/A STATS_EVENT_LINK_UP, 670SN/A STATS_EVENT_UPDATE, 680SN/A STATS_EVENT_STOP, 690SN/A STATS_EVENT_MAX 700SN/A}; 710SN/A 720SN/Aenum bxe_stats_state { 730SN/A STATS_STATE_DISABLED = 0, 740SN/A STATS_STATE_ENABLED, 750SN/A STATS_STATE_MAX 760SN/A}; 770SN/A 780SN/Astruct bxe_eth_stats { 790SN/A uint32_t total_bytes_received_hi; 800SN/A uint32_t total_bytes_received_lo; 810SN/A uint32_t total_bytes_transmitted_hi; 820SN/A uint32_t total_bytes_transmitted_lo; 830SN/A uint32_t total_unicast_packets_received_hi; 840SN/A uint32_t total_unicast_packets_received_lo; 850SN/A uint32_t total_multicast_packets_received_hi; 860SN/A uint32_t total_multicast_packets_received_lo; 870SN/A uint32_t total_broadcast_packets_received_hi; 880SN/A uint32_t total_broadcast_packets_received_lo; 890SN/A uint32_t total_unicast_packets_transmitted_hi; 900SN/A uint32_t total_unicast_packets_transmitted_lo; 910SN/A uint32_t total_multicast_packets_transmitted_hi; 920SN/A uint32_t total_multicast_packets_transmitted_lo; 930SN/A uint32_t total_broadcast_packets_transmitted_hi; 940SN/A uint32_t total_broadcast_packets_transmitted_lo; 950SN/A uint32_t valid_bytes_received_hi; 960SN/A uint32_t valid_bytes_received_lo; 970SN/A 980SN/A uint32_t error_bytes_received_hi; 990SN/A uint32_t error_bytes_received_lo; 1000SN/A uint32_t etherstatsoverrsizepkts_hi; 1010SN/A uint32_t etherstatsoverrsizepkts_lo; 1020SN/A uint32_t no_buff_discard_hi; 1030SN/A uint32_t no_buff_discard_lo; 1040SN/A 1050SN/A uint32_t rx_stat_ifhcinbadoctets_hi; 1060SN/A uint32_t rx_stat_ifhcinbadoctets_lo; 1070SN/A uint32_t tx_stat_ifhcoutbadoctets_hi; 1080SN/A uint32_t tx_stat_ifhcoutbadoctets_lo; 1090SN/A uint32_t rx_stat_dot3statsfcserrors_hi; 1100SN/A uint32_t rx_stat_dot3statsfcserrors_lo; 1110SN/A uint32_t rx_stat_dot3statsalignmenterrors_hi; 1120SN/A uint32_t rx_stat_dot3statsalignmenterrors_lo; 1130SN/A uint32_t rx_stat_dot3statscarriersenseerrors_hi; 1140SN/A uint32_t rx_stat_dot3statscarriersenseerrors_lo; 1150SN/A uint32_t rx_stat_falsecarriererrors_hi; 1160SN/A uint32_t rx_stat_falsecarriererrors_lo; 1170SN/A uint32_t rx_stat_etherstatsundersizepkts_hi; 1180SN/A uint32_t rx_stat_etherstatsundersizepkts_lo; 1190SN/A uint32_t rx_stat_dot3statsframestoolong_hi; 1200SN/A uint32_t rx_stat_dot3statsframestoolong_lo; 1210SN/A uint32_t rx_stat_etherstatsfragments_hi; 1220SN/A uint32_t rx_stat_etherstatsfragments_lo; 1230SN/A uint32_t rx_stat_etherstatsjabbers_hi; 1240SN/A uint32_t rx_stat_etherstatsjabbers_lo; 1250SN/A uint32_t rx_stat_maccontrolframesreceived_hi; 1260SN/A uint32_t rx_stat_maccontrolframesreceived_lo; 1270SN/A uint32_t rx_stat_bmac_xpf_hi; 1280SN/A uint32_t rx_stat_bmac_xpf_lo; 1290SN/A uint32_t rx_stat_bmac_xcf_hi; 1300SN/A uint32_t rx_stat_bmac_xcf_lo; 1310SN/A uint32_t rx_stat_xoffstateentered_hi; 1320SN/A uint32_t rx_stat_xoffstateentered_lo; 1330SN/A uint32_t rx_stat_xonpauseframesreceived_hi; 1340SN/A uint32_t rx_stat_xonpauseframesreceived_lo; 1350SN/A uint32_t rx_stat_xoffpauseframesreceived_hi; 1360SN/A uint32_t rx_stat_xoffpauseframesreceived_lo; 1370SN/A uint32_t tx_stat_outxonsent_hi; 1380SN/A uint32_t tx_stat_outxonsent_lo; 1390SN/A uint32_t tx_stat_outxoffsent_hi; 1400SN/A uint32_t tx_stat_outxoffsent_lo; 1410SN/A uint32_t tx_stat_flowcontroldone_hi; 1420SN/A uint32_t tx_stat_flowcontroldone_lo; 1430SN/A uint32_t tx_stat_etherstatscollisions_hi; 1440SN/A uint32_t tx_stat_etherstatscollisions_lo; 1450SN/A uint32_t tx_stat_dot3statssinglecollisionframes_hi; 1460SN/A uint32_t tx_stat_dot3statssinglecollisionframes_lo; 1470SN/A uint32_t tx_stat_dot3statsmultiplecollisionframes_hi; 1480SN/A uint32_t tx_stat_dot3statsmultiplecollisionframes_lo; 1490SN/A uint32_t tx_stat_dot3statsdeferredtransmissions_hi; 1500SN/A uint32_t tx_stat_dot3statsdeferredtransmissions_lo; 1510SN/A uint32_t tx_stat_dot3statsexcessivecollisions_hi; 1520SN/A uint32_t tx_stat_dot3statsexcessivecollisions_lo; 1530SN/A uint32_t tx_stat_dot3statslatecollisions_hi; 1540SN/A uint32_t tx_stat_dot3statslatecollisions_lo; 1550SN/A uint32_t tx_stat_etherstatspkts64octets_hi; 1560SN/A uint32_t tx_stat_etherstatspkts64octets_lo; 1570SN/A uint32_t tx_stat_etherstatspkts65octetsto127octets_hi; 1580SN/A uint32_t tx_stat_etherstatspkts65octetsto127octets_lo; 1590SN/A uint32_t tx_stat_etherstatspkts128octetsto255octets_hi; 1600SN/A uint32_t tx_stat_etherstatspkts128octetsto255octets_lo; 1610SN/A uint32_t tx_stat_etherstatspkts256octetsto511octets_hi; 1620SN/A uint32_t tx_stat_etherstatspkts256octetsto511octets_lo; 1630SN/A uint32_t tx_stat_etherstatspkts512octetsto1023octets_hi; 1640SN/A uint32_t tx_stat_etherstatspkts512octetsto1023octets_lo; 1650SN/A uint32_t tx_stat_etherstatspkts1024octetsto1522octets_hi; 1660SN/A uint32_t tx_stat_etherstatspkts1024octetsto1522octets_lo; 1670SN/A uint32_t tx_stat_etherstatspktsover1522octets_hi; 1680SN/A uint32_t tx_stat_etherstatspktsover1522octets_lo; 1690SN/A uint32_t tx_stat_bmac_2047_hi; 1700SN/A uint32_t tx_stat_bmac_2047_lo; 1710SN/A uint32_t tx_stat_bmac_4095_hi; 1720SN/A uint32_t tx_stat_bmac_4095_lo; 1730SN/A uint32_t tx_stat_bmac_9216_hi; 1740SN/A uint32_t tx_stat_bmac_9216_lo; 1750SN/A uint32_t tx_stat_bmac_16383_hi; 1760SN/A uint32_t tx_stat_bmac_16383_lo; 1770SN/A uint32_t tx_stat_dot3statsinternalmactransmiterrors_hi; 1780SN/A uint32_t tx_stat_dot3statsinternalmactransmiterrors_lo; 1790SN/A uint32_t tx_stat_bmac_ufl_hi; 1800SN/A uint32_t tx_stat_bmac_ufl_lo; 1810SN/A 1820SN/A uint32_t pause_frames_received_hi; 1830SN/A uint32_t pause_frames_received_lo; 1840SN/A uint32_t pause_frames_sent_hi; 1850SN/A uint32_t pause_frames_sent_lo; 1860SN/A 1870SN/A uint32_t etherstatspkts1024octetsto1522octets_hi; 1880SN/A uint32_t etherstatspkts1024octetsto1522octets_lo; 1890SN/A uint32_t etherstatspktsover1522octets_hi; 1900SN/A uint32_t etherstatspktsover1522octets_lo; 1910SN/A 1920SN/A uint32_t brb_drop_hi; 1930SN/A uint32_t brb_drop_lo; 1940SN/A uint32_t brb_truncate_hi; 1950SN/A uint32_t brb_truncate_lo; 1960SN/A 1970SN/A uint32_t mac_filter_discard; 1980SN/A uint32_t mf_tag_discard; 1990SN/A uint32_t brb_truncate_discard; 2000SN/A uint32_t mac_discard; 2010SN/A 2020SN/A uint32_t nig_timer_max; 2030SN/A 2040SN/A uint32_t total_tpa_aggregations_hi; 2050SN/A uint32_t total_tpa_aggregations_lo; 2060SN/A uint32_t total_tpa_aggregated_frames_hi; 2070SN/A uint32_t total_tpa_aggregated_frames_lo; 2080SN/A uint32_t total_tpa_bytes_hi; 2090SN/A uint32_t total_tpa_bytes_lo; 2100SN/A 2110SN/A /* PFC */ 2120SN/A uint32_t pfc_frames_received_hi; 2130SN/A uint32_t pfc_frames_received_lo; 2140SN/A uint32_t pfc_frames_sent_hi; 2150SN/A uint32_t pfc_frames_sent_lo; 2160SN/A 2170SN/A /* Recovery */ 2180SN/A uint32_t recoverable_error; 2190SN/A uint32_t unrecoverable_error; 2200SN/A 2210SN/A /* src: Clear-on-Read register; Will not survive PMF Migration */ 2220SN/A uint32_t eee_tx_lpi; 2230SN/A 2240SN/A /* receive path driver statistics */ 2250SN/A uint32_t rx_calls; 2260SN/A uint32_t rx_pkts; 2270SN/A uint32_t rx_tpa_pkts; 2280SN/A uint32_t rx_soft_errors; 2290SN/A uint32_t rx_hw_csum_errors; 2300SN/A uint32_t rx_ofld_frames_csum_ip; 2310SN/A uint32_t rx_ofld_frames_csum_tcp_udp; 2320SN/A uint32_t rx_budget_reached; 2330SN/A 2340SN/A /* tx path driver statistics */ 2350SN/A uint32_t tx_pkts; 2360SN/A uint32_t tx_soft_errors; 2370SN/A uint32_t tx_ofld_frames_csum_ip; 2380SN/A uint32_t tx_ofld_frames_csum_tcp; 2390SN/A uint32_t tx_ofld_frames_csum_udp; 2400SN/A uint32_t tx_ofld_frames_lso; 2410SN/A uint32_t tx_ofld_frames_lso_hdr_splits; 2420SN/A uint32_t tx_encap_failures; 2430SN/A uint32_t tx_hw_queue_full; 2440SN/A uint32_t tx_hw_max_queue_depth; 2450SN/A uint32_t tx_dma_mapping_failure; 2460SN/A uint32_t tx_max_drbr_queue_depth; 2470SN/A uint32_t tx_window_violation_std; 2480SN/A uint32_t tx_window_violation_tso; 2490SN/A //uint32_t tx_unsupported_tso_request_ipv6; 2500SN/A //uint32_t tx_unsupported_tso_request_not_tcp; 2510SN/A uint32_t tx_chain_lost_mbuf; 2520SN/A uint32_t tx_frames_deferred; 2530SN/A uint32_t tx_queue_xoff; 2540SN/A 2550SN/A /* mbuf driver statistics */ 2560SN/A uint32_t mbuf_defrag_attempts; 2570SN/A uint32_t mbuf_defrag_failures; 2580SN/A uint32_t mbuf_rx_bd_alloc_failed; 2590SN/A uint32_t mbuf_rx_bd_mapping_failed; 2600SN/A uint32_t mbuf_rx_tpa_alloc_failed; 2610SN/A uint32_t mbuf_rx_tpa_mapping_failed; 2620SN/A uint32_t mbuf_rx_sge_alloc_failed; 2630SN/A uint32_t mbuf_rx_sge_mapping_failed; 2640SN/A 2650SN/A /* track the number of allocated mbufs */ 2660SN/A uint32_t mbuf_alloc_tx; 2670SN/A uint32_t mbuf_alloc_rx; 2680SN/A uint32_t mbuf_alloc_sge; 2690SN/A uint32_t mbuf_alloc_tpa; 2700SN/A}; 2710SN/A 2720SN/A 2730SN/Astruct bxe_eth_q_stats { 2740SN/A uint32_t total_unicast_bytes_received_hi; 2750SN/A uint32_t total_unicast_bytes_received_lo; 2760SN/A uint32_t total_broadcast_bytes_received_hi; 2770SN/A uint32_t total_broadcast_bytes_received_lo; 2780SN/A uint32_t total_multicast_bytes_received_hi; 2790SN/A uint32_t total_multicast_bytes_received_lo; 2800SN/A uint32_t total_bytes_received_hi; 2810SN/A uint32_t total_bytes_received_lo; 2820SN/A uint32_t total_unicast_bytes_transmitted_hi; 2830SN/A uint32_t total_unicast_bytes_transmitted_lo; 2840SN/A uint32_t total_broadcast_bytes_transmitted_hi; 2850SN/A uint32_t total_broadcast_bytes_transmitted_lo; 2860SN/A uint32_t total_multicast_bytes_transmitted_hi; 2870SN/A uint32_t total_multicast_bytes_transmitted_lo; 2880SN/A uint32_t total_bytes_transmitted_hi; 2890SN/A uint32_t total_bytes_transmitted_lo; 2900SN/A uint32_t total_unicast_packets_received_hi; 2910SN/A uint32_t total_unicast_packets_received_lo; 2920SN/A uint32_t total_multicast_packets_received_hi; 2930SN/A uint32_t total_multicast_packets_received_lo; 2940SN/A uint32_t total_broadcast_packets_received_hi; 2950SN/A uint32_t total_broadcast_packets_received_lo; 2960SN/A uint32_t total_unicast_packets_transmitted_hi; 2970SN/A uint32_t total_unicast_packets_transmitted_lo; 2980SN/A uint32_t total_multicast_packets_transmitted_hi; 2990SN/A uint32_t total_multicast_packets_transmitted_lo; 3000SN/A uint32_t total_broadcast_packets_transmitted_hi; 3010SN/A uint32_t total_broadcast_packets_transmitted_lo; 3020SN/A uint32_t valid_bytes_received_hi; 3030SN/A uint32_t valid_bytes_received_lo; 3040SN/A 3050SN/A uint32_t etherstatsoverrsizepkts_hi; 3060SN/A uint32_t etherstatsoverrsizepkts_lo; 3070SN/A uint32_t no_buff_discard_hi; 3080SN/A uint32_t no_buff_discard_lo; 3090SN/A 3100SN/A uint32_t total_packets_received_checksum_discarded_hi; 3110SN/A uint32_t total_packets_received_checksum_discarded_lo; 3120SN/A uint32_t total_packets_received_ttl0_discarded_hi; 3130SN/A uint32_t total_packets_received_ttl0_discarded_lo; 3140SN/A uint32_t total_transmitted_dropped_packets_error_hi; 3150SN/A uint32_t total_transmitted_dropped_packets_error_lo; 3160SN/A 3170SN/A uint32_t total_tpa_aggregations_hi; 3180SN/A uint32_t total_tpa_aggregations_lo; 3190SN/A uint32_t total_tpa_aggregated_frames_hi; 3200SN/A uint32_t total_tpa_aggregated_frames_lo; 3210SN/A uint32_t total_tpa_bytes_hi; 3220SN/A uint32_t total_tpa_bytes_lo; 3230SN/A 3240SN/A /* receive path driver statistics */ 3250SN/A uint32_t rx_calls; 3260SN/A uint32_t rx_pkts; 3270SN/A uint32_t rx_tpa_pkts; 3280SN/A uint32_t rx_soft_errors; 3290SN/A uint32_t rx_hw_csum_errors; 3300SN/A uint32_t rx_ofld_frames_csum_ip; 3310SN/A uint32_t rx_ofld_frames_csum_tcp_udp; 3320SN/A uint32_t rx_budget_reached; 3330SN/A 3340SN/A /* tx path driver statistics */ 3350SN/A uint32_t tx_pkts; 3360SN/A uint32_t tx_soft_errors; 3370SN/A uint32_t tx_ofld_frames_csum_ip; 3380SN/A uint32_t tx_ofld_frames_csum_tcp; 3390SN/A uint32_t tx_ofld_frames_csum_udp; 3400SN/A uint32_t tx_ofld_frames_lso; 3410SN/A uint32_t tx_ofld_frames_lso_hdr_splits; 3420SN/A uint32_t tx_encap_failures; 3430SN/A uint32_t tx_hw_queue_full; 3440SN/A uint32_t tx_hw_max_queue_depth; 3450SN/A uint32_t tx_dma_mapping_failure; 3460SN/A uint32_t tx_max_drbr_queue_depth; 3470SN/A uint32_t tx_window_violation_std; 3480SN/A uint32_t tx_window_violation_tso; 3490SN/A //uint32_t tx_unsupported_tso_request_ipv6; 3500SN/A //uint32_t tx_unsupported_tso_request_not_tcp; 3510SN/A uint32_t tx_chain_lost_mbuf; 3520SN/A uint32_t tx_frames_deferred; 3530SN/A uint32_t tx_queue_xoff; 3540SN/A 3550SN/A /* mbuf driver statistics */ 3560SN/A uint32_t mbuf_defrag_attempts; 3570SN/A uint32_t mbuf_defrag_failures; 3580SN/A uint32_t mbuf_rx_bd_alloc_failed; 3590SN/A uint32_t mbuf_rx_bd_mapping_failed; 3600SN/A uint32_t mbuf_rx_tpa_alloc_failed; 3610SN/A uint32_t mbuf_rx_tpa_mapping_failed; 3620SN/A uint32_t mbuf_rx_sge_alloc_failed; 3630SN/A uint32_t mbuf_rx_sge_mapping_failed; 3640SN/A 3650SN/A /* track the number of allocated mbufs */ 3660SN/A uint32_t mbuf_alloc_tx; 3670SN/A uint32_t mbuf_alloc_rx; 3680SN/A uint32_t mbuf_alloc_sge; 3690SN/A uint32_t mbuf_alloc_tpa; 3700SN/A}; 3710SN/A 3720SN/Astruct bxe_eth_stats_old { 3730SN/A uint32_t rx_stat_dot3statsframestoolong_hi; 3740SN/A uint32_t rx_stat_dot3statsframestoolong_lo; 3750SN/A}; 3760SN/A 3770SN/Astruct bxe_eth_q_stats_old { 3780SN/A /* Fields to perserve over fw reset*/ 3790SN/A uint32_t total_unicast_bytes_received_hi; 3800SN/A uint32_t total_unicast_bytes_received_lo; 3810SN/A uint32_t total_broadcast_bytes_received_hi; 3820SN/A uint32_t total_broadcast_bytes_received_lo; 3830SN/A uint32_t total_multicast_bytes_received_hi; 3840SN/A uint32_t total_multicast_bytes_received_lo; 3850SN/A uint32_t total_unicast_bytes_transmitted_hi; 3860SN/A uint32_t total_unicast_bytes_transmitted_lo; 3870SN/A uint32_t total_broadcast_bytes_transmitted_hi; 3880SN/A uint32_t total_broadcast_bytes_transmitted_lo; 3890SN/A uint32_t total_multicast_bytes_transmitted_hi; 3900SN/A uint32_t total_multicast_bytes_transmitted_lo; 3910SN/A uint32_t total_tpa_bytes_hi; 3920SN/A uint32_t total_tpa_bytes_lo; 3930SN/A 3940SN/A /* Fields to perserve last of */ 3950SN/A uint32_t total_bytes_received_hi; 3960SN/A uint32_t total_bytes_received_lo; 3970SN/A uint32_t total_bytes_transmitted_hi; 3980SN/A uint32_t total_bytes_transmitted_lo; 3990SN/A uint32_t total_unicast_packets_received_hi; 4000SN/A uint32_t total_unicast_packets_received_lo; 4010SN/A uint32_t total_multicast_packets_received_hi; 4020SN/A uint32_t total_multicast_packets_received_lo; 4030SN/A uint32_t total_broadcast_packets_received_hi; 4040SN/A uint32_t total_broadcast_packets_received_lo; 4050SN/A uint32_t total_unicast_packets_transmitted_hi; 4060SN/A uint32_t total_unicast_packets_transmitted_lo; 4070SN/A uint32_t total_multicast_packets_transmitted_hi; 4080SN/A uint32_t total_multicast_packets_transmitted_lo; 4090SN/A uint32_t total_broadcast_packets_transmitted_hi; 4100SN/A uint32_t total_broadcast_packets_transmitted_lo; 4110SN/A uint32_t valid_bytes_received_hi; 4120SN/A uint32_t valid_bytes_received_lo; 4130SN/A 4140SN/A uint32_t total_tpa_bytes_hi_old; 4150SN/A uint32_t total_tpa_bytes_lo_old; 4160SN/A 4170SN/A /* receive path driver statistics */ 4180SN/A uint32_t rx_calls_old; 4190SN/A uint32_t rx_pkts_old; 4200SN/A uint32_t rx_tpa_pkts_old; 4210SN/A uint32_t rx_soft_errors_old; 4220SN/A uint32_t rx_hw_csum_errors_old; 4230SN/A uint32_t rx_ofld_frames_csum_ip_old; 4240SN/A uint32_t rx_ofld_frames_csum_tcp_udp_old; 4250SN/A uint32_t rx_budget_reached_old; 4260SN/A 4270SN/A /* tx path driver statistics */ 4280SN/A uint32_t tx_pkts_old; 4290SN/A uint32_t tx_soft_errors_old; 4300SN/A uint32_t tx_ofld_frames_csum_ip_old; 4310SN/A uint32_t tx_ofld_frames_csum_tcp_old; 4320SN/A uint32_t tx_ofld_frames_csum_udp_old; 4330SN/A uint32_t tx_ofld_frames_lso_old; 4340SN/A uint32_t tx_ofld_frames_lso_hdr_splits_old; 4350SN/A uint32_t tx_encap_failures_old; 4360SN/A uint32_t tx_hw_queue_full_old; 4370SN/A uint32_t tx_hw_max_queue_depth_old; 4380SN/A uint32_t tx_dma_mapping_failure_old; 4390SN/A uint32_t tx_max_drbr_queue_depth_old; 4400SN/A uint32_t tx_window_violation_std_old; 4410SN/A uint32_t tx_window_violation_tso_old; 4420SN/A //uint32_t tx_unsupported_tso_request_ipv6_old; 4430SN/A //uint32_t tx_unsupported_tso_request_not_tcp_old; 4440SN/A uint32_t tx_chain_lost_mbuf_old; 4450SN/A uint32_t tx_frames_deferred_old; 4460SN/A uint32_t tx_queue_xoff_old; 4470SN/A 4480SN/A /* mbuf driver statistics */ 4490SN/A uint32_t mbuf_defrag_attempts_old; 4500SN/A uint32_t mbuf_defrag_failures_old; 4510SN/A uint32_t mbuf_rx_bd_alloc_failed_old; 4520SN/A uint32_t mbuf_rx_bd_mapping_failed_old; 4530SN/A uint32_t mbuf_rx_tpa_alloc_failed_old; 4540SN/A uint32_t mbuf_rx_tpa_mapping_failed_old; 4550SN/A uint32_t mbuf_rx_sge_alloc_failed_old; 4560SN/A uint32_t mbuf_rx_sge_mapping_failed_old; 4570SN/A 4580SN/A /* track the number of allocated mbufs */ 4590SN/A int mbuf_alloc_tx_old; 4600SN/A int mbuf_alloc_rx_old; 4610SN/A int mbuf_alloc_sge_old; 4620SN/A int mbuf_alloc_tpa_old; 4630SN/A}; 4640SN/A 4650SN/Astruct bxe_net_stats_old { 4660SN/A uint32_t rx_dropped; 4670SN/A}; 4680SN/A 4690SN/Astruct bxe_fw_port_stats_old { 4700SN/A uint32_t pfc_frames_tx_hi; 4710SN/A uint32_t pfc_frames_tx_lo; 4720SN/A uint32_t pfc_frames_rx_hi; 4730SN/A uint32_t pfc_frames_rx_lo; 4740SN/A 4750SN/A uint32_t mac_filter_discard; 4760SN/A uint32_t mf_tag_discard; 4770SN/A uint32_t brb_truncate_discard; 4780SN/A uint32_t mac_discard; 4790SN/A}; 4800SN/A 4810SN/A/* sum[hi:lo] += add[hi:lo] */ 4820SN/A#define ADD_64(s_hi, a_hi, s_lo, a_lo) \ 4830SN/A do { \ 4840SN/A s_lo += a_lo; \ 4850SN/A s_hi += a_hi + ((s_lo < a_lo) ? 1 : 0); \ 4860SN/A } while (0) 4870SN/A 4880SN/A#define LE32_0 ((uint32_t) 0) 4890SN/A#define LE16_0 ((uint16_t) 0) 4900SN/A 4910SN/A/* The _force is for cases where high value is 0 */ 4920SN/A#define ADD_64_LE(s_hi, a_hi_le, s_lo, a_lo_le) \ 4930SN/A ADD_64(s_hi, le32toh(a_hi_le), \ 4940SN/A s_lo, le32toh(a_lo_le)) 4950SN/A 4960SN/A#define ADD_64_LE16(s_hi, a_hi_le, s_lo, a_lo_le) \ 4970SN/A ADD_64(s_hi, le16toh(a_hi_le), \ 4980SN/A s_lo, le16toh(a_lo_le)) 4990SN/A 5000SN/A/* difference = minuend - subtrahend */ 5010SN/A#define DIFF_64(d_hi, m_hi, s_hi, d_lo, m_lo, s_lo) \ 5020SN/A do { \ 5030SN/A if (m_lo < s_lo) { \ 5040SN/A /* underflow */ \ 5050SN/A d_hi = m_hi - s_hi; \ 5060SN/A if (d_hi > 0) { \ 5070SN/A /* we can 'loan' 1 */ \ 5080SN/A d_hi--; \ 5090SN/A d_lo = m_lo + (UINT_MAX - s_lo) + 1; \ 5100SN/A } else { \ 5110SN/A /* m_hi <= s_hi */ \ 5120SN/A d_hi = 0; \ 5130SN/A d_lo = 0; \ 5140SN/A } \ 5150SN/A } else { \ 5160SN/A /* m_lo >= s_lo */ \ 5170SN/A if (m_hi < s_hi) { \ 5180SN/A d_hi = 0; \ 5190SN/A d_lo = 0; \ 5200SN/A } else { \ 5210SN/A /* m_hi >= s_hi */ \ 5220SN/A d_hi = m_hi - s_hi; \ 5230SN/A d_lo = m_lo - s_lo; \ 5240SN/A } \ 5250SN/A } \ 5260SN/A } while (0) 5270SN/A 5280SN/A#define UPDATE_STAT64(s, t) \ 5290SN/A do { \ 5300SN/A DIFF_64(diff.hi, new->s##_hi, pstats->mac_stx[0].t##_hi, \ 5310SN/A diff.lo, new->s##_lo, pstats->mac_stx[0].t##_lo); \ 5320SN/A pstats->mac_stx[0].t##_hi = new->s##_hi; \ 5330SN/A pstats->mac_stx[0].t##_lo = new->s##_lo; \ 5340SN/A ADD_64(pstats->mac_stx[1].t##_hi, diff.hi, \ 5350SN/A pstats->mac_stx[1].t##_lo, diff.lo); \ 5360SN/A } while (0) 5370SN/A 5380SN/A#define UPDATE_STAT64_NIG(s, t) \ 5390SN/A do { \ 5400SN/A DIFF_64(diff.hi, new->s##_hi, old->s##_hi, \ 5410SN/A diff.lo, new->s##_lo, old->s##_lo); \ 5420SN/A ADD_64(estats->t##_hi, diff.hi, \ 5430SN/A estats->t##_lo, diff.lo); \ 5440SN/A } while (0) 5450SN/A 5460SN/A/* sum[hi:lo] += add */ 5470SN/A#define ADD_EXTEND_64(s_hi, s_lo, a) \ 5480SN/A do { \ 5490SN/A s_lo += a; \ 5500SN/A s_hi += (s_lo < a) ? 1 : 0; \ 5510SN/A } while (0) 5520SN/A 5530SN/A#define ADD_STAT64(diff, t) \ 5540SN/A do { \ 5550SN/A ADD_64(pstats->mac_stx[1].t##_hi, new->diff##_hi, \ 5560SN/A pstats->mac_stx[1].t##_lo, new->diff##_lo); \ 5570SN/A } while (0) 5580SN/A 5590SN/A#define UPDATE_EXTEND_STAT(s) \ 5600SN/A do { \ 5610SN/A ADD_EXTEND_64(pstats->mac_stx[1].s##_hi, \ 5620SN/A pstats->mac_stx[1].s##_lo, \ 5630SN/A new->s); \ 5640SN/A } while (0) 5650SN/A 5660SN/A#define UPDATE_EXTEND_TSTAT_X(s, t, size) \ 5670SN/A do { \ 5680SN/A diff = le##size##toh(tclient->s) - \ 5690SN/A le##size##toh(old_tclient->s); \ 5700SN/A old_tclient->s = tclient->s; \ 5710SN/A ADD_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \ 5720SN/A } while (0) 5730SN/A 5740SN/A#define UPDATE_EXTEND_TSTAT(s, t) UPDATE_EXTEND_TSTAT_X(s, t, 32) 5750SN/A 5760SN/A#define UPDATE_EXTEND_E_TSTAT(s, t, size) \ 5770SN/A do { \ 5780SN/A UPDATE_EXTEND_TSTAT_X(s, t, size); \ 5790SN/A ADD_EXTEND_64(estats->t##_hi, estats->t##_lo, diff); \ 5800SN/A } while (0) 5810SN/A 5820SN/A#define UPDATE_EXTEND_USTAT(s, t) \ 5830SN/A do { \ 5840SN/A diff = le32toh(uclient->s) - le32toh(old_uclient->s); \ 5850SN/A old_uclient->s = uclient->s; \ 5860SN/A ADD_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \ 5870SN/A } while (0) 5880SN/A 5890SN/A#define UPDATE_EXTEND_E_USTAT(s, t) \ 5900SN/A do { \ 5910SN/A UPDATE_EXTEND_USTAT(s, t); \ 5920SN/A ADD_EXTEND_64(estats->t##_hi, estats->t##_lo, diff); \ 5930SN/A } while (0) 5940SN/A 5950SN/A#define UPDATE_EXTEND_XSTAT(s, t) \ 5960SN/A do { \ 5970SN/A diff = le32toh(xclient->s) - le32toh(old_xclient->s); \ 5980SN/A old_xclient->s = xclient->s; \ 5990SN/A ADD_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \ 6000SN/A } while (0) 6010SN/A 6020SN/A#define UPDATE_QSTAT(s, t) \ 6030SN/A do { \ 6040SN/A qstats->t##_hi = qstats_old->t##_hi + le32toh(s.hi); \ 6050SN/A qstats->t##_lo = qstats_old->t##_lo + le32toh(s.lo); \ 6060SN/A } while (0) 6070SN/A 6080SN/A#define UPDATE_QSTAT_OLD(f) \ 6090SN/A do { \ 6100SN/A qstats_old->f = qstats->f; \ 6110SN/A } while (0) 6120SN/A 6130SN/A#define UPDATE_ESTAT_QSTAT_64(s) \ 6140SN/A do { \ 6150SN/A ADD_64(estats->s##_hi, qstats->s##_hi, \ 6160SN/A estats->s##_lo, qstats->s##_lo); \ 6170SN/A SUB_64(estats->s##_hi, qstats_old->s##_hi_old, \ 6180SN/A estats->s##_lo, qstats_old->s##_lo_old); \ 6190SN/A qstats_old->s##_hi_old = qstats->s##_hi; \ 6200SN/A qstats_old->s##_lo_old = qstats->s##_lo; \ 6210SN/A } while (0) 6220SN/A 6230SN/A#define UPDATE_ESTAT_QSTAT(s) \ 6240SN/A do { \ 6250SN/A estats->s += qstats->s; \ 6260SN/A estats->s -= qstats_old->s##_old; \ 6270SN/A qstats_old->s##_old = qstats->s; \ 6280SN/A } while (0) 6290SN/A 6300SN/A#define UPDATE_FSTAT_QSTAT(s) \ 6310SN/A do { \ 6320SN/A ADD_64(fstats->s##_hi, qstats->s##_hi, \ 6330SN/A fstats->s##_lo, qstats->s##_lo); \ 6340SN/A SUB_64(fstats->s##_hi, qstats_old->s##_hi, \ 6350SN/A fstats->s##_lo, qstats_old->s##_lo); \ 6360SN/A estats->s##_hi = fstats->s##_hi; \ 6370SN/A estats->s##_lo = fstats->s##_lo; \ 6380SN/A qstats_old->s##_hi = qstats->s##_hi; \ 6390SN/A qstats_old->s##_lo = qstats->s##_lo; \ 6400SN/A } while (0) 6410SN/A 6420SN/A#define UPDATE_FW_STAT(s) \ 6430SN/A do { \ 6440SN/A estats->s = le32toh(tport->s) + fwstats->s; \ 6450SN/A } while (0) 6460SN/A 6470SN/A#define UPDATE_FW_STAT_OLD(f) \ 6480SN/A do { \ 6490SN/A fwstats->f = estats->f; \ 6500SN/A } while (0) 6510SN/A 6520SN/A#define UPDATE_ESTAT(s, t) \ 6530SN/A do { \ 6540SN/A SUB_64(estats->s##_hi, estats_old->t##_hi, \ 6550SN/A estats->s##_lo, estats_old->t##_lo); \ 6560SN/A ADD_64(estats->s##_hi, estats->t##_hi, \ 6570SN/A estats->s##_lo, estats->t##_lo); \ 6580SN/A estats_old->t##_hi = estats->t##_hi; \ 6590SN/A estats_old->t##_lo = estats->t##_lo; \ 6600SN/A } while (0) 6610SN/A 6620SN/A/* minuend -= subtrahend */ 6630SN/A#define SUB_64(m_hi, s_hi, m_lo, s_lo) \ 6640SN/A do { \ 6650SN/A DIFF_64(m_hi, m_hi, s_hi, m_lo, m_lo, s_lo); \ 6660SN/A } while (0) 6670SN/A 6680SN/A/* minuend[hi:lo] -= subtrahend */ 6690SN/A#define SUB_EXTEND_64(m_hi, m_lo, s) \ 6700SN/A do { \ 6710SN/A SUB_64(m_hi, 0, m_lo, s); \ 6720SN/A } while (0) 6730SN/A 6740SN/A#define SUB_EXTEND_USTAT(s, t) \ 6750SN/A do { \ 6760SN/A diff = le32toh(uclient->s) - le32toh(old_uclient->s); \ 6770SN/A SUB_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \ 6780SN/A } while (0) 6790SN/A 6800SN/Astruct bxe_softc; 6810SN/Avoid bxe_stats_init(struct bxe_softc *sc); 6820SN/Avoid bxe_stats_handle(struct bxe_softc *sc, enum bxe_stats_event event); 6830SN/Avoid bxe_save_statistics(struct bxe_softc *sc); 6840SN/Avoid bxe_afex_collect_stats(struct bxe_softc *sc, void *void_afex_stats, uint32_t stats_type); 6850SN/A 6860SN/A#endif /* BXE_STATS_H */ 6870SN/A 6880SN/A