13859Sml29623 /* 23859Sml29623 * CDDL HEADER START 33859Sml29623 * 43859Sml29623 * The contents of this file are subject to the terms of the 53859Sml29623 * Common Development and Distribution License (the "License"). 63859Sml29623 * You may not use this file except in compliance with the License. 73859Sml29623 * 83859Sml29623 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 93859Sml29623 * or http://www.opensolaris.org/os/licensing. 103859Sml29623 * See the License for the specific language governing permissions 113859Sml29623 * and limitations under the License. 123859Sml29623 * 133859Sml29623 * When distributing Covered Code, include this CDDL HEADER in each 143859Sml29623 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 153859Sml29623 * If applicable, add the following below this CDDL HEADER, with the 163859Sml29623 * fields enclosed by brackets "[]" replaced with your own identifying 173859Sml29623 * information: Portions Copyright [yyyy] [name of copyright owner] 183859Sml29623 * 193859Sml29623 * CDDL HEADER END 203859Sml29623 */ 213859Sml29623 /* 225938Smisaki * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 233859Sml29623 * Use is subject to license terms. 243859Sml29623 */ 253859Sml29623 263859Sml29623 #ifndef _SYS_NXGE_NXGE_H 273859Sml29623 #define _SYS_NXGE_NXGE_H 283859Sml29623 293859Sml29623 #ifdef __cplusplus 303859Sml29623 extern "C" { 313859Sml29623 #endif 323859Sml29623 333859Sml29623 #include <nxge_mac.h> 343859Sml29623 #include <nxge_ipp.h> 353859Sml29623 #include <nxge_fflp.h> 363859Sml29623 373859Sml29623 /* 383859Sml29623 * NXGE diagnostics IOCTLS. 393859Sml29623 */ 403859Sml29623 #define NXGE_IOC ((((('N' << 8) + 'X') << 8) + 'G') << 8) 413859Sml29623 423859Sml29623 #define NXGE_GET64 (NXGE_IOC|1) 433859Sml29623 #define NXGE_PUT64 (NXGE_IOC|2) 443859Sml29623 #define NXGE_GET_TX_RING_SZ (NXGE_IOC|3) 453859Sml29623 #define NXGE_GET_TX_DESC (NXGE_IOC|4) 463859Sml29623 #define NXGE_GLOBAL_RESET (NXGE_IOC|5) 473859Sml29623 #define NXGE_TX_SIDE_RESET (NXGE_IOC|6) 483859Sml29623 #define NXGE_RX_SIDE_RESET (NXGE_IOC|7) 493859Sml29623 #define NXGE_RESET_MAC (NXGE_IOC|8) 503859Sml29623 513859Sml29623 #define NXGE_GET_MII (NXGE_IOC|11) 523859Sml29623 #define NXGE_PUT_MII (NXGE_IOC|12) 533859Sml29623 #define NXGE_RTRACE (NXGE_IOC|13) 543859Sml29623 #define NXGE_RTRACE_TEST (NXGE_IOC|20) 553859Sml29623 #define NXGE_TX_REGS_DUMP (NXGE_IOC|21) 563859Sml29623 #define NXGE_RX_REGS_DUMP (NXGE_IOC|22) 573859Sml29623 #define NXGE_INT_REGS_DUMP (NXGE_IOC|23) 583859Sml29623 #define NXGE_VIR_REGS_DUMP (NXGE_IOC|24) 593859Sml29623 #define NXGE_VIR_INT_REGS_DUMP (NXGE_IOC|25) 603859Sml29623 #define NXGE_RDUMP (NXGE_IOC|26) 613859Sml29623 #define NXGE_RDC_GRPS_DUMP (NXGE_IOC|27) 623859Sml29623 #define NXGE_PIO_TEST (NXGE_IOC|28) 633859Sml29623 643859Sml29623 #define NXGE_GET_TCAM (NXGE_IOC|29) 653859Sml29623 #define NXGE_PUT_TCAM (NXGE_IOC|30) 663859Sml29623 #define NXGE_INJECT_ERR (NXGE_IOC|40) 673859Sml29623 683859Sml29623 #define NXGE_OK 0 693859Sml29623 #define NXGE_ERROR 0x40000000 703859Sml29623 #define NXGE_DDI_FAILED 0x20000000 713859Sml29623 #define NXGE_GET_PORT_NUM(n) n 723859Sml29623 733859Sml29623 /* 743859Sml29623 * Definitions for module_info. 753859Sml29623 */ 763859Sml29623 #define NXGE_IDNUM (0) /* module ID number */ 773859Sml29623 #define NXGE_DRIVER_NAME "nxge" /* module name */ 783859Sml29623 793859Sml29623 #define NXGE_MINPSZ (0) /* min packet size */ 803859Sml29623 #define NXGE_MAXPSZ (ETHERMTU) /* max packet size */ 813859Sml29623 #define NXGE_HIWAT (2048 * NXGE_MAXPSZ) /* hi-water mark */ 823859Sml29623 #define NXGE_LOWAT (1) /* lo-water mark */ 833859Sml29623 #define NXGE_HIWAT_MAX (192000 * NXGE_MAXPSZ) 843859Sml29623 #define NXGE_HIWAT_MIN (2 * NXGE_MAXPSZ) 853859Sml29623 #define NXGE_LOWAT_MAX (192000 * NXGE_MAXPSZ) 863859Sml29623 #define NXGE_LOWAT_MIN (1) 873859Sml29623 883859Sml29623 #ifndef D_HOTPLUG 893859Sml29623 #define D_HOTPLUG 0x00 903859Sml29623 #endif 913859Sml29623 923859Sml29623 #define INIT_BUCKET_SIZE 16 /* Initial Hash Bucket Size */ 933859Sml29623 943859Sml29623 #define NXGE_CHECK_TIMER (5000) 953859Sml29623 963859Sml29623 typedef enum { 973859Sml29623 param_instance, 983859Sml29623 param_main_instance, 993859Sml29623 param_function_number, 1003859Sml29623 param_partition_id, 1013859Sml29623 param_read_write_mode, 1024185Sspeer param_fw_version, 1034977Sraghus param_port_mode, 1043859Sml29623 param_niu_cfg_type, 1053859Sml29623 param_tx_quick_cfg, 1063859Sml29623 param_rx_quick_cfg, 1073859Sml29623 param_master_cfg_enable, 1083859Sml29623 param_master_cfg_value, 1093859Sml29623 1103859Sml29623 param_autoneg, 1113859Sml29623 param_anar_10gfdx, 1123859Sml29623 param_anar_10ghdx, 1133859Sml29623 param_anar_1000fdx, 1143859Sml29623 param_anar_1000hdx, 1153859Sml29623 param_anar_100T4, 1163859Sml29623 param_anar_100fdx, 1173859Sml29623 param_anar_100hdx, 1183859Sml29623 param_anar_10fdx, 1193859Sml29623 param_anar_10hdx, 1203859Sml29623 1213859Sml29623 param_anar_asmpause, 1223859Sml29623 param_anar_pause, 1233859Sml29623 param_use_int_xcvr, 1243859Sml29623 param_enable_ipg0, 1253859Sml29623 param_ipg0, 1263859Sml29623 param_ipg1, 1273859Sml29623 param_ipg2, 1283859Sml29623 param_accept_jumbo, 1293859Sml29623 param_txdma_weight, 1303859Sml29623 param_txdma_channels_begin, 1313859Sml29623 1323859Sml29623 param_txdma_channels, 1333859Sml29623 param_txdma_info, 1343859Sml29623 param_rxdma_channels_begin, 1353859Sml29623 param_rxdma_channels, 1363859Sml29623 param_rxdma_drr_weight, 1373859Sml29623 param_rxdma_full_header, 1383859Sml29623 param_rxdma_info, 1393859Sml29623 param_rxdma_rbr_size, 1403859Sml29623 param_rxdma_rcr_size, 1413859Sml29623 param_default_port_rdc, 1423859Sml29623 param_rxdma_intr_time, 1433859Sml29623 param_rxdma_intr_pkts, 1443859Sml29623 1453859Sml29623 param_rdc_grps_start, 1463859Sml29623 param_rx_rdc_grps, 1473859Sml29623 param_default_grp0_rdc, 1483859Sml29623 param_default_grp1_rdc, 1493859Sml29623 param_default_grp2_rdc, 1503859Sml29623 param_default_grp3_rdc, 1513859Sml29623 param_default_grp4_rdc, 1523859Sml29623 param_default_grp5_rdc, 1533859Sml29623 param_default_grp6_rdc, 1543859Sml29623 param_default_grp7_rdc, 1553859Sml29623 1563859Sml29623 param_info_rdc_groups, 1573859Sml29623 param_start_ldg, 1583859Sml29623 param_max_ldg, 1593859Sml29623 param_mac_2rdc_grp, 1603859Sml29623 param_vlan_2rdc_grp, 1613859Sml29623 param_fcram_part_cfg, 1623859Sml29623 param_fcram_access_ratio, 1633859Sml29623 param_tcam_access_ratio, 1643859Sml29623 param_tcam_enable, 1653859Sml29623 param_hash_lookup_enable, 1663859Sml29623 param_llc_snap_enable, 1673859Sml29623 1683859Sml29623 param_h1_init_value, 1693859Sml29623 param_h2_init_value, 1703859Sml29623 param_class_cfg_ether_usr1, 1713859Sml29623 param_class_cfg_ether_usr2, 1723859Sml29623 param_class_cfg_ip_usr4, 1733859Sml29623 param_class_cfg_ip_usr5, 1743859Sml29623 param_class_cfg_ip_usr6, 1753859Sml29623 param_class_cfg_ip_usr7, 1763859Sml29623 param_class_opt_ip_usr4, 1773859Sml29623 param_class_opt_ip_usr5, 1783859Sml29623 param_class_opt_ip_usr6, 1793859Sml29623 param_class_opt_ip_usr7, 1803859Sml29623 param_class_opt_ipv4_tcp, 1813859Sml29623 param_class_opt_ipv4_udp, 1823859Sml29623 param_class_opt_ipv4_ah, 1833859Sml29623 param_class_opt_ipv4_sctp, 1843859Sml29623 param_class_opt_ipv6_tcp, 1853859Sml29623 param_class_opt_ipv6_udp, 1863859Sml29623 param_class_opt_ipv6_ah, 1873859Sml29623 param_class_opt_ipv6_sctp, 1883859Sml29623 param_nxge_debug_flag, 1893859Sml29623 param_npi_debug_flag, 1903859Sml29623 param_dump_rdc, 1913859Sml29623 param_dump_tdc, 1923859Sml29623 param_dump_mac_regs, 1933859Sml29623 param_dump_ipp_regs, 1943859Sml29623 param_dump_fflp_regs, 1953859Sml29623 param_dump_vlan_table, 1963859Sml29623 param_dump_rdc_table, 1973859Sml29623 param_dump_ptrs, 1983859Sml29623 param_end 1993859Sml29623 } nxge_param_index_t; 2003859Sml29623 2016495Sspeer typedef enum { 2026495Sspeer SOLARIS_DOMAIN, 2036495Sspeer SOLARIS_SERVICE_DOMAIN, 2046495Sspeer SOLARIS_GUEST_DOMAIN, 2056495Sspeer LINUX_SERVICE_DOMAIN, 2066495Sspeer LINUX_GUEST_DOMAIN 2076495Sspeer } nxge_environs_t; 2083859Sml29623 2093859Sml29623 /* 2103859Sml29623 * Named Dispatch Parameter Management Structure 2113859Sml29623 */ 2123859Sml29623 typedef int (*nxge_ndgetf_t)(p_nxge_t, queue_t *, MBLKP, caddr_t, cred_t *); 2133859Sml29623 typedef int (*nxge_ndsetf_t)(p_nxge_t, queue_t *, 2143859Sml29623 MBLKP, char *, caddr_t, cred_t *); 2153859Sml29623 2163859Sml29623 #define NXGE_PARAM_READ 0x00000001ULL 2173859Sml29623 #define NXGE_PARAM_WRITE 0x00000002ULL 2183859Sml29623 #define NXGE_PARAM_SHARED 0x00000004ULL 2193859Sml29623 #define NXGE_PARAM_PRIV 0x00000008ULL 2203859Sml29623 #define NXGE_PARAM_RW NXGE_PARAM_READ | NXGE_PARAM_WRITE 2213859Sml29623 #define NXGE_PARAM_RWS NXGE_PARAM_RW | NXGE_PARAM_SHARED 2223859Sml29623 #define NXGE_PARAM_RWP NXGE_PARAM_RW | NXGE_PARAM_PRIV 2233859Sml29623 2243859Sml29623 #define NXGE_PARAM_RXDMA 0x00000010ULL 2253859Sml29623 #define NXGE_PARAM_TXDMA 0x00000020ULL 2263859Sml29623 #define NXGE_PARAM_CLASS_GEN 0x00000040ULL 2273859Sml29623 #define NXGE_PARAM_MAC 0x00000080ULL 2283859Sml29623 #define NXGE_PARAM_CLASS_BIN NXGE_PARAM_CLASS_GEN | NXGE_PARAM_BASE_BIN 2293859Sml29623 #define NXGE_PARAM_CLASS_HEX NXGE_PARAM_CLASS_GEN | NXGE_PARAM_BASE_HEX 2303859Sml29623 #define NXGE_PARAM_CLASS NXGE_PARAM_CLASS_HEX 2313859Sml29623 2323859Sml29623 #define NXGE_PARAM_CMPLX 0x00010000ULL 2333859Sml29623 #define NXGE_PARAM_NDD_WR_OK 0x00020000ULL 2343859Sml29623 #define NXGE_PARAM_INIT_ONLY 0x00040000ULL 2353859Sml29623 #define NXGE_PARAM_INIT_CONFIG 0x00080000ULL 2363859Sml29623 2373859Sml29623 #define NXGE_PARAM_READ_PROP 0x00100000ULL 2383859Sml29623 #define NXGE_PARAM_PROP_ARR32 0x00200000ULL 2393859Sml29623 #define NXGE_PARAM_PROP_ARR64 0x00400000ULL 2403859Sml29623 #define NXGE_PARAM_PROP_STR 0x00800000ULL 2413859Sml29623 2423859Sml29623 #define NXGE_PARAM_BASE_DEC 0x00000000ULL 2433859Sml29623 #define NXGE_PARAM_BASE_BIN 0x10000000ULL 2443859Sml29623 #define NXGE_PARAM_BASE_HEX 0x20000000ULL 2453859Sml29623 #define NXGE_PARAM_BASE_STR 0x40000000ULL 2463859Sml29623 #define NXGE_PARAM_DONT_SHOW 0x80000000ULL 2473859Sml29623 2483859Sml29623 #define NXGE_PARAM_ARRAY_CNT_MASK 0x0000ffff00000000ULL 2493859Sml29623 #define NXGE_PARAM_ARRAY_CNT_SHIFT 32ULL 2503859Sml29623 #define NXGE_PARAM_ARRAY_ALLOC_MASK 0xffff000000000000ULL 2513859Sml29623 #define NXGE_PARAM_ARRAY_ALLOC_SHIFT 48ULL 2523859Sml29623 2533859Sml29623 typedef struct _nxge_param_t { 2543859Sml29623 int (*getf)(); 2553859Sml29623 int (*setf)(); /* null for read only */ 2563859Sml29623 uint64_t type; /* R/W/ Common/Port/ .... */ 2573859Sml29623 uint64_t minimum; 2583859Sml29623 uint64_t maximum; 2593859Sml29623 uint64_t value; /* for array params, pointer to value array */ 2603859Sml29623 uint64_t old_value; /* for array params, pointer to old_value array */ 2613859Sml29623 char *fcode_name; 2623859Sml29623 char *name; 2633859Sml29623 } nxge_param_t, *p_nxge_param_t; 2643859Sml29623 2653859Sml29623 2666075Ssbehera /* 2676075Ssbehera * Do not change the order of the elements of this enum as that will 2686075Ssbehera * break the driver code. 2696075Ssbehera */ 2703859Sml29623 typedef enum { 2713859Sml29623 nxge_lb_normal, 2723859Sml29623 nxge_lb_ext10g, 2733859Sml29623 nxge_lb_ext1000, 2743859Sml29623 nxge_lb_ext100, 2753859Sml29623 nxge_lb_ext10, 2763859Sml29623 nxge_lb_phy10g, 2773859Sml29623 nxge_lb_phy1000, 2783859Sml29623 nxge_lb_phy, 2793859Sml29623 nxge_lb_serdes10g, 2803859Sml29623 nxge_lb_serdes1000, 2813859Sml29623 nxge_lb_serdes, 2823859Sml29623 nxge_lb_mac10g, 2833859Sml29623 nxge_lb_mac1000, 2843859Sml29623 nxge_lb_mac 2853859Sml29623 } nxge_lb_t; 2863859Sml29623 2873859Sml29623 enum nxge_mac_state { 2883859Sml29623 NXGE_MAC_STOPPED = 0, 2896495Sspeer NXGE_MAC_STARTED, 2906495Sspeer NXGE_MAC_STOPPING 2913859Sml29623 }; 2923859Sml29623 2933859Sml29623 /* 2943859Sml29623 * Private DLPI full dlsap address format. 2953859Sml29623 */ 2963859Sml29623 typedef struct _nxge_dladdr_t { 2973859Sml29623 ether_addr_st dl_phys; 2983859Sml29623 uint16_t dl_sap; 2993859Sml29623 } nxge_dladdr_t, *p_nxge_dladdr_t; 3003859Sml29623 3013859Sml29623 typedef struct _mc_addr_t { 3023859Sml29623 ether_addr_st multcast_addr; 3033859Sml29623 uint_t mc_addr_cnt; 3043859Sml29623 } mc_addr_t, *p_mc_addr_t; 3053859Sml29623 3063859Sml29623 typedef struct _mc_bucket_t { 3073859Sml29623 p_mc_addr_t addr_list; 3083859Sml29623 uint_t list_size; 3093859Sml29623 } mc_bucket_t, *p_mc_bucket_t; 3103859Sml29623 3113859Sml29623 typedef struct _mc_table_t { 3123859Sml29623 p_mc_bucket_t bucket_list; 3133859Sml29623 uint_t buckets_used; 3143859Sml29623 } mc_table_t, *p_mc_table_t; 3153859Sml29623 3163859Sml29623 typedef struct _filter_t { 3173859Sml29623 uint32_t all_phys_cnt; 3183859Sml29623 uint32_t all_multicast_cnt; 3193859Sml29623 uint32_t all_sap_cnt; 3203859Sml29623 } filter_t, *p_filter_t; 3213859Sml29623 3223859Sml29623 typedef struct _nxge_port_stats_t { 3233859Sml29623 /* 3243859Sml29623 * Overall structure size 3253859Sml29623 */ 3263859Sml29623 size_t stats_size; 3273859Sml29623 3283859Sml29623 /* 3293859Sml29623 * Link Input/Output stats 3303859Sml29623 */ 3313859Sml29623 uint64_t ipackets; 3323859Sml29623 uint64_t ierrors; 3333859Sml29623 uint64_t opackets; 3343859Sml29623 uint64_t oerrors; 3353859Sml29623 uint64_t collisions; 3363859Sml29623 3373859Sml29623 /* 3383859Sml29623 * MIB II variables 3393859Sml29623 */ 3403859Sml29623 uint64_t rbytes; /* # bytes received */ 3413859Sml29623 uint64_t obytes; /* # bytes transmitted */ 3423859Sml29623 uint32_t multircv; /* # multicast packets received */ 3433859Sml29623 uint32_t multixmt; /* # multicast packets for xmit */ 3443859Sml29623 uint32_t brdcstrcv; /* # broadcast packets received */ 3453859Sml29623 uint32_t brdcstxmt; /* # broadcast packets for xmit */ 3463859Sml29623 uint32_t norcvbuf; /* # rcv packets discarded */ 3473859Sml29623 uint32_t noxmtbuf; /* # xmit packets discarded */ 3483859Sml29623 3493859Sml29623 /* 3503859Sml29623 * Lets the user know the MTU currently in use by 3513859Sml29623 * the physical MAC port. 3523859Sml29623 */ 3533859Sml29623 nxge_lb_t lb_mode; 3543859Sml29623 uint32_t qos_mode; 3553859Sml29623 uint32_t trunk_mode; 3563859Sml29623 uint32_t poll_mode; 3573859Sml29623 3583859Sml29623 /* 3593859Sml29623 * Tx Statistics. 3603859Sml29623 */ 3613859Sml29623 uint32_t tx_inits; 3623859Sml29623 uint32_t tx_starts; 3633859Sml29623 uint32_t tx_nocanput; 3643859Sml29623 uint32_t tx_msgdup_fail; 3653859Sml29623 uint32_t tx_allocb_fail; 3663859Sml29623 uint32_t tx_no_desc; 3673859Sml29623 uint32_t tx_dma_bind_fail; 3683859Sml29623 uint32_t tx_uflo; 3693859Sml29623 uint32_t tx_hdr_pkts; 3703859Sml29623 uint32_t tx_ddi_pkts; 3713859Sml29623 uint32_t tx_dvma_pkts; 3723859Sml29623 3733859Sml29623 uint32_t tx_max_pend; 3743859Sml29623 3753859Sml29623 /* 3763859Sml29623 * Rx Statistics. 3773859Sml29623 */ 3783859Sml29623 uint32_t rx_inits; 3793859Sml29623 uint32_t rx_hdr_pkts; 3803859Sml29623 uint32_t rx_mtu_pkts; 3813859Sml29623 uint32_t rx_split_pkts; 3823859Sml29623 uint32_t rx_no_buf; 3833859Sml29623 uint32_t rx_no_comp_wb; 3843859Sml29623 uint32_t rx_ov_flow; 3853859Sml29623 uint32_t rx_len_mm; 3863859Sml29623 uint32_t rx_tag_err; 3873859Sml29623 uint32_t rx_nocanput; 3883859Sml29623 uint32_t rx_msgdup_fail; 3893859Sml29623 uint32_t rx_allocb_fail; 3903859Sml29623 3913859Sml29623 /* 3923859Sml29623 * Receive buffer management statistics. 3933859Sml29623 */ 3943859Sml29623 uint32_t rx_new_pages; 3953859Sml29623 uint32_t rx_new_hdr_pgs; 3963859Sml29623 uint32_t rx_new_mtu_pgs; 3973859Sml29623 uint32_t rx_new_nxt_pgs; 3983859Sml29623 uint32_t rx_reused_pgs; 3993859Sml29623 uint32_t rx_hdr_drops; 4003859Sml29623 uint32_t rx_mtu_drops; 4013859Sml29623 uint32_t rx_nxt_drops; 4023859Sml29623 4033859Sml29623 /* 4043859Sml29623 * Receive flow statistics 4053859Sml29623 */ 4063859Sml29623 uint32_t rx_rel_flow; 4073859Sml29623 uint32_t rx_rel_bit; 4083859Sml29623 4093859Sml29623 uint32_t rx_pkts_dropped; 4103859Sml29623 4113859Sml29623 /* 4123859Sml29623 * PCI-E Bus Statistics. 4133859Sml29623 */ 4143859Sml29623 uint32_t pci_bus_speed; 4153859Sml29623 uint32_t pci_err; 4163859Sml29623 uint32_t pci_rta_err; 4173859Sml29623 uint32_t pci_rma_err; 4183859Sml29623 uint32_t pci_parity_err; 4193859Sml29623 uint32_t pci_bad_ack_err; 4203859Sml29623 uint32_t pci_drto_err; 4213859Sml29623 uint32_t pci_dmawz_err; 4223859Sml29623 uint32_t pci_dmarz_err; 4233859Sml29623 4243859Sml29623 uint32_t rx_taskq_waits; 4253859Sml29623 4263859Sml29623 uint32_t tx_jumbo_pkts; 4273859Sml29623 4283859Sml29623 /* 4293859Sml29623 * Some statistics added to support bringup, these 4303859Sml29623 * should be removed. 4313859Sml29623 */ 4323859Sml29623 uint32_t user_defined; 4333859Sml29623 } nxge_port_stats_t, *p_nxge_port_stats_t; 4343859Sml29623 4353859Sml29623 4363859Sml29623 typedef struct _nxge_stats_t { 4373859Sml29623 /* 4383859Sml29623 * Overall structure size 4393859Sml29623 */ 4403859Sml29623 size_t stats_size; 4413859Sml29623 4423859Sml29623 kstat_t *ksp; 4433859Sml29623 kstat_t *rdc_ksp[NXGE_MAX_RDCS]; 4443859Sml29623 kstat_t *tdc_ksp[NXGE_MAX_TDCS]; 4453859Sml29623 kstat_t *rdc_sys_ksp; 4463859Sml29623 kstat_t *fflp_ksp[1]; 4473859Sml29623 kstat_t *ipp_ksp; 4483859Sml29623 kstat_t *txc_ksp; 4493859Sml29623 kstat_t *mac_ksp; 4503859Sml29623 kstat_t *zcp_ksp; 4513859Sml29623 kstat_t *port_ksp; 4523859Sml29623 kstat_t *mmac_ksp; 4533859Sml29623 4543859Sml29623 nxge_mac_stats_t mac_stats; /* Common MAC Statistics */ 4553859Sml29623 nxge_xmac_stats_t xmac_stats; /* XMAC Statistics */ 4563859Sml29623 nxge_bmac_stats_t bmac_stats; /* BMAC Statistics */ 4573859Sml29623 4583859Sml29623 nxge_rx_ring_stats_t rx_stats; /* per port RX stats */ 4593859Sml29623 nxge_ipp_stats_t ipp_stats; /* per port IPP stats */ 4603859Sml29623 nxge_zcp_stats_t zcp_stats; /* per port IPP stats */ 4613859Sml29623 nxge_rx_ring_stats_t rdc_stats[NXGE_MAX_RDCS]; /* per rdc stats */ 4623859Sml29623 nxge_rdc_sys_stats_t rdc_sys_stats; /* per port RDC stats */ 4633859Sml29623 4643859Sml29623 nxge_tx_ring_stats_t tx_stats; /* per port TX stats */ 4653859Sml29623 nxge_txc_stats_t txc_stats; /* per port TX stats */ 4663859Sml29623 nxge_tx_ring_stats_t tdc_stats[NXGE_MAX_TDCS]; /* per tdc stats */ 4673859Sml29623 nxge_fflp_stats_t fflp_stats; /* fflp stats */ 4683859Sml29623 nxge_port_stats_t port_stats; /* fflp stats */ 4693859Sml29623 nxge_mmac_stats_t mmac_stats; /* Multi mac. stats */ 4703859Sml29623 4713859Sml29623 } nxge_stats_t, *p_nxge_stats_t; 4723859Sml29623 4733859Sml29623 typedef struct _nxge_intr_t { 4743859Sml29623 boolean_t intr_registered; /* interrupts are registered */ 4753859Sml29623 boolean_t intr_enabled; /* interrupts are enabled */ 4763859Sml29623 boolean_t niu_msi_enable; /* debug or configurable? */ 4773859Sml29623 int intr_types; /* interrupt types supported */ 4783859Sml29623 int intr_type; /* interrupt type to add */ 4793859Sml29623 int max_int_cnt; /* max MSIX/INT HW supports */ 4803859Sml29623 int start_inum; /* start inum (in sequence?) */ 4813859Sml29623 int msi_intx_cnt; /* # msi/intx ints returned */ 4823859Sml29623 int intr_added; /* # ints actually needed */ 4833859Sml29623 int intr_cap; /* interrupt capabilities */ 4843859Sml29623 size_t intr_size; /* size of array to allocate */ 4853859Sml29623 ddi_intr_handle_t *htable; /* For array of interrupts */ 4863859Sml29623 /* Add interrupt number for each interrupt vector */ 4873859Sml29623 int pri; 4883859Sml29623 } nxge_intr_t, *p_nxge_intr_t; 4893859Sml29623 4903859Sml29623 typedef struct _nxge_ldgv_t { 4913859Sml29623 uint8_t ndma_ldvs; 4923859Sml29623 uint8_t nldvs; 4933859Sml29623 uint8_t maxldgs; 4943859Sml29623 uint8_t maxldvs; 4953859Sml29623 uint8_t ldg_intrs; 4963859Sml29623 uint32_t tmres; 4973859Sml29623 p_nxge_ldg_t ldgp; 4983859Sml29623 p_nxge_ldv_t ldvp; 4993859Sml29623 p_nxge_ldv_t ldvp_syserr; 5007466SMisaki.Kataoka@Sun.COM int ldvp_syserr_allocated; 5013859Sml29623 } nxge_ldgv_t, *p_nxge_ldgv_t; 5023859Sml29623 5036495Sspeer typedef enum { 5046495Sspeer NXGE_TRANSMIT_GROUP, /* Legacy transmit group */ 5056495Sspeer NXGE_RECEIVE_GROUP, /* Legacy receive group */ 5066495Sspeer NXGE_VR_GROUP, /* Virtualization Region group */ 5076495Sspeer EXT_TRANSMIT_GROUP, /* External (Crossbow) transmit group */ 5086495Sspeer EXT_RECEIVE_GROUP /* External (Crossbow) receive group */ 5096495Sspeer } nxge_grp_type_t; 5106495Sspeer 5116495Sspeer #define NXGE_ILLEGAL_CHANNEL (NXGE_MAX_TDCS + 1) 5126495Sspeer 5136495Sspeer typedef uint8_t nxge_channel_t; 5146495Sspeer 5156495Sspeer typedef struct nxge_grp { 5166495Sspeer nxge_t *nxge; 5176495Sspeer nxge_grp_type_t type; /* Tx or Rx */ 5186495Sspeer 5196495Sspeer int sequence; /* When it was created. */ 5206495Sspeer int index; /* nxge_grp_set_t.group[index] */ 5216495Sspeer 5226495Sspeer struct nx_dc *dc; /* Linked list of DMA channels. */ 5236495Sspeer size_t count; /* A count of <dc> above. */ 5246495Sspeer 5256495Sspeer boolean_t active; /* Is it being used? */ 5266495Sspeer 5276495Sspeer dc_map_t map; /* A bitmap of the channels in <dc>. */ 5286495Sspeer nxge_channel_t legend[NXGE_MAX_TDCS]; 5296495Sspeer 5306495Sspeer } nxge_grp_t; 5316495Sspeer 5326495Sspeer typedef struct { 5336495Sspeer lg_map_t map; 5346495Sspeer size_t count; 5356495Sspeer } lg_data_t; 5366495Sspeer 5376495Sspeer typedef struct { 5386495Sspeer dc_map_t map; 5396495Sspeer size_t count; 5406495Sspeer } dc_data_t; 5416495Sspeer 5426495Sspeer #define NXGE_DC_SET(map, channel) map |= (1 << channel) 5436495Sspeer #define NXGE_DC_RESET(map, channel) map &= (~(1 << channel)) 5446495Sspeer 5456495Sspeer #define NXGE_LOGICAL_GROUP_MAX NXGE_MAX_TDCS 5466495Sspeer 5476495Sspeer typedef struct { 5486495Sspeer int sequence; /* To order groups in time. */ 5496495Sspeer 5506495Sspeer /* These are this instance's logical groups. */ 5516495Sspeer nxge_grp_t *group[NXGE_LOGICAL_GROUP_MAX]; 5526495Sspeer lg_data_t lg; 5536495Sspeer 5546495Sspeer dc_data_t shared; /* These DCs are being shared. */ 5556495Sspeer dc_data_t owned; /* These DCs belong to me. */ 5566495Sspeer dc_data_t dead; /* These DCs are in an error state. */ 5576495Sspeer 5586495Sspeer } nxge_grp_set_t; 5596495Sspeer 5606495Sspeer /* 5616495Sspeer * Receive Ring Group 5626495Sspeer * One of the advanced virtualization features is the ability to bundle 5636495Sspeer * multiple Receive Rings in a single group. One or more MAC addresses may 5646495Sspeer * be assigned to a group. Incoming packets destined to the group's MAC 5656495Sspeer * address(es) are delivered to any ring member, according to a programmable 5666495Sspeer * or predefined RTS policy. Member rings can be polled individually. 5676495Sspeer * RX ring groups can come with a predefined set of member rings, or they 5686495Sspeer * are programmable by adding and removing rings to/from them. 5696495Sspeer */ 5706495Sspeer typedef struct _nxge_rx_ring_group_t { 5716495Sspeer mac_group_handle_t ghandle; 5726495Sspeer p_nxge_t nxgep; 5736495Sspeer int gindex; 5746495Sspeer int sindex; 5756495Sspeer } nxge_rx_ring_group_t; 5766495Sspeer 5776495Sspeer /* 5786495Sspeer * Ring Handle 5796495Sspeer */ 5806495Sspeer typedef struct _nxge_ring_handle_t { 5816495Sspeer p_nxge_t nxgep; 5826495Sspeer int index; /* port-wise */ 5836495Sspeer mac_ring_handle_t ring_handle; 5846495Sspeer } nxge_ring_handle_t; 5856495Sspeer 5866495Sspeer /* 5876495Sspeer * Share Handle 5886495Sspeer */ 5896495Sspeer typedef struct _nxge_share_handle_t { 5906495Sspeer p_nxge_t nxgep; /* Driver Handle */ 5916495Sspeer int index; 5926495Sspeer void *vrp; 5936495Sspeer uint64_t tmap; 5946495Sspeer uint64_t rmap; 5956495Sspeer int rxgroup; 5966495Sspeer boolean_t active; 5976495Sspeer } nxge_share_handle_t; 5986495Sspeer 5993859Sml29623 /* 6003859Sml29623 * Neptune Device instance state information. 6013859Sml29623 * 6023859Sml29623 * Each instance is dynamically allocated on first attach. 6033859Sml29623 */ 6043859Sml29623 struct _nxge_t { 6053859Sml29623 dev_info_t *dip; /* device instance */ 6063859Sml29623 dev_info_t *p_dip; /* Parent's device instance */ 6073859Sml29623 int instance; /* instance number */ 6083859Sml29623 int function_num; /* device function number */ 6093859Sml29623 int nports; /* # of ports on this device */ 6103859Sml29623 int board_ver; /* Board Version */ 6113859Sml29623 int use_partition; /* partition is enabled */ 6123859Sml29623 uint32_t drv_state; /* driver state bit flags */ 6133859Sml29623 uint64_t nxge_debug_level; /* driver state bit flags */ 6143859Sml29623 kmutex_t genlock[1]; 6153859Sml29623 enum nxge_mac_state nxge_mac_state; 6163859Sml29623 ddi_softintr_t resched_id; /* reschedule callback */ 6173859Sml29623 boolean_t resched_needed; 6183859Sml29623 boolean_t resched_running; 6193859Sml29623 6203859Sml29623 p_dev_regs_t dev_regs; 6213859Sml29623 npi_handle_t npi_handle; 6223859Sml29623 npi_handle_t npi_pci_handle; 6233859Sml29623 npi_handle_t npi_reg_handle; 6243859Sml29623 npi_handle_t npi_msi_handle; 6253859Sml29623 npi_handle_t npi_vreg_handle; 6263859Sml29623 npi_handle_t npi_v2reg_handle; 6273859Sml29623 6284732Sdavemq nxge_xcvr_table_t xcvr; 6295572Ssbehera boolean_t hot_swappable_phy; 6305572Ssbehera boolean_t phy_absent; 6315572Ssbehera uint32_t xcvr_addr; 6325572Ssbehera uint16_t chip_id; 6333859Sml29623 nxge_mac_t mac; 6343859Sml29623 nxge_ipp_t ipp; 6353859Sml29623 nxge_txc_t txc; 6363859Sml29623 nxge_classify_t classifier; 6373859Sml29623 6383859Sml29623 mac_handle_t mach; /* mac module handle */ 6393859Sml29623 p_nxge_stats_t statsp; 6403859Sml29623 uint32_t param_count; 6413859Sml29623 p_nxge_param_t param_arr; 6426439Sml29623 6436439Sml29623 uint32_t param_en_pause:1, 6446439Sml29623 param_en_asym_pause:1, 6456439Sml29623 param_en_1000fdx:1, 6466439Sml29623 param_en_100fdx:1, 6476439Sml29623 param_en_10fdx:1, 6486439Sml29623 param_pad_to_32:27; 6496439Sml29623 6503859Sml29623 nxge_hw_list_t *nxge_hw_p; /* pointer to per Neptune */ 6513859Sml29623 niu_type_t niu_type; 6524977Sraghus platform_type_t platform_type; 6533859Sml29623 boolean_t os_addr_mode32; /* set to 1 for 32 bit mode */ 6546495Sspeer 6553859Sml29623 uint8_t def_rdc; 6563859Sml29623 6573859Sml29623 nxge_intr_t nxge_intr_type; 6583859Sml29623 nxge_dma_pt_cfg_t pt_config; 6593859Sml29623 nxge_class_pt_cfg_t class_config; 6603859Sml29623 6613859Sml29623 /* Logical device and group data structures. */ 6623859Sml29623 p_nxge_ldgv_t ldgvp; 6633859Sml29623 6644185Sspeer npi_vpd_info_t vpd_info; 6653859Sml29623 6663859Sml29623 ether_addr_st factaddr; /* factory mac address */ 6673859Sml29623 ether_addr_st ouraddr; /* individual address */ 6683859Sml29623 kmutex_t ouraddr_lock; /* lock to protect to uradd */ 6693859Sml29623 6703859Sml29623 ddi_iblock_cookie_t interrupt_cookie; 6713859Sml29623 6723859Sml29623 /* 6733859Sml29623 * Blocks of memory may be pre-allocated by the 6743859Sml29623 * partition manager or the driver. They may include 6753859Sml29623 * blocks for configuration and buffers. The idea is 6763859Sml29623 * to preallocate big blocks of contiguous areas in 6773859Sml29623 * system memory (i.e. with IOMMU). These blocks then 6783859Sml29623 * will be broken up to a fixed number of blocks with 6793859Sml29623 * each block having the same block size (4K, 8K, 16K or 6803859Sml29623 * 32K) in the case of buffer blocks. For systems that 6813859Sml29623 * do not support DVMA, more than one big block will be 6823859Sml29623 * allocated. 6833859Sml29623 */ 6843859Sml29623 uint32_t rx_default_block_size; 6853859Sml29623 nxge_rx_block_size_t rx_bksize_code; 6863859Sml29623 6873859Sml29623 p_nxge_dma_pool_t rx_buf_pool_p; 6883859Sml29623 p_nxge_dma_pool_t rx_cntl_pool_p; 6893859Sml29623 6903859Sml29623 p_nxge_dma_pool_t tx_buf_pool_p; 6913859Sml29623 p_nxge_dma_pool_t tx_cntl_pool_p; 6923859Sml29623 6933859Sml29623 /* Receive buffer block ring and completion ring. */ 6943859Sml29623 p_rx_rbr_rings_t rx_rbr_rings; 6953859Sml29623 p_rx_rcr_rings_t rx_rcr_rings; 6963859Sml29623 p_rx_mbox_areas_t rx_mbox_areas_p; 6973859Sml29623 6983859Sml29623 uint32_t start_rdc; 6993859Sml29623 uint32_t max_rdcs; 7003859Sml29623 uint32_t rdc_mask; 7013859Sml29623 7023859Sml29623 /* Transmit descriptors rings */ 7033859Sml29623 p_tx_rings_t tx_rings; 7043859Sml29623 p_tx_mbox_areas_t tx_mbox_areas_p; 7053859Sml29623 7063859Sml29623 uint32_t start_tdc; 7073859Sml29623 uint32_t max_tdcs; 7083859Sml29623 7093859Sml29623 ddi_dma_handle_t dmasparehandle; 7103859Sml29623 7113859Sml29623 ulong_t sys_page_sz; 7123859Sml29623 ulong_t sys_page_mask; 7133859Sml29623 int suspended; 7143859Sml29623 7153859Sml29623 mii_bmsr_t bmsr; /* xcvr status at last poll. */ 7163859Sml29623 mii_bmsr_t soft_bmsr; /* xcvr status kept by SW. */ 7173859Sml29623 7183859Sml29623 kmutex_t mif_lock; /* Lock to protect the list. */ 7193859Sml29623 7203859Sml29623 void (*mii_read)(); 7213859Sml29623 void (*mii_write)(); 7223859Sml29623 void (*mii_poll)(); 7233859Sml29623 filter_t filter; /* Current instance filter */ 7243859Sml29623 p_hash_filter_t hash_filter; /* Multicast hash filter. */ 7253859Sml29623 krwlock_t filter_lock; /* Lock to protect filters. */ 7263859Sml29623 7273859Sml29623 ulong_t sys_burst_sz; 7283859Sml29623 7293859Sml29623 uint8_t cache_line; 7303859Sml29623 7313859Sml29623 timeout_id_t nxge_link_poll_timerid; 7323859Sml29623 timeout_id_t nxge_timerid; 7333859Sml29623 7343859Sml29623 uint_t need_periodic_reclaim; 7353859Sml29623 timeout_id_t reclaim_timer; 7363859Sml29623 7373859Sml29623 uint8_t msg_min; 7383859Sml29623 uint8_t crc_size; 7393859Sml29623 7403859Sml29623 boolean_t hard_props_read; 7413859Sml29623 7423859Sml29623 uint32_t nxge_ncpus; 7433859Sml29623 uint16_t intr_timeout; 7443859Sml29623 uint16_t intr_threshold; 7453859Sml29623 7463859Sml29623 int fm_capabilities; /* FMA capabilities */ 7473859Sml29623 7483859Sml29623 uint32_t nxge_port_rbr_size; 7496495Sspeer uint32_t nxge_port_rbr_spare_size; 7503859Sml29623 uint32_t nxge_port_rcr_size; 7516495Sspeer uint32_t nxge_port_rx_cntl_alloc_size; 7523859Sml29623 uint32_t nxge_port_tx_ring_size; 7533859Sml29623 nxge_mmac_t nxge_mmac_info; 7543859Sml29623 #if defined(sun4v) 7553859Sml29623 boolean_t niu_hsvc_available; 7563859Sml29623 hsvc_info_t niu_hsvc; 7573859Sml29623 uint64_t niu_min_ver; 7583859Sml29623 #endif 7593859Sml29623 boolean_t link_notify; 7604693Stm144005 7614693Stm144005 kmutex_t poll_lock; 7624693Stm144005 kcondvar_t poll_cv; 7634693Stm144005 link_mon_enable_t poll_state; 7644693Stm144005 #define NXGE_MAGIC 0x3ab434e3 7654693Stm144005 uint32_t nxge_magic; 7666003Sml29623 7676003Sml29623 int soft_lso_enable; 7686495Sspeer /* The following fields are LDOMs-specific additions. */ 7696495Sspeer nxge_environs_t environs; 7706495Sspeer ether_addr_t hio_mac_addr; 7716495Sspeer uint32_t niu_cfg_hdl; 7726495Sspeer kmutex_t group_lock; 7736495Sspeer 7746495Sspeer struct nxge_hio_vr *hio_vr; 7756495Sspeer 7766495Sspeer nxge_grp_set_t rx_set; 7776495Sspeer nxge_grp_set_t tx_set; 778*7812SMichael.Speer@Sun.COM boolean_t tdc_is_shared[NXGE_MAX_TDCS]; 7796495Sspeer 7806495Sspeer nxge_rx_ring_group_t rx_hio_groups[NXGE_MAX_RDC_GROUPS]; 7816495Sspeer nxge_share_handle_t shares[NXGE_MAX_VRS]; 7823859Sml29623 }; 7833859Sml29623 7843859Sml29623 /* 7853859Sml29623 * Driver state flags. 7863859Sml29623 */ 7873859Sml29623 #define STATE_REGS_MAPPED 0x000000001 /* device registers mapped */ 7883859Sml29623 #define STATE_KSTATS_SETUP 0x000000002 /* kstats allocated */ 7893859Sml29623 #define STATE_NODE_CREATED 0x000000004 /* device node created */ 7903859Sml29623 #define STATE_HW_CONFIG_CREATED 0x000000008 /* hardware properties */ 7913859Sml29623 #define STATE_HW_INITIALIZED 0x000000010 /* hardware initialized */ 7923859Sml29623 #define STATE_MDIO_LOCK_INIT 0x000000020 /* mdio lock initialized */ 7933859Sml29623 #define STATE_MII_LOCK_INIT 0x000000040 /* mii lock initialized */ 7943859Sml29623 7953859Sml29623 #define STOP_POLL_THRESH 9 7963859Sml29623 #define START_POLL_THRESH 2 7973859Sml29623 7983859Sml29623 typedef struct _nxge_port_kstat_t { 7993859Sml29623 /* 8003859Sml29623 * Transciever state informations. 8013859Sml29623 */ 8023859Sml29623 kstat_named_t xcvr_inits; 8033859Sml29623 kstat_named_t xcvr_inuse; 8043859Sml29623 kstat_named_t xcvr_addr; 8053859Sml29623 kstat_named_t xcvr_id; 8063859Sml29623 kstat_named_t cap_autoneg; 8073859Sml29623 kstat_named_t cap_10gfdx; 8083859Sml29623 kstat_named_t cap_10ghdx; 8093859Sml29623 kstat_named_t cap_1000fdx; 8103859Sml29623 kstat_named_t cap_1000hdx; 8113859Sml29623 kstat_named_t cap_100T4; 8123859Sml29623 kstat_named_t cap_100fdx; 8133859Sml29623 kstat_named_t cap_100hdx; 8143859Sml29623 kstat_named_t cap_10fdx; 8153859Sml29623 kstat_named_t cap_10hdx; 8163859Sml29623 kstat_named_t cap_asmpause; 8173859Sml29623 kstat_named_t cap_pause; 8183859Sml29623 8193859Sml29623 /* 8203859Sml29623 * Link partner capabilities. 8213859Sml29623 */ 8223859Sml29623 kstat_named_t lp_cap_autoneg; 8233859Sml29623 kstat_named_t lp_cap_10gfdx; 8243859Sml29623 kstat_named_t lp_cap_10ghdx; 8253859Sml29623 kstat_named_t lp_cap_1000fdx; 8263859Sml29623 kstat_named_t lp_cap_1000hdx; 8273859Sml29623 kstat_named_t lp_cap_100T4; 8283859Sml29623 kstat_named_t lp_cap_100fdx; 8293859Sml29623 kstat_named_t lp_cap_100hdx; 8303859Sml29623 kstat_named_t lp_cap_10fdx; 8313859Sml29623 kstat_named_t lp_cap_10hdx; 8323859Sml29623 kstat_named_t lp_cap_asmpause; 8333859Sml29623 kstat_named_t lp_cap_pause; 8343859Sml29623 8353859Sml29623 /* 8363859Sml29623 * Shared link setup. 8373859Sml29623 */ 8383859Sml29623 kstat_named_t link_T4; 8393859Sml29623 kstat_named_t link_speed; 8403859Sml29623 kstat_named_t link_duplex; 8413859Sml29623 kstat_named_t link_asmpause; 8423859Sml29623 kstat_named_t link_pause; 8433859Sml29623 kstat_named_t link_up; 8443859Sml29623 8453859Sml29623 /* 8463859Sml29623 * Lets the user know the MTU currently in use by 8473859Sml29623 * the physical MAC port. 8483859Sml29623 */ 8493859Sml29623 kstat_named_t mac_mtu; 8503859Sml29623 kstat_named_t lb_mode; 8513859Sml29623 kstat_named_t qos_mode; 8523859Sml29623 kstat_named_t trunk_mode; 8533859Sml29623 8543859Sml29623 /* 8553859Sml29623 * Misc MAC statistics. 8563859Sml29623 */ 8573859Sml29623 kstat_named_t ifspeed; 8583859Sml29623 kstat_named_t promisc; 8593859Sml29623 kstat_named_t rev_id; 8603859Sml29623 8613859Sml29623 /* 8623859Sml29623 * Some statistics added to support bringup, these 8633859Sml29623 * should be removed. 8643859Sml29623 */ 8653859Sml29623 kstat_named_t user_defined; 8663859Sml29623 } nxge_port_kstat_t, *p_nxge_port_kstat_t; 8673859Sml29623 8683859Sml29623 typedef struct _nxge_rdc_kstat { 8693859Sml29623 /* 8703859Sml29623 * Receive DMA channel statistics. 8713859Sml29623 */ 8723859Sml29623 kstat_named_t ipackets; 8733859Sml29623 kstat_named_t rbytes; 8743859Sml29623 kstat_named_t errors; 8753859Sml29623 kstat_named_t dcf_err; 8763859Sml29623 kstat_named_t rcr_ack_err; 8773859Sml29623 8783859Sml29623 kstat_named_t dc_fifoflow_err; 8793859Sml29623 kstat_named_t rcr_sha_par_err; 8803859Sml29623 kstat_named_t rbr_pre_par_err; 8813859Sml29623 kstat_named_t wred_drop; 8823859Sml29623 kstat_named_t rbr_pre_emty; 8833859Sml29623 8843859Sml29623 kstat_named_t rcr_shadow_full; 8853859Sml29623 kstat_named_t rbr_tmout; 8863859Sml29623 kstat_named_t rsp_cnt_err; 8873859Sml29623 kstat_named_t byte_en_bus; 8883859Sml29623 kstat_named_t rsp_dat_err; 8893859Sml29623 8906028Ssbehera kstat_named_t pkt_too_long_err; 8913859Sml29623 kstat_named_t compl_l2_err; 8923859Sml29623 kstat_named_t compl_l4_cksum_err; 8933859Sml29623 kstat_named_t compl_zcp_soft_err; 8943859Sml29623 kstat_named_t compl_fflp_soft_err; 8953859Sml29623 kstat_named_t config_err; 8963859Sml29623 8973859Sml29623 kstat_named_t rcrincon; 8983859Sml29623 kstat_named_t rcrfull; 8993859Sml29623 kstat_named_t rbr_empty; 9003859Sml29623 kstat_named_t rbrfull; 9013859Sml29623 kstat_named_t rbrlogpage; 9023859Sml29623 9033859Sml29623 kstat_named_t cfiglogpage; 9043859Sml29623 kstat_named_t port_drop_pkt; 9053859Sml29623 kstat_named_t rcr_to; 9063859Sml29623 kstat_named_t rcr_thresh; 9073859Sml29623 kstat_named_t rcr_mex; 9083859Sml29623 kstat_named_t id_mismatch; 9093859Sml29623 kstat_named_t zcp_eop_err; 9103859Sml29623 kstat_named_t ipp_eop_err; 9113859Sml29623 } nxge_rdc_kstat_t, *p_nxge_rdc_kstat_t; 9123859Sml29623 9133859Sml29623 typedef struct _nxge_rdc_sys_kstat { 9143859Sml29623 /* 9153859Sml29623 * Receive DMA system statistics. 9163859Sml29623 */ 9173859Sml29623 kstat_named_t pre_par; 9183859Sml29623 kstat_named_t sha_par; 9193859Sml29623 kstat_named_t id_mismatch; 9203859Sml29623 kstat_named_t ipp_eop_err; 9213859Sml29623 kstat_named_t zcp_eop_err; 9223859Sml29623 } nxge_rdc_sys_kstat_t, *p_nxge_rdc_sys_kstat_t; 9233859Sml29623 9243859Sml29623 typedef struct _nxge_tdc_kstat { 9253859Sml29623 /* 9263859Sml29623 * Transmit DMA channel statistics. 9273859Sml29623 */ 9283859Sml29623 kstat_named_t opackets; 9293859Sml29623 kstat_named_t obytes; 9303859Sml29623 kstat_named_t oerrors; 9313859Sml29623 kstat_named_t tx_inits; 9323859Sml29623 kstat_named_t tx_no_buf; 9333859Sml29623 9343859Sml29623 kstat_named_t mbox_err; 9353859Sml29623 kstat_named_t pkt_size_err; 9363859Sml29623 kstat_named_t tx_ring_oflow; 9373859Sml29623 kstat_named_t pref_buf_ecc_err; 9383859Sml29623 kstat_named_t nack_pref; 9393859Sml29623 kstat_named_t nack_pkt_rd; 9403859Sml29623 kstat_named_t conf_part_err; 9413859Sml29623 kstat_named_t pkt_prt_err; 9423859Sml29623 kstat_named_t reset_fail; 9433859Sml29623 /* used to in the common (per port) counter */ 9443859Sml29623 9453859Sml29623 kstat_named_t tx_starts; 9463859Sml29623 kstat_named_t tx_nocanput; 9473859Sml29623 kstat_named_t tx_msgdup_fail; 9483859Sml29623 kstat_named_t tx_allocb_fail; 9493859Sml29623 kstat_named_t tx_no_desc; 9503859Sml29623 kstat_named_t tx_dma_bind_fail; 9513859Sml29623 kstat_named_t tx_uflo; 9523859Sml29623 kstat_named_t tx_hdr_pkts; 9533859Sml29623 kstat_named_t tx_ddi_pkts; 9543859Sml29623 kstat_named_t tx_dvma_pkts; 9553859Sml29623 kstat_named_t tx_max_pend; 9563859Sml29623 } nxge_tdc_kstat_t, *p_nxge_tdc_kstat_t; 9573859Sml29623 9583859Sml29623 typedef struct _nxge_txc_kstat { 9593859Sml29623 /* 9603859Sml29623 * Transmit port TXC block statistics. 9613859Sml29623 */ 9623859Sml29623 kstat_named_t pkt_stuffed; 9633859Sml29623 kstat_named_t pkt_xmit; 9643859Sml29623 kstat_named_t ro_correct_err; 9653859Sml29623 kstat_named_t ro_uncorrect_err; 9663859Sml29623 kstat_named_t sf_correct_err; 9673859Sml29623 kstat_named_t sf_uncorrect_err; 9683859Sml29623 kstat_named_t address_failed; 9693859Sml29623 kstat_named_t dma_failed; 9703859Sml29623 kstat_named_t length_failed; 9713859Sml29623 kstat_named_t pkt_assy_dead; 9723859Sml29623 kstat_named_t reorder_err; 9733859Sml29623 } nxge_txc_kstat_t, *p_nxge_txc_kstat_t; 9743859Sml29623 9753859Sml29623 typedef struct _nxge_ipp_kstat { 9763859Sml29623 /* 9773859Sml29623 * Receive port IPP block statistics. 9783859Sml29623 */ 9793859Sml29623 kstat_named_t eop_miss; 9803859Sml29623 kstat_named_t sop_miss; 9813859Sml29623 kstat_named_t dfifo_ue; 9823859Sml29623 kstat_named_t ecc_err_cnt; 9834439Sml29623 kstat_named_t pfifo_perr; 9843859Sml29623 kstat_named_t pfifo_over; 9853859Sml29623 kstat_named_t pfifo_und; 9863859Sml29623 kstat_named_t bad_cs_cnt; 9873859Sml29623 kstat_named_t pkt_dis_cnt; 9883859Sml29623 } nxge_ipp_kstat_t, *p_nxge_ipp_kstat_t; 9893859Sml29623 9903859Sml29623 typedef struct _nxge_zcp_kstat { 9913859Sml29623 /* 9923859Sml29623 * ZCP statistics. 9933859Sml29623 */ 9943859Sml29623 kstat_named_t errors; 9953859Sml29623 kstat_named_t inits; 9963859Sml29623 kstat_named_t rrfifo_underrun; 9973859Sml29623 kstat_named_t rrfifo_overrun; 9983859Sml29623 kstat_named_t rspfifo_uncorr_err; 9993859Sml29623 kstat_named_t buffer_overflow; 10003859Sml29623 kstat_named_t stat_tbl_perr; 10013859Sml29623 kstat_named_t dyn_tbl_perr; 10023859Sml29623 kstat_named_t buf_tbl_perr; 10033859Sml29623 kstat_named_t tt_program_err; 10043859Sml29623 kstat_named_t rsp_tt_index_err; 10053859Sml29623 kstat_named_t slv_tt_index_err; 10063859Sml29623 kstat_named_t zcp_tt_index_err; 10073859Sml29623 kstat_named_t access_fail; 10083859Sml29623 kstat_named_t cfifo_ecc; 10093859Sml29623 } nxge_zcp_kstat_t, *p_nxge_zcp_kstat_t; 10103859Sml29623 10113859Sml29623 typedef struct _nxge_mac_kstat { 10123859Sml29623 /* 10133859Sml29623 * Transmit MAC statistics. 10143859Sml29623 */ 10153859Sml29623 kstat_named_t tx_frame_cnt; 10163859Sml29623 kstat_named_t tx_underflow_err; 10173859Sml29623 kstat_named_t tx_overflow_err; 10183859Sml29623 kstat_named_t tx_maxpktsize_err; 10193859Sml29623 kstat_named_t tx_fifo_xfr_err; 10203859Sml29623 kstat_named_t tx_byte_cnt; 10213859Sml29623 10223859Sml29623 /* 10233859Sml29623 * Receive MAC statistics. 10243859Sml29623 */ 10253859Sml29623 kstat_named_t rx_frame_cnt; 10263859Sml29623 kstat_named_t rx_underflow_err; 10273859Sml29623 kstat_named_t rx_overflow_err; 10283859Sml29623 kstat_named_t rx_len_err_cnt; 10293859Sml29623 kstat_named_t rx_crc_err_cnt; 10303859Sml29623 kstat_named_t rx_viol_err_cnt; 10313859Sml29623 kstat_named_t rx_byte_cnt; 10323859Sml29623 kstat_named_t rx_hist1_cnt; 10333859Sml29623 kstat_named_t rx_hist2_cnt; 10343859Sml29623 kstat_named_t rx_hist3_cnt; 10353859Sml29623 kstat_named_t rx_hist4_cnt; 10363859Sml29623 kstat_named_t rx_hist5_cnt; 10373859Sml29623 kstat_named_t rx_hist6_cnt; 10386075Ssbehera kstat_named_t rx_hist7_cnt; 10393859Sml29623 kstat_named_t rx_broadcast_cnt; 10403859Sml29623 kstat_named_t rx_mult_cnt; 10413859Sml29623 kstat_named_t rx_frag_cnt; 10423859Sml29623 kstat_named_t rx_frame_align_err_cnt; 10433859Sml29623 kstat_named_t rx_linkfault_err_cnt; 10443859Sml29623 kstat_named_t rx_local_fault_err_cnt; 10453859Sml29623 kstat_named_t rx_remote_fault_err_cnt; 10463859Sml29623 } nxge_mac_kstat_t, *p_nxge_mac_kstat_t; 10473859Sml29623 10483859Sml29623 typedef struct _nxge_xmac_kstat { 10493859Sml29623 /* 10503859Sml29623 * XMAC statistics. 10513859Sml29623 */ 10523859Sml29623 kstat_named_t tx_frame_cnt; 10533859Sml29623 kstat_named_t tx_underflow_err; 10543859Sml29623 kstat_named_t tx_maxpktsize_err; 10553859Sml29623 kstat_named_t tx_overflow_err; 10563859Sml29623 kstat_named_t tx_fifo_xfr_err; 10573859Sml29623 kstat_named_t tx_byte_cnt; 10583859Sml29623 kstat_named_t rx_frame_cnt; 10593859Sml29623 kstat_named_t rx_underflow_err; 10603859Sml29623 kstat_named_t rx_overflow_err; 10613859Sml29623 kstat_named_t rx_crc_err_cnt; 10623859Sml29623 kstat_named_t rx_len_err_cnt; 10633859Sml29623 kstat_named_t rx_viol_err_cnt; 10643859Sml29623 kstat_named_t rx_byte_cnt; 10653859Sml29623 kstat_named_t rx_hist1_cnt; 10663859Sml29623 kstat_named_t rx_hist2_cnt; 10673859Sml29623 kstat_named_t rx_hist3_cnt; 10683859Sml29623 kstat_named_t rx_hist4_cnt; 10693859Sml29623 kstat_named_t rx_hist5_cnt; 10703859Sml29623 kstat_named_t rx_hist6_cnt; 10713859Sml29623 kstat_named_t rx_hist7_cnt; 10723859Sml29623 kstat_named_t rx_broadcast_cnt; 10733859Sml29623 kstat_named_t rx_mult_cnt; 10743859Sml29623 kstat_named_t rx_frag_cnt; 10753859Sml29623 kstat_named_t rx_frame_align_err_cnt; 10763859Sml29623 kstat_named_t rx_linkfault_err_cnt; 10773859Sml29623 kstat_named_t rx_remote_fault_err_cnt; 10783859Sml29623 kstat_named_t rx_local_fault_err_cnt; 10793859Sml29623 kstat_named_t rx_pause_cnt; 10803859Sml29623 kstat_named_t xpcs_deskew_err_cnt; 10813859Sml29623 kstat_named_t xpcs_ln0_symbol_err_cnt; 10823859Sml29623 kstat_named_t xpcs_ln1_symbol_err_cnt; 10833859Sml29623 kstat_named_t xpcs_ln2_symbol_err_cnt; 10843859Sml29623 kstat_named_t xpcs_ln3_symbol_err_cnt; 10853859Sml29623 } nxge_xmac_kstat_t, *p_nxge_xmac_kstat_t; 10863859Sml29623 10873859Sml29623 typedef struct _nxge_bmac_kstat { 10883859Sml29623 /* 10893859Sml29623 * BMAC statistics. 10903859Sml29623 */ 10913859Sml29623 kstat_named_t tx_frame_cnt; 10923859Sml29623 kstat_named_t tx_underrun_err; 10933859Sml29623 kstat_named_t tx_max_pkt_err; 10943859Sml29623 kstat_named_t tx_byte_cnt; 10953859Sml29623 kstat_named_t rx_frame_cnt; 10963859Sml29623 kstat_named_t rx_byte_cnt; 10973859Sml29623 kstat_named_t rx_overflow_err; 10983859Sml29623 kstat_named_t rx_align_err_cnt; 10993859Sml29623 kstat_named_t rx_crc_err_cnt; 11003859Sml29623 kstat_named_t rx_len_err_cnt; 11013859Sml29623 kstat_named_t rx_viol_err_cnt; 11023859Sml29623 kstat_named_t rx_pause_cnt; 11033859Sml29623 kstat_named_t tx_pause_state; 11043859Sml29623 kstat_named_t tx_nopause_state; 11053859Sml29623 } nxge_bmac_kstat_t, *p_nxge_bmac_kstat_t; 11063859Sml29623 11073859Sml29623 11083859Sml29623 typedef struct _nxge_fflp_kstat { 11093859Sml29623 /* 11103859Sml29623 * FFLP statistics. 11113859Sml29623 */ 11123859Sml29623 11135938Smisaki kstat_named_t fflp_tcam_perr; 11143859Sml29623 kstat_named_t fflp_tcam_ecc_err; 11153859Sml29623 kstat_named_t fflp_vlan_perr; 11163859Sml29623 kstat_named_t fflp_hasht_lookup_err; 11173859Sml29623 kstat_named_t fflp_hasht_data_err[MAX_PARTITION]; 11183859Sml29623 } nxge_fflp_kstat_t, *p_nxge_fflp_kstat_t; 11193859Sml29623 11203859Sml29623 typedef struct _nxge_mmac_kstat { 11213859Sml29623 kstat_named_t mmac_max_addr_cnt; 11223859Sml29623 kstat_named_t mmac_avail_addr_cnt; 11233859Sml29623 kstat_named_t mmac_addr1; 11243859Sml29623 kstat_named_t mmac_addr2; 11253859Sml29623 kstat_named_t mmac_addr3; 11263859Sml29623 kstat_named_t mmac_addr4; 11273859Sml29623 kstat_named_t mmac_addr5; 11283859Sml29623 kstat_named_t mmac_addr6; 11293859Sml29623 kstat_named_t mmac_addr7; 11303859Sml29623 kstat_named_t mmac_addr8; 11313859Sml29623 kstat_named_t mmac_addr9; 11323859Sml29623 kstat_named_t mmac_addr10; 11333859Sml29623 kstat_named_t mmac_addr11; 11343859Sml29623 kstat_named_t mmac_addr12; 11353859Sml29623 kstat_named_t mmac_addr13; 11363859Sml29623 kstat_named_t mmac_addr14; 11373859Sml29623 kstat_named_t mmac_addr15; 11383859Sml29623 kstat_named_t mmac_addr16; 11393859Sml29623 } nxge_mmac_kstat_t, *p_nxge_mmac_kstat_t; 11403859Sml29623 11413859Sml29623 /* 11423859Sml29623 * Prototype definitions. 11433859Sml29623 */ 11443859Sml29623 nxge_status_t nxge_init(p_nxge_t); 11453859Sml29623 void nxge_uninit(p_nxge_t); 11463859Sml29623 void nxge_get64(p_nxge_t, p_mblk_t); 11473859Sml29623 void nxge_put64(p_nxge_t, p_mblk_t); 11483859Sml29623 void nxge_pio_loop(p_nxge_t, p_mblk_t); 11493859Sml29623 11503859Sml29623 typedef void (*fptrv_t)(); 1151*7812SMichael.Speer@Sun.COM timeout_id_t nxge_start_timer(p_nxge_t, fptrv_t, int); 1152*7812SMichael.Speer@Sun.COM void nxge_stop_timer(p_nxge_t, timeout_id_t); 11533859Sml29623 11543859Sml29623 #ifdef __cplusplus 11553859Sml29623 } 11563859Sml29623 #endif 11573859Sml29623 11583859Sml29623 #endif /* _SYS_NXGE_NXGE_H */ 1159