if_il.c revision 1.14 1 /* $NetBSD: if_il.c,v 1.14 2006/03/29 18:17:36 thorpej Exp $ */
2 /*
3 * Copyright (c) 1982, 1986 Regents of the University of California.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
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.
14 * 3. Neither the name of the University nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
30 * @(#)if_il.c 7.8 (Berkeley) 12/16/90
31 */
32
33 /*
34 * Interlan Ethernet Communications Controller interface
35 */
36
37 #include <sys/cdefs.h>
38 __KERNEL_RCSID(0, "$NetBSD: if_il.c,v 1.14 2006/03/29 18:17:36 thorpej Exp $");
39
40 #include "opt_inet.h"
41 #include "opt_ns.h"
42
43 #include <sys/param.h>
44 #include <sys/systm.h>
45 #include <sys/mbuf.h>
46 #include <sys/buf.h>
47 #include <sys/protosw.h>
48 #include <sys/socket.h>
49 #include <sys/ioctl.h>
50 #include <sys/errno.h>
51 #include <sys/syslog.h>
52 #include <sys/device.h>
53
54 #include <net/if.h>
55 #include <net/if_ether.h>
56 #include <net/if_dl.h>
57
58 #ifdef INET
59 #include <netinet/in.h>
60 #endif
61
62 #ifdef NS
63 #include <netns/ns.h>
64 #include <netns/ns_if.h>
65 #endif
66
67 #include <machine/bus.h>
68
69 #include <dev/qbus/ubareg.h>
70 #include <dev/qbus/ubavar.h>
71 #include <dev/qbus/if_uba.h>
72
73 #include <dev/qbus/if_il.h>
74 #include <dev/qbus/if_ilreg.h>
75
76 /*
77 * Ethernet software status per interface.
78 *
79 * Each interface is referenced by a network interface structure,
80 * is_if, which the routing code uses to locate the interface.
81 * This structure contains the output queue for the interface, its address, ...
82 * We also have, for each interface, a UBA interface structure, which
83 * contains information about the UNIBUS resources held by the interface:
84 * map registers, buffered data paths, etc. Information is cached in this
85 * structure for use by the if_uba.c routines in running the interface
86 * efficiently.
87 */
88
89 struct il_softc {
90 struct device sc_dev; /* Configuration common part */
91 struct ethercom sc_ec; /* Ethernet common part */
92 #define sc_if sc_ec.ec_if /* network-visible interface */
93 struct evcnt sc_cintrcnt; /* Command interrupts */
94 struct evcnt sc_rintrcnt; /* Receive interrupts */
95 bus_space_tag_t sc_iot;
96 bus_addr_t sc_ioh;
97 bus_dma_tag_t sc_dmat;
98 struct ubinfo sc_ui;
99
100 struct ifuba sc_ifuba; /* UNIBUS resources */
101 int sc_flags;
102 #define ILF_RCVPENDING 0x2 /* start rcv in ilcint */
103 #define ILF_STATPENDING 0x4 /* stat cmd pending */
104 #define ILF_RUNNING 0x8 /* board is running */
105 #define ILF_SETADDR 0x10 /* physical address is changed */
106 short sc_lastcmd; /* can't read csr, so must save it */
107 short sc_scaninterval; /* interval of stat collection */
108 #define ILWATCHINTERVAL 60 /* once every 60 seconds */
109 union {
110 struct il_stats isu_stats; /* holds on-board statistics */
111 struct ether_addr isu_maddrs[63]; /* multicast addrs */
112 } sc_isu;
113 #define sc_stats sc_isu.isu_stats
114 #define sc_maddrs sc_isu.isu_maddrs
115 struct il_stats sc_sum; /* summation over time */
116 int sc_ubaddr; /* mapping registers of is_stats */
117 };
118
119 static int ilmatch(struct device *, struct cfdata *, void *);
120 static void ilattach(struct device *, struct device *, void *);
121 static void ilcint(void *);
122 static void ilrint(void *);
123 static void ilreset(struct device *);
124 static int ilwait(struct il_softc *, char *);
125 static int ilinit(struct ifnet *);
126 static void ilstart(struct ifnet *);
127 static void ilwatch(struct ifnet *);
128 static void iltotal(struct il_softc *);
129 static void ilstop(struct ifnet *, int);
130
131 CFATTACH_DECL(il, sizeof(struct il_softc),
132 ilmatch, ilattach, NULL, NULL);
133
134 #define IL_WCSR(csr, val) \
135 bus_space_write_2(sc->sc_iot, sc->sc_ioh, csr, val)
136 #define IL_RCSR(csr) \
137 bus_space_read_2(sc->sc_iot, sc->sc_ioh, csr)
138 #define LOWORD(x) ((int)(x) & 0xffff)
139 #define HIWORD(x) (((int)(x) >> 16) & 0x3)
140
141 int
142 ilmatch(struct device *parent, struct cfdata *cf, void *aux)
143 {
144 struct uba_attach_args *ua = aux;
145 volatile int i;
146
147 bus_space_write_2(ua->ua_iot, ua->ua_ioh, IL_CSR, ILC_OFFLINE|IL_CIE);
148 DELAY(100000);
149 i = bus_space_read_2(ua->ua_iot, ua->ua_ioh, IL_CSR); /* clear CDONE */
150
151 return 1;
152 }
153
154 /*
155 * Interface exists: make available by filling in network interface
156 * record. System will initialize the interface when it is ready
157 * to accept packets. A STATUS command is done to get the ethernet
158 * address and other interesting data.
159 */
160 void
161 ilattach(struct device *parent, struct device *self, void *aux)
162 {
163 struct uba_attach_args *ua = aux;
164 struct il_softc *sc = device_private(self);
165 struct ifnet *ifp = &sc->sc_if;
166 int error;
167
168 sc->sc_iot = ua->ua_iot;
169 sc->sc_ioh = ua->ua_ioh;
170 sc->sc_dmat = ua->ua_dmat;
171
172 /*
173 * Map interrupt vectors and reset function.
174 */
175 uba_intr_establish(ua->ua_icookie, ua->ua_cvec, ilcint,
176 sc, &sc->sc_cintrcnt);
177 evcnt_attach_dynamic(&sc->sc_cintrcnt, EVCNT_TYPE_INTR, ua->ua_evcnt,
178 sc->sc_dev.dv_xname, "intr");
179 uba_intr_establish(ua->ua_icookie, ua->ua_cvec-4, ilrint,
180 sc, &sc->sc_rintrcnt);
181 evcnt_attach_dynamic(&sc->sc_rintrcnt, EVCNT_TYPE_INTR, ua->ua_evcnt,
182 sc->sc_dev.dv_xname, "intr");
183 uba_reset_establish(ilreset, &sc->sc_dev);
184
185 /*
186 * Reset the board and map the statistics
187 * buffer onto the Unibus.
188 */
189 IL_WCSR(IL_CSR, ILC_RESET);
190 (void)ilwait(sc, "reset");
191 sc->sc_ui.ui_size = sizeof(struct il_stats);
192 sc->sc_ui.ui_vaddr = (caddr_t)&sc->sc_stats;
193 if ((error = uballoc((struct uba_softc *)parent, &sc->sc_ui, 0)))
194 return printf(": failed uballoc, error = %d\n", error);
195
196 IL_WCSR(IL_BAR, LOWORD(sc->sc_ui.ui_baddr));
197 IL_WCSR(IL_BCR, sizeof(struct il_stats));
198 IL_WCSR(IL_CSR, ((sc->sc_ui.ui_baddr >> 2) & IL_EUA)|ILC_STAT);
199 (void)ilwait(sc, "status");
200 ubfree((struct uba_softc *)parent, &sc->sc_ui);
201 printf("%s: module=%s firmware=%s\n", sc->sc_dev.dv_xname,
202 sc->sc_stats.ils_module, sc->sc_stats.ils_firmware);
203 printf("%s: hardware address %s\n", sc->sc_dev.dv_xname,
204 ether_sprintf(sc->sc_stats.ils_addr));
205
206 strcpy(ifp->if_xname, sc->sc_dev.dv_xname);
207 ifp->if_softc = sc;
208 ifp->if_flags = IFF_BROADCAST;
209 ifp->if_init = ilinit;
210 ifp->if_stop = ilstop;
211 ifp->if_ioctl = ether_ioctl;
212 ifp->if_start = ilstart;
213 ifp->if_watchdog = ilwatch;
214 IFQ_SET_READY(&ifp->if_snd);
215
216 if_attach(ifp);
217 ether_ifattach(ifp, sc->sc_stats.ils_addr);
218 }
219
220 void
221 ilstop(struct ifnet *ifp, int a)
222 {
223 struct il_softc *sc = ifp->if_softc;
224
225 IL_WCSR(IL_CSR, ILC_RESET);
226 }
227
228
229 int
230 ilwait(struct il_softc *sc, char *op)
231 {
232
233 while ((IL_RCSR(IL_CSR)&IL_CDONE) == 0)
234 ;
235 if (IL_RCSR(IL_CSR)&IL_STATUS) {
236 char bits[64];
237
238 printf("%s: %s failed, csr=%s\n", sc->sc_dev.dv_xname, op,
239 bitmask_snprintf(IL_RCSR(IL_CSR), IL_BITS, bits,
240 sizeof(bits)));
241 return (-1);
242 }
243 return (0);
244 }
245
246 /*
247 * Reset of interface after UNIBUS reset.
248 * If interface is on specified uba, reset its state.
249 */
250 void
251 ilreset(struct device *dev)
252 {
253 struct il_softc *sc = (void *)dev;
254
255 printf(" %s", sc->sc_dev.dv_xname);
256 sc->sc_if.if_flags &= ~IFF_RUNNING;
257 sc->sc_flags &= ~ILF_RUNNING;
258 ilinit(&sc->sc_if);
259 }
260
261 /*
262 * Initialization of interface; clear recorded pending
263 * operations, and reinitialize UNIBUS usage.
264 */
265 int
266 ilinit(struct ifnet *ifp)
267 {
268 struct il_softc *sc = ifp->if_softc;
269 int s;
270
271 if (sc->sc_flags & ILF_RUNNING)
272 return 0;
273
274 if ((ifp->if_flags & IFF_RUNNING) == 0) {
275 if (if_ubainit(&sc->sc_ifuba,
276 (void *)device_parent(&sc->sc_dev),
277 ETHER_MAX_LEN)) {
278 printf("%s: can't initialize\n", sc->sc_dev.dv_xname);
279 sc->sc_if.if_flags &= ~IFF_UP;
280 return 0;
281 }
282 sc->sc_ui.ui_size = sizeof(sc->sc_isu);
283 sc->sc_ui.ui_vaddr = (caddr_t)&sc->sc_isu;
284 uballoc((void *)device_parent(&sc->sc_dev), &sc->sc_ui, 0);
285 }
286 sc->sc_scaninterval = ILWATCHINTERVAL;
287 ifp->if_timer = sc->sc_scaninterval;
288
289 /*
290 * Turn off source address insertion (it's faster this way),
291 * and set board online. Former doesn't work if board is
292 * already online (happens on ubareset), so we put it offline
293 * first.
294 */
295 s = splnet();
296 IL_WCSR(IL_CSR, ILC_RESET);
297 if (ilwait(sc, "hardware diag")) {
298 sc->sc_if.if_flags &= ~IFF_UP;
299 splx(s);
300 return 0;
301 }
302 IL_WCSR(IL_CSR, ILC_CISA);
303 while ((IL_RCSR(IL_CSR) & IL_CDONE) == 0)
304 ;
305 /*
306 * If we must reprogram this board's physical ethernet
307 * address (as for secondary XNS interfaces), we do so
308 * before putting it on line, and starting receive requests.
309 * If you try this on an older 1010 board, it will total
310 * wedge the board.
311 */
312 if (sc->sc_flags & ILF_SETADDR) {
313 bcopy((caddr_t)LLADDR(ifp->if_sadl),
314 (caddr_t)&sc->sc_isu, ETHER_ADDR_LEN);
315 IL_WCSR(IL_BAR, LOWORD(sc->sc_ui.ui_baddr));
316 IL_WCSR(IL_BCR, ETHER_ADDR_LEN);
317 IL_WCSR(IL_CSR, ((sc->sc_ui.ui_baddr >> 2) & IL_EUA)|ILC_LDPA);
318 if (ilwait(sc, "setaddr"))
319 return 0;
320 IL_WCSR(IL_BAR, LOWORD(sc->sc_ui.ui_baddr));
321 IL_WCSR(IL_BCR, sizeof (struct il_stats));
322 IL_WCSR(IL_CSR, ((sc->sc_ui.ui_baddr >> 2) & IL_EUA)|ILC_STAT);
323 if (ilwait(sc, "verifying setaddr"))
324 return 0;
325 if (memcmp((caddr_t)sc->sc_stats.ils_addr,
326 (caddr_t)LLADDR(ifp->if_sadl), ETHER_ADDR_LEN) != 0) {
327 printf("%s: setaddr didn't work\n",
328 sc->sc_dev.dv_xname);
329 return 0;
330 }
331 }
332 #ifdef MULTICAST
333 if (is->is_if.if_flags & IFF_PROMISC) {
334 addr->il_csr = ILC_PRMSC;
335 if (ilwait(ui, "all multi"))
336 return 0;
337 } else if (is->is_if.if_flags & IFF_ALLMULTI) {
338 too_many_multis:
339 addr->il_csr = ILC_ALLMC;
340 if (ilwait(ui, "all multi"))
341 return 0;
342 else {
343 int i;
344 register struct ether_addr *ep = is->is_maddrs;
345 struct ether_multi *enm;
346 struct ether_multistep step;
347 /*
348 * Step through our list of multicast addresses. If we have
349 * too many multicast addresses, or if we have to listen to
350 * a range of multicast addresses, turn on reception of all
351 * multicasts.
352 */
353 i = 0;
354 ETHER_FIRST_MULTI(step, &is->is_ac, enm);
355 while (enm != NULL) {
356 if (++i > 63 && k != 0) {
357 break;
358 }
359 *ep++ = *(struct ether_addr *)enm->enm_addrlo;
360 ETHER_NEXT_MULTI(step, enm);
361 }
362 if (i = 0) {
363 /* no multicasts! */
364 } else if (i <= 63) {
365 addr->il_bar = is->is_ubaddr & 0xffff;
366 addr->il_bcr = i * sizeof (struct ether_addr);
367 addr->il_csr = ((is->is_ubaddr >> 2) & IL_EUA)|
368 LC_LDGRPS;
369 if (ilwait(ui, "load multi"))
370 return;
371 } else {
372 is->is_if.if_flags |= IFF_ALLMULTI;
373 goto too_many_multis;
374 }
375 }
376 #endif /* MULTICAST */
377 /*
378 * Set board online.
379 * Hang receive buffer and start any pending
380 * writes by faking a transmit complete.
381 * Receive bcr is not a multiple of 8 so buffer
382 * chaining can't happen.
383 */
384 IL_WCSR(IL_CSR, ILC_ONLINE);
385 while ((IL_RCSR(IL_CSR) & IL_CDONE) == 0)
386 ;
387
388 IL_WCSR(IL_BAR, LOWORD(sc->sc_ifuba.ifu_r.ifrw_info));
389 IL_WCSR(IL_BCR, sizeof(struct il_rheader) + ETHERMTU + 6);
390 IL_WCSR(IL_CSR,
391 ((sc->sc_ifuba.ifu_r.ifrw_info >> 2) & IL_EUA)|ILC_RCV|IL_RIE);
392 while ((IL_RCSR(IL_CSR) & IL_CDONE) == 0)
393 ;
394 ifp->if_flags |= IFF_RUNNING | IFF_OACTIVE;
395 sc->sc_flags |= ILF_RUNNING;
396 sc->sc_lastcmd = 0;
397 ilcint(sc);
398 splx(s);
399 return 0;
400 }
401
402 /*
403 * Start output on interface.
404 * Get another datagram to send off of the interface queue,
405 * and map it to the interface before starting the output.
406 */
407 void
408 ilstart(struct ifnet *ifp)
409 {
410 struct il_softc *sc = ifp->if_softc;
411 int len;
412 struct mbuf *m;
413 short csr;
414
415 IFQ_DEQUEUE(&ifp->if_snd, m);
416 if (m == 0) {
417 if ((sc->sc_flags & ILF_STATPENDING) == 0)
418 return;
419 IL_WCSR(IL_BAR, LOWORD(sc->sc_ui.ui_baddr));
420 IL_WCSR(IL_BCR, sizeof (struct il_stats));
421 csr = ((sc->sc_ui.ui_baddr >> 2) & IL_EUA)|ILC_STAT|IL_RIE|IL_CIE;
422 sc->sc_flags &= ~ILF_STATPENDING;
423 goto startcmd;
424 }
425 len = if_wubaput(&sc->sc_ifuba, m);
426 #ifdef notdef
427 if (sc->sc_ifuba.ifu_flags & UBA_NEEDBDP)
428 UBAPURGE(is->is_ifuba.ifu_uba, is->is_ifuba.ifu_w.ifrw_bdp);
429 #endif
430 IL_WCSR(IL_BAR, LOWORD(sc->sc_ifuba.ifu_w.ifrw_info));
431 IL_WCSR(IL_BCR, len);
432 csr =
433 ((sc->sc_ifuba.ifu_w.ifrw_info >> 2) & IL_EUA)|ILC_XMIT|IL_CIE|IL_RIE;
434
435 startcmd:
436 sc->sc_lastcmd = csr & IL_CMD;
437 IL_WCSR(IL_CSR, csr);
438 ifp->if_flags |= IFF_OACTIVE;
439 return;
440 }
441
442 /*
443 * Command done interrupt.
444 */
445 void
446 ilcint(void *arg)
447 {
448 struct il_softc *sc = arg;
449 short csr;
450
451 if ((sc->sc_if.if_flags & IFF_OACTIVE) == 0) {
452 char bits[64];
453
454 printf("%s: stray xmit interrupt, csr=%s\n",
455 sc->sc_dev.dv_xname,
456 bitmask_snprintf(IL_RCSR(IL_CSR), IL_BITS, bits,
457 sizeof(bits)));
458 return;
459 }
460
461 csr = IL_RCSR(IL_CSR);
462 /*
463 * Hang receive buffer if it couldn't
464 * be done earlier (in ilrint).
465 */
466 if (sc->sc_flags & ILF_RCVPENDING) {
467 int s;
468
469 IL_WCSR(IL_BAR, LOWORD(sc->sc_ifuba.ifu_r.ifrw_info));
470 IL_WCSR(IL_BCR, sizeof(struct il_rheader) + ETHERMTU + 6);
471 IL_WCSR(IL_CSR,
472 ((sc->sc_ifuba.ifu_r.ifrw_info>>2) & IL_EUA)|ILC_RCV|IL_RIE);
473 s = splhigh();
474 while ((IL_RCSR(IL_CSR) & IL_CDONE) == 0)
475 ;
476 splx(s);
477 sc->sc_flags &= ~ILF_RCVPENDING;
478 }
479 sc->sc_if.if_flags &= ~IFF_OACTIVE;
480 csr &= IL_STATUS;
481 switch (sc->sc_lastcmd) {
482
483 case ILC_XMIT:
484 sc->sc_if.if_opackets++;
485 if (csr > ILERR_RETRIES)
486 sc->sc_if.if_oerrors++;
487 break;
488
489 case ILC_STAT:
490 if (csr == ILERR_SUCCESS)
491 iltotal(sc);
492 break;
493 }
494 if_wubaend(&sc->sc_ifuba);
495 ilstart(&sc->sc_if);
496 }
497
498 /*
499 * Ethernet interface receiver interrupt.
500 * If input error just drop packet.
501 * Otherwise purge input buffered data path and examine
502 * packet to determine type. If can't determine length
503 * from type, then have to drop packet. Othewise decapsulate
504 * packet based on type and pass to type specific higher-level
505 * input routine.
506 */
507 void
508 ilrint(void *arg)
509 {
510 struct il_softc *sc = arg;
511 struct il_rheader *il;
512 struct mbuf *m;
513 int len, s;
514
515 sc->sc_if.if_ipackets++;
516 #ifdef notyet
517 if (sc->sc_ifuba.ifu_flags & UBA_NEEDBDP)
518 UBAPURGE(is->is_ifuba.ifu_uba, is->is_ifuba.ifu_r.ifrw_bdp);
519 #endif
520 il = (struct il_rheader *)(sc->sc_ifuba.ifu_r.ifrw_addr);
521 len = il->ilr_length - sizeof(struct il_rheader);
522 if ((il->ilr_status&(ILFSTAT_A|ILFSTAT_C)) || len < 46 ||
523 len > ETHERMTU) {
524 sc->sc_if.if_ierrors++;
525 #ifdef notdef
526 if (sc->sc_if.if_ierrors % 100 == 0)
527 printf("il%d: += 100 input errors\n", unit);
528 #endif
529 goto setup;
530 }
531
532 if (len == 0)
533 goto setup;
534
535 /*
536 * Pull packet off interface.
537 */
538 m = if_rubaget(&sc->sc_ifuba, &sc->sc_if, len);
539 if (m == NULL)
540 goto setup;
541
542 /* Shave off status hdr */
543 m_adj(m, 4);
544 (*sc->sc_if.if_input)(&sc->sc_if, m);
545 setup:
546 /*
547 * Reset for next packet if possible.
548 * If waiting for transmit command completion, set flag
549 * and wait until command completes.
550 */
551 if (sc->sc_if.if_flags & IFF_OACTIVE) {
552 sc->sc_flags |= ILF_RCVPENDING;
553 return;
554 }
555 IL_WCSR(IL_BAR, LOWORD(sc->sc_ifuba.ifu_r.ifrw_info));
556 IL_WCSR(IL_BCR, sizeof(struct il_rheader) + ETHERMTU + 6);
557 IL_WCSR(IL_CSR,
558 ((sc->sc_ifuba.ifu_r.ifrw_info >> 2) & IL_EUA)|ILC_RCV|IL_RIE);
559 s = splhigh();
560 while ((IL_RCSR(IL_CSR) & IL_CDONE) == 0)
561 ;
562 splx(s);
563 }
564 /*
565 * Watchdog routine, request statistics from board.
566 */
567 void
568 ilwatch(struct ifnet *ifp)
569 {
570 struct il_softc *sc = ifp->if_softc;
571 int s;
572
573 if (sc->sc_flags & ILF_STATPENDING) {
574 ifp->if_timer = sc->sc_scaninterval;
575 return;
576 }
577 s = splnet();
578 sc->sc_flags |= ILF_STATPENDING;
579 if ((sc->sc_if.if_flags & IFF_OACTIVE) == 0)
580 ilstart(ifp);
581 splx(s);
582 ifp->if_timer = sc->sc_scaninterval;
583 }
584
585 /*
586 * Total up the on-board statistics.
587 */
588 void
589 iltotal(struct il_softc *sc)
590 {
591 struct ifnet *ifp = &sc->sc_if;
592 u_short *interval, *sum, *end;
593
594 interval = &sc->sc_stats.ils_frames;
595 sum = &sc->sc_sum.ils_frames;
596 end = sc->sc_sum.ils_fill2;
597 while (sum < end)
598 *sum++ += *interval++;
599 sc->sc_if.if_collisions = sc->sc_sum.ils_collis;
600 if ((sc->sc_flags & ILF_SETADDR) &&
601 (memcmp((caddr_t)sc->sc_stats.ils_addr, LLADDR(ifp->if_sadl),
602 ETHER_ADDR_LEN) != 0)) {
603 log(LOG_ERR, "%s: physaddr reverted\n", sc->sc_dev.dv_xname);
604 sc->sc_flags &= ~ILF_RUNNING;
605 ilinit(&sc->sc_if);
606 }
607 }
608
609 #ifdef notyet
610 /*
611 * set ethernet address for unit
612 */
613 void
614 il_setaddr(u_char *physaddr, struct il_softc *sc)
615 {
616 if (! (sc->sc_flags & ILF_RUNNING))
617 return;
618
619 bcopy((caddr_t)physaddr, (caddr_t)is->is_addr, sizeof is->is_addr);
620 sc->sc_flags &= ~ILF_RUNNING;
621 sc->sc_flags |= ILF_SETADDR;
622 ilinit(&sc->sc_if);
623 }
624 #endif
625