if_nfevar.h revision 164650
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 * $FreeBSD: head/sys/dev/nfe/if_nfevar.h 164650 2006-11-27 00:16:47Z obrien $
19 */
20
21#define	NFE_IFQ_MAXLEN	64
22
23struct nfe_tx_data {
24	bus_dmamap_t	tx_data_map;
25	bus_dmamap_t	active;
26	int		nsegs;
27	struct mbuf	*m;
28};
29
30struct nfe_tx_ring {
31	bus_dmamap_t		tx_desc_map;
32	bus_dma_segment_t	tx_desc_segs;
33	bus_addr_t		physaddr;
34	struct nfe_desc32	*desc32;
35	struct nfe_desc64	*desc64;
36	struct nfe_tx_data	data[NFE_TX_RING_COUNT];
37	int			queued;
38	int			cur;
39	int			next;
40	bus_addr_t		tx_desc_addr;
41	bus_addr_t		tx_data_addr;
42	bus_dma_tag_t		tx_desc_tag;
43	bus_dma_tag_t		tx_data_tag;
44};
45
46struct nfe_jbuf {
47	caddr_t			buf;
48	bus_addr_t		physaddr;
49	SLIST_ENTRY(nfe_jbuf)	jnext;
50};
51
52struct nfe_rx_data {
53	bus_dmamap_t	rx_data_map;
54	bus_dma_tag_t	rx_data_tag;
55	bus_addr_t	rx_data_addr;
56	bus_dma_segment_t rx_data_segs;
57	struct mbuf	*m;
58};
59
60struct nfe_rx_ring {
61	bus_dmamap_t		rx_desc_map;
62	bus_dma_segment_t	rx_desc_segs;
63        bus_dma_tag_t		rx_desc_tag;
64	bus_addr_t		rx_desc_addr;
65#ifndef JMBUF
66	bus_dmamap_t		rx_jumbo_map;
67	bus_dma_segment_t	rx_jumbo_segs;
68        bus_dma_tag_t		rx_jumbo_tag;
69	bus_addr_t		rx_jumbo_addr;
70	caddr_t			jpool;
71	struct nfe_jbuf		jbuf[NFE_JPOOL_COUNT];
72	SLIST_HEAD(, nfe_jbuf)	jfreelist;
73#endif
74	bus_addr_t		physaddr;
75	struct nfe_desc32	*desc32;
76	struct nfe_desc64	*desc64;
77	struct nfe_rx_data	data[NFE_RX_RING_COUNT];
78	int			bufsz;
79	int			cur;
80	int			next;
81};
82
83struct nfe_softc {
84	struct ifnet		*nfe_ifp;
85	device_t		nfe_dev;
86	device_t		nfe_miibus;
87	struct mtx		nfe_mtx;
88	bus_space_handle_t	nfe_memh;
89	bus_space_tag_t		nfe_memt;
90	struct resource		*nfe_res;
91	struct resource		*nfe_irq;
92	void			*nfe_intrhand;
93	struct mii_data		nfe_mii;
94	u_int8_t		nfe_unit;
95	struct callout		nfe_stat_ch;
96
97	struct arpcom		nfe_arpcom;
98	bus_dma_tag_t		nfe_parent_tag;
99  /*	struct timeout		nfe_tick_ch; */
100	void			*nfe_powerhook;
101
102	int			nfe_if_flags;
103	u_int			nfe_flags;
104#define	NFE_JUMBO_SUP	0x01
105#define	NFE_40BIT_ADDR	0x02
106#define	NFE_HW_CSUM	0x04
107#define	NFE_HW_VLAN	0x08
108	u_int32_t		rxtxctl;
109	u_int32_t		nfe_mtu;
110	u_int8_t		mii_phyaddr;
111	u_char			eaddr[ETHER_ADDR_LEN];
112	struct task		nfe_txtask;
113	int			nfe_link;
114
115	struct nfe_tx_ring	txq;
116	struct nfe_rx_ring	rxq;
117
118#ifdef DEVICE_POLLING
119	int			rxcycles;
120#endif
121};
122
123struct nfe_type {
124	u_int16_t	vid_id;
125	u_int16_t	dev_id;
126	char		*name;
127};
128