561static boolean_t 562oce_phy_flashing_required(POCE_SOFTC sc) 563{ 564 int status = 0; 565 struct oce_phy_info phy_info; 566 567 status = oce_mbox_get_phy_info(sc, &phy_info); 568 if (status) 569 return FALSE; 570 571 if ((phy_info.phy_type == TN_8022) && 572 (phy_info.interface_type == PHY_TYPE_BASET_10GB)) { 573 return TRUE; 574 } 575 576 return FALSE; 577} 578 579 580static boolean_t 581oce_img_flashing_required(POCE_SOFTC sc, const char *p, 582 int img_optype, uint32_t img_offset, 583 uint32_t img_size, uint32_t hdrs_size) 584{ 585 uint32_t crc_offset; 586 uint8_t flashed_crc[4]; 587 int status; 588 589 crc_offset = hdrs_size + img_offset + img_size - 4; 590 591 p += crc_offset; 592 593 status = oce_mbox_get_flashrom_crc(sc, flashed_crc, 594 (img_size - 4), img_optype); 595 if (status) 596 return TRUE; /* Some thing worng. ReFlash */ 597 598 /*update redboot only if crc does not match*/ 599 if (bcmp(flashed_crc, p, 4)) 600 return TRUE; 601 else 602 return FALSE; 603} 604 605 606static int 607oce_lancer_fwupgrade(POCE_SOFTC sc, const struct firmware *fw) 608{ 609 610 int rc = 0; 611 OCE_DMA_MEM dma_mem; 612 const uint8_t *data = NULL; 613 uint8_t *dest_image_ptr = NULL; 614 size_t size = 0; 615 uint32_t data_written = 0, chunk_size = 0; 616 uint32_t offset = 0, add_status = 0; 617 618 if (!IS_ALIGNED(fw->datasize, sizeof(uint32_t))) { 619 device_printf(sc->dev, 620 "Lancer FW image is not 4 byte aligned."); 621 return EINVAL; 622 } 623 624 rc = oce_dma_alloc(sc, 32*1024, &dma_mem, 0); 625 if (rc) { 626 device_printf(sc->dev, 627 "Memory allocation failure while flashing Lancer\n"); 628 return ENOMEM; 629 } 630 631 size = fw->datasize; 632 data = fw->data; 633 dest_image_ptr = OCE_DMAPTR(&dma_mem, uint8_t); 634 635 while (size) { 636 chunk_size = MIN(size, (32*1024)); 637 638 bcopy(data, dest_image_ptr, chunk_size); 639 640 rc = oce_mbox_lancer_write_flashrom(sc, chunk_size, offset, 641 &dma_mem, &data_written, &add_status); 642 643 if (rc) 644 break; 645 646 size -= data_written; 647 data += data_written; 648 offset += data_written; 649 pause("yield", 10); 650 651 } 652 653 if (!rc) 654 /* Commit the firmware*/ 655 rc = oce_mbox_lancer_write_flashrom(sc, 0, offset, &dma_mem, 656 &data_written, &add_status); 657 if (rc) { 658 device_printf(sc->dev, "Lancer firmware load error. " 659 "Addstatus = 0x%x, status = %d \n", add_status, rc); 660 rc = EIO; 661 } 662 oce_dma_free(sc, &dma_mem); 663 return rc; 664 665} 666 667 668static void 669oce_add_stats_sysctls_be3(POCE_SOFTC sc, 670 struct sysctl_ctx_list *ctx, 671 struct sysctl_oid *stats_node) 672{ 673 struct sysctl_oid *rx_stats_node, *tx_stats_node; 674 struct sysctl_oid_list *rx_stat_list, *tx_stat_list; 675 struct sysctl_oid_list *queue_stats_list; 676 struct sysctl_oid *queue_stats_node; 677 struct oce_drv_stats *stats; 678 char prefix[32]; 679 int i; 680 681 stats = &sc->oce_stats_info; 682 683 rx_stats_node = SYSCTL_ADD_NODE(ctx, 684 SYSCTL_CHILDREN(stats_node), 685 OID_AUTO,"rx", CTLFLAG_RD, 686 NULL, "RX Ethernet Statistics"); 687 rx_stat_list = SYSCTL_CHILDREN(rx_stats_node); 688 689 690 SYSCTL_ADD_QUAD(ctx, rx_stat_list, OID_AUTO, "total_pkts", 691 CTLFLAG_RD, &stats->rx.t_rx_pkts, 692 "Total Received Packets"); 693 SYSCTL_ADD_QUAD(ctx, rx_stat_list, OID_AUTO, "total_bytes", 694 CTLFLAG_RD, &stats->rx.t_rx_bytes, 695 "Total Received Bytes"); 696 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "total_frags", 697 CTLFLAG_RD, &stats->rx.t_rx_frags, 0, 698 "Total Received Fragements"); 699 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "total_mcast_pkts", 700 CTLFLAG_RD, &stats->rx.t_rx_mcast_pkts, 0, 701 "Total Received Multicast Packets"); 702 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "total_ucast_pkts", 703 CTLFLAG_RD, &stats->rx.t_rx_ucast_pkts, 0, 704 "Total Received Unicast Packets"); 705 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "total_rxcp_errs", 706 CTLFLAG_RD, &stats->rx.t_rxcp_errs, 0, 707 "Total Receive completion errors"); 708 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "pause_frames", 709 CTLFLAG_RD, &stats->u0.be.rx_pause_frames, 0, 710 "Pause Frames"); 711 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "priority_pause_frames", 712 CTLFLAG_RD, &stats->u0.be.rx_priority_pause_frames, 0, 713 "Priority Pause Frames"); 714 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "control_frames", 715 CTLFLAG_RD, &stats->u0.be.rx_control_frames, 0, 716 "Control Frames"); 717 718 for (i = 0; i < sc->nrqs; i++) { 719 sprintf(prefix, "queue%d",i); 720 queue_stats_node = SYSCTL_ADD_NODE(ctx, 721 SYSCTL_CHILDREN(rx_stats_node), 722 OID_AUTO, prefix, CTLFLAG_RD, 723 NULL, "Queue name"); 724 queue_stats_list = SYSCTL_CHILDREN(queue_stats_node); 725 726 SYSCTL_ADD_QUAD(ctx, queue_stats_list, OID_AUTO, "rx_pkts", 727 CTLFLAG_RD, &sc->rq[i]->rx_stats.rx_pkts, 728 "Receive Packets"); 729 SYSCTL_ADD_QUAD(ctx, queue_stats_list, OID_AUTO, "rx_bytes", 730 CTLFLAG_RD, &sc->rq[i]->rx_stats.rx_bytes, 731 "Recived Bytes"); 732 SYSCTL_ADD_UINT(ctx, queue_stats_list, OID_AUTO, "rx_frags", 733 CTLFLAG_RD, &sc->rq[i]->rx_stats.rx_frags, 0, 734 "Received Fragments"); 735 SYSCTL_ADD_UINT(ctx, queue_stats_list, OID_AUTO, 736 "rx_mcast_pkts", CTLFLAG_RD, 737 &sc->rq[i]->rx_stats.rx_mcast_pkts, 0, 738 "Received Multicast Packets"); 739 SYSCTL_ADD_UINT(ctx, queue_stats_list, OID_AUTO, 740 "rx_ucast_pkts", CTLFLAG_RD, 741 &sc->rq[i]->rx_stats.rx_ucast_pkts, 0, 742 "Received Unicast Packets"); 743 SYSCTL_ADD_UINT(ctx, queue_stats_list, OID_AUTO, "rxcp_err", 744 CTLFLAG_RD, &sc->rq[i]->rx_stats.rxcp_err, 0, 745 "Received Completion Errors"); 746 747 } 748 749 rx_stats_node = SYSCTL_ADD_NODE(ctx, 750 SYSCTL_CHILDREN(rx_stats_node), 751 OID_AUTO, "err", CTLFLAG_RD, 752 NULL, "Receive Error Stats"); 753 rx_stat_list = SYSCTL_CHILDREN(rx_stats_node); 754 755 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "crc_errs", 756 CTLFLAG_RD, &stats->u0.be.rx_crc_errors, 0, 757 "CRC Errors"); 758 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "pbuf_errors", 759 CTLFLAG_RD, &stats->u0.be.rx_drops_no_pbuf, 0, 760 "Drops due to pbuf full"); 761 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "erx_errors", 762 CTLFLAG_RD, &stats->u0.be.rx_drops_no_erx_descr, 0, 763 "ERX Errors"); 764 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "alignment_errors", 765 CTLFLAG_RD, &stats->u0.be.rx_drops_too_many_frags, 0, 766 "RX Alignmnet Errors"); 767 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "in_range_errors", 768 CTLFLAG_RD, &stats->u0.be.rx_in_range_errors, 0, 769 "In Range Errors"); 770 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "out_range_errors", 771 CTLFLAG_RD, &stats->u0.be.rx_out_range_errors, 0, 772 "Out Range Errors"); 773 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "frame_too_long", 774 CTLFLAG_RD, &stats->u0.be.rx_frame_too_long, 0, 775 "Frame Too Long"); 776 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "address_match_errors", 777 CTLFLAG_RD, &stats->u0.be.rx_address_match_errors, 0, 778 "Address Match Errors"); 779 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "dropped_too_small", 780 CTLFLAG_RD, &stats->u0.be.rx_dropped_too_small, 0, 781 "Dropped Too Small"); 782 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "dropped_too_short", 783 CTLFLAG_RD, &stats->u0.be.rx_dropped_too_short, 0, 784 "Dropped Too Short"); 785 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, 786 "dropped_header_too_small", CTLFLAG_RD, 787 &stats->u0.be.rx_dropped_header_too_small, 0, 788 "Dropped Header Too Small"); 789 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "dropped_tcp_length", 790 CTLFLAG_RD, &stats->u0.be.rx_dropped_tcp_length, 0, 791 "Dropped TCP Length"); 792 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "dropped_runt", 793 CTLFLAG_RD, &stats->u0.be.rx_dropped_runt, 0, 794 "Dropped runt"); 795 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "ip_checksum_errs", 796 CTLFLAG_RD, &stats->u0.be.rx_ip_checksum_errs, 0, 797 "IP Checksum Errors"); 798 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "tcp_checksum_errs", 799 CTLFLAG_RD, &stats->u0.be.rx_tcp_checksum_errs, 0, 800 "TCP Checksum Errors"); 801 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "udp_checksum_errs", 802 CTLFLAG_RD, &stats->u0.be.rx_udp_checksum_errs, 0, 803 "UDP Checksum Errors"); 804 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "fifo_overflow_drop", 805 CTLFLAG_RD, &stats->u0.be.rxpp_fifo_overflow_drop, 0, 806 "FIFO Overflow Drop"); 807 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, 808 "input_fifo_overflow_drop", CTLFLAG_RD, 809 &stats->u0.be.rx_input_fifo_overflow_drop, 0, 810 "Input FIFO Overflow Drop"); 811 812 tx_stats_node = SYSCTL_ADD_NODE(ctx, 813 SYSCTL_CHILDREN(stats_node), OID_AUTO, 814 "tx",CTLFLAG_RD, NULL, 815 "TX Ethernet Statistics"); 816 tx_stat_list = SYSCTL_CHILDREN(tx_stats_node); 817 818 SYSCTL_ADD_QUAD(ctx, tx_stat_list, OID_AUTO, "total_tx_pkts", 819 CTLFLAG_RD, &stats->tx.t_tx_pkts, 820 "Total Transmit Packets"); 821 SYSCTL_ADD_QUAD(ctx, tx_stat_list, OID_AUTO, "total_tx_bytes", 822 CTLFLAG_RD, &stats->tx.t_tx_bytes, 823 "Total Transmit Bytes"); 824 SYSCTL_ADD_UINT(ctx, tx_stat_list, OID_AUTO, "total_tx_reqs", 825 CTLFLAG_RD, &stats->tx.t_tx_reqs, 0, 826 "Total Transmit Requests"); 827 SYSCTL_ADD_UINT(ctx, tx_stat_list, OID_AUTO, "total_tx_stops", 828 CTLFLAG_RD, &stats->tx.t_tx_stops, 0, 829 "Total Transmit Stops"); 830 SYSCTL_ADD_UINT(ctx, tx_stat_list, OID_AUTO, "total_tx_wrbs", 831 CTLFLAG_RD, &stats->tx.t_tx_wrbs, 0, 832 "Total Transmit WRB's"); 833 SYSCTL_ADD_UINT(ctx, tx_stat_list, OID_AUTO, "total_tx_compl", 834 CTLFLAG_RD, &stats->tx.t_tx_compl, 0, 835 "Total Transmit Completions"); 836 SYSCTL_ADD_UINT(ctx, tx_stat_list, OID_AUTO, 837 "total_ipv6_ext_hdr_tx_drop", CTLFLAG_RD, 838 &stats->tx.t_ipv6_ext_hdr_tx_drop, 0, 839 "Total Transmit IPV6 Drops"); 840 SYSCTL_ADD_UINT(ctx, tx_stat_list, OID_AUTO, "pauseframes", 841 CTLFLAG_RD, &stats->u0.be.tx_pauseframes, 0, 842 "Pause Frames"); 843 SYSCTL_ADD_UINT(ctx, tx_stat_list, OID_AUTO, "priority_pauseframes", 844 CTLFLAG_RD, &stats->u0.be.tx_priority_pauseframes, 0, 845 "Priority Pauseframes"); 846 SYSCTL_ADD_UINT(ctx, tx_stat_list, OID_AUTO, "controlframes", 847 CTLFLAG_RD, &stats->u0.be.tx_controlframes, 0, 848 "Tx Control Frames"); 849 850 for (i = 0; i < sc->nwqs; i++) { 851 sprintf(prefix, "queue%d",i); 852 queue_stats_node = SYSCTL_ADD_NODE(ctx, 853 SYSCTL_CHILDREN(tx_stats_node), 854 OID_AUTO, prefix, CTLFLAG_RD, 855 NULL, "Queue name"); 856 queue_stats_list = SYSCTL_CHILDREN(queue_stats_node); 857 858 SYSCTL_ADD_QUAD(ctx, queue_stats_list, OID_AUTO, "tx_pkts", 859 CTLFLAG_RD, &sc->wq[i]->tx_stats.tx_pkts, 860 "Transmit Packets"); 861 SYSCTL_ADD_QUAD(ctx, queue_stats_list, OID_AUTO, "tx_bytes", 862 CTLFLAG_RD, &sc->wq[i]->tx_stats.tx_bytes, 863 "Transmit Bytes"); 864 SYSCTL_ADD_UINT(ctx, queue_stats_list, OID_AUTO, "tx_reqs", 865 CTLFLAG_RD, &sc->wq[i]->tx_stats.tx_reqs, 0, 866 "Transmit Requests"); 867 SYSCTL_ADD_UINT(ctx, queue_stats_list, OID_AUTO, "tx_stops", 868 CTLFLAG_RD, &sc->wq[i]->tx_stats.tx_stops, 0, 869 "Transmit Stops"); 870 SYSCTL_ADD_UINT(ctx, queue_stats_list, OID_AUTO, "tx_wrbs", 871 CTLFLAG_RD, &sc->wq[i]->tx_stats.tx_wrbs, 0, 872 "Transmit WRB's"); 873 SYSCTL_ADD_UINT(ctx, queue_stats_list, OID_AUTO, "tx_compl", 874 CTLFLAG_RD, &sc->wq[i]->tx_stats.tx_compl, 0, 875 "Transmit Completions"); 876 SYSCTL_ADD_UINT(ctx, queue_stats_list, OID_AUTO, 877 "ipv6_ext_hdr_tx_drop",CTLFLAG_RD, 878 &sc->wq[i]->tx_stats.ipv6_ext_hdr_tx_drop, 0, 879 "Transmit IPV6 Ext Header Drop"); 880 881 } 882 return; 883} 884 885 886static void 887oce_add_stats_sysctls_xe201(POCE_SOFTC sc, 888 struct sysctl_ctx_list *ctx, 889 struct sysctl_oid *stats_node) 890{ 891 struct sysctl_oid *rx_stats_node, *tx_stats_node; 892 struct sysctl_oid_list *rx_stat_list, *tx_stat_list; 893 struct sysctl_oid_list *queue_stats_list; 894 struct sysctl_oid *queue_stats_node; 895 struct oce_drv_stats *stats; 896 char prefix[32]; 897 int i; 898 899 stats = &sc->oce_stats_info; 900 901 rx_stats_node = SYSCTL_ADD_NODE(ctx, 902 SYSCTL_CHILDREN(stats_node), 903 OID_AUTO, "rx", CTLFLAG_RD, 904 NULL, "RX Ethernet Statistics"); 905 rx_stat_list = SYSCTL_CHILDREN(rx_stats_node); 906 907 908 SYSCTL_ADD_QUAD(ctx, rx_stat_list, OID_AUTO, "total_pkts", 909 CTLFLAG_RD, &stats->rx.t_rx_pkts, 910 "Total Received Packets"); 911 SYSCTL_ADD_QUAD(ctx, rx_stat_list, OID_AUTO, "total_bytes", 912 CTLFLAG_RD, &stats->rx.t_rx_bytes, 913 "Total Received Bytes"); 914 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "total_frags", 915 CTLFLAG_RD, &stats->rx.t_rx_frags, 0, 916 "Total Received Fragements"); 917 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "total_mcast_pkts", 918 CTLFLAG_RD, &stats->rx.t_rx_mcast_pkts, 0, 919 "Total Received Multicast Packets"); 920 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "total_ucast_pkts", 921 CTLFLAG_RD, &stats->rx.t_rx_ucast_pkts, 0, 922 "Total Received Unicast Packets"); 923 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "total_rxcp_errs", 924 CTLFLAG_RD, &stats->rx.t_rxcp_errs, 0, 925 "Total Receive completion errors"); 926 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "pause_frames", 927 CTLFLAG_RD, &stats->u0.xe201.rx_pause_frames, 0, 928 "Pause Frames"); 929 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "control_frames", 930 CTLFLAG_RD, &stats->u0.xe201.rx_control_frames, 0, 931 "Control Frames"); 932 933 for (i = 0; i < sc->nrqs; i++) { 934 sprintf(prefix, "queue%d",i); 935 queue_stats_node = SYSCTL_ADD_NODE(ctx, 936 SYSCTL_CHILDREN(rx_stats_node), 937 OID_AUTO, prefix, CTLFLAG_RD, 938 NULL, "Queue name"); 939 queue_stats_list = SYSCTL_CHILDREN(queue_stats_node); 940 941 SYSCTL_ADD_QUAD(ctx, queue_stats_list, OID_AUTO, "rx_pkts", 942 CTLFLAG_RD, &sc->rq[i]->rx_stats.rx_pkts, 943 "Receive Packets"); 944 SYSCTL_ADD_QUAD(ctx, queue_stats_list, OID_AUTO, "rx_bytes", 945 CTLFLAG_RD, &sc->rq[i]->rx_stats.rx_bytes, 946 "Recived Bytes"); 947 SYSCTL_ADD_UINT(ctx, queue_stats_list, OID_AUTO, "rx_frags", 948 CTLFLAG_RD, &sc->rq[i]->rx_stats.rx_frags, 0, 949 "Received Fragments"); 950 SYSCTL_ADD_UINT(ctx, queue_stats_list, OID_AUTO, 951 "rx_mcast_pkts", CTLFLAG_RD, 952 &sc->rq[i]->rx_stats.rx_mcast_pkts, 0, 953 "Received Multicast Packets"); 954 SYSCTL_ADD_UINT(ctx, queue_stats_list, OID_AUTO, 955 "rx_ucast_pkts",CTLFLAG_RD, 956 &sc->rq[i]->rx_stats.rx_ucast_pkts, 0, 957 "Received Unicast Packets"); 958 SYSCTL_ADD_UINT(ctx, queue_stats_list, OID_AUTO, "rxcp_err", 959 CTLFLAG_RD, &sc->rq[i]->rx_stats.rxcp_err, 0, 960 "Received Completion Errors"); 961 962 } 963 964 rx_stats_node = SYSCTL_ADD_NODE(ctx, 965 SYSCTL_CHILDREN(rx_stats_node), 966 OID_AUTO, "err", CTLFLAG_RD, 967 NULL, "Receive Error Stats"); 968 rx_stat_list = SYSCTL_CHILDREN(rx_stats_node); 969 970 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "crc_errs", 971 CTLFLAG_RD, &stats->u0.xe201.rx_crc_errors, 0, 972 "CRC Errors"); 973 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "alignment_errors", 974 CTLFLAG_RD, &stats->u0.xe201.rx_alignment_errors, 0, 975 "RX Alignmnet Errors"); 976 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "in_range_errors", 977 CTLFLAG_RD, &stats->u0.xe201.rx_in_range_errors, 0, 978 "In Range Errors"); 979 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "out_range_errors", 980 CTLFLAG_RD, &stats->u0.xe201.rx_out_of_range_errors, 0, 981 "Out Range Errors"); 982 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "frame_too_long", 983 CTLFLAG_RD, &stats->u0.xe201.rx_frames_too_long, 0, 984 "Frame Too Long"); 985 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "address_match_errors", 986 CTLFLAG_RD, &stats->u0.xe201.rx_address_match_errors, 0, 987 "Address Match Errors"); 988 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "dropped_too_small", 989 CTLFLAG_RD, &stats->u0.xe201.rx_dropped_too_small, 0, 990 "Dropped Too Small"); 991 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "dropped_too_short", 992 CTLFLAG_RD, &stats->u0.xe201.rx_dropped_too_short, 0, 993 "Dropped Too Short"); 994 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, 995 "dropped_header_too_small", CTLFLAG_RD, 996 &stats->u0.xe201.rx_dropped_header_too_small, 0, 997 "Dropped Header Too Small"); 998 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, 999 "dropped_tcp_length", CTLFLAG_RD, 1000 &stats->u0.xe201.rx_dropped_invalid_tcp_length, 0, 1001 "Dropped TCP Length"); 1002 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "dropped_runt", 1003 CTLFLAG_RD, &stats->u0.xe201.rx_dropped_runt, 0, 1004 "Dropped runt"); 1005 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "ip_checksum_errs", 1006 CTLFLAG_RD, &stats->u0.xe201.rx_ip_checksum_errors, 0, 1007 "IP Checksum Errors"); 1008 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "tcp_checksum_errs", 1009 CTLFLAG_RD, &stats->u0.xe201.rx_tcp_checksum_errors, 0, 1010 "TCP Checksum Errors"); 1011 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "udp_checksum_errs", 1012 CTLFLAG_RD, &stats->u0.xe201.rx_udp_checksum_errors, 0, 1013 "UDP Checksum Errors"); 1014 SYSCTL_ADD_UINT(ctx, rx_stat_list, OID_AUTO, "input_fifo_overflow_drop", 1015 CTLFLAG_RD, &stats->u0.xe201.rx_fifo_overflow, 0, 1016 "Input FIFO Overflow Drop"); 1017 1018 tx_stats_node = SYSCTL_ADD_NODE(ctx, 1019 SYSCTL_CHILDREN(stats_node), 1020 OID_AUTO, "tx", CTLFLAG_RD, 1021 NULL, "TX Ethernet Statistics"); 1022 tx_stat_list = SYSCTL_CHILDREN(tx_stats_node); 1023 1024 SYSCTL_ADD_QUAD(ctx, tx_stat_list, OID_AUTO, "total_tx_pkts", 1025 CTLFLAG_RD, &stats->tx.t_tx_pkts, 1026 "Total Transmit Packets"); 1027 SYSCTL_ADD_QUAD(ctx, tx_stat_list, OID_AUTO, "total_tx_bytes", 1028 CTLFLAG_RD, &stats->tx.t_tx_bytes, 1029 "Total Transmit Bytes"); 1030 SYSCTL_ADD_UINT(ctx, tx_stat_list, OID_AUTO, "total_tx_reqs", 1031 CTLFLAG_RD, &stats->tx.t_tx_reqs, 0, 1032 "Total Transmit Requests"); 1033 SYSCTL_ADD_UINT(ctx, tx_stat_list, OID_AUTO, "total_tx_stops", 1034 CTLFLAG_RD, &stats->tx.t_tx_stops, 0, 1035 "Total Transmit Stops"); 1036 SYSCTL_ADD_UINT(ctx, tx_stat_list, OID_AUTO, "total_tx_wrbs", 1037 CTLFLAG_RD, &stats->tx.t_tx_wrbs, 0, 1038 "Total Transmit WRB's"); 1039 SYSCTL_ADD_UINT(ctx, tx_stat_list, OID_AUTO, "total_tx_compl", 1040 CTLFLAG_RD, &stats->tx.t_tx_compl, 0, 1041 "Total Transmit Completions"); 1042 SYSCTL_ADD_UINT(ctx, tx_stat_list, OID_AUTO, 1043 "total_ipv6_ext_hdr_tx_drop", 1044 CTLFLAG_RD, &stats->tx.t_ipv6_ext_hdr_tx_drop, 0, 1045 "Total Transmit IPV6 Drops"); 1046 SYSCTL_ADD_UINT(ctx, tx_stat_list, OID_AUTO, "pauseframes", 1047 CTLFLAG_RD, &stats->u0.xe201.tx_pause_frames, 0, 1048 "Pause Frames"); 1049 SYSCTL_ADD_UINT(ctx, tx_stat_list, OID_AUTO, "controlframes", 1050 CTLFLAG_RD, &stats->u0.xe201.tx_control_frames, 0, 1051 "Tx Control Frames"); 1052 1053 for (i = 0; i < sc->nwqs; i++) { 1054 sprintf(prefix, "queue%d",i); 1055 queue_stats_node = SYSCTL_ADD_NODE(ctx, 1056 SYSCTL_CHILDREN(tx_stats_node), 1057 OID_AUTO, prefix, CTLFLAG_RD, 1058 NULL, "Queue name"); 1059 queue_stats_list = SYSCTL_CHILDREN(queue_stats_node); 1060 1061 SYSCTL_ADD_QUAD(ctx, queue_stats_list, OID_AUTO, "tx_pkts", 1062 CTLFLAG_RD, &sc->wq[i]->tx_stats.tx_pkts, 1063 "Transmit Packets"); 1064 SYSCTL_ADD_QUAD(ctx, queue_stats_list, OID_AUTO, "tx_bytes", 1065 CTLFLAG_RD, &sc->wq[i]->tx_stats.tx_bytes, 1066 "Transmit Bytes"); 1067 SYSCTL_ADD_UINT(ctx, queue_stats_list, OID_AUTO, "tx_reqs", 1068 CTLFLAG_RD, &sc->wq[i]->tx_stats.tx_reqs, 0, 1069 "Transmit Requests"); 1070 SYSCTL_ADD_UINT(ctx, queue_stats_list, OID_AUTO, "tx_stops", 1071 CTLFLAG_RD, &sc->wq[i]->tx_stats.tx_stops, 0, 1072 "Transmit Stops"); 1073 SYSCTL_ADD_UINT(ctx, queue_stats_list, OID_AUTO, "tx_wrbs", 1074 CTLFLAG_RD, &sc->wq[i]->tx_stats.tx_wrbs, 0, 1075 "Transmit WRB's"); 1076 SYSCTL_ADD_UINT(ctx, queue_stats_list, OID_AUTO, "tx_compl", 1077 CTLFLAG_RD, &sc->wq[i]->tx_stats.tx_compl, 0, 1078 "Transmit Completions"); 1079 SYSCTL_ADD_UINT(ctx, queue_stats_list, OID_AUTO, 1080 "ipv6_ext_hdr_tx_drop", CTLFLAG_RD, 1081 &sc->wq[i]->tx_stats.ipv6_ext_hdr_tx_drop, 0, 1082 "Transmit IPV6 Ext Header Drop"); 1083 1084 } 1085 return; 1086} 1087 1088 1089void 1090oce_refresh_queue_stats(POCE_SOFTC sc) 1091{ 1092 struct oce_drv_stats *adapter_stats; 1093 int i; 1094 1095 adapter_stats = &sc->oce_stats_info; 1096 1097 /* Caluculate total TX and TXstats from all queues */ 1098 1099 bzero(&adapter_stats->rx, sizeof(struct oce_rx_stats)); 1100 for (i = 0; i < sc->nrqs; i++) { 1101 1102 adapter_stats->rx.t_rx_pkts += sc->rq[i]->rx_stats.rx_pkts; 1103 adapter_stats->rx.t_rx_bytes += sc->rq[i]->rx_stats.rx_bytes; 1104 adapter_stats->rx.t_rx_frags += sc->rq[i]->rx_stats.rx_frags; 1105 adapter_stats->rx.t_rx_mcast_pkts += 1106 sc->rq[i]->rx_stats.rx_mcast_pkts; 1107 adapter_stats->rx.t_rx_ucast_pkts += 1108 sc->rq[i]->rx_stats.rx_ucast_pkts; 1109 adapter_stats->rx.t_rxcp_errs += sc-> rq[i]->rx_stats.rxcp_err; 1110 } 1111 1112 bzero(&adapter_stats->tx, sizeof(struct oce_tx_stats)); 1113 for (i = 0; i < sc->nwqs; i++) { 1114 adapter_stats->tx.t_tx_reqs += sc->wq[i]->tx_stats.tx_reqs; 1115 adapter_stats->tx.t_tx_stops += sc->wq[i]->tx_stats.tx_stops; 1116 adapter_stats->tx.t_tx_wrbs += sc->wq[i]->tx_stats.tx_wrbs; 1117 adapter_stats->tx.t_tx_compl += sc->wq[i]->tx_stats.tx_compl; 1118 adapter_stats->tx.t_tx_bytes += sc->wq[i]->tx_stats.tx_bytes; 1119 adapter_stats->tx.t_tx_pkts += sc->wq[i]->tx_stats.tx_pkts; 1120 adapter_stats->tx.t_ipv6_ext_hdr_tx_drop += 1121 sc->wq[i]->tx_stats.ipv6_ext_hdr_tx_drop; 1122 } 1123 1124} 1125 1126 1127 1128static void 1129copy_stats_to_sc_xe201(POCE_SOFTC sc) 1130{ 1131 struct oce_xe201_stats *adapter_stats; 1132 struct mbx_get_pport_stats *nic_mbx; 1133 struct pport_stats *port_stats; 1134 1135 nic_mbx = OCE_DMAPTR(&sc->stats_mem, struct mbx_get_pport_stats); 1136 port_stats = &nic_mbx->params.rsp.pps; 1137 adapter_stats = &sc->oce_stats_info.u0.xe201; 1138 1139 adapter_stats->tx_pkts = port_stats->tx_pkts; 1140 adapter_stats->tx_unicast_pkts = port_stats->tx_unicast_pkts; 1141 adapter_stats->tx_multicast_pkts = port_stats->tx_multicast_pkts; 1142 adapter_stats->tx_broadcast_pkts = port_stats->tx_broadcast_pkts; 1143 adapter_stats->tx_bytes = port_stats->tx_bytes; 1144 adapter_stats->tx_unicast_bytes = port_stats->tx_unicast_bytes; 1145 adapter_stats->tx_multicast_bytes = port_stats->tx_multicast_bytes; 1146 adapter_stats->tx_broadcast_bytes = port_stats->tx_broadcast_bytes; 1147 adapter_stats->tx_discards = port_stats->tx_discards; 1148 adapter_stats->tx_errors = port_stats->tx_errors; 1149 adapter_stats->tx_pause_frames = port_stats->tx_pause_frames; 1150 adapter_stats->tx_pause_on_frames = port_stats->tx_pause_on_frames; 1151 adapter_stats->tx_pause_off_frames = port_stats->tx_pause_off_frames; 1152 adapter_stats->tx_internal_mac_errors = 1153 port_stats->tx_internal_mac_errors; 1154 adapter_stats->tx_control_frames = port_stats->tx_control_frames; 1155 adapter_stats->tx_pkts_64_bytes = port_stats->tx_pkts_64_bytes; 1156 adapter_stats->tx_pkts_65_to_127_bytes = 1157 port_stats->tx_pkts_65_to_127_bytes; 1158 adapter_stats->tx_pkts_128_to_255_bytes = 1159 port_stats->tx_pkts_128_to_255_bytes; 1160 adapter_stats->tx_pkts_256_to_511_bytes = 1161 port_stats->tx_pkts_256_to_511_bytes; 1162 adapter_stats->tx_pkts_512_to_1023_bytes = 1163 port_stats->tx_pkts_512_to_1023_bytes; 1164 adapter_stats->tx_pkts_1024_to_1518_bytes = 1165 port_stats->tx_pkts_1024_to_1518_bytes; 1166 adapter_stats->tx_pkts_1519_to_2047_bytes = 1167 port_stats->tx_pkts_1519_to_2047_bytes; 1168 adapter_stats->tx_pkts_2048_to_4095_bytes = 1169 port_stats->tx_pkts_2048_to_4095_bytes; 1170 adapter_stats->tx_pkts_4096_to_8191_bytes = 1171 port_stats->tx_pkts_4096_to_8191_bytes; 1172 adapter_stats->tx_pkts_8192_to_9216_bytes = 1173 port_stats->tx_pkts_8192_to_9216_bytes; 1174 adapter_stats->tx_lso_pkts = port_stats->tx_lso_pkts; 1175 adapter_stats->rx_pkts = port_stats->rx_pkts; 1176 adapter_stats->rx_unicast_pkts = port_stats->rx_unicast_pkts; 1177 adapter_stats->rx_multicast_pkts = port_stats->rx_multicast_pkts; 1178 adapter_stats->rx_broadcast_pkts = port_stats->rx_broadcast_pkts; 1179 adapter_stats->rx_bytes = port_stats->rx_bytes; 1180 adapter_stats->rx_unicast_bytes = port_stats->rx_unicast_bytes; 1181 adapter_stats->rx_multicast_bytes = port_stats->rx_multicast_bytes; 1182 adapter_stats->rx_broadcast_bytes = port_stats->rx_broadcast_bytes; 1183 adapter_stats->rx_unknown_protos = port_stats->rx_unknown_protos; 1184 adapter_stats->rx_discards = port_stats->rx_discards; 1185 adapter_stats->rx_errors = port_stats->rx_errors; 1186 adapter_stats->rx_crc_errors = port_stats->rx_crc_errors; 1187 adapter_stats->rx_alignment_errors = port_stats->rx_alignment_errors; 1188 adapter_stats->rx_symbol_errors = port_stats->rx_symbol_errors; 1189 adapter_stats->rx_pause_frames = port_stats->rx_pause_frames; 1190 adapter_stats->rx_pause_on_frames = port_stats->rx_pause_on_frames; 1191 adapter_stats->rx_pause_off_frames = port_stats->rx_pause_off_frames; 1192 adapter_stats->rx_frames_too_long = port_stats->rx_frames_too_long; 1193 adapter_stats->rx_internal_mac_errors = 1194 port_stats->rx_internal_mac_errors; 1195 adapter_stats->rx_undersize_pkts = port_stats->rx_undersize_pkts; 1196 adapter_stats->rx_oversize_pkts = port_stats->rx_oversize_pkts; 1197 adapter_stats->rx_fragment_pkts = port_stats->rx_fragment_pkts; 1198 adapter_stats->rx_jabbers = port_stats->rx_jabbers; 1199 adapter_stats->rx_control_frames = port_stats->rx_control_frames; 1200 adapter_stats->rx_control_frames_unknown_opcode = 1201 port_stats->rx_control_frames_unknown_opcode; 1202 adapter_stats->rx_in_range_errors = port_stats->rx_in_range_errors; 1203 adapter_stats->rx_out_of_range_errors = 1204 port_stats->rx_out_of_range_errors; 1205 adapter_stats->rx_address_match_errors = 1206 port_stats->rx_address_match_errors; 1207 adapter_stats->rx_vlan_mismatch_errors = 1208 port_stats->rx_vlan_mismatch_errors; 1209 adapter_stats->rx_dropped_too_small = port_stats->rx_dropped_too_small; 1210 adapter_stats->rx_dropped_too_short = port_stats->rx_dropped_too_short; 1211 adapter_stats->rx_dropped_header_too_small = 1212 port_stats->rx_dropped_header_too_small; 1213 adapter_stats->rx_dropped_invalid_tcp_length = 1214 port_stats->rx_dropped_invalid_tcp_length; 1215 adapter_stats->rx_dropped_runt = port_stats->rx_dropped_runt; 1216 adapter_stats->rx_ip_checksum_errors = 1217 port_stats->rx_ip_checksum_errors; 1218 adapter_stats->rx_tcp_checksum_errors = 1219 port_stats->rx_tcp_checksum_errors; 1220 adapter_stats->rx_udp_checksum_errors = 1221 port_stats->rx_udp_checksum_errors; 1222 adapter_stats->rx_non_rss_pkts = port_stats->rx_non_rss_pkts; 1223 adapter_stats->rx_ipv4_pkts = port_stats->rx_ipv4_pkts; 1224 adapter_stats->rx_ipv6_pkts = port_stats->rx_ipv6_pkts; 1225 adapter_stats->rx_ipv4_bytes = port_stats->rx_ipv4_bytes; 1226 adapter_stats->rx_ipv6_bytes = port_stats->rx_ipv6_bytes; 1227 adapter_stats->rx_nic_pkts = port_stats->rx_nic_pkts; 1228 adapter_stats->rx_tcp_pkts = port_stats->rx_tcp_pkts; 1229 adapter_stats->rx_iscsi_pkts = port_stats->rx_iscsi_pkts; 1230 adapter_stats->rx_management_pkts = port_stats->rx_management_pkts; 1231 adapter_stats->rx_switched_unicast_pkts = 1232 port_stats->rx_switched_unicast_pkts; 1233 adapter_stats->rx_switched_multicast_pkts = 1234 port_stats->rx_switched_multicast_pkts; 1235 adapter_stats->rx_switched_broadcast_pkts = 1236 port_stats->rx_switched_broadcast_pkts; 1237 adapter_stats->num_forwards = port_stats->num_forwards; 1238 adapter_stats->rx_fifo_overflow = port_stats->rx_fifo_overflow; 1239 adapter_stats->rx_input_fifo_overflow = 1240 port_stats->rx_input_fifo_overflow; 1241 adapter_stats->rx_drops_too_many_frags = 1242 port_stats->rx_drops_too_many_frags; 1243 adapter_stats->rx_drops_invalid_queue = 1244 port_stats->rx_drops_invalid_queue; 1245 adapter_stats->rx_drops_mtu = port_stats->rx_drops_mtu; 1246 adapter_stats->rx_pkts_64_bytes = port_stats->rx_pkts_64_bytes; 1247 adapter_stats->rx_pkts_65_to_127_bytes = 1248 port_stats->rx_pkts_65_to_127_bytes; 1249 adapter_stats->rx_pkts_128_to_255_bytes = 1250 port_stats->rx_pkts_128_to_255_bytes; 1251 adapter_stats->rx_pkts_256_to_511_bytes = 1252 port_stats->rx_pkts_256_to_511_bytes; 1253 adapter_stats->rx_pkts_512_to_1023_bytes = 1254 port_stats->rx_pkts_512_to_1023_bytes; 1255 adapter_stats->rx_pkts_1024_to_1518_bytes = 1256 port_stats->rx_pkts_1024_to_1518_bytes; 1257 adapter_stats->rx_pkts_1519_to_2047_bytes = 1258 port_stats->rx_pkts_1519_to_2047_bytes; 1259 adapter_stats->rx_pkts_2048_to_4095_bytes = 1260 port_stats->rx_pkts_2048_to_4095_bytes; 1261 adapter_stats->rx_pkts_4096_to_8191_bytes = 1262 port_stats->rx_pkts_4096_to_8191_bytes; 1263 adapter_stats->rx_pkts_8192_to_9216_bytes = 1264 port_stats->rx_pkts_8192_to_9216_bytes; 1265} 1266 1267 1268 1269static void 1270copy_stats_to_sc_be2(POCE_SOFTC sc) 1271{ 1272 struct oce_be_stats *adapter_stats; 1273 struct oce_pmem_stats *pmem; 1274 struct oce_rxf_stats_v0 *rxf_stats; 1275 struct oce_port_rxf_stats_v0 *port_stats; 1276 struct mbx_get_nic_stats_v0 *nic_mbx; 1277 uint32_t port = sc->port_id; 1278 1279 nic_mbx = OCE_DMAPTR(&sc->stats_mem, struct mbx_get_nic_stats_v0); 1280 pmem = &nic_mbx->params.rsp.stats.pmem; 1281 rxf_stats = &nic_mbx->params.rsp.stats.rxf; 1282 port_stats = &nic_mbx->params.rsp.stats.rxf.port[port]; 1283 1284 adapter_stats = &sc->oce_stats_info.u0.be; 1285 1286 1287 /* Update stats */ 1288 adapter_stats->rx_pause_frames = port_stats->rx_pause_frames; 1289 adapter_stats->rx_crc_errors = port_stats->rx_crc_errors; 1290 adapter_stats->rx_control_frames = port_stats->rx_control_frames; 1291 adapter_stats->rx_in_range_errors = port_stats->rx_in_range_errors; 1292 adapter_stats->rx_frame_too_long = port_stats->rx_frame_too_long; 1293 adapter_stats->rx_dropped_runt = port_stats->rx_dropped_runt; 1294 adapter_stats->rx_ip_checksum_errs = port_stats->rx_ip_checksum_errs; 1295 adapter_stats->rx_tcp_checksum_errs = port_stats->rx_tcp_checksum_errs; 1296 adapter_stats->rx_udp_checksum_errs = port_stats->rx_udp_checksum_errs; 1297 adapter_stats->rxpp_fifo_overflow_drop = 1298 port_stats->rxpp_fifo_overflow_drop; 1299 adapter_stats->rx_dropped_tcp_length = 1300 port_stats->rx_dropped_tcp_length; 1301 adapter_stats->rx_dropped_too_small = port_stats->rx_dropped_too_small; 1302 adapter_stats->rx_dropped_too_short = port_stats->rx_dropped_too_short; 1303 adapter_stats->rx_out_range_errors = port_stats->rx_out_range_errors; 1304 adapter_stats->rx_dropped_header_too_small = 1305 port_stats->rx_dropped_header_too_small; 1306 adapter_stats->rx_input_fifo_overflow_drop = 1307 port_stats->rx_input_fifo_overflow_drop; 1308 adapter_stats->rx_address_match_errors = 1309 port_stats->rx_address_match_errors; 1310 adapter_stats->rx_alignment_symbol_errors = 1311 port_stats->rx_alignment_symbol_errors; 1312 adapter_stats->tx_pauseframes = port_stats->tx_pauseframes; 1313 adapter_stats->tx_controlframes = port_stats->tx_controlframes; 1314 1315 if (sc->if_id) 1316 adapter_stats->jabber_events = rxf_stats->port1_jabber_events; 1317 else 1318 adapter_stats->jabber_events = rxf_stats->port0_jabber_events; 1319 1320 adapter_stats->rx_drops_no_pbuf = rxf_stats->rx_drops_no_pbuf; 1321 adapter_stats->rx_drops_no_txpb = rxf_stats->rx_drops_no_txpb; 1322 adapter_stats->rx_drops_no_erx_descr = rxf_stats->rx_drops_no_erx_descr; 1323 adapter_stats->rx_drops_invalid_ring = rxf_stats->rx_drops_invalid_ring; 1324 adapter_stats->forwarded_packets = rxf_stats->forwarded_packets; 1325 adapter_stats->rx_drops_mtu = rxf_stats->rx_drops_mtu; 1326 adapter_stats->rx_drops_no_tpre_descr = 1327 rxf_stats->rx_drops_no_tpre_descr; 1328 adapter_stats->rx_drops_too_many_frags = 1329 rxf_stats->rx_drops_too_many_frags; 1330 adapter_stats->eth_red_drops = pmem->eth_red_drops; 1331} 1332 1333 1334static void 1335copy_stats_to_sc_be3(POCE_SOFTC sc) 1336{ 1337 struct oce_be_stats *adapter_stats; 1338 struct oce_pmem_stats *pmem; 1339 struct oce_rxf_stats_v1 *rxf_stats; 1340 struct oce_port_rxf_stats_v1 *port_stats; 1341 struct mbx_get_nic_stats *nic_mbx; 1342 uint32_t port = sc->port_id; 1343 1344 nic_mbx = OCE_DMAPTR(&sc->stats_mem, struct mbx_get_nic_stats); 1345 pmem = &nic_mbx->params.rsp.stats.pmem; 1346 rxf_stats = &nic_mbx->params.rsp.stats.rxf; 1347 port_stats = &nic_mbx->params.rsp.stats.rxf.port[port]; 1348 1349 adapter_stats = &sc->oce_stats_info.u0.be; 1350 1351 /* Update stats */ 1352 adapter_stats->pmem_fifo_overflow_drop = 1353 port_stats->pmem_fifo_overflow_drop; 1354 adapter_stats->rx_priority_pause_frames = 1355 port_stats->rx_priority_pause_frames; 1356 adapter_stats->rx_pause_frames = port_stats->rx_pause_frames; 1357 adapter_stats->rx_crc_errors = port_stats->rx_crc_errors; 1358 adapter_stats->rx_control_frames = port_stats->rx_control_frames; 1359 adapter_stats->rx_in_range_errors = port_stats->rx_in_range_errors; 1360 adapter_stats->rx_frame_too_long = port_stats->rx_frame_too_long; 1361 adapter_stats->rx_dropped_runt = port_stats->rx_dropped_runt; 1362 adapter_stats->rx_ip_checksum_errs = port_stats->rx_ip_checksum_errs; 1363 adapter_stats->rx_tcp_checksum_errs = port_stats->rx_tcp_checksum_errs; 1364 adapter_stats->rx_udp_checksum_errs = port_stats->rx_udp_checksum_errs; 1365 adapter_stats->rx_dropped_tcp_length = 1366 port_stats->rx_dropped_tcp_length; 1367 adapter_stats->rx_dropped_too_small = port_stats->rx_dropped_too_small; 1368 adapter_stats->rx_dropped_too_short = port_stats->rx_dropped_too_short; 1369 adapter_stats->rx_out_range_errors = port_stats->rx_out_range_errors; 1370 adapter_stats->rx_dropped_header_too_small = 1371 port_stats->rx_dropped_header_too_small; 1372 adapter_stats->rx_input_fifo_overflow_drop = 1373 port_stats->rx_input_fifo_overflow_drop; 1374 adapter_stats->rx_address_match_errors = 1375 port_stats->rx_address_match_errors; 1376 adapter_stats->rx_alignment_symbol_errors = 1377 port_stats->rx_alignment_symbol_errors; 1378 adapter_stats->rxpp_fifo_overflow_drop = 1379 port_stats->rxpp_fifo_overflow_drop; 1380 adapter_stats->tx_pauseframes = port_stats->tx_pauseframes; 1381 adapter_stats->tx_controlframes = port_stats->tx_controlframes; 1382 adapter_stats->jabber_events = port_stats->jabber_events; 1383 1384 adapter_stats->rx_drops_no_pbuf = rxf_stats->rx_drops_no_pbuf; 1385 adapter_stats->rx_drops_no_txpb = rxf_stats->rx_drops_no_txpb; 1386 adapter_stats->rx_drops_no_erx_descr = rxf_stats->rx_drops_no_erx_descr; 1387 adapter_stats->rx_drops_invalid_ring = rxf_stats->rx_drops_invalid_ring; 1388 adapter_stats->forwarded_packets = rxf_stats->forwarded_packets; 1389 adapter_stats->rx_drops_mtu = rxf_stats->rx_drops_mtu; 1390 adapter_stats->rx_drops_no_tpre_descr = 1391 rxf_stats->rx_drops_no_tpre_descr; 1392 adapter_stats->rx_drops_too_many_frags = 1393 rxf_stats->rx_drops_too_many_frags; 1394 1395 adapter_stats->eth_red_drops = pmem->eth_red_drops; 1396} 1397 1398 1399int 1400oce_stats_init(POCE_SOFTC sc) 1401{ 1402 int rc = 0, sz; 1403 1404 if (IS_BE(sc) || IS_SH(sc)) { 1405 if (sc->flags & OCE_FLAGS_BE2) 1406 sz = sizeof(struct mbx_get_nic_stats_v0); 1407 else 1408 sz = sizeof(struct mbx_get_nic_stats); 1409 } else 1410 sz = sizeof(struct mbx_get_pport_stats); 1411 1412 rc = oce_dma_alloc(sc, sz, &sc->stats_mem, 0); 1413 1414 return rc; 1415} 1416 1417 1418void 1419oce_stats_free(POCE_SOFTC sc) 1420{ 1421 1422 oce_dma_free(sc, &sc->stats_mem); 1423 1424} 1425 1426 1427int 1428oce_refresh_nic_stats(POCE_SOFTC sc) 1429{ 1430 int rc = 0, reset = 0; 1431 1432 if (IS_BE(sc) || IS_SH(sc)) { 1433 if (sc->flags & OCE_FLAGS_BE2) { 1434 rc = oce_mbox_get_nic_stats_v0(sc, &sc->stats_mem); 1435 if (!rc) 1436 copy_stats_to_sc_be2(sc); 1437 } else { 1438 rc = oce_mbox_get_nic_stats(sc, &sc->stats_mem); 1439 if (!rc) 1440 copy_stats_to_sc_be3(sc); 1441 } 1442 1443 } else { 1444 rc = oce_mbox_get_pport_stats(sc, &sc->stats_mem, reset); 1445 if (!rc) 1446 copy_stats_to_sc_xe201(sc); 1447 } 1448 1449 return rc; 1450} 1451 1452static int 1453oce_sysctl_sfp_vpd_dump(SYSCTL_HANDLER_ARGS) 1454{ 1455 int result = 0, error; 1456 int rc = 0; 1457 POCE_SOFTC sc = (POCE_SOFTC) arg1; 1458 1459 /* sysctl default handler */ 1460 error = sysctl_handle_int(oidp, &result, 0, req); 1461 if (error || !req->newptr) 1462 return (error); 1463 1464 if(result == -1) { 1465 return EINVAL; 1466 } 1467 bzero((char *)sfp_vpd_dump_buffer, TRANSCEIVER_DATA_SIZE); 1468 1469 rc = oce_mbox_read_transrecv_data(sc, PAGE_NUM_A0); 1470 if(rc) 1471 return rc; 1472 1473 rc = oce_mbox_read_transrecv_data(sc, PAGE_NUM_A2); 1474 if(rc) 1475 return rc; 1476 1477 return rc; 1478}
|