missed a sleep() and removed UNTESTED comment
[unix-history] / usr / src / sys / vax / if / if_en.c
CommitLineData
732fb59b 1/* if_en.c 4.76 83/05/10 */
11720282
BJ
2
3#include "en.h"
f1b2fa5b 4
11720282 5/*
f1b2fa5b 6 * Xerox prototype (3 Mb) Ethernet interface driver.
11720282 7 */
961945a8 8#include "../machine/pte.h"
11720282
BJ
9
10#include "../h/param.h"
11#include "../h/systm.h"
12#include "../h/mbuf.h"
11720282 13#include "../h/buf.h"
8a13b737
BJ
14#include "../h/protosw.h"
15#include "../h/socket.h"
8a13b737 16#include "../h/vmmac.h"
eaa60542
BJ
17#include <errno.h>
18
19#include "../net/if.h"
20#include "../net/netisr.h"
21#include "../net/route.h"
d2cc167c
BJ
22#include "../netinet/in.h"
23#include "../netinet/in_systm.h"
d2cc167c
BJ
24#include "../netinet/ip.h"
25#include "../netinet/ip_var.h"
26#include "../netpup/pup.h"
eaa60542
BJ
27
28#include "../vax/cpu.h"
29#include "../vax/mtpr.h"
30#include "../vaxif/if_en.h"
31#include "../vaxif/if_enreg.h"
32#include "../vaxif/if_uba.h"
33#include "../vaxuba/ubareg.h"
34#include "../vaxuba/ubavar.h"
8a13b737 35
a453e1b5 36#define ENMTU (1024+512)
dc39362e 37#define ENMRU (1024+512+16) /* 16 is enough to receive trailer */
11720282 38
11720282
BJ
39int enprobe(), enattach(), enrint(), enxint(), encollide();
40struct uba_device *eninfo[NEN];
41u_short enstd[] = { 0 };
42struct uba_driver endriver =
b454c3ea 43 { enprobe, 0, enattach, 0, enstd, "en", eninfo };
11720282
BJ
44#define ENUNIT(x) minor(x)
45
f1b2fa5b
BJ
46int eninit(),enoutput(),enreset();
47
48/*
49 * Ethernet software status per interface.
50 *
51 * Each interface is referenced by a network interface structure,
52 * es_if, which the routing code uses to locate the interface.
53 * This structure contains the output queue for the interface, its address, ...
54 * We also have, for each interface, a UBA interface structure, which
55 * contains information about the UNIBUS resources held by the interface:
56 * map registers, buffered data paths, etc. Information is cached in this
57 * structure for use by the if_uba.c routines in running the interface
58 * efficiently.
59 */
8a13b737 60struct en_softc {
f1b2fa5b
BJ
61 struct ifnet es_if; /* network-visible interface */
62 struct ifuba es_ifuba; /* UNIBUS resources */
63 short es_delay; /* current output delay */
64 short es_mask; /* mask for current output delay */
0658a645 65 short es_lastx; /* host last transmitted to */
f1b2fa5b
BJ
66 short es_oactive; /* is output active? */
67 short es_olen; /* length of last output */
8a13b737 68} en_softc[NEN];
11720282 69
f1b2fa5b
BJ
70/*
71 * Do output DMA to determine interface presence and
72 * interrupt vector. DMA is too short to disturb other hosts.
73 */
11720282
BJ
74enprobe(reg)
75 caddr_t reg;
76{
b454c3ea 77 register int br, cvec; /* r11, r10 value-result */
11720282
BJ
78 register struct endevice *addr = (struct endevice *)reg;
79
80#ifdef lint
81 br = 0; cvec = br; br = cvec;
2b4b57cd 82 enrint(0); enxint(0); encollide(0);
11720282 83#endif
11720282 84 addr->en_istat = 0;
11720282
BJ
85 addr->en_owc = -1;
86 addr->en_oba = 0;
941ee7ef 87 addr->en_ostat = EN_IEN|EN_GO;
11720282
BJ
88 DELAY(100000);
89 addr->en_ostat = 0;
7d6f1cd5
SL
90#ifdef ECHACK
91 br = 0x16;
92#endif
11720282
BJ
93 return (1);
94}
95
f1b2fa5b
BJ
96/*
97 * Interface exists: make available by filling in network interface
98 * record. System will initialize the interface when it is ready
99 * to accept packets.
100 */
11720282
BJ
101enattach(ui)
102 struct uba_device *ui;
103{
f1b2fa5b 104 register struct en_softc *es = &en_softc[ui->ui_unit];
f1b2fa5b
BJ
105
106 es->es_if.if_unit = ui->ui_unit;
b454c3ea 107 es->es_if.if_name = "en";
f1b2fa5b 108 es->es_if.if_mtu = ENMTU;
732fb59b
SL
109 if (ui->ui_flags)
110 ensetaddr(es, ui->ui_flags);
f1b2fa5b 111 es->es_if.if_init = eninit;
b454c3ea 112 es->es_if.if_output = enoutput;
51595ca2 113 es->es_if.if_reset = enreset;
d9c0644f 114 es->es_ifuba.ifu_flags = UBA_NEEDBDP | UBA_NEED16 | UBA_CANTWAIT;
b4e3e570
SL
115#if defined(VAX750)
116 /* don't chew up 750 bdp's */
117 if (cpu == VAX_750 && ui->ui_unit > 0)
118 es->es_ifuba.ifu_flags &= ~UBA_NEEDBDP;
119#endif
405c9168 120 if_attach(&es->es_if);
11720282
BJ
121}
122
732fb59b
SL
123/*
124 * Set interface's Internet address
125 * given the network number. The station
126 * number, taken from the on-board register,
127 * is used as the local part.
128 */
129ensetaddr(es, net)
130 register struct en_softc *es;
131 int net;
132{
133 struct endevice *enaddr;
134 register struct sockaddr_in *sin;
135
136 es->es_if.if_net = net;
137 enaddr = (struct endevice *)eninfo[es->es_if.if_unit]->ui_addr;
138 es->es_if.if_host[0] = (~enaddr->en_addr) & 0xff;
139 sin = (struct sockaddr_in *)&es->es_if.if_addr;
140 sin->sin_family = AF_INET;
141 sin->sin_addr = if_makeaddr(net, es->es_if.if_host[0]);
142 sin = (struct sockaddr_in *)&es->es_if.if_broadaddr;
143 sin->sin_family = AF_INET;
144 sin->sin_addr = if_makeaddr(net, INADDR_ANY);
145 es->es_if.if_flags |= IFF_BROADCAST;
146}
147
f1b2fa5b
BJ
148/*
149 * Reset of interface after UNIBUS reset.
150 * If interface is on specified uba, reset its state.
151 */
152enreset(unit, uban)
153 int unit, uban;
8a13b737 154{
11720282 155 register struct uba_device *ui;
11720282 156
b454c3ea
BJ
157 if (unit >= NEN || (ui = eninfo[unit]) == 0 || ui->ui_alive == 0 ||
158 ui->ui_ubanum != uban)
f1b2fa5b 159 return;
b454c3ea 160 printf(" en%d", unit);
f1b2fa5b
BJ
161 eninit(unit);
162}
163
164/*
165 * Initialization of interface; clear recorded pending
166 * operations, and reinitialize UNIBUS usage.
167 */
168eninit(unit)
169 int unit;
170{
b454c3ea
BJ
171 register struct en_softc *es = &en_softc[unit];
172 register struct uba_device *ui = eninfo[unit];
f1b2fa5b 173 register struct endevice *addr;
732fb59b
SL
174 struct sockaddr_in *sin = (struct sockaddr_in *)&es->es_if.if_addr;
175 int net, s;
f1b2fa5b 176
732fb59b
SL
177 net = in_netof(sin->sin_addr);
178 if (net == 0)
179 return;
180 ensetaddr(es, net);
181#ifdef notdef
182 if (es->es_if.if_flags & IFF_UP)
183 return;
184#endif
f1b2fa5b 185 if (if_ubainit(&es->es_ifuba, ui->ui_ubanum,
dc39362e 186 sizeof (struct en_header), (int)btoc(ENMRU)) == 0) {
b454c3ea 187 printf("en%d: can't initialize\n", unit);
ee787340 188 es->es_if.if_flags &= ~IFF_UP;
8a13b737 189 return;
11720282 190 }
11720282 191 addr = (struct endevice *)ui->ui_addr;
8a13b737 192 addr->en_istat = addr->en_ostat = 0;
11720282 193
f1b2fa5b 194 /*
b454c3ea
BJ
195 * Hang a receive and start any
196 * pending writes by faking a transmit complete.
f1b2fa5b
BJ
197 */
198 s = splimp();
b454c3ea 199 addr->en_iba = es->es_ifuba.ifu_r.ifrw_info;
dc39362e 200 addr->en_iwc = -(sizeof (struct en_header) + ENMRU) >> 1;
b454c3ea
BJ
201 addr->en_istat = EN_IEN|EN_GO;
202 es->es_oactive = 1;
ee787340 203 es->es_if.if_flags |= IFF_UP;
f1b2fa5b
BJ
204 enxint(unit);
205 splx(s);
a13c006d 206 if_rtinit(&es->es_if, RTF_UP);
11720282
BJ
207}
208
0658a645 209int enalldelay = 0;
4c073c48 210int enlastdel = 50;
0658a645 211int enlastmask = (~0) << 5;
8a13b737 212
f1b2fa5b
BJ
213/*
214 * Start or restart output on interface.
215 * If interface is already active, then this is a retransmit
216 * after a collision, and just restuff registers and delay.
217 * If interface is not already active, get another datagram
218 * to send off of the interface queue, and map it to the interface
219 * before starting the output.
220 */
ae348eea 221enstart(dev)
11720282
BJ
222 dev_t dev;
223{
b454c3ea
BJ
224 int unit = ENUNIT(dev);
225 struct uba_device *ui = eninfo[unit];
226 register struct en_softc *es = &en_softc[unit];
8a13b737 227 register struct endevice *addr;
8a13b737
BJ
228 struct mbuf *m;
229 int dest;
11720282 230
8a13b737
BJ
231 if (es->es_oactive)
232 goto restart;
f1b2fa5b
BJ
233
234 /*
235 * Not already active: dequeue another request
236 * and map it to the UNIBUS. If no more requests,
237 * just return.
238 */
239 IF_DEQUEUE(&es->es_if.if_snd, m);
8a13b737
BJ
240 if (m == 0) {
241 es->es_oactive = 0;
11720282
BJ
242 return;
243 }
a453e1b5 244 dest = mtod(m, struct en_header *)->en_dhost;
8a13b737 245 es->es_olen = if_wubaput(&es->es_ifuba, m);
f1b2fa5b
BJ
246
247 /*
248 * Ethernet cannot take back-to-back packets (no
0658a645
BJ
249 * buffering in interface. To help avoid overrunning
250 * receivers, enforce a small delay (about 1ms) in interface:
251 * * between all packets when enalldelay
252 * * whenever last packet was broadcast
253 * * whenever this packet is to same host as last packet
f1b2fa5b 254 */
0658a645 255 if (enalldelay || es->es_lastx == 0 || es->es_lastx == dest) {
8a13b737 256 es->es_delay = enlastdel;
0658a645
BJ
257 es->es_mask = enlastmask;
258 }
259 es->es_lastx = dest;
f1b2fa5b 260
8a13b737 261restart:
f1b2fa5b
BJ
262 /*
263 * Have request mapped to UNIBUS for transmission.
264 * Purge any stale data from this BDP, and start the otput.
265 */
ee787340
SL
266 if (es->es_ifuba.ifu_flags & UBA_NEEDBDP)
267 UBAPURGE(es->es_ifuba.ifu_uba, es->es_ifuba.ifu_w.ifrw_bdp);
11720282 268 addr = (struct endevice *)ui->ui_addr;
405c9168 269 addr->en_oba = (int)es->es_ifuba.ifu_w.ifrw_info;
8a13b737
BJ
270 addr->en_odelay = es->es_delay;
271 addr->en_owc = -((es->es_olen + 1) >> 1);
941ee7ef 272 addr->en_ostat = EN_IEN|EN_GO;
8a13b737 273 es->es_oactive = 1;
11720282
BJ
274}
275
f1b2fa5b
BJ
276/*
277 * Ethernet interface transmitter interrupt.
278 * Start another output if more data to send.
279 */
11720282
BJ
280enxint(unit)
281 int unit;
282{
b454c3ea
BJ
283 register struct uba_device *ui = eninfo[unit];
284 register struct en_softc *es = &en_softc[unit];
519a1ecf 285 register struct endevice *addr = (struct endevice *)ui->ui_addr;
11720282 286
8a13b737
BJ
287 if (es->es_oactive == 0)
288 return;
519a1ecf 289 if (es->es_mask && (addr->en_ostat&EN_OERROR)) {
89413846 290 es->es_if.if_oerrors++;
519a1ecf
BJ
291 endocoll(unit);
292 return;
89413846 293 }
519a1ecf
BJ
294 es->es_if.if_opackets++;
295 es->es_oactive = 0;
296 es->es_delay = 0;
297 es->es_mask = ~0;
7a66118b
BJ
298 if (es->es_ifuba.ifu_xtofree) {
299 m_freem(es->es_ifuba.ifu_xtofree);
300 es->es_ifuba.ifu_xtofree = 0;
301 }
f1b2fa5b 302 if (es->es_if.if_snd.ifq_head == 0) {
0658a645 303 es->es_lastx = 256; /* putatively illegal */
11720282
BJ
304 return;
305 }
8a13b737 306 enstart(unit);
11720282
BJ
307}
308
f1b2fa5b
BJ
309/*
310 * Collision on ethernet interface. Do exponential
311 * backoff, and retransmit. If have backed off all
ee787340 312 * the way print warning diagnostic, and drop packet.
f1b2fa5b 313 */
11720282
BJ
314encollide(unit)
315 int unit;
316{
519a1ecf 317 struct en_softc *es = &en_softc[unit];
11720282 318
f1b2fa5b 319 es->es_if.if_collisions++;
8a13b737 320 if (es->es_oactive == 0)
11720282 321 return;
519a1ecf
BJ
322 endocoll(unit);
323}
324
325endocoll(unit)
326 int unit;
327{
328 register struct en_softc *es = &en_softc[unit];
329
b454c3ea
BJ
330 /*
331 * Es_mask is a 16 bit number with n low zero bits, with
332 * n the number of backoffs. When es_mask is 0 we have
333 * backed off 16 times, and give up.
334 */
8a13b737 335 if (es->es_mask == 0) {
a453e1b5 336 printf("en%d: send error\n", unit);
8a13b737 337 enxint(unit);
b454c3ea 338 return;
11720282 339 }
b454c3ea
BJ
340 /*
341 * Another backoff. Restart with delay based on n low bits
342 * of the interval timer.
343 */
344 es->es_mask <<= 1;
345 es->es_delay = mfpr(ICR) &~ es->es_mask;
346 enstart(unit);
11720282
BJ
347}
348
31c2345c
SL
349struct sockaddr_pup pupsrc = { AF_PUP };
350struct sockaddr_pup pupdst = { AF_PUP };
351struct sockproto pupproto = { PF_PUP };
f1b2fa5b
BJ
352/*
353 * Ethernet interface receiver interrupt.
354 * If input error just drop packet.
355 * Otherwise purge input buffered data path and examine
356 * packet to determine type. If can't determine length
357 * from type, then have to drop packet. Othewise decapsulate
358 * packet based on type and pass to type specific higher-level
359 * input routine.
360 */
11720282
BJ
361enrint(unit)
362 int unit;
363{
b454c3ea
BJ
364 register struct en_softc *es = &en_softc[unit];
365 struct endevice *addr = (struct endevice *)eninfo[unit]->ui_addr;
366 register struct en_header *en;
8a13b737 367 struct mbuf *m;
038ee561 368 int len; short resid;
b454c3ea 369 register struct ifqueue *inq;
8a13b737 370 int off;
11720282 371
b454c3ea 372 es->es_if.if_ipackets++;
f1b2fa5b
BJ
373
374 /*
b454c3ea 375 * Purge BDP; drop if input error indicated.
f1b2fa5b 376 */
ee787340
SL
377 if (es->es_ifuba.ifu_flags & UBA_NEEDBDP)
378 UBAPURGE(es->es_ifuba.ifu_uba, es->es_ifuba.ifu_r.ifrw_bdp);
941ee7ef 379 if (addr->en_istat&EN_IERROR) {
f1b2fa5b 380 es->es_if.if_ierrors++;
8a13b737 381 goto setup;
11720282 382 }
f1b2fa5b
BJ
383
384 /*
0658a645 385 * Calculate input data length.
f1b2fa5b
BJ
386 * Get pointer to ethernet header (in input buffer).
387 * Deal with trailer protocol: if type is PUP trailer
388 * get true type from first 16-bit word past data.
389 * Remember that type was trailer by setting off.
390 */
0658a645
BJ
391 resid = addr->en_iwc;
392 if (resid)
393 resid |= 0176000;
dc39362e 394 len = (((sizeof (struct en_header) + ENMRU) >> 1) + resid) << 1;
0658a645 395 len -= sizeof (struct en_header);
dc39362e 396 if (len > ENMRU)
0658a645 397 goto setup; /* sanity */
f1b2fa5b 398 en = (struct en_header *)(es->es_ifuba.ifu_r.ifrw_addr);
8a13b737
BJ
399#define endataaddr(en, off, type) ((type)(((caddr_t)((en)+1)+(off))))
400 if (en->en_type >= ENPUP_TRAIL &&
401 en->en_type < ENPUP_TRAIL+ENPUP_NTRAILER) {
402 off = (en->en_type - ENPUP_TRAIL) * 512;
dc39362e 403 if (off > ENMTU)
b454c3ea 404 goto setup; /* sanity */
8a13b737 405 en->en_type = *endataaddr(en, off, u_short *);
0658a645
BJ
406 resid = *(endataaddr(en, off+2, u_short *));
407 if (off + resid > len)
408 goto setup; /* sanity */
409 len = off + resid;
8a13b737
BJ
410 } else
411 off = 0;
8a13b737
BJ
412 if (len == 0)
413 goto setup;
f1b2fa5b
BJ
414 /*
415 * Pull packet off interface. Off is nonzero if packet
416 * has trailing header; if_rubaget will then force this header
417 * information to be at the front, but we still have to drop
0658a645 418 * the type and length which are at the front of any trailer data.
f1b2fa5b
BJ
419 */
420 m = if_rubaget(&es->es_ifuba, len, off);
a453e1b5
BJ
421 if (m == 0)
422 goto setup;
f1b2fa5b 423 if (off) {
0658a645
BJ
424 m->m_off += 2 * sizeof (u_short);
425 m->m_len -= 2 * sizeof (u_short);
f1b2fa5b 426 }
31c2345c
SL
427 switch (en->en_type) {
428
429#ifdef INET
430 case ENPUP_IPTYPE:
9c8692e9 431 schednetisr(NETISR_IP);
31c2345c
SL
432 inq = &ipintrq;
433 break;
434#endif
ee787340 435#ifdef PUP
31c2345c
SL
436 case ENPUP_PUPTYPE: {
437 struct pup_header *pup = mtod(m, struct pup_header *);
438
439 pupproto.sp_protocol = pup->pup_type;
440 pupdst.spup_addr = pup->pup_dport;
441 pupsrc.spup_addr = pup->pup_sport;
57aa3090
SL
442 raw_input(m, &pupproto, (struct sockaddr *)&pupsrc,
443 (struct sockaddr *)&pupdst);
31c2345c 444 goto setup;
31c2345c 445 }
ee787340 446#endif
c8f8184f
BJ
447 default:
448 m_freem(m);
449 goto setup;
ee787340
SL
450 }
451
1e977657
BJ
452 if (IF_QFULL(inq)) {
453 IF_DROP(inq);
ee787340 454 m_freem(m);
1e977657
BJ
455 } else
456 IF_ENQUEUE(inq, m);
f1b2fa5b 457
ae348eea 458setup:
f1b2fa5b
BJ
459 /*
460 * Reset for next packet.
461 */
462 addr->en_iba = es->es_ifuba.ifu_r.ifrw_info;
dc39362e 463 addr->en_iwc = -(sizeof (struct en_header) + ENMRU) >> 1;
941ee7ef 464 addr->en_istat = EN_IEN|EN_GO;
ae348eea 465}
11720282 466
8a13b737
BJ
467/*
468 * Ethernet output routine.
469 * Encapsulate a packet of type family for the local net.
f1b2fa5b
BJ
470 * Use trailer local net encapsulation if enough data in first
471 * packet leaves a multiple of 512 bytes of data in remainder.
8a13b737 472 */
ee787340 473enoutput(ifp, m0, dst)
8a13b737
BJ
474 struct ifnet *ifp;
475 struct mbuf *m0;
ee787340 476 struct sockaddr *dst;
11720282 477{
8a2f82db 478 int type, dest, s, error;
f1b2fa5b 479 register struct mbuf *m = m0;
8a13b737 480 register struct en_header *en;
ee787340 481 register int off;
8a13b737 482
ee787340 483 switch (dst->sa_family) {
11720282 484
8a13b737 485#ifdef INET
ee787340 486 case AF_INET:
4e818526 487 dest = ((struct sockaddr_in *)dst)->sin_addr.s_addr;
4fce3bf9 488 if (in_lnaof(*((struct in_addr *)&dest)) >= 0x100) {
8a2f82db 489 error = EPERM; /* ??? */
3734056d 490 goto bad;
8a2f82db 491 }
4e818526 492 dest = (dest >> 24) & 0xff;
ee787340
SL
493 off = ntohs((u_short)mtod(m, struct ip *)->ip_len) - m->m_len;
494 if (off > 0 && (off & 0x1ff) == 0 &&
0658a645 495 m->m_off >= MMINOFF + 2 * sizeof (u_short)) {
8a13b737 496 type = ENPUP_TRAIL + (off>>9);
0658a645
BJ
497 m->m_off -= 2 * sizeof (u_short);
498 m->m_len += 2 * sizeof (u_short);
f1b2fa5b 499 *mtod(m, u_short *) = ENPUP_IPTYPE;
0658a645 500 *(mtod(m, u_short *) + 1) = m->m_len;
f1b2fa5b 501 goto gottrailertype;
8a13b737 502 }
f1b2fa5b
BJ
503 type = ENPUP_IPTYPE;
504 off = 0;
505 goto gottype;
8a13b737 506#endif
31c2345c 507#ifdef PUP
ee787340
SL
508 case AF_PUP:
509 dest = ((struct sockaddr_pup *)dst)->spup_addr.pp_host;
31c2345c
SL
510 type = ENPUP_PUPTYPE;
511 off = 0;
512 goto gottype;
31c2345c 513#endif
8a13b737
BJ
514
515 default:
ee787340
SL
516 printf("en%d: can't handle af%d\n", ifp->if_unit,
517 dst->sa_family);
8a2f82db
SL
518 error = EAFNOSUPPORT;
519 goto bad;
8a13b737 520 }
f1b2fa5b 521
b454c3ea 522gottrailertype:
f1b2fa5b
BJ
523 /*
524 * Packet to be sent as trailer: move first packet
525 * (control information) to end of chain.
526 */
f1b2fa5b
BJ
527 while (m->m_next)
528 m = m->m_next;
529 m->m_next = m0;
530 m = m0->m_next;
531 m0->m_next = 0;
b454c3ea 532 m0 = m;
f1b2fa5b 533
b454c3ea 534gottype:
f1b2fa5b
BJ
535 /*
536 * Add local net header. If no space in first mbuf,
537 * allocate another.
538 */
a453e1b5
BJ
539 if (m->m_off > MMAXOFF ||
540 MMINOFF + sizeof (struct en_header) > m->m_off) {
cce93e4b 541 m = m_get(M_DONTWAIT, MT_HEADER);
8a13b737 542 if (m == 0) {
8a2f82db
SL
543 error = ENOBUFS;
544 goto bad;
8a13b737
BJ
545 }
546 m->m_next = m0;
547 m->m_off = MMINOFF;
548 m->m_len = sizeof (struct en_header);
549 } else {
8a13b737
BJ
550 m->m_off -= sizeof (struct en_header);
551 m->m_len += sizeof (struct en_header);
11720282 552 }
8a13b737
BJ
553 en = mtod(m, struct en_header *);
554 en->en_shost = ifp->if_host[0];
555 en->en_dhost = dest;
556 en->en_type = type;
f1b2fa5b
BJ
557
558 /*
559 * Queue message on interface, and start output if interface
560 * not yet active.
561 */
8a13b737 562 s = splimp();
1e977657
BJ
563 if (IF_QFULL(&ifp->if_snd)) {
564 IF_DROP(&ifp->if_snd);
8a2f82db
SL
565 error = ENOBUFS;
566 goto qfull;
1e977657 567 }
8a13b737 568 IF_ENQUEUE(&ifp->if_snd, m);
8a13b737
BJ
569 if (en_softc[ifp->if_unit].es_oactive == 0)
570 enstart(ifp->if_unit);
89413846 571 splx(s);
4e818526 572 return (0);
8a2f82db
SL
573qfull:
574 m0 = m;
575 splx(s);
576bad:
577 m_freem(m0);
578 return (error);
11720282 579}