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