2 * Copyright (c) 1997-2001 Granch, Ltd. All rights reserved.
3 * Author: Denis I.Timofeev <timofeev@granch.ru>
5 * Redistributon 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 unmodified, this list of conditions, and the following
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * $FreeBSD: src/sys/dev/sbni/if_sbnivar.h,v 1.1.2.3 2002/08/11 09:32:00 fjoe Exp $
28 * $DragonFly: src/sys/dev/netif/sbni/if_sbnivar.h,v 1.3 2004/09/15 00:39:53 joerg Exp $
36 * CONFIGURATION PARAMETER:
38 * Uncomment this if you want to use model SBNI12D-11/ISA with same IRQ
39 * for both first and second channels.
41 #define SBNI_DUAL_COMPOUND 1
51 struct sbni_in_stats {
52 u_int32_t all_rx_number;
53 u_int32_t bad_rx_number;
54 u_int32_t timeout_number;
55 u_int32_t all_tx_number;
56 u_int32_t resend_tx_number;
68 #ifdef _KERNEL /* to avoid compile this decls with sbniconfig */
71 struct arpcom arpcom; /* ethernet common */
74 struct resource *io_res;
78 struct resource *irq_res;
81 struct mbuf *rx_buf_p; /* receive buffer ptr */
82 struct mbuf *tx_buf_p; /* transmit buffer ptr */
84 u_int pktlen; /* length of transmitting pkt */
85 u_int framelen; /* current frame length */
86 u_int maxframe; /* maximum valid frame length */
88 u_int inppos; /* positions in rx/tx buffers */
89 u_int outpos; /* positions in rx/tx buffers */
91 /* transmitting frame number - from frames qty to 1 */
94 /* expected number of next receiving frame */
97 /* count of failed attempts to frame send - 32 attempts do before
98 error - while receiver tunes on opposite side of wire */
101 /* idle time; send pong when limit exceeded */
104 /* fields used for receive level autoselection */
108 u_int32_t cur_rxl_rcvd;
109 u_int32_t prev_rxl_rcvd;
111 struct sbni_csr1 csr1; /* current value of CSR1 */
112 struct sbni_in_stats in_stats; /* internal statistics */
114 struct callout sbni_stat_timer;
116 struct sbni_softc *slave_sc;
118 #ifdef SBNI_DUAL_COMPOUND
119 struct sbni_softc *link;
123 void sbni_intr(void *);
124 int sbni_probe(struct sbni_softc *);
125 void sbni_attach(struct sbni_softc *, int, struct sbni_flags);
127 extern u_int32_t next_sbni_unit;
129 #ifdef SBNI_DUAL_COMPOUND
130 extern struct sbni_softc *sbni_headlist;
132 struct sbni_softc *connect_to_master(struct sbni_softc *);
137 * SBNI socket ioctl params
139 #define SIOCGHWFLAGS _IOWR('i', 62, struct ifreq) /* get flags */
140 #define SIOCSHWFLAGS _IOWR('i', 61, struct ifreq) /* set flags */
141 #define SIOCGINSTATS _IOWR('i', 60, struct ifreq) /* get internal stats */
142 #define SIOCRINSTATS _IOWR('i', 63, struct ifreq) /* reset internal stats */
148 #define CRC32(c,crc) (crc32tab[((size_t)(crc) ^ (c)) & 0xff] ^ (((crc) >> 8) & 0x00ffffff))
149 /* CRC generator EDB88320 */
150 /* CRC remainder 2144DF1C */
151 /* CRC initial value 0 */
152 #define CRC32_REMAINDER 0x2144df1c
153 #define CRC32_INITIAL 0x00000000