FreeBSD/Linux Kernel Cross Reference
sys/sqtsec/if_se.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991 Carnegie Mellon University
4 * Copyright (c) 1991 Sequent Computer Systems
5 * All Rights Reserved.
6 *
7 * Permission to use, copy, modify and distribute this software and its
8 * documentation is hereby granted, provided that both the copyright
9 * notice and this permission notice appear in all copies of the
10 * software, derivative works or modified versions, and any portions
11 * thereof, and that both notices appear in supporting documentation.
12 *
13 * CARNEGIE MELLON AND SEQUENT COMPUTER SYSTEMS ALLOW FREE USE OF
14 * THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON AND
15 * SEQUENT COMPUTER SYSTEMS DISCLAIM ANY LIABILITY OF ANY KIND FOR
16 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17 *
18 * Carnegie Mellon requests users of this software to return to
19 *
20 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
21 * School of Computer Science
22 * Carnegie Mellon University
23 * Pittsburgh PA 15213-3890
24 *
25 * any improvements or extensions that they make and grant Carnegie Mellon
26 * the rights to redistribute these changes.
27 */
28
29 /*
30 * HISTORY
31 * $Log: if_se.h,v $
32 * Revision 2.4 93/03/10 11:30:42 danner
33 * u_long -> u_int
34 * [93/03/10 danner]
35 *
36 * Revision 2.3 91/07/31 18:06:48 dbg
37 * Changed copyright.
38 * [91/07/31 dbg]
39 *
40 * Revision 2.2 91/05/08 13:05:59 dbg
41 * MACH_KERNEL conversion.
42 * [90/10/05 dbg]
43 *
44 */
45
46 /*
47 * $Header: if_se.h,v 2.4 93/03/10 11:30:42 danner Exp $
48 */
49
50 /*
51 * Revision 1.1 89/07/05 13:18:32 kak
52 * Initial revision
53 *
54 */
55 #ifndef _SQTSEC_IF_SE_H_
56 #define _SQTSEC_IF_SE_H_
57
58 #include <sys/types.h>
59
60 #include <device/io_req.h>
61 #include <device/net_io.h>
62 #include <device/if_hdr.h>
63 #include <device/if_ether.h>
64
65 #include <sqt/mutex.h>
66 #include <sqtsec/sec.h>
67
68 /*
69 * se_counts - statistics taken from the interface.
70 */
71 struct se_counts {
72 u_int ec_rx_ovfl;
73 u_int ec_rx_crc;
74 u_int ec_rx_dribbles;
75 u_int ec_rx_short;
76 u_int ec_rx_good;
77 u_int ec_tx_unfl;
78 u_int ec_tx_coll;
79 u_int ec_tx_16xcoll;
80 u_int ec_tx_good;
81 };
82 /*
83 * SEC-related types.
84 *
85 * Due to the SCSI-related interface to the Ether firmware,
86 * it is helps to hide the interface from the driver.
87 * Some day some of this should be made available for the other SEC
88 * drivers but time does not permit that now.
89 */
90
91 /*
92 * sec_pq describes the complete state of a device program
93 * queue for the SCSI/Ether controller.
94 * For unknown reasons, the size of the queue is not included
95 * in the standard SCSI/Ether interface.
96 */
97
98 struct sec_pq {
99 struct sec_progq *sq_progq;
100 u_short sq_size;
101 };
102
103
104 /*
105 * This type records the state of a queue of sec_iat structures.
106 * These are used for both input and output of Ether packets.
107 */
108
109 struct sec_iatq {
110 struct sec_iat *iq_iats; /* ring of iats itself */
111 u_short iq_size; /* number of entries in the array */
112 u_short iq_head; /* index of next available iat */
113 };
114
115
116 #ifdef MACH_KERNEL
117 /*
118 * sec_msgq - type
119 *
120 * This structure records the state of a queue of message pointers,
121 * just like the queue of IATs described above.
122 * This is used in parallel with an IAT queue to handle
123 * Ether input packets.
124 */
125 struct sec_msgq {
126 ipc_kmsg_t *mq_msgs;
127 unsigned short mq_size;
128 unsigned short mq_head;
129 };
130 #else MACH_KERNEL
131 /*
132 * sec_mbufq - type.
133 *
134 * This type records the state of a queue of mbuf pointers,
135 * much like the queue of iats described above.
136 * This is used in parallel with an an iat queue to handle
137 * Ether input packets.
138 */
139
140 struct sec_mbufq {
141 struct mbuf **mq_mbufs;
142 u_short mq_size;
143 u_short mq_head;
144 };
145 #endif MACH_KERNEL
146
147
148
149 /*
150 * Ethernet software state per interface(one for each controller).
151 * It contains 3 segments: details about the controller;
152 * details about the input side; and details about the output side.
153 * Locks exist on each of the separate segments, and should
154 * be used to lock as little about the state as is necessary.
155 *
156 * It is assumed throughout that both input and output will be
157 * locked whenever any of the controller details are changed.
158 *
159 * Locking rules to avoid deadlock are as follows:
160 * - Lock the output data before the controller data.
161 * - Lock the interrupt lock (output only) after the data.
162 */
163
164 struct se_state {
165 /* Describing the controller: */
166 #ifdef MACH_KERNEL
167 struct ifnet ss_if; /* generic interface header */
168 u_char ss_addr[6]; /* Ethernet hardware address */
169 u_char ss_pad0[2];
170 #else /* MACH_KERNEL */
171 struct arpcom ss_arp; /* Ethernet common */
172 #endif /* MACH_KERNEL */
173 #ifdef MACH_KERNEL
174 simple_lock_data_t ss_lock; /* mutex lock */
175 #else /* MACH_KERNEL */
176 lock_t ss_lock; /* mutex lock */
177 #endif /* MACH_KERNEL */
178 struct se_counts ss_sum; /* statistics summary */
179 int ss_scan_int; /* stat scan interval */
180 u_short ss_ether_flags; /* SETMODE flags */
181 u_char ss_slic; /* slic address of SEC */
182 u_char ss_bin; /* bin to intr SEC with */
183 u_char ss_alive:1, /* controller alive? */
184 ss_initted:1, /* filled in? */
185 ss_init_called:1;
186 /* Describing the input half: */
187 #ifdef MACH_KERNEL
188 simple_lock_data_t is_lock; /* interrupt lock */
189 #else /* MACH_KERNEL */
190 lock_t is_lock; /* interrupt lock */
191 #endif /* MACH_KERNEL */
192 struct sec_cib *is_cib; /* input cib */
193 int is_status; /* cib's status var */
194 struct sec_pq is_reqq; /* request queue */
195 struct sec_pq is_doneq; /* done queue */
196 struct sec_iatq is_iatq; /* queue of iats */
197 #ifdef MACH_KERNEL
198 struct sec_msgq is_msgq; /* parallel net_msg queue */
199 #else MACH_KERNEL
200 struct sec_mbufq is_mbufq; /* parallel mbuf queue */
201 #endif MACH_KERNEL
202 u_char is_initted:1; /* filled in? */
203 /* Describing the output half: */
204 #ifdef MACH_KERNEL
205 simple_lock_data_t os_lock; /* mutex lock */
206 #else /* MACH_KERNEL */
207 lock_t os_lock; /* mutex lock */
208 #endif /* MACH_KERNEL */
209 struct sec_cib *os_cib; /* output cib */
210 int os_status; /* cib's status var */
211 struct sec_pq os_reqq; /* request queue */
212 struct sec_pq os_doneq; /* done queue */
213 struct sec_iatq os_iatq; /* iats for output */
214 #ifdef MACH_KERNEL
215 io_req_t os_pending; /* io_req being written */
216 #else MACH_KERNEL
217 struct mbuf *os_pending; /* mbuf being written */
218 #endif MACH_KERNEL
219 struct sec_gmode os_gmode; /* temp for SINST_GETMODE */
220 u_char *os_buf; /* buffer for Ether output */
221 u_char os_initted:1, /* filled in */
222 os_active:1; /* output active */
223 long ss_pad; /* 4-byte pad for bitfields */
224 };
225
226
227 #ifdef KERNEL
228
229 #define OS_BUF_SIZE (se_mtu + 36) /* sizeof *os_buf */
230
231 #ifdef ns32000 /* no SLIC gates in SGS */
232 extern gate_t se_gate; /* gate for locks */
233 #endif ns32000
234
235 extern int se_watch_interval; /* seconds between stats collection */
236 extern int se_write_iats; /* number of IATs for Ether writes */
237 extern int se_bin; /* bin number to interrupt SEC on mIntr */
238 extern short se_mtu; /* max transfer unit on se interface */
239 #ifdef DEBUG
240 extern int se_ibug, se_obug; /* debug flags */
241 #endif DEBUG
242 #endif KERNEL
243
244 #endif /* _SQTSEC_IF_SE_H_ */
Cache object: 2584098fcf72bfaecb44c3b9530fbcf4
|