if_nfevar.h revision 159952
1/*	$OpenBSD: if_nfevar.h,v 1.11 2006/02/19 13:57:02 damien Exp $	*/
2
3/*-
4 * Copyright (c) 2005 Jonathan Gray <jsg@openbsd.org>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#define NFE_IFQ_MAXLEN	64
20
21struct nfe_tx_data {
22	bus_dmamap_t	map;
23	bus_dmamap_t	active;
24	struct mbuf	*m;
25};
26
27struct nfe_tx_ring {
28	bus_dmamap_t		map;
29	bus_dma_segment_t	seg;
30	bus_addr_t		physaddr;
31	struct nfe_desc32	*desc32;
32	struct nfe_desc64	*desc64;
33	struct nfe_tx_data	data[NFE_TX_RING_COUNT];
34	int			queued;
35	int			cur;
36	int			next;
37};
38
39struct nfe_jbuf {
40	caddr_t			buf;
41	bus_addr_t		physaddr;
42	SLIST_ENTRY(nfe_jbuf)	jnext;
43};
44
45struct nfe_rx_data {
46	bus_dmamap_t	map;
47	struct mbuf	*m;
48};
49
50struct nfe_rx_ring {
51	bus_dmamap_t		map;
52	bus_dma_segment_t	seg;
53	bus_dmamap_t		jmap;
54	bus_dma_segment_t	jseg;
55	bus_addr_t		physaddr;
56	struct nfe_desc32	*desc32;
57	struct nfe_desc64	*desc64;
58	caddr_t			jpool;
59	struct nfe_rx_data	data[NFE_RX_RING_COUNT];
60	struct nfe_jbuf		jbuf[NFE_JPOOL_COUNT];
61	SLIST_HEAD(, nfe_jbuf)	jfreelist;
62	int			bufsz;
63	int			cur;
64	int			next;
65};
66
67struct nfe_softc {
68	struct device		sc_dev;
69	struct arpcom		sc_arpcom;
70	bus_space_handle_t	sc_memh;
71	bus_space_tag_t		sc_memt;
72	void			*sc_ih;
73	bus_dma_tag_t		sc_dmat;
74	struct mii_data		sc_mii;
75	struct timeout		sc_tick_ch;
76	void			*sc_powerhook;
77
78	int			sc_if_flags;
79	u_int			sc_flags;
80#define NFE_JUMBO_SUP	0x01
81#define NFE_40BIT_ADDR	0x02
82#define NFE_HW_CSUM	0x04
83#define NFE_HW_VLAN	0x08
84#define NFE_USE_JUMBO	0x10
85
86	uint32_t		rxtxctl;
87	uint8_t			mii_phyaddr;
88
89	struct nfe_tx_ring	txq;
90	struct nfe_rx_ring	rxq;
91};
92