18 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
30 static inline long bnx2x_hilo(
u32 *hiref)
32 u32 lo = *(hiref + 1);
33 #if (BITS_PER_LONG == 64)
42 static inline u16 bnx2x_get_port_stats_dma_len(
struct bnx2x *bp)
88 static void bnx2x_storm_stats_post(
struct bnx2x *bp)
120 static void bnx2x_hw_stats_post(
struct bnx2x *bp)
147 (loader_idx + 1)) >> 2;
152 dmae->
comp_addr_lo = dmae_reg_go_c[loader_idx + 1] >> 2;
165 static int bnx2x_stats_comp(
struct bnx2x *bp)
173 BNX2X_ERR(
"timeout waiting for stats finished\n");
186 static void bnx2x_stats_pmf_update(
struct bnx2x *bp)
194 if (!bp->
port.pmf || !bp->
port.port_stx) {
229 bnx2x_hw_stats_post(bp);
230 bnx2x_stats_comp(bp);
233 static void bnx2x_port_stats_init(
struct bnx2x *bp)
254 if (bp->
port.port_stx) {
262 dmae->len = bnx2x_get_port_stats_dma_len(bp);
333 u32 tx_src_addr_lo, rx_src_addr_lo;
345 tx_src_addr_lo = (mac_addr +
349 rx_src_addr_lo = (mac_addr +
354 tx_src_addr_lo = (mac_addr +
358 rx_src_addr_lo = (mac_addr +
369 tx_src_addr_lo = (mac_addr +
371 rx_src_addr_lo = (mac_addr +
418 dmae->len = (2*
sizeof(
u32)) >> 2;
432 dmae->len = (2*
sizeof(
u32)) >> 2;
446 dmae->len = (
sizeof(
struct nig_stats) - 4*
sizeof(
u32)) >> 2;
455 static void bnx2x_func_stats_init(
struct bnx2x *bp)
483 static void bnx2x_stats_start(
struct bnx2x *bp)
486 bnx2x_port_stats_init(bp);
489 bnx2x_func_stats_init(bp);
491 bnx2x_hw_stats_post(bp);
492 bnx2x_storm_stats_post(bp);
495 static void bnx2x_stats_pmf_start(
struct bnx2x *bp)
497 bnx2x_stats_comp(bp);
498 bnx2x_stats_pmf_update(bp);
499 bnx2x_stats_start(bp);
502 static void bnx2x_stats_restart(
struct bnx2x *bp)
504 bnx2x_stats_comp(bp);
505 bnx2x_stats_start(bp);
508 static void bnx2x_bmac_stats_update(
struct bnx2x *bp)
523 UPDATE_STAT64(rx_stat_grund, rx_stat_etherstatsundersizepkts);
524 UPDATE_STAT64(rx_stat_grovr, rx_stat_dot3statsframestoolong);
527 UPDATE_STAT64(rx_stat_grxcf, rx_stat_maccontrolframesreceived);
535 tx_stat_etherstatspkts65octetsto127octets);
537 tx_stat_etherstatspkts128octetsto255octets);
539 tx_stat_etherstatspkts256octetsto511octets);
541 tx_stat_etherstatspkts512octetsto1023octets);
543 tx_stat_etherstatspkts1024octetsto1522octets);
549 tx_stat_dot3statsinternalmactransmiterrors);
558 UPDATE_STAT64(rx_stat_grund, rx_stat_etherstatsundersizepkts);
559 UPDATE_STAT64(rx_stat_grovr, rx_stat_dot3statsframestoolong);
562 UPDATE_STAT64(rx_stat_grxcf, rx_stat_maccontrolframesreceived);
569 tx_stat_etherstatspkts65octetsto127octets);
571 tx_stat_etherstatspkts128octetsto255octets);
573 tx_stat_etherstatspkts256octetsto511octets);
575 tx_stat_etherstatspkts512octetsto1023octets);
577 tx_stat_etherstatspkts1024octetsto1522octets);
583 tx_stat_dot3statsinternalmactransmiterrors);
595 pstats->
mac_stx[1].rx_stat_mac_xpf_hi;
597 pstats->
mac_stx[1].rx_stat_mac_xpf_lo;
600 pstats->
mac_stx[1].tx_stat_outxoffsent_hi;
602 pstats->
mac_stx[1].tx_stat_outxoffsent_lo;
614 static void bnx2x_mstat_stats_update(
struct bnx2x *bp)
640 tx_stat_etherstatspkts65octetsto127octets);
642 tx_stat_etherstatspkts128octetsto255octets);
644 tx_stat_etherstatspkts256octetsto511octets);
646 tx_stat_etherstatspkts512octetsto1023octets);
648 tx_stat_etherstatspkts1024octetsto1522octets);
656 tx_stat_dot3statsinternalmactransmiterrors);
660 pstats->
mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_hi;
662 pstats->
mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_lo;
665 pstats->
mac_stx[1].tx_stat_mac_2047_hi;
667 pstats->
mac_stx[1].tx_stat_mac_2047_lo;
670 pstats->
mac_stx[1].tx_stat_mac_4095_hi,
672 pstats->
mac_stx[1].tx_stat_mac_4095_lo);
675 pstats->
mac_stx[1].tx_stat_mac_9216_hi,
677 pstats->
mac_stx[1].tx_stat_mac_9216_lo);
680 pstats->
mac_stx[1].tx_stat_mac_16383_hi,
682 pstats->
mac_stx[1].tx_stat_mac_16383_lo);
685 pstats->
mac_stx[1].rx_stat_mac_xpf_hi;
687 pstats->
mac_stx[1].rx_stat_mac_xpf_lo;
690 pstats->
mac_stx[1].tx_stat_outxoffsent_hi;
692 pstats->
mac_stx[1].tx_stat_outxoffsent_lo;
704 static void bnx2x_emac_stats_update(
struct bnx2x *bp)
743 pstats->
mac_stx[1].rx_stat_xonpauseframesreceived_hi;
745 pstats->
mac_stx[1].rx_stat_xonpauseframesreceived_lo;
747 pstats->
mac_stx[1].rx_stat_xoffpauseframesreceived_hi,
749 pstats->
mac_stx[1].rx_stat_xoffpauseframesreceived_lo);
752 pstats->
mac_stx[1].tx_stat_outxonsent_hi;
754 pstats->
mac_stx[1].tx_stat_outxonsent_lo;
756 pstats->
mac_stx[1].tx_stat_outxoffsent_hi,
758 pstats->
mac_stx[1].tx_stat_outxoffsent_lo);
761 static int bnx2x_hw_stats_update(
struct bnx2x *bp)
774 bnx2x_bmac_stats_update(bp);
778 bnx2x_emac_stats_update(bp);
783 bnx2x_mstat_stats_update(bp);
788 "stats updated by DMAE but no MAC active\n");
802 etherstatspkts1024octetsto1522octets);
804 etherstatspktsover1522octets);
835 static int bnx2x_storm_stats_update(
struct bnx2x *bp)
846 u16 cur_stats_counter;
858 "stats not updated by xstorm xstorm counter (0x%x) != stats_counter (0x%x)\n",
865 "stats not updated by ustorm ustorm counter (0x%x) != stats_counter (0x%x)\n",
872 "stats not updated by cstorm cstorm counter (0x%x) != stats_counter (0x%x)\n",
879 "stats not updated by tstorm tstorm counter (0x%x) != stats_counter (0x%x)\n",
891 tstorm_queue_statistics;
896 ustorm_queue_statistics;
901 xstorm_queue_statistics;
911 DP(
BNX2X_MSG_STATS,
"queue[%d]: ucast_sent 0x%x, bcast_sent 0x%x mcast_sent 0x%x\n",
918 total_broadcast_bytes_received);
920 total_multicast_bytes_received);
922 total_unicast_bytes_received);
950 total_unicast_packets_received);
952 total_multicast_packets_received);
954 total_broadcast_packets_received);
956 etherstatsoverrsizepkts);
960 total_unicast_packets_received);
962 total_multicast_packets_received);
964 total_broadcast_packets_received);
970 total_broadcast_bytes_transmitted);
972 total_multicast_bytes_transmitted);
974 total_unicast_bytes_transmitted);
996 total_unicast_packets_transmitted);
998 total_multicast_packets_transmitted);
1000 total_broadcast_packets_transmitted);
1003 total_packets_received_checksum_discarded);
1005 total_packets_received_ttl0_discarded);
1008 total_transmitted_dropped_packets_error);
1014 total_tpa_aggregated_frames);
1046 UPDATE_ESTAT(etherstatsoverrsizepkts, rx_stat_dot3statsframestoolong);
1068 static void bnx2x_net_stats_update(
struct bnx2x *bp)
1138 static void bnx2x_drv_stats_update(
struct bnx2x *bp)
1155 static bool bnx2x_edebug_stats_stopped(
struct bnx2x *bp)
1160 val =
SHMEM2_RD(bp, edebug_driver_if[1]);
1169 static void bnx2x_stats_update(
struct bnx2x *bp)
1173 if (bnx2x_edebug_stats_stopped(bp))
1180 bnx2x_hw_stats_update(bp);
1182 if (bnx2x_storm_stats_update(bp)) {
1184 BNX2X_ERR(
"storm stats were not updated for 3 times\n");
1190 bnx2x_net_stats_update(bp);
1191 bnx2x_drv_stats_update(bp);
1200 bnx2x_hw_stats_post(bp);
1201 bnx2x_storm_stats_post(bp);
1204 static void bnx2x_port_stats_stop(
struct bnx2x *bp)
1215 if (bp->
port.port_stx) {
1229 dmae->len = bnx2x_get_port_stats_dma_len(bp);
1263 static void bnx2x_stats_stop(
struct bnx2x *bp)
1267 bnx2x_stats_comp(bp);
1270 update = (bnx2x_hw_stats_update(bp) == 0);
1272 update |= (bnx2x_storm_stats_update(bp) == 0);
1275 bnx2x_net_stats_update(bp);
1278 bnx2x_port_stats_stop(bp);
1280 bnx2x_hw_stats_post(bp);
1281 bnx2x_stats_comp(bp);
1285 static void bnx2x_stats_do_nothing(
struct bnx2x *bp)
1289 static const struct {
1326 static void bnx2x_port_stats_base_init(
struct bnx2x *bp)
1332 if (!bp->
port.pmf || !bp->
port.port_stx) {
1346 dmae->len = bnx2x_get_port_stats_dma_len(bp);
1352 bnx2x_hw_stats_post(bp);
1353 bnx2x_stats_comp(bp);
1360 static void bnx2x_prep_fw_stats_req(
struct bnx2x *bp)
1363 int first_queue_query_index;
1452 query[first_queue_query_index +
i];
1455 cur_query_entry->
index = bnx2x_stats_id(&bp->
fp[i]);
1469 query[first_queue_query_index +
i];
1493 bp->
port.port_stx =
SHMEM_RD(bp, port_mb[port].port_stx);
1497 bp->
port.port_stx = 0;
1510 bp->
port.old_nig_stats.brb_discard =
1512 bp->
port.old_nig_stats.brb_truncate =
1516 &(bp->
port.old_nig_stats.egress_mac_pkt0_lo), 2);
1518 &(bp->
port.old_nig_stats.egress_mac_pkt1_lo), 2);
1540 bnx2x_prep_fw_stats_req(bp);
1554 bnx2x_func_stats_init(bp);
1555 bnx2x_hw_stats_post(bp);
1556 bnx2x_stats_comp(bp);
1562 if (bp->
port.pmf && bp->
port.port_stx)
1563 bnx2x_port_stats_base_init(bp);
1633 memset(afex_stats, 0,
sizeof(
struct afex_stats));
1734 fw_fcoe_stat->
rx_stat0.fcoe_rx_byte_cnt);
1754 fw_fcoe_stat->
rx_stat0.fcoe_rx_pkt_cnt);
1809 fw_fcoe_stat->
rx_stat1.fcoe_rx_drop_pkt_cnt);
1814 fw_fcoe_stat->
rx_stat2.fcoe_rx_drop_pkt_cnt);
1819 fw_fcoe_stat->
tx_stat.fcoe_tx_byte_cnt);
1839 fw_fcoe_stat->
tx_stat.fcoe_tx_pkt_cnt);