if_cnmacvar.h revision 1.9
1/*	$OpenBSD: if_cnmacvar.h,v 1.9 2016/04/26 11:22:05 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
37struct _send_queue_entry;
38struct cn30xxpow_softc;
39struct cn30xxpip_softc;
40struct cn30xxipd_softc;
41struct cn30xxpko_softc;
42struct cn30xxasx_softc;
43struct cn30xxsmi_softc;
44struct cn30xxgmx_port_softc;
45struct cn30xxpow_softc;
46
47extern struct cn30xxpow_softc	cn30xxpow_softc;
48
49struct octeon_eth_softc {
50	struct device		sc_dev;
51	bus_space_tag_t		sc_regt;
52	bus_dma_tag_t		sc_dmat;
53
54	bus_dmamap_t		sc_dmap;
55
56	void			*sc_pow_recv_ih;
57	struct cn30xxpip_softc	*sc_pip;
58	struct cn30xxipd_softc	*sc_ipd;
59	struct cn30xxpko_softc	*sc_pko;
60	struct cn30xxasx_softc	*sc_asx;
61	struct cn30xxsmi_softc	*sc_smi;
62	struct cn30xxgmx_softc	*sc_gmx;
63	struct cn30xxgmx_port_softc
64				*sc_gmx_port;
65	struct cn30xxpow_softc
66				*sc_pow;
67
68	struct arpcom		sc_arpcom;
69	struct mii_data		sc_mii;
70
71	struct timeout		sc_tick_misc_ch;
72	struct timeout		sc_tick_free_ch;
73
74	int64_t			sc_soft_req_thresh;
75	int64_t			sc_hard_done_cnt;
76	int			sc_prefetch;
77	struct mbuf_list	sc_sendq;
78	uint64_t		sc_ext_callback_cnt;
79
80	uint32_t		sc_port;
81	uint32_t		sc_port_type;
82	uint32_t		sc_init_flag;
83	int			sc_phy_addr;
84
85	/*
86	 * Redirection - received (input) packets are redirected (directly sent)
87	 * to another port.  Only meant to test hardware + driver performance.
88	 *
89	 *  0	- disabled
90	 * >0	- redirected to ports that correspond to bits
91	 *		0b001 (0x1)	- Port 0
92	 *		0b010 (0x2)	- Port 1
93	 *		0b100 (0x4)	- Port 2
94	 */
95	int			sc_redir;
96
97	struct cn30xxfau_desc	sc_fau_done;
98	struct cn30xxpko_cmdptr_desc
99				sc_cmdptr;
100
101	size_t			sc_ip_offset;
102
103	struct timeval		sc_rate_recv_check_link_last;
104	struct timeval		sc_rate_recv_check_link_cap;
105	struct timeval		sc_rate_recv_check_jumbo_last;
106	struct timeval		sc_rate_recv_check_jumbo_cap;
107	struct timeval		sc_rate_recv_check_code_last;
108	struct timeval		sc_rate_recv_check_code_cap;
109};
110