2 * Copyright (c) 2009 Yohanes Nugroho <yohanes@gmail.com>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 #define ECE_MAX_TX_BUFFERS 128
33 #define ECE_MAX_RX_BUFFERS 128
34 #define MAX_FRAGMENT 32
42 uint32_t tco:1; /*tcp checksum offload*/
43 uint32_t uco:1; /*udp checksum offload*/
44 uint32_t ico:1; /*ip checksum offload*/
45 /* force_route_port_map*/
49 /* force_priority_value */
68 /*pppoe_section_index*/
70 /*insert_pppoe_section*/
101 struct tx_desc_info {
110 struct ifnet *ifp; /* ifnet pointer */
111 struct mtx sc_mtx; /* global mutex */
112 struct mtx sc_mtx_tx; /* tx mutex */
113 struct mtx sc_mtx_rx; /* rx mutex */
114 struct mtx sc_mtx_cleanup; /* rx mutex */
116 bus_dma_tag_t sc_parent_tag; /* parent bus DMA tag */
118 device_t dev; /* Myself */
119 device_t miibus; /* My child miibus */
120 void *intrhand; /* Interrupt handle */
121 void *intrhand_qf; /* queue full */
122 void *intrhand_tx; /* tx complete */
123 void *intrhand_status; /* error status */
125 struct resource *irq_res_tx; /* transmit */
126 struct resource *irq_res_rec; /* receive */
127 struct resource *irq_res_qf; /* queue full */
128 struct resource *irq_res_status; /* status */
130 struct resource *mem_res; /* Memory resource */
132 struct callout tick_ch; /* Tick callout */
134 struct taskqueue *sc_tq;
135 struct task sc_intr_task;
136 struct task sc_cleanup_task;
137 struct task sc_tx_task;
139 bus_dmamap_t dmamap_ring_tx;
140 bus_dmamap_t dmamap_ring_rx;
141 bus_dmamap_t rx_sparemap;
144 bus_dma_tag_t dmatag_ring_tx;
145 bus_dma_tag_t dmatag_ring_rx;
148 bus_dma_tag_t dmatag_data_tx;
149 bus_dma_tag_t dmatag_data_rx;
152 eth_tx_desc_t* desc_tx;
153 eth_rx_desc_t* desc_rx;
155 /*ring physical address*/
156 bus_addr_t ring_paddr_tx;
157 bus_addr_t ring_paddr_rx;
159 /*index of last received descriptor*/
161 struct rx_desc_info rx_desc[ECE_MAX_RX_BUFFERS];
163 /* tx producer index */
165 /* tx consumer index */
168 uint32_t desc_curr_tx;
170 struct tx_desc_info tx_desc[ECE_MAX_TX_BUFFERS];
174 struct arl_table_entry_t {
175 uint32_t cmd_complete: 1;
176 uint32_t table_end: 1;
177 uint32_t search_match: 1;
178 uint32_t filter:1; /*if set, packet will be dropped */
179 uint32_t vlan_mac:1; /*indicates that this is the gateway mac address*/
180 uint32_t vlan_gid:3; /*vlan id*/
181 uint32_t age_field:3;
183 /*48 bit mac address*/
190 struct mac_list *next;