xref: /openbsd/sys/dev/pci/if_nfevar.h (revision e7da7166)
1 /*	$OpenBSD: if_nfevar.h,v 1.17 2014/08/20 01:02:50 dlg 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 
21 struct nfe_tx_data {
22 	bus_dmamap_t	map;
23 	bus_dmamap_t	active;
24 	struct mbuf	*m;
25 };
26 
27 struct 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 
39 struct nfe_rx_data {
40 	bus_dmamap_t	map;
41 	struct mbuf	*m;
42 };
43 
44 struct nfe_rx_ring {
45 	bus_dmamap_t		map;
46 	bus_dma_segment_t	seg;
47 	bus_addr_t		physaddr;
48 	struct nfe_desc32	*desc32;
49 	struct nfe_desc64	*desc64;
50 	struct nfe_rx_data	data[NFE_RX_RING_COUNT];
51 	int			bufsz;
52 	int			cur;
53 	int			next;
54 };
55 
56 struct nfe_softc {
57 	struct device		sc_dev;
58 	struct arpcom		sc_arpcom;
59 	bus_space_handle_t	sc_memh;
60 	bus_space_tag_t		sc_memt;
61 	void			*sc_ih;
62 	bus_dma_tag_t		sc_dmat;
63 	struct mii_data		sc_mii;
64 	struct timeout		sc_tick_ch;
65 
66 	u_int			sc_flags;
67 #define NFE_JUMBO_SUP		0x01
68 #define NFE_40BIT_ADDR		0x02
69 #define NFE_HW_CSUM		0x04
70 #define NFE_HW_VLAN		0x08
71 #define NFE_CORRECT_MACADDR	0x20
72 #define NFE_PWR_MGMT		0x40
73 #define NFE_WOL			0x80
74 
75 	uint32_t		rxtxctl;
76 	uint8_t			mii_phyaddr;
77 
78 	struct nfe_tx_ring	txq;
79 	struct nfe_rx_ring	rxq;
80 };
81