if_nfevar.h revision 171559
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 171559 2007-07-24 01:11:00Z yongari $
19 */
20
21struct nfe_tx_data {
22	bus_dmamap_t	tx_data_map;
23	struct mbuf	*m;
24};
25
26struct nfe_tx_ring {
27	bus_dma_tag_t		tx_desc_tag;
28	bus_dmamap_t		tx_desc_map;
29	bus_addr_t		physaddr;
30	struct nfe_desc32	*desc32;
31	struct nfe_desc64	*desc64;
32	bus_dma_tag_t		tx_data_tag;
33	struct nfe_tx_data	data[NFE_TX_RING_COUNT];
34	int			queued;
35	int			cur;
36	int			next;
37};
38
39struct nfe_jpool_entry {
40	int				slot;
41	SLIST_ENTRY(nfe_jpool_entry)	jpool_entries;
42};
43
44struct nfe_rx_data {
45	bus_dmamap_t	rx_data_map;
46	bus_addr_t	paddr;
47	struct mbuf	*m;
48};
49
50struct nfe_rx_ring {
51	bus_dma_tag_t		rx_desc_tag;
52	bus_dmamap_t		rx_desc_map;
53	bus_addr_t		physaddr;
54	struct nfe_desc32	*desc32;
55	struct nfe_desc64	*desc64;
56	bus_dma_tag_t		rx_data_tag;
57	bus_dmamap_t		rx_spare_map;
58	struct nfe_rx_data	data[NFE_RX_RING_COUNT];
59	int			cur;
60	int			next;
61};
62
63struct nfe_jrx_ring {
64	bus_dma_tag_t		jrx_desc_tag;
65	bus_dmamap_t		jrx_desc_map;
66	bus_dma_tag_t		jrx_jumbo_tag;
67	bus_dmamap_t		jrx_jumbo_map;
68	void			*jpool;
69	caddr_t			jslots[NFE_JSLOTS];
70	bus_addr_t		jphysaddr;
71	struct nfe_desc32	*jdesc32;
72	struct nfe_desc64	*jdesc64;
73	bus_dma_tag_t		jrx_data_tag;
74	bus_dmamap_t		jrx_spare_map;
75	struct nfe_rx_data	jdata[NFE_JUMBO_RX_RING_COUNT];
76	int			jcur;
77	int			jnext;
78};
79
80struct nfe_softc {
81	struct ifnet		*nfe_ifp;
82	device_t		nfe_dev;
83	uint16_t		nfe_devid;
84	uint16_t		nfe_revid;
85	device_t		nfe_miibus;
86	struct mtx		nfe_mtx;
87	struct resource		*nfe_res[1];
88	struct resource		*nfe_msix_res;
89	struct resource		*nfe_msix_pba_res;
90	struct resource		*nfe_irq[NFE_MSI_MESSAGES];
91	void			*nfe_intrhand[NFE_MSI_MESSAGES];
92	struct callout		nfe_stat_ch;
93	int			nfe_watchdog_timer;
94
95	bus_dma_tag_t		nfe_parent_tag;
96
97	int			nfe_if_flags;
98	uint32_t		nfe_flags;
99#define	NFE_JUMBO_SUP		0x0001
100#define	NFE_40BIT_ADDR		0x0002
101#define	NFE_HW_CSUM		0x0004
102#define	NFE_HW_VLAN		0x0008
103#define	NFE_PWR_MGMT		0x0010
104#define	NFE_CORRECT_MACADDR	0x0020
105#define	NFE_TX_FLOW_CTRL	0x0040
106	int			nfe_jumbo_disable;
107	uint32_t		rxtxctl;
108	uint8_t			mii_phyaddr;
109	uint8_t			eaddr[ETHER_ADDR_LEN];
110	struct taskqueue	*nfe_tq;
111	struct task		nfe_int_task;
112	struct task		nfe_tx_task;
113	struct task		nfe_link_task;
114	int			nfe_link;
115	int			nfe_suspended;
116	int			nfe_framesize;
117	int			nfe_process_limit;
118	int			nfe_force_tx;
119	uint32_t		nfe_irq_status;
120	uint32_t		nfe_irq_mask;
121	uint32_t		nfe_intrs;
122	uint32_t		nfe_nointrs;
123	uint32_t		nfe_msi;
124	uint32_t		nfe_msix;
125
126	struct nfe_tx_ring	txq;
127	struct nfe_rx_ring	rxq;
128	struct nfe_jrx_ring	jrxq;
129	SLIST_HEAD(__nfe_jfreehead, nfe_jpool_entry)	nfe_jfree_listhead;
130	SLIST_HEAD(__nfe_jinusehead, nfe_jpool_entry)	nfe_jinuse_listhead;
131	struct mtx		nfe_jlist_mtx;
132};
133
134struct nfe_type {
135	uint16_t	vid_id;
136	uint16_t	dev_id;
137	char		*name;
138};
139