1 1.1 hikaru /* $NetBSD: if_cnmacvar.h,v 1.1 2015/04/29 08:32:01 hikaru Exp $ */ 2 1.1 hikaru 3 1.1 hikaru #undef DEBUG 4 1.1 hikaru #undef TENBASET_DBG 5 1.1 hikaru #undef REGISTER_DUMP 6 1.1 hikaru #ifdef DEBUG 7 1.1 hikaru #define dprintf printf 8 1.1 hikaru #else 9 1.1 hikaru #define dprintf(...) 10 1.1 hikaru #endif 11 1.1 hikaru 12 1.1 hikaru #define IS_MAC_MULTICASTBIT(addr) \ 13 1.1 hikaru ((addr)[0] & 0x01) 14 1.1 hikaru 15 1.1 hikaru #define SEND_QUEUE_SIZE (32) 16 1.1 hikaru #define GATHER_QUEUE_SIZE (1024) 17 1.1 hikaru #define FREE_QUEUE_SIZE GATHER_QUEUE_SIZE 18 1.1 hikaru #define RECV_QUEUE_SIZE (GATHER_QUEUE_SIZE * 2) 19 1.1 hikaru 20 1.1 hikaru #ifdef OCTEON_ETH_FIXUP_ODD_NIBBLE_DYNAMIC 21 1.1 hikaru #define PROC_NIBBLE_SOFT_THRESHOLD 2000 22 1.1 hikaru #endif 23 1.1 hikaru 24 1.1 hikaru /* XXX MUST BE REPLACED WITH BUS_DMA!!! */ 25 1.1 hikaru paddr_t kvtophys(vaddr_t); 26 1.1 hikaru /* XXX MUST BE REPLACED WITH BUS_DMA!!! */ 27 1.1 hikaru 28 1.1 hikaru struct _send_queue_entry; 29 1.1 hikaru struct octeon_pow_softc; 30 1.1 hikaru struct octeon_pip_softc; 31 1.1 hikaru struct octeon_ipd_softc; 32 1.1 hikaru struct octeon_pko_softc; 33 1.1 hikaru struct octeon_asx_softc; 34 1.1 hikaru struct octeon_smi_softc; 35 1.1 hikaru struct octeon_gmx_port_softc; 36 1.1 hikaru struct octeon_pow_softc; 37 1.1 hikaru 38 1.1 hikaru extern struct octeon_pow_softc octeon_pow_softc; 39 1.1 hikaru 40 1.1 hikaru struct octeon_eth_softc { 41 1.1 hikaru device_t sc_dev; 42 1.1 hikaru bus_space_tag_t sc_regt; 43 1.1 hikaru bus_dma_tag_t sc_dmat; 44 1.1 hikaru 45 1.1 hikaru #if 1 46 1.1 hikaru /* XXX backward compatibility; debugging purpose only */ 47 1.1 hikaru bus_space_handle_t sc_gmx_regh; 48 1.1 hikaru bus_space_handle_t sc_gmx_port_regh; 49 1.1 hikaru bus_space_handle_t sc_asx_regh; 50 1.1 hikaru bus_space_handle_t sc_pow_regh; 51 1.1 hikaru bus_space_handle_t sc_fpa_regh; 52 1.1 hikaru bus_space_handle_t sc_smi_regh; 53 1.1 hikaru bus_space_handle_t sc_pip_regh; 54 1.1 hikaru #endif 55 1.1 hikaru 56 1.1 hikaru void *sc_pow_recv_ih; 57 1.1 hikaru struct octeon_pip_softc *sc_pip; 58 1.1 hikaru struct octeon_ipd_softc *sc_ipd; 59 1.1 hikaru struct octeon_pko_softc *sc_pko; 60 1.1 hikaru struct octeon_asx_softc *sc_asx; 61 1.1 hikaru struct octeon_smi_softc *sc_smi; 62 1.1 hikaru struct octeon_gmx_softc *sc_gmx; 63 1.1 hikaru struct octeon_gmx_port_softc 64 1.1 hikaru *sc_gmx_port; 65 1.1 hikaru struct octeon_pow_softc 66 1.1 hikaru *sc_pow; 67 1.1 hikaru 68 1.1 hikaru struct ethercom sc_ethercom; 69 1.1 hikaru struct mii_data sc_mii; 70 1.1 hikaru 71 1.1 hikaru void *sc_sdhook; 72 1.1 hikaru 73 1.1 hikaru struct callout sc_tick_misc_ch; 74 1.1 hikaru struct callout sc_tick_free_ch; 75 1.1 hikaru 76 1.1 hikaru #ifdef OCTEON_ETH_INTR_FEEDBACK 77 1.1 hikaru struct callout sc_resume_ch; 78 1.1 hikaru #endif 79 1.1 hikaru 80 1.1 hikaru int64_t sc_soft_req_cnt; 81 1.1 hikaru int64_t sc_soft_req_thresh; 82 1.1 hikaru int64_t sc_hard_done_cnt; 83 1.1 hikaru int sc_flush; 84 1.1 hikaru int sc_prefetch; 85 1.1 hikaru SIMPLEQ_HEAD(, _send_queue_entry) 86 1.1 hikaru sc_sendq; 87 1.1 hikaru uint64_t sc_ext_callback_cnt; 88 1.1 hikaru 89 1.1 hikaru uint32_t sc_port; 90 1.1 hikaru uint32_t sc_port_type; 91 1.1 hikaru uint32_t sc_init_flag; 92 1.1 hikaru 93 1.1 hikaru /* 94 1.1 hikaru * Redirection - received (input) packets are redirected (directly sent) 95 1.1 hikaru * to another port. Only meant to test hardware + driver performance. 96 1.1 hikaru * 97 1.1 hikaru * 0 - disabled 98 1.1 hikaru * >0 - redirected to ports that correspond to bits 99 1.1 hikaru * 0b001 (0x1) - Port 0 100 1.1 hikaru * 0b010 (0x2) - Port 1 101 1.1 hikaru * 0b100 (0x4) - Port 2 102 1.1 hikaru */ 103 1.1 hikaru int sc_redir; 104 1.1 hikaru 105 1.1 hikaru struct octeon_fau_desc sc_fau_done; 106 1.1 hikaru struct octeon_pko_cmdptr_desc 107 1.1 hikaru sc_cmdptr; 108 1.1 hikaru 109 1.1 hikaru size_t sc_ip_offset; 110 1.1 hikaru 111 1.1 hikaru struct timeval sc_rate_recv_check_link_last; 112 1.1 hikaru struct timeval sc_rate_recv_check_link_cap; 113 1.1 hikaru struct timeval sc_rate_recv_check_jumbo_last; 114 1.1 hikaru struct timeval sc_rate_recv_check_jumbo_cap; 115 1.1 hikaru struct timeval sc_rate_recv_check_code_last; 116 1.1 hikaru struct timeval sc_rate_recv_check_code_cap; 117 1.1 hikaru struct timeval sc_rate_recv_fixup_odd_nibble_short_last; 118 1.1 hikaru struct timeval sc_rate_recv_fixup_odd_nibble_short_cap; 119 1.1 hikaru struct timeval sc_rate_recv_fixup_odd_nibble_preamble_last; 120 1.1 hikaru struct timeval sc_rate_recv_fixup_odd_nibble_preamble_cap; 121 1.1 hikaru struct timeval sc_rate_recv_fixup_odd_nibble_crc_last; 122 1.1 hikaru struct timeval sc_rate_recv_fixup_odd_nibble_crc_cap; 123 1.1 hikaru #ifdef OCTEON_ETH_DEBUG 124 1.1 hikaru struct timeval sc_rate_recv_fixup_odd_nibble_addr_last; 125 1.1 hikaru struct timeval sc_rate_recv_fixup_odd_nibble_addr_cap; 126 1.1 hikaru #endif 127 1.1 hikaru int sc_quirks; 128 1.1 hikaru #ifdef OCTEON_ETH_DEBUG 129 1.1 hikaru struct evcnt sc_ev_rx; 130 1.1 hikaru struct evcnt sc_ev_rxint; 131 1.1 hikaru struct evcnt sc_ev_rxrs; 132 1.1 hikaru struct evcnt sc_ev_rxbufpkalloc; 133 1.1 hikaru struct evcnt sc_ev_rxbufpkput; 134 1.1 hikaru struct evcnt sc_ev_rxbufwqalloc; 135 1.1 hikaru struct evcnt sc_ev_rxbufwqput; 136 1.1 hikaru struct evcnt sc_ev_rxerrcode; 137 1.1 hikaru struct evcnt sc_ev_rxerrfix; 138 1.1 hikaru struct evcnt sc_ev_rxerrjmb; 139 1.1 hikaru struct evcnt sc_ev_rxerrlink; 140 1.1 hikaru struct evcnt sc_ev_rxerroff; 141 1.1 hikaru struct evcnt sc_ev_rxonperrshort; 142 1.1 hikaru struct evcnt sc_ev_rxonperrpreamble; 143 1.1 hikaru struct evcnt sc_ev_rxonperrcrc; 144 1.1 hikaru struct evcnt sc_ev_rxonperraddress; 145 1.1 hikaru struct evcnt sc_ev_rxonponp; 146 1.1 hikaru struct evcnt sc_ev_rxonpok; 147 1.1 hikaru struct evcnt sc_ev_tx; 148 1.1 hikaru struct evcnt sc_ev_txadd; 149 1.1 hikaru struct evcnt sc_ev_txbufcballoc; 150 1.1 hikaru struct evcnt sc_ev_txbufcbget; 151 1.1 hikaru struct evcnt sc_ev_txbufgballoc; 152 1.1 hikaru struct evcnt sc_ev_txbufgbget; 153 1.1 hikaru struct evcnt sc_ev_txbufgbput; 154 1.1 hikaru struct evcnt sc_ev_txdel; 155 1.1 hikaru struct evcnt sc_ev_txerr; 156 1.1 hikaru struct evcnt sc_ev_txerrcmd; 157 1.1 hikaru struct evcnt sc_ev_txerrgbuf; 158 1.1 hikaru struct evcnt sc_ev_txerrlink; 159 1.1 hikaru struct evcnt sc_ev_txerrmkcmd; 160 1.1 hikaru #endif 161 1.1 hikaru }; 162