am7990.c revision 1.55 1 /* $NetBSD: am7990.c,v 1.55 1999/10/29 19:50:07 ragge Exp $ */
2
3 /*-
4 * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Charles M. Hannum and by Jason R. Thorpe of the Numerical Aerospace
9 * Simulation Facility, NASA Ames Research Center.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgement:
21 * This product includes software developed by the NetBSD
22 * Foundation, Inc. and its contributors.
23 * 4. Neither the name of The NetBSD Foundation nor the names of its
24 * contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
31 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGE.
38 */
39
40 /*-
41 * Copyright (c) 1992, 1993
42 * The Regents of the University of California. All rights reserved.
43 *
44 * This code is derived from software contributed to Berkeley by
45 * Ralph Campbell and Rick Macklem.
46 *
47 * Redistribution and use in source and binary forms, with or without
48 * modification, are permitted provided that the following conditions
49 * are met:
50 * 1. Redistributions of source code must retain the above copyright
51 * notice, this list of conditions and the following disclaimer.
52 * 2. Redistributions in binary form must reproduce the above copyright
53 * notice, this list of conditions and the following disclaimer in the
54 * documentation and/or other materials provided with the distribution.
55 * 3. All advertising materials mentioning features or use of this software
56 * must display the following acknowledgement:
57 * This product includes software developed by the University of
58 * California, Berkeley and its contributors.
59 * 4. Neither the name of the University nor the names of its contributors
60 * may be used to endorse or promote products derived from this software
61 * without specific prior written permission.
62 *
63 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
64 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
65 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
66 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
67 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
68 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
69 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
70 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
71 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
72 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
73 * SUCH DAMAGE.
74 *
75 * @(#)if_le.c 8.2 (Berkeley) 11/16/93
76 */
77
78 #include "bpfilter.h"
79 #include "rnd.h"
80
81 #include <sys/param.h>
82 #include <sys/systm.h>
83 #include <sys/mbuf.h>
84 #include <sys/syslog.h>
85 #include <sys/socket.h>
86 #include <sys/device.h>
87 #include <sys/malloc.h>
88 #include <sys/ioctl.h>
89 #include <sys/errno.h>
90 #if NRND > 0
91 #include <sys/rnd.h>
92 #endif
93
94 #include <net/if.h>
95 #include <net/if_dl.h>
96 #include <net/if_ether.h>
97 #include <net/if_media.h>
98
99 #if NBPFILTER > 0
100 #include <net/bpf.h>
101 #include <net/bpfdesc.h>
102 #endif
103
104 #include <dev/ic/lancereg.h>
105 #include <dev/ic/lancevar.h>
106 #include <dev/ic/am7990reg.h>
107 #include <dev/ic/am7990var.h>
108
109 void am7990_meminit __P((struct lance_softc *));
110 void am7990_start __P((struct ifnet *));
111
112 #if defined(_KERNEL) && !defined(_LKM)
113 #include "opt_ddb.h"
114 #endif
115
116 #ifdef DDB
117 #define integrate
118 #define hide
119 #else
120 #define integrate static __inline
121 #define hide static
122 #endif
123
124 integrate void am7990_rint __P((struct lance_softc *));
125 integrate void am7990_tint __P((struct lance_softc *));
126
127 #ifdef LEDEBUG
128 void am7990_recv_print __P((struct lance_softc *, int));
129 void am7990_xmit_print __P((struct lance_softc *, int));
130 #endif
131
132 #define ifp (&sc->sc_ethercom.ec_if)
133
134 void
135 am7990_config(sc)
136 struct am7990_softc *sc;
137 {
138 int mem, i;
139
140 sc->lsc.sc_meminit = am7990_meminit;
141 sc->lsc.sc_start = am7990_start;
142
143 lance_config(&sc->lsc);
144
145 mem = 0;
146 sc->lsc.sc_initaddr = mem;
147 mem += sizeof(struct leinit);
148 sc->lsc.sc_rmdaddr = mem;
149 mem += sizeof(struct lermd) * sc->lsc.sc_nrbuf;
150 sc->lsc.sc_tmdaddr = mem;
151 mem += sizeof(struct letmd) * sc->lsc.sc_ntbuf;
152 for (i = 0; i < sc->lsc.sc_nrbuf; i++, mem += LEBLEN)
153 sc->lsc.sc_rbufaddr[i] = mem;
154 for (i = 0; i < sc->lsc.sc_ntbuf; i++, mem += LEBLEN)
155 sc->lsc.sc_tbufaddr[i] = mem;
156 #ifdef notyet
157 if (mem > ...)
158 panic(...);
159 #endif
160 }
161
162 /*
163 * Set up the initialization block and the descriptor rings.
164 */
165 void
166 am7990_meminit(sc)
167 register struct lance_softc *sc;
168 {
169 u_long a;
170 int bix;
171 struct leinit init;
172 struct lermd rmd;
173 struct letmd tmd;
174 u_int8_t *myaddr;
175
176 #if NBPFILTER > 0
177 if (ifp->if_flags & IFF_PROMISC)
178 init.init_mode = LE_MODE_NORMAL | LE_MODE_PROM;
179 else
180 #endif
181 init.init_mode = LE_MODE_NORMAL;
182 if (sc->sc_initmodemedia == 1)
183 init.init_mode |= LE_MODE_PSEL0;
184
185 /*
186 * Update our private copy of the Ethernet address.
187 * We NEED the copy so we can ensure its alignment!
188 */
189 bcopy(LLADDR(ifp->if_sadl), sc->sc_enaddr, 6);
190 myaddr = sc->sc_enaddr;
191
192 init.init_padr[0] = (myaddr[1] << 8) | myaddr[0];
193 init.init_padr[1] = (myaddr[3] << 8) | myaddr[2];
194 init.init_padr[2] = (myaddr[5] << 8) | myaddr[4];
195 lance_setladrf(&sc->sc_ethercom, init.init_ladrf);
196
197 sc->sc_last_rd = 0;
198 sc->sc_first_td = sc->sc_last_td = sc->sc_no_td = 0;
199
200 a = sc->sc_addr + LE_RMDADDR(sc, 0);
201 init.init_rdra = a;
202 init.init_rlen = (a >> 16) | ((ffs(sc->sc_nrbuf) - 1) << 13);
203
204 a = sc->sc_addr + LE_TMDADDR(sc, 0);
205 init.init_tdra = a;
206 init.init_tlen = (a >> 16) | ((ffs(sc->sc_ntbuf) - 1) << 13);
207
208 (*sc->sc_copytodesc)(sc, &init, LE_INITADDR(sc), sizeof(init));
209
210 /*
211 * Set up receive ring descriptors.
212 */
213 for (bix = 0; bix < sc->sc_nrbuf; bix++) {
214 a = sc->sc_addr + LE_RBUFADDR(sc, bix);
215 rmd.rmd0 = a;
216 rmd.rmd1_hadr = a >> 16;
217 rmd.rmd1_bits = LE_R1_OWN;
218 rmd.rmd2 = -LEBLEN | LE_XMD2_ONES;
219 rmd.rmd3 = 0;
220 (*sc->sc_copytodesc)(sc, &rmd, LE_RMDADDR(sc, bix),
221 sizeof(rmd));
222 }
223
224 /*
225 * Set up transmit ring descriptors.
226 */
227 for (bix = 0; bix < sc->sc_ntbuf; bix++) {
228 a = sc->sc_addr + LE_TBUFADDR(sc, bix);
229 tmd.tmd0 = a;
230 tmd.tmd1_hadr = a >> 16;
231 tmd.tmd1_bits = 0;
232 tmd.tmd2 = 0 | LE_XMD2_ONES;
233 tmd.tmd3 = 0;
234 (*sc->sc_copytodesc)(sc, &tmd, LE_TMDADDR(sc, bix),
235 sizeof(tmd));
236 }
237 }
238
239 integrate void
240 am7990_rint(sc)
241 struct lance_softc *sc;
242 {
243 register int bix;
244 int rp;
245 struct lermd rmd;
246
247 bix = sc->sc_last_rd;
248
249 /* Process all buffers with valid data. */
250 for (;;) {
251 rp = LE_RMDADDR(sc, bix);
252 (*sc->sc_copyfromdesc)(sc, &rmd, rp, sizeof(rmd));
253
254 if (rmd.rmd1_bits & LE_R1_OWN)
255 break;
256
257 if (rmd.rmd1_bits & LE_R1_ERR) {
258 if (rmd.rmd1_bits & LE_R1_ENP) {
259 #ifdef LEDEBUG
260 if ((rmd.rmd1_bits & LE_R1_OFLO) == 0) {
261 if (rmd.rmd1_bits & LE_R1_FRAM)
262 printf("%s: framing error\n",
263 sc->sc_dev.dv_xname);
264 if (rmd.rmd1_bits & LE_R1_CRC)
265 printf("%s: crc mismatch\n",
266 sc->sc_dev.dv_xname);
267 }
268 #endif
269 } else {
270 if (rmd.rmd1_bits & LE_R1_OFLO)
271 printf("%s: overflow\n",
272 sc->sc_dev.dv_xname);
273 }
274 if (rmd.rmd1_bits & LE_R1_BUFF)
275 printf("%s: receive buffer error\n",
276 sc->sc_dev.dv_xname);
277 ifp->if_ierrors++;
278 } else if ((rmd.rmd1_bits & (LE_R1_STP | LE_R1_ENP)) !=
279 (LE_R1_STP | LE_R1_ENP)) {
280 printf("%s: dropping chained buffer\n",
281 sc->sc_dev.dv_xname);
282 ifp->if_ierrors++;
283 } else {
284 #ifdef LEDEBUG
285 if (sc->sc_debug)
286 am7990_recv_print(sc, sc->sc_last_rd);
287 #endif
288 lance_read(sc, LE_RBUFADDR(sc, bix),
289 (int)rmd.rmd3 - 4);
290 }
291
292 rmd.rmd1_bits = LE_R1_OWN;
293 rmd.rmd2 = -LEBLEN | LE_XMD2_ONES;
294 rmd.rmd3 = 0;
295 (*sc->sc_copytodesc)(sc, &rmd, rp, sizeof(rmd));
296
297 #ifdef LEDEBUG
298 if (sc->sc_debug)
299 printf("sc->sc_last_rd = %x, rmd: "
300 "ladr %04x, hadr %02x, flags %02x, "
301 "bcnt %04x, mcnt %04x\n",
302 sc->sc_last_rd,
303 rmd.rmd0, rmd.rmd1_hadr, rmd.rmd1_bits,
304 rmd.rmd2, rmd.rmd3);
305 #endif
306
307 if (++bix == sc->sc_nrbuf)
308 bix = 0;
309 }
310
311 sc->sc_last_rd = bix;
312 }
313
314 integrate void
315 am7990_tint(sc)
316 register struct lance_softc *sc;
317 {
318 register int bix;
319 struct letmd tmd;
320
321 bix = sc->sc_first_td;
322
323 for (;;) {
324 if (sc->sc_no_td <= 0)
325 break;
326
327 (*sc->sc_copyfromdesc)(sc, &tmd, LE_TMDADDR(sc, bix),
328 sizeof(tmd));
329
330 #ifdef LEDEBUG
331 if (sc->sc_debug)
332 printf("trans tmd: "
333 "ladr %04x, hadr %02x, flags %02x, "
334 "bcnt %04x, mcnt %04x\n",
335 tmd.tmd0, tmd.tmd1_hadr, tmd.tmd1_bits,
336 tmd.tmd2, tmd.tmd3);
337 #endif
338
339 if (tmd.tmd1_bits & LE_T1_OWN)
340 break;
341
342 ifp->if_flags &= ~IFF_OACTIVE;
343
344 if (tmd.tmd1_bits & LE_T1_ERR) {
345 if (tmd.tmd3 & LE_T3_BUFF)
346 printf("%s: transmit buffer error\n",
347 sc->sc_dev.dv_xname);
348 else if (tmd.tmd3 & LE_T3_UFLO)
349 printf("%s: underflow\n", sc->sc_dev.dv_xname);
350 if (tmd.tmd3 & (LE_T3_BUFF | LE_T3_UFLO)) {
351 lance_reset(sc);
352 return;
353 }
354 if (tmd.tmd3 & LE_T3_LCAR) {
355 sc->sc_havecarrier = 0;
356 if (sc->sc_nocarrier)
357 (*sc->sc_nocarrier)(sc);
358 else
359 printf("%s: lost carrier\n",
360 sc->sc_dev.dv_xname);
361 }
362 if (tmd.tmd3 & LE_T3_LCOL)
363 ifp->if_collisions++;
364 if (tmd.tmd3 & LE_T3_RTRY) {
365 printf("%s: excessive collisions, tdr %d\n",
366 sc->sc_dev.dv_xname,
367 tmd.tmd3 & LE_T3_TDR_MASK);
368 ifp->if_collisions += 16;
369 }
370 ifp->if_oerrors++;
371 } else {
372 if (tmd.tmd1_bits & LE_T1_ONE)
373 ifp->if_collisions++;
374 else if (tmd.tmd1_bits & LE_T1_MORE)
375 /* Real number is unknown. */
376 ifp->if_collisions += 2;
377 ifp->if_opackets++;
378 }
379
380 if (++bix == sc->sc_ntbuf)
381 bix = 0;
382
383 --sc->sc_no_td;
384 }
385
386 sc->sc_first_td = bix;
387
388 am7990_start(ifp);
389
390 if (sc->sc_no_td == 0)
391 ifp->if_timer = 0;
392 }
393
394 /*
395 * Controller interrupt.
396 */
397 int
398 am7990_intr(arg)
399 register void *arg;
400 {
401 register struct lance_softc *sc = arg;
402 register u_int16_t isr;
403
404 isr = (*sc->sc_rdcsr)(sc, LE_CSR0) | sc->sc_saved_csr0;
405 sc->sc_saved_csr0 = 0;
406 #ifdef LEDEBUG
407 if (sc->sc_debug)
408 printf("%s: am7990_intr entering with isr=%04x\n",
409 sc->sc_dev.dv_xname, isr);
410 #endif
411 if ((isr & LE_C0_INTR) == 0)
412 return (0);
413
414 #ifdef __vax__
415 /*
416 * DEC needs this write order to the registers, don't know
417 * the results on other arch's. Ragge 991029
418 */
419 isr &= ~LE_C0_INEA;
420 (*sc->sc_wrcsr)(sc, LE_CSR0, isr);
421 (*sc->sc_wrcsr)(sc, LE_CSR0, LE_C0_INEA);
422 #else
423 (*sc->sc_wrcsr)(sc, LE_CSR0,
424 isr & (LE_C0_INEA | LE_C0_BABL | LE_C0_MISS | LE_C0_MERR |
425 LE_C0_RINT | LE_C0_TINT | LE_C0_IDON));
426 #endif
427 if (isr & LE_C0_ERR) {
428 if (isr & LE_C0_BABL) {
429 #ifdef LEDEBUG
430 printf("%s: babble\n", sc->sc_dev.dv_xname);
431 #endif
432 ifp->if_oerrors++;
433 }
434 #if 0
435 if (isr & LE_C0_CERR) {
436 printf("%s: collision error\n", sc->sc_dev.dv_xname);
437 ifp->if_collisions++;
438 }
439 #endif
440 if (isr & LE_C0_MISS) {
441 #ifdef LEDEBUG
442 printf("%s: missed packet\n", sc->sc_dev.dv_xname);
443 #endif
444 ifp->if_ierrors++;
445 }
446 if (isr & LE_C0_MERR) {
447 printf("%s: memory error\n", sc->sc_dev.dv_xname);
448 lance_reset(sc);
449 return (1);
450 }
451 }
452
453 if ((isr & LE_C0_RXON) == 0) {
454 printf("%s: receiver disabled\n", sc->sc_dev.dv_xname);
455 ifp->if_ierrors++;
456 lance_reset(sc);
457 return (1);
458 }
459 if ((isr & LE_C0_TXON) == 0) {
460 printf("%s: transmitter disabled\n", sc->sc_dev.dv_xname);
461 ifp->if_oerrors++;
462 lance_reset(sc);
463 return (1);
464 }
465
466 /*
467 * Pretend we have carrier; if we don't this will be cleared
468 * shortly.
469 */
470 sc->sc_havecarrier = 1;
471
472 if (isr & LE_C0_RINT)
473 am7990_rint(sc);
474 if (isr & LE_C0_TINT)
475 am7990_tint(sc);
476
477 #if NRND > 0
478 rnd_add_uint32(&sc->rnd_source, isr);
479 #endif
480
481 return (1);
482 }
483
484 #undef ifp
485
486 /*
487 * Setup output on interface.
488 * Get another datagram to send off of the interface queue, and map it to the
489 * interface before starting the output.
490 * Called only at splnet or interrupt level.
491 */
492 void
493 am7990_start(ifp)
494 register struct ifnet *ifp;
495 {
496 register struct lance_softc *sc = ifp->if_softc;
497 register int bix;
498 register struct mbuf *m;
499 struct letmd tmd;
500 int rp;
501 int len;
502
503 if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
504 return;
505
506 bix = sc->sc_last_td;
507
508 for (;;) {
509 rp = LE_TMDADDR(sc, bix);
510 (*sc->sc_copyfromdesc)(sc, &tmd, rp, sizeof(tmd));
511
512 if (tmd.tmd1_bits & LE_T1_OWN) {
513 ifp->if_flags |= IFF_OACTIVE;
514 printf("missing buffer, no_td = %d, last_td = %d\n",
515 sc->sc_no_td, sc->sc_last_td);
516 }
517
518 IF_DEQUEUE(&ifp->if_snd, m);
519 if (m == 0)
520 break;
521
522 #if NBPFILTER > 0
523 /*
524 * If BPF is listening on this interface, let it see the packet
525 * before we commit it to the wire.
526 */
527 if (ifp->if_bpf)
528 bpf_mtap(ifp->if_bpf, m);
529 #endif
530
531 /*
532 * Copy the mbuf chain into the transmit buffer.
533 */
534 len = lance_put(sc, LE_TBUFADDR(sc, bix), m);
535
536 #ifdef LEDEBUG
537 if (len > ETHERMTU + sizeof(struct ether_header))
538 printf("packet length %d\n", len);
539 #endif
540
541 ifp->if_timer = 5;
542
543 /*
544 * Init transmit registers, and set transmit start flag.
545 */
546 tmd.tmd1_bits = LE_T1_OWN | LE_T1_STP | LE_T1_ENP;
547 tmd.tmd2 = -len | LE_XMD2_ONES;
548 tmd.tmd3 = 0;
549
550 (*sc->sc_copytodesc)(sc, &tmd, rp, sizeof(tmd));
551
552 #ifdef LEDEBUG
553 if (sc->sc_debug)
554 am7990_xmit_print(sc, sc->sc_last_td);
555 #endif
556
557 (*sc->sc_wrcsr)(sc, LE_CSR0, LE_C0_INEA | LE_C0_TDMD);
558
559 if (++bix == sc->sc_ntbuf)
560 bix = 0;
561
562 if (++sc->sc_no_td == sc->sc_ntbuf) {
563 ifp->if_flags |= IFF_OACTIVE;
564 break;
565 }
566
567 }
568
569 sc->sc_last_td = bix;
570 }
571
572 #ifdef LEDEBUG
573 void
574 am7990_recv_print(sc, no)
575 struct lance_softc *sc;
576 int no;
577 {
578 struct lermd rmd;
579 u_int16_t len;
580 struct ether_header eh;
581
582 (*sc->sc_copyfromdesc)(sc, &rmd, LE_RMDADDR(sc, no), sizeof(rmd));
583 len = rmd.rmd3;
584 printf("%s: receive buffer %d, len = %d\n", sc->sc_dev.dv_xname, no,
585 len);
586 printf("%s: status %04x\n", sc->sc_dev.dv_xname,
587 (*sc->sc_rdcsr)(sc, LE_CSR0));
588 printf("%s: ladr %04x, hadr %02x, flags %02x, bcnt %04x, mcnt %04x\n",
589 sc->sc_dev.dv_xname,
590 rmd.rmd0, rmd.rmd1_hadr, rmd.rmd1_bits, rmd.rmd2, rmd.rmd3);
591 if (len >= sizeof(eh)) {
592 (*sc->sc_copyfrombuf)(sc, &eh, LE_RBUFADDR(sc, no), sizeof(eh));
593 printf("%s: dst %s", sc->sc_dev.dv_xname,
594 ether_sprintf(eh.ether_dhost));
595 printf(" src %s type %04x\n", ether_sprintf(eh.ether_shost),
596 ntohs(eh.ether_type));
597 }
598 }
599
600 void
601 am7990_xmit_print(sc, no)
602 struct lance_softc *sc;
603 int no;
604 {
605 struct letmd tmd;
606 u_int16_t len;
607 struct ether_header eh;
608
609 (*sc->sc_copyfromdesc)(sc, &tmd, LE_TMDADDR(sc, no), sizeof(tmd));
610 len = -tmd.tmd2;
611 printf("%s: transmit buffer %d, len = %d\n", sc->sc_dev.dv_xname, no,
612 len);
613 printf("%s: status %04x\n", sc->sc_dev.dv_xname,
614 (*sc->sc_rdcsr)(sc, LE_CSR0));
615 printf("%s: ladr %04x, hadr %02x, flags %02x, bcnt %04x, mcnt %04x\n",
616 sc->sc_dev.dv_xname,
617 tmd.tmd0, tmd.tmd1_hadr, tmd.tmd1_bits, tmd.tmd2, tmd.tmd3);
618 if (len >= sizeof(eh)) {
619 (*sc->sc_copyfrombuf)(sc, &eh, LE_TBUFADDR(sc, no), sizeof(eh));
620 printf("%s: dst %s", sc->sc_dev.dv_xname,
621 ether_sprintf(eh.ether_dhost));
622 printf(" src %s type %04x\n", ether_sprintf(eh.ether_shost),
623 ntohs(eh.ether_type));
624 }
625 }
626 #endif /* LEDEBUG */
627