Commit | Line | Data |
---|---|---|
8ae0e4b4 | 1 | /* |
b0c21e3a MK |
2 | * Copyright (c) 1982,1986,1988 Regents of the University of California. |
3 | * All rights reserved. | |
8ae0e4b4 | 4 | * |
b0c21e3a MK |
5 | * Redistribution and use in source and binary forms are permitted |
6 | * provided that this notice is preserved and that due credit is given | |
7 | * to the University of California at Berkeley. The name of the University | |
8 | * may not be used to endorse or promote products derived from this | |
9 | * software without specific prior written permission. This software | |
10 | * is provided ``as is'' without express or implied warranty. | |
11 | * | |
2c63532d | 12 | * @(#)if_imp.h 7.4 (Berkeley) %G% |
8ae0e4b4 | 13 | */ |
745d10ec SL |
14 | |
15 | /* | |
16 | * Structure of IMP 1822 long leader. | |
17 | */ | |
a2cd4df7 | 18 | struct control_leader { |
be7e9ce3 MK |
19 | u_char dl_format; /* 1-8 leader format */ |
20 | u_char dl_network; /* 9-16 src/dest network */ | |
21 | u_char dl_flags; /* 17-24 leader flags */ | |
22 | u_char dl_mtype; /* 25-32 message type */ | |
23 | u_char dl_htype; /* 33-40 handling type */ | |
24 | u_char dl_host; /* 41-48 host number */ | |
25 | u_short dl_imp; /* 49-64 imp field */ | |
26 | u_char dl_link; /* 65-72 link number */ | |
27 | u_char dl_subtype; /* 73-80 message subtype */ | |
a2cd4df7 BJ |
28 | }; |
29 | ||
30 | struct imp_leader { | |
31 | struct control_leader il_dl; | |
32 | #define il_format il_dl.dl_format | |
33 | #define il_network il_dl.dl_network | |
34 | #define il_flags il_dl.dl_flags | |
35 | #define il_mtype il_dl.dl_mtype | |
36 | #define il_htype il_dl.dl_htype | |
37 | #define il_host il_dl.dl_host | |
38 | #define il_imp il_dl.dl_imp | |
a2cd4df7 BJ |
39 | #define il_link il_dl.dl_link |
40 | #define il_subtype il_dl.dl_subtype | |
745d10ec SL |
41 | u_short il_length; /* message length */ |
42 | }; | |
43 | ||
b0c21e3a | 44 | #define IMP_MAXHOSTMSG 8 /* max messages in flight to a host */ |
be7e9ce3 | 45 | #define IMP_NOOPCNT 3 /* # of noops to send imp on reset */ |
e431883e BJ |
46 | /* insure things are even... */ |
47 | #define IMPMTU ((8159 / NBBY) & ~01) | |
be7e9ce3 | 48 | #define IMP_RCVBUF ((8159 / NBBY + 2) & ~01) |
745d10ec SL |
49 | |
50 | /* | |
51 | * IMP-host flags | |
52 | */ | |
2c63532d MK |
53 | #define IMP_1822L_H2I 0xd /* 1822L host-to-imp, 96-bit format */ |
54 | #define IMP_1822L_I2H 0xe /* 1822L imp-to-host, 96-bit format */ | |
745d10ec SL |
55 | #define IMP_NFF 0xf /* 96-bit (new) format */ |
56 | #define IMP_TRACE 0x8 /* trace message route */ | |
57 | ||
745d10ec SL |
58 | /* |
59 | * IMP-host message types. | |
60 | */ | |
61 | #define IMPTYPE_DATA 0 /* data for protocol */ | |
62 | #define IMPTYPE_BADLEADER 1 /* leader error */ | |
63 | #define IMPTYPE_DOWN 2 /* imp going down */ | |
64 | #define IMPTYPE_NOOP 4 /* noop seen during initialization */ | |
65 | #define IMPTYPE_RFNM 5 /* request for new messages */ | |
66 | #define IMPTYPE_HOSTDEAD 6 /* host doesn't respond */ | |
67 | #define IMPTYPE_HOSTUNREACH 7 /* host unreachable */ | |
68 | #define IMPTYPE_BADDATA 8 /* data error */ | |
69 | #define IMPTYPE_INCOMPLETE 9 /* incomplete message, send rest */ | |
70 | #define IMPTYPE_RESET 10 /* reset complete */ | |
71 | /* non-blocking IMP interface */ | |
72 | #define IMPTYPE_RETRY 11 /* IMP refused, try again */ | |
73 | #define IMPTYPE_NOTIFY 12 /* IMP refused, will notify */ | |
74 | #define IMPTYPE_TRYING 13 /* IMP refused, still rexmt'ng */ | |
75 | #define IMPTYPE_READY 14 /* ready for next message */ | |
76 | ||
77 | /* | |
be7e9ce3 | 78 | * IMPTYPE_DOWN subtypes, in link number field. |
745d10ec | 79 | */ |
be7e9ce3 | 80 | #define IMP_DMASK 0x3 /* host going down mask */ |
745d10ec SL |
81 | #define IMPDOWN_GOING 0 /* 30 secs */ |
82 | #define IMPDOWN_PM 1 /* hardware PM */ | |
83 | #define IMPDOWN_RELOAD 2 /* software reload */ | |
84 | #define IMPDOWN_RESTART 3 /* emergency restart */ | |
be7e9ce3 MK |
85 | #define IMPDOWN_WHENMASK 0x3c /* mask for "how soon" */ |
86 | #define IMPDOWN_WHENSHIFT 2 /* shift for "how soon" */ | |
87 | #define IMPDOWN_WHENUNIT 5 /* unit for "how soon", 5 min. */ | |
88 | ||
89 | #define IMPTV_DOWN 30 /* going down timer 30 secs */ | |
90 | ||
91 | #ifdef IMPMESSAGES | |
92 | /* | |
93 | * Messages from IMP regarding why | |
94 | * it's going down. | |
95 | */ | |
96 | char *impmessage[] = { | |
97 | "in 30 seconds", | |
98 | "for hardware PM", | |
99 | "to reload software", | |
100 | "for emergency reset" | |
101 | }; | |
102 | #endif | |
745d10ec SL |
103 | |
104 | /* | |
105 | * IMPTYPE_BADLEADER subtypes. | |
106 | */ | |
107 | #define IMPLEADER_ERR 0 /* error flip-flop set */ | |
108 | #define IMPLEADER_SHORT 1 /* leader < 80 bits */ | |
109 | #define IMPLEADER_TYPE 2 /* illegal type field */ | |
110 | #define IMPLEADER_OPPOSITE 3 /* opposite leader type */ | |
111 | ||
112 | /* | |
113 | * IMPTYPE_HOSTDEAD subtypes. | |
114 | */ | |
115 | #define IMPHOST_NORDY 1 /* ready-line negated */ | |
116 | #define IMPHOST_TARDY 2 /* tardy receiving mesgs */ | |
117 | #define IMPHOST_NOEXIST 3 /* NCC doesn't know host */ | |
118 | #define IMPHOST_IMPSOFT 4 /* IMP software won't allow mesgs */ | |
119 | #define IMPHOST_PM 5 /* host down for scheduled PM */ | |
120 | #define IMPHOST_HARDSCHED 6 /* " " " " hardware work */ | |
121 | #define IMPHOST_SOFTSCHED 7 /* " " " " software work */ | |
122 | #define IMPHOST_RESTART 8 /* host down for emergency restart */ | |
123 | #define IMPHOST_POWER 9 /* down because of power outage */ | |
124 | #define IMPHOST_BREAKPOINT 10 /* host stopped at a breakpoint */ | |
125 | #define IMPHOST_HARDWARE 11 /* hardware failure */ | |
126 | #define IMPHOST_NOTUP 12 /* host not scheduled to be up */ | |
127 | /* 13-14 currently unused */ | |
128 | #define IMPHOST_COMINGUP 15 /* host in process of coming up */ | |
129 | ||
130 | /* | |
131 | * IMPTYPE_HOSTUNREACH subtypes. | |
132 | */ | |
133 | #define IMPREACH_IMP 0 /* destination IMP can't be reached */ | |
134 | #define IMPREACH_HOSTUP 1 /* destination host isn't up */ | |
135 | #define IMPREACH_LEADER 2 /* host doesn't support long leader */ | |
136 | #define IMPREACH_PROHIBITED 3 /* communication is prohibited */ | |
137 | ||
138 | /* | |
139 | * IMPTYPE_INCOMPLETE subtypes. | |
140 | */ | |
141 | #define IMPCOMPLETE_SLOW 0 /* host didn't take data fast enough */ | |
142 | #define IMPCOMPLETE_TOOLONG 1 /* message was too long */ | |
143 | #define IMPCOMPLETE_TIMEOUT 2 /* mesg transmission time > 15 sec. */ | |
144 | #define IMPCOMPLETE_FAILURE 3 /* IMP/circuit failure */ | |
145 | #define IMPCOMPLETE_NOSPACE 4 /* no resources within 15 sec. */ | |
146 | #define IMPCOMPLETE_IMPIO 5 /* src IMP I/O failure during receipt */ | |
147 | ||
148 | /* | |
149 | * IMPTYPE_RETRY subtypes. | |
150 | */ | |
151 | #define IMPRETRY_BUFFER 0 /* IMP buffer wasn't available */ | |
152 | #define IMPRETRY_BLOCK 1 /* connection block unavailable */ | |
153 | ||
2c63532d MK |
154 | #define RFNMTIMER (120*PR_SLOWHZ) /* time to wait for RFNM for msg. */ |
155 | #define IMP_OTIMER (5*IFNET_SLOWHZ) /* max output time unless blocked */ | |
b0c21e3a | 156 | |
745d10ec SL |
157 | /* |
158 | * Data structure shared between IMP protocol module and hardware | |
159 | * interface driver. Used to allow layering of IMP routines on top | |
be7e9ce3 | 160 | * of varying device drivers. |
745d10ec | 161 | */ |
12ef2795 | 162 | struct impcb { |
be7e9ce3 MK |
163 | int ic_hwunit; /* H/W unit number */ |
164 | char *ic_hwname; /* H/W type name */ | |
745d10ec SL |
165 | char ic_oactive; /* output in progress */ |
166 | int (*ic_init)(); /* hardware init routine */ | |
b0c21e3a MK |
167 | int (*ic_output)(); /* hardware output routine */ |
168 | int (*ic_down)(); /* hardware "drop ready" routine */ | |
be7e9ce3 MK |
169 | }; |
170 | ||
171 | /* | |
172 | * IMP software status per interface. | |
173 | * (partially shared with the hardware specific module) | |
174 | * | |
175 | * Each interface is referenced by a network interface structure, | |
176 | * imp_if, which the routing code uses to locate the interface. | |
177 | * This structure contains the output queue for the interface, its | |
178 | * address, ... IMP specific structures used in connecting the | |
179 | * IMP software modules to the hardware specific interface routines | |
180 | * are stored here. The common structures are made visible to the | |
181 | * interface driver by passing a pointer to the hardware routine | |
182 | * at "attach" time. | |
183 | */ | |
184 | struct imp_softc { | |
185 | struct ifnet imp_if; /* network visible interface */ | |
186 | struct impcb imp_cb; /* hooks to hardware module */ | |
187 | int imp_state; /* current state of IMP */ | |
188 | int imp_dropcnt; /* used during initialization */ | |
b0c21e3a MK |
189 | struct mbuf *imp_hosts; /* Head of host table hash chains. */ |
190 | struct mbuf *imp_hostq; /* current round-robin-output mark */ | |
191 | u_int imp_hostent; /* current round-robin-output mark */ | |
192 | int imp_msgready; /* number of messages ready to send */ | |
193 | u_long imp_block; /* times imp blocked output */ | |
be7e9ce3 MK |
194 | u_long imp_lostrfnm; /* rfnm's timed out */ |
195 | u_long imp_badrfnm; /* rfnm/incompl after timeout/bogus */ | |
196 | u_long imp_incomplete; /* incomplete's received */ | |
197 | u_long imp_garbage; /* bad messages received */ | |
745d10ec | 198 | }; |
b0c21e3a | 199 | |
be7e9ce3 | 200 | struct imp_softc *impattach(); |
745d10ec SL |
201 | |
202 | /* | |
203 | * State of an IMP. | |
204 | */ | |
be7e9ce3 MK |
205 | #define IMPS_DOWN 0 /* unavailable, host not ready */ |
206 | #define IMPS_WINIT 1 /* imp not ready, waiting for init */ | |
745d10ec SL |
207 | #define IMPS_INIT 2 /* coming up */ |
208 | #define IMPS_UP 3 /* ready to go */ | |
be7e9ce3 | 209 | #define IMPS_GOINGDOWN 4 /* been told we go down soon */ |
745d10ec | 210 | |
be7e9ce3 MK |
211 | #define IMPS_RUNNING(s) ((s) >= IMPS_UP) /* ready for messages */ |
212 | #define IMPS_IMPREADY(s) ((s) >= IMPS_INIT) /* IMP ready line on */ | |
a2cd4df7 BJ |
213 | |
214 | #ifdef IMPLEADERS | |
12ef2795 | 215 | char *impleaders[IMPTYPE_READY+1] = { |
a2cd4df7 BJ |
216 | "DATA", "BADLEADER", "DOWN", "bad", "NOOP", "RFNM", "HOSTDEAD", |
217 | "HOSTUNREACH", "BADDATA", "INCOMPLETE", "RESET", "RETRY", | |
218 | "NOTIFY", "TRYING", "READY" | |
219 | }; | |
220 | #endif |