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