1 /* $OpenBSD: if_nfevar.h,v 1.11 2006/02/19 13:57:02 damien Exp $ */
4 * Copyright (c) 2005 Jonathan Gray <jsg@openbsd.org>
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.
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.
28 struct nfe_desc32 *desc32;
29 struct nfe_desc64 *desc64;
31 bus_dma_tag_t data_tag;
32 struct nfe_tx_data *data;
42 struct nfe_rx_ring *ring;
47 SLIST_ENTRY(nfe_jbuf) jnext;
59 struct nfe_desc32 *desc32;
60 struct nfe_desc64 *desc64;
65 struct nfe_jbuf *jbuf;
66 SLIST_HEAD(, nfe_jbuf) jfreelist;
68 bus_dma_tag_t data_tag;
69 bus_dmamap_t data_tmpmap;
70 struct nfe_rx_data *data;
80 time_t sc_rate_second;
83 struct resource *sc_mem_res;
84 bus_space_handle_t sc_memh;
85 bus_space_tag_t sc_memt;
88 struct resource *sc_irq_res;
92 struct callout sc_tick_ch;
95 uint32_t sc_caps; /* hardware capabilities */
96 #define NFE_JUMBO_SUP 0x01
97 #define NFE_40BIT_ADDR 0x02
98 #define NFE_HW_CSUM 0x04
99 #define NFE_HW_VLAN 0x08
100 #define NFE_FIX_EADDR 0x10
101 #define NFE_NO_PWRCTL 0x20
102 #define NFE_WORDALIGN 0x40 /* word alignment DMA */
105 #define NFE_F_USE_JUMBO 0x01 /* use jumbo frame */
106 #define NFE_F_DYN_IM 0x02 /* enable dynamic interrupt moderation */
107 #define NFE_F_IRQ_TIMER 0x04 /* hardware timer irq is used */
109 uint32_t rxtxctl_desc;
113 struct ifpoll_compat sc_npoll;
114 bus_dma_tag_t sc_dtag;
115 struct nfe_tx_ring txq;
116 struct nfe_rx_ring rxq;
118 uint32_t sc_irq_enable;
121 int sc_rx_ring_count;
122 int sc_tx_ring_count;
125 struct lwkt_serialize sc_jbuf_serializer;
128 #define NFE_IRQ_ENABLE(sc) \
129 ((sc)->sc_imtime == 0 ? NFE_IRQ_NOIMTIMER : \
130 (((sc)->sc_flags & NFE_F_DYN_IM) ? NFE_IRQ_NOIMTIMER: NFE_IRQ_IMTIMER))
132 #define NFE_ADDR_HI(addr) ((uint64_t) (addr) >> 32)
133 #define NFE_ADDR_LO(addr) ((uint64_t) (addr) & 0xffffffff)