1 /* $OpenBSD: if_cnmacvar.h,v 1.16 2016/08/06 04:32:24 visa Exp $ */ 2 3 /* 4 * Copyright (c) 2007 Internet Initiative Japan, Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 */ 28 29 #define IS_MAC_MULTICASTBIT(addr) \ 30 ((addr)[0] & 0x01) 31 32 #define SEND_QUEUE_SIZE (32) 33 #define GATHER_QUEUE_SIZE (1024) 34 #define FREE_QUEUE_SIZE GATHER_QUEUE_SIZE 35 #define RECV_QUEUE_SIZE (GATHER_QUEUE_SIZE * 2) 36 37 #define OCTEON_ETH_MAX_MTU 12288 38 39 /* Number of mbufs per port to keep in the packet pool */ 40 #define OCTEON_ETH_MBUFS_PER_PORT 256 41 42 struct _send_queue_entry; 43 struct cn30xxpow_softc; 44 struct cn30xxpip_softc; 45 struct cn30xxipd_softc; 46 struct cn30xxpko_softc; 47 struct cn30xxasx_softc; 48 struct cn30xxsmi_softc; 49 struct cn30xxgmx_port_softc; 50 struct cn30xxpow_softc; 51 52 extern struct cn30xxpow_softc cn30xxpow_softc; 53 54 struct octeon_eth_softc { 55 struct device sc_dev; 56 bus_space_tag_t sc_regt; 57 bus_dma_tag_t sc_dmat; 58 59 bus_dmamap_t sc_dmap; 60 61 void *sc_pow_recv_ih; 62 struct cn30xxpip_softc *sc_pip; 63 struct cn30xxipd_softc *sc_ipd; 64 struct cn30xxpko_softc *sc_pko; 65 struct cn30xxsmi_softc *sc_smi; 66 struct cn30xxgmx_softc *sc_gmx; 67 struct cn30xxgmx_port_softc 68 *sc_gmx_port; 69 struct cn30xxpow_softc 70 *sc_pow; 71 72 struct arpcom sc_arpcom; 73 struct mii_data sc_mii; 74 75 struct timeout sc_tick_misc_ch; 76 struct timeout sc_tick_free_ch; 77 78 struct task sc_free_task; 79 80 int64_t sc_soft_req_thresh; 81 int64_t sc_hard_done_cnt; 82 int sc_prefetch; 83 struct mbuf_list sc_sendq; 84 uint64_t sc_ext_callback_cnt; 85 86 uint32_t sc_port; 87 uint32_t sc_port_type; 88 uint32_t sc_init_flag; 89 int sc_phy_addr; 90 91 /* 92 * Redirection - received (input) packets are redirected (directly sent) 93 * to another port. Only meant to test hardware + driver performance. 94 * 95 * 0 - disabled 96 * >0 - redirected to ports that correspond to bits 97 * 0b001 (0x1) - Port 0 98 * 0b010 (0x2) - Port 1 99 * 0b100 (0x4) - Port 2 100 */ 101 int sc_redir; 102 103 struct cn30xxfau_desc sc_fau_done; 104 struct cn30xxpko_cmdptr_desc 105 sc_cmdptr; 106 107 size_t sc_ip_offset; 108 109 struct timeval sc_rxerr_log_last; 110 }; 111