xref: /csrg-svn/sys/vax/if/if_il.c (revision 19865)
1 /*	if_il.c	6.6	85/05/01	*/
2 
3 #include "il.h"
4 
5 /*
6  * Interlan Ethernet Communications Controller interface
7  */
8 #include "../machine/pte.h"
9 
10 #include "param.h"
11 #include "systm.h"
12 #include "mbuf.h"
13 #include "buf.h"
14 #include "protosw.h"
15 #include "socket.h"
16 #include "vmmac.h"
17 #include "ioctl.h"
18 #include "errno.h"
19 
20 #include "../net/if.h"
21 #include "../net/netisr.h"
22 #include "../net/route.h"
23 #include "../netinet/in.h"
24 #include "../netinet/in_systm.h"
25 #include "../netinet/in_var.h"
26 #include "../netinet/ip.h"
27 #include "../netinet/ip_var.h"
28 #include "../netinet/if_ether.h"
29 #include "../netpup/pup.h"
30 
31 #include "../vax/cpu.h"
32 #include "../vax/mtpr.h"
33 #include "if_il.h"
34 #include "if_ilreg.h"
35 #include "if_uba.h"
36 #include "../vaxuba/ubareg.h"
37 #include "../vaxuba/ubavar.h"
38 
39 int	ilprobe(), ilattach(), ilrint(), ilcint();
40 struct	uba_device *ilinfo[NIL];
41 u_short ilstd[] = { 0 };
42 struct	uba_driver ildriver =
43 	{ ilprobe, 0, ilattach, 0, ilstd, "il", ilinfo };
44 #define	ILUNIT(x)	minor(x)
45 int	ilinit(),iloutput(),ilioctl(),ilreset(),ilwatch();
46 
47 /*
48  * Ethernet software status per interface.
49  *
50  * Each interface is referenced by a network interface structure,
51  * is_if, which the routing code uses to locate the interface.
52  * This structure contains the output queue for the interface, its address, ...
53  * We also have, for each interface, a UBA interface structure, which
54  * contains information about the UNIBUS resources held by the interface:
55  * map registers, buffered data paths, etc.  Information is cached in this
56  * structure for use by the if_uba.c routines in running the interface
57  * efficiently.
58  */
59 struct	il_softc {
60 	struct	arpcom is_ac;		/* Ethernet common part */
61 #define	is_if	is_ac.ac_if		/* network-visible interface */
62 #define	is_addr	is_ac.ac_enaddr		/* hardware Ethernet address */
63 	struct	ifuba is_ifuba;		/* UNIBUS resources */
64 	int	is_flags;
65 #define	ILF_OACTIVE	0x1		/* output is active */
66 #define	ILF_RCVPENDING	0x2		/* start rcv in ilcint */
67 #define	ILF_STATPENDING	0x4		/* stat cmd pending */
68 	short	is_lastcmd;		/* can't read csr, so must save it */
69 	short	is_scaninterval;	/* interval of stat collection */
70 #define	ILWATCHINTERVAL	60		/* once every 60 seconds */
71 	struct	il_stats is_stats;	/* holds on-board statistics */
72 	struct	il_stats is_sum;	/* summation over time */
73 	int	is_ubaddr;		/* mapping registers of is_stats */
74 } il_softc[NIL];
75 
76 ilprobe(reg)
77 	caddr_t reg;
78 {
79 	register int br, cvec;		/* r11, r10 value-result */
80 	register struct ildevice *addr = (struct ildevice *)reg;
81 	register i;
82 
83 #ifdef lint
84 	br = 0; cvec = br; br = cvec;
85 	i = 0; ilrint(i); ilcint(i); ilwatch(i);
86 #endif
87 
88 	addr->il_csr = ILC_OFFLINE|IL_CIE;
89 	DELAY(100000);
90 	i = addr->il_csr;		/* clear CDONE */
91 	if (cvec > 0 && cvec != 0x200)
92 		cvec -= 4;
93 	return (1);
94 }
95 
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.  A STATUS command is done to get the ethernet
100  * address and other interesting data.
101  */
102 ilattach(ui)
103 	struct uba_device *ui;
104 {
105 	register struct il_softc *is = &il_softc[ui->ui_unit];
106 	register struct ifnet *ifp = &is->is_if;
107 	register struct ildevice *addr = (struct ildevice *)ui->ui_addr;
108 
109 	ifp->if_unit = ui->ui_unit;
110 	ifp->if_name = "il";
111 	ifp->if_mtu = ETHERMTU;
112 	ifp->if_flags = IFF_BROADCAST;
113 
114 	/*
115 	 * Reset the board and map the statistics
116 	 * buffer onto the Unibus.
117 	 */
118 	addr->il_csr = ILC_RESET;
119 	while ((addr->il_csr&IL_CDONE) == 0)
120 		;
121 	if (addr->il_csr&IL_STATUS)
122 		printf("il%d: reset failed, csr=%b\n", ui->ui_unit,
123 			addr->il_csr, IL_BITS);
124 
125 	is->is_ubaddr = uballoc(ui->ui_ubanum, (caddr_t)&is->is_stats,
126 	    sizeof (struct il_stats), 0);
127 	addr->il_bar = is->is_ubaddr & 0xffff;
128 	addr->il_bcr = sizeof (struct il_stats);
129 	addr->il_csr = ((is->is_ubaddr >> 2) & IL_EUA)|ILC_STAT;
130 	while ((addr->il_csr&IL_CDONE) == 0)
131 		;
132 	if (addr->il_csr&IL_STATUS)
133 		printf("il%d: status failed, csr=%b\n", ui->ui_unit,
134 			addr->il_csr, IL_BITS);
135 	ubarelse(ui->ui_ubanum, &is->is_ubaddr);
136 #ifdef notdef
137 	printf("il%d: addr=%x:%x:%x:%x:%x:%x module=%s firmware=%s\n",
138 		ui->ui_unit,
139 		is->is_stats.ils_addr[0]&0xff, is->is_stats.ils_addr[1]&0xff,
140 		is->is_stats.ils_addr[2]&0xff, is->is_stats.ils_addr[3]&0xff,
141 		is->is_stats.ils_addr[4]&0xff, is->is_stats.ils_addr[5]&0xff,
142 		is->is_stats.ils_module, is->is_stats.ils_firmware);
143 #endif
144  	bcopy((caddr_t)is->is_stats.ils_addr, (caddr_t)is->is_addr,
145  	    sizeof (is->is_addr));
146 	ifp->if_init = ilinit;
147 	ifp->if_output = iloutput;
148 	ifp->if_ioctl = ilioctl;
149 	ifp->if_reset = ilreset;
150 	is->is_ifuba.ifu_flags = UBA_CANTWAIT;
151 #ifdef notdef
152 	is->is_ifuba.ifu_flags |= UBA_NEEDBDP;
153 #endif
154 	if_attach(ifp);
155 }
156 
157 /*
158  * Reset of interface after UNIBUS reset.
159  * If interface is on specified uba, reset its state.
160  */
161 ilreset(unit, uban)
162 	int unit, uban;
163 {
164 	register struct uba_device *ui;
165 
166 	if (unit >= NIL || (ui = ilinfo[unit]) == 0 || ui->ui_alive == 0 ||
167 	    ui->ui_ubanum != uban)
168 		return;
169 	printf(" il%d", unit);
170 	ilinit(unit);
171 }
172 
173 /*
174  * Initialization of interface; clear recorded pending
175  * operations, and reinitialize UNIBUS usage.
176  */
177 ilinit(unit)
178 	int unit;
179 {
180 	register struct il_softc *is = &il_softc[unit];
181 	register struct uba_device *ui = ilinfo[unit];
182 	register struct ildevice *addr;
183 	register struct ifnet *ifp = &is->is_if;
184 	int s;
185 
186 	/* not yet, if address still unknown */
187 	if (ifp->if_addrlist == (struct ifaddr *)0)
188 		return;
189 
190 	if (ifp->if_flags & IFF_RUNNING)
191 		return;
192 	if (if_ubainit(&is->is_ifuba, ui->ui_ubanum,
193 	    sizeof (struct il_rheader), (int)btoc(ETHERMTU)) == 0) {
194 		printf("il%d: can't initialize\n", unit);
195 		is->is_if.if_flags &= ~IFF_UP;
196 		return;
197 	}
198 	is->is_ubaddr = uballoc(ui->ui_ubanum, (caddr_t)&is->is_stats,
199 	    sizeof (struct il_stats), 0);
200 	ifp->if_watchdog = ilwatch;
201 	is->is_scaninterval = ILWATCHINTERVAL;
202 	ifp->if_timer = is->is_scaninterval;
203 	addr = (struct ildevice *)ui->ui_addr;
204 
205 	/*
206 	 * Turn off source address insertion (it's faster this way),
207 	 * and set board online.  Former doesn't work if board is
208 	 * already online (happens on ubareset), so we put it offline
209 	 * first.
210 	 */
211 	s = splimp();
212 	addr->il_csr = ILC_OFFLINE;
213 	while ((addr->il_csr & IL_CDONE) == 0)
214 		;
215 	addr->il_csr = ILC_CISA;
216 	while ((addr->il_csr & IL_CDONE) == 0)
217 		;
218 	/*
219 	 * Set board online.
220 	 * Hang receive buffer and start any pending
221 	 * writes by faking a transmit complete.
222 	 * Receive bcr is not a muliple of 4 so buffer
223 	 * chaining can't happen.
224 	 */
225 	addr->il_csr = ILC_ONLINE;
226 	while ((addr->il_csr & IL_CDONE) == 0)
227 		;
228 	addr->il_bar = is->is_ifuba.ifu_r.ifrw_info & 0xffff;
229 	addr->il_bcr = sizeof(struct il_rheader) + ETHERMTU + 6;
230 	addr->il_csr =
231 	    ((is->is_ifuba.ifu_r.ifrw_info >> 2) & IL_EUA)|ILC_RCV|IL_RIE;
232 	while ((addr->il_csr & IL_CDONE) == 0)
233 		;
234 	is->is_flags = ILF_OACTIVE;
235 	is->is_if.if_flags |= IFF_RUNNING;
236 	is->is_lastcmd = 0;
237 	ilcint(unit);
238 	splx(s);
239 }
240 
241 /*
242  * Start output on interface.
243  * Get another datagram to send off of the interface queue,
244  * and map it to the interface before starting the output.
245  */
246 ilstart(dev)
247 	dev_t dev;
248 {
249         int unit = ILUNIT(dev), len;
250 	struct uba_device *ui = ilinfo[unit];
251 	register struct il_softc *is = &il_softc[unit];
252 	register struct ildevice *addr;
253 	struct mbuf *m;
254 	short csr;
255 
256 	IF_DEQUEUE(&is->is_if.if_snd, m);
257 	addr = (struct ildevice *)ui->ui_addr;
258 	if (m == 0) {
259 		if ((is->is_flags & ILF_STATPENDING) == 0)
260 			return;
261 		addr->il_bar = is->is_ubaddr & 0xffff;
262 		addr->il_bcr = sizeof (struct il_stats);
263 		csr = ((is->is_ubaddr >> 2) & IL_EUA)|ILC_STAT|IL_RIE|IL_CIE;
264 		is->is_flags &= ~ILF_STATPENDING;
265 		goto startcmd;
266 	}
267 	len = if_wubaput(&is->is_ifuba, m);
268 	/*
269 	 * Ensure minimum packet length.
270 	 * This makes the safe assumtion that there are no virtual holes
271 	 * after the data.
272 	 * For security, it might be wise to zero out the added bytes,
273 	 * but we're mainly interested in speed at the moment.
274 	 */
275 	if (len - sizeof(struct ether_header) < ETHERMIN)
276 		len = ETHERMIN + sizeof(struct ether_header);
277 	if (is->is_ifuba.ifu_flags & UBA_NEEDBDP)
278 		UBAPURGE(is->is_ifuba.ifu_uba, is->is_ifuba.ifu_w.ifrw_bdp);
279 	addr->il_bar = is->is_ifuba.ifu_w.ifrw_info & 0xffff;
280 	addr->il_bcr = len;
281 	csr =
282 	  ((is->is_ifuba.ifu_w.ifrw_info >> 2) & IL_EUA)|ILC_XMIT|IL_CIE|IL_RIE;
283 
284 startcmd:
285 	is->is_lastcmd = csr & IL_CMD;
286 	addr->il_csr = csr;
287 	is->is_flags |= ILF_OACTIVE;
288 }
289 
290 /*
291  * Command done interrupt.
292  */
293 ilcint(unit)
294 	int unit;
295 {
296 	register struct il_softc *is = &il_softc[unit];
297 	struct uba_device *ui = ilinfo[unit];
298 	register struct ildevice *addr = (struct ildevice *)ui->ui_addr;
299 	short csr;
300 
301 	if ((is->is_flags & ILF_OACTIVE) == 0) {
302 		printf("il%d: stray xmit interrupt, csr=%b\n", unit,
303 			addr->il_csr, IL_BITS);
304 		return;
305 	}
306 
307 	csr = addr->il_csr;
308 	/*
309 	 * Hang receive buffer if it couldn't
310 	 * be done earlier (in ilrint).
311 	 */
312 	if (is->is_flags & ILF_RCVPENDING) {
313 		addr->il_bar = is->is_ifuba.ifu_r.ifrw_info & 0xffff;
314 		addr->il_bcr = sizeof(struct il_rheader) + ETHERMTU + 6;
315 		addr->il_csr =
316 		  ((is->is_ifuba.ifu_r.ifrw_info >> 2) & IL_EUA)|ILC_RCV|IL_RIE;
317 		while ((addr->il_csr & IL_CDONE) == 0)
318 			;
319 		is->is_flags &= ~ILF_RCVPENDING;
320 	}
321 	is->is_flags &= ~ILF_OACTIVE;
322 	csr &= IL_STATUS;
323 	switch (is->is_lastcmd) {
324 
325 	case ILC_XMIT:
326 		is->is_if.if_opackets++;
327 		if (csr > ILERR_RETRIES)
328 			is->is_if.if_oerrors++;
329 		break;
330 
331 	case ILC_STAT:
332 		if (csr == ILERR_SUCCESS)
333 			iltotal(is);
334 		break;
335 	}
336 	if (is->is_ifuba.ifu_xtofree) {
337 		m_freem(is->is_ifuba.ifu_xtofree);
338 		is->is_ifuba.ifu_xtofree = 0;
339 	}
340 	ilstart(unit);
341 }
342 
343 /*
344  * Ethernet interface receiver interrupt.
345  * If input error just drop packet.
346  * Otherwise purge input buffered data path and examine
347  * packet to determine type.  If can't determine length
348  * from type, then have to drop packet.  Othewise decapsulate
349  * packet based on type and pass to type specific higher-level
350  * input routine.
351  */
352 ilrint(unit)
353 	int unit;
354 {
355 	register struct il_softc *is = &il_softc[unit];
356 	struct ildevice *addr = (struct ildevice *)ilinfo[unit]->ui_addr;
357 	register struct il_rheader *il;
358     	struct mbuf *m;
359 	int len, off, resid, s;
360 	register struct ifqueue *inq;
361 
362 	is->is_if.if_ipackets++;
363 	if (is->is_ifuba.ifu_flags & UBA_NEEDBDP)
364 		UBAPURGE(is->is_ifuba.ifu_uba, is->is_ifuba.ifu_r.ifrw_bdp);
365 	il = (struct il_rheader *)(is->is_ifuba.ifu_r.ifrw_addr);
366 	len = il->ilr_length - sizeof(struct il_rheader);
367 	if ((il->ilr_status&(ILFSTAT_A|ILFSTAT_C)) || len < 46 ||
368 	    len > ETHERMTU) {
369 		is->is_if.if_ierrors++;
370 #ifdef notdef
371 		if (is->is_if.if_ierrors % 100 == 0)
372 			printf("il%d: += 100 input errors\n", unit);
373 #endif
374 		goto setup;
375 	}
376 
377 	/*
378 	 * Deal with trailer protocol: if type is trailer type
379 	 * get true type from first 16-bit word past data.
380 	 * Remember that type was trailer by setting off.
381 	 */
382 	il->ilr_type = ntohs((u_short)il->ilr_type);
383 #define	ildataaddr(il, off, type)	((type)(((caddr_t)((il)+1)+(off))))
384 	if (il->ilr_type >= ETHERTYPE_TRAIL &&
385 	    il->ilr_type < ETHERTYPE_TRAIL+ETHERTYPE_NTRAILER) {
386 		off = (il->ilr_type - ETHERTYPE_TRAIL) * 512;
387 		if (off >= ETHERMTU)
388 			goto setup;		/* sanity */
389 		il->ilr_type = ntohs(*ildataaddr(il, off, u_short *));
390 		resid = ntohs(*(ildataaddr(il, off+2, u_short *)));
391 		if (off + resid > len)
392 			goto setup;		/* sanity */
393 		len = off + resid;
394 	} else
395 		off = 0;
396 	if (len == 0)
397 		goto setup;
398 
399 	/*
400 	 * Pull packet off interface.  Off is nonzero if packet
401 	 * has trailing header; ilget will then force this header
402 	 * information to be at the front, but we still have to drop
403 	 * the type and length which are at the front of any trailer data.
404 	 */
405 	m = if_rubaget(&is->is_ifuba, len, off);
406 	if (m == 0)
407 		goto setup;
408 	if (off) {
409 		m->m_off += 2 * sizeof (u_short);
410 		m->m_len -= 2 * sizeof (u_short);
411 	}
412 	switch (il->ilr_type) {
413 
414 #ifdef INET
415 	case ETHERTYPE_IP:
416 		schednetisr(NETISR_IP);
417 		inq = &ipintrq;
418 		break;
419 
420 	case ETHERTYPE_ARP:
421 		arpinput(&is->is_ac, m);
422 		goto setup;
423 #endif
424 	default:
425 		m_freem(m);
426 		goto setup;
427 	}
428 
429 	s = splimp();
430 	if (IF_QFULL(inq)) {
431 		IF_DROP(inq);
432 		m_freem(m);
433 	} else
434 		IF_ENQUEUE(inq, m);
435 	splx(s);
436 
437 setup:
438 	/*
439 	 * Reset for next packet if possible.
440 	 * If waiting for transmit command completion, set flag
441 	 * and wait until command completes.
442 	 */
443 	if (is->is_flags & ILF_OACTIVE) {
444 		is->is_flags |= ILF_RCVPENDING;
445 		return;
446 	}
447 	addr->il_bar = is->is_ifuba.ifu_r.ifrw_info & 0xffff;
448 	addr->il_bcr = sizeof(struct il_rheader) + ETHERMTU + 6;
449 	addr->il_csr =
450 		((is->is_ifuba.ifu_r.ifrw_info >> 2) & IL_EUA)|ILC_RCV|IL_RIE;
451 	while ((addr->il_csr & IL_CDONE) == 0)
452 		;
453 }
454 
455 /*
456  * Ethernet output routine.
457  * Encapsulate a packet of type family for the local net.
458  * Use trailer local net encapsulation if enough data in first
459  * packet leaves a multiple of 512 bytes of data in remainder.
460  */
461 iloutput(ifp, m0, dst)
462 	struct ifnet *ifp;
463 	struct mbuf *m0;
464 	struct sockaddr *dst;
465 {
466 	int type, s, error;
467  	u_char edst[6];
468 	struct in_addr idst;
469 	register struct il_softc *is = &il_softc[ifp->if_unit];
470 	register struct mbuf *m = m0;
471 	register struct ether_header *il;
472 	register int off;
473 
474 	switch (dst->sa_family) {
475 
476 #ifdef INET
477 	case AF_INET:
478 		idst = ((struct sockaddr_in *)dst)->sin_addr;
479  		if (!arpresolve(&is->is_ac, m, &idst, edst))
480 			return (0);	/* if not yet resolved */
481 		off = ntohs((u_short)mtod(m, struct ip *)->ip_len) - m->m_len;
482 		/* need per host negotiation */
483 		if ((ifp->if_flags & IFF_NOTRAILERS) == 0)
484 		if (off > 0 && (off & 0x1ff) == 0 &&
485 		    m->m_off >= MMINOFF + 2 * sizeof (u_short)) {
486 			type = ETHERTYPE_TRAIL + (off>>9);
487 			m->m_off -= 2 * sizeof (u_short);
488 			m->m_len += 2 * sizeof (u_short);
489 			*mtod(m, u_short *) = htons((u_short)ETHERTYPE_IP);
490 			*(mtod(m, u_short *) + 1) = htons((u_short)m->m_len);
491 			goto gottrailertype;
492 		}
493 		type = ETHERTYPE_IP;
494 		off = 0;
495 		goto gottype;
496 #endif
497 
498 	case AF_UNSPEC:
499 		il = (struct ether_header *)dst->sa_data;
500  		bcopy((caddr_t)il->ether_dhost, (caddr_t)edst, sizeof (edst));
501 		type = il->ether_type;
502 		goto gottype;
503 
504 	default:
505 		printf("il%d: can't handle af%d\n", ifp->if_unit,
506 			dst->sa_family);
507 		error = EAFNOSUPPORT;
508 		goto bad;
509 	}
510 
511 gottrailertype:
512 	/*
513 	 * Packet to be sent as trailer: move first packet
514 	 * (control information) to end of chain.
515 	 */
516 	while (m->m_next)
517 		m = m->m_next;
518 	m->m_next = m0;
519 	m = m0->m_next;
520 	m0->m_next = 0;
521 	m0 = m;
522 
523 gottype:
524 	/*
525 	 * Add local net header.  If no space in first mbuf,
526 	 * allocate another.
527 	 */
528 	if (m->m_off > MMAXOFF ||
529 	    MMINOFF + sizeof (struct ether_header) > m->m_off) {
530 		m = m_get(M_DONTWAIT, MT_HEADER);
531 		if (m == 0) {
532 			error = ENOBUFS;
533 			goto bad;
534 		}
535 		m->m_next = m0;
536 		m->m_off = MMINOFF;
537 		m->m_len = sizeof (struct ether_header);
538 	} else {
539 		m->m_off -= sizeof (struct ether_header);
540 		m->m_len += sizeof (struct ether_header);
541 	}
542 	il = mtod(m, struct ether_header *);
543 	il->ether_type = htons((u_short)type);
544  	bcopy((caddr_t)edst, (caddr_t)il->ether_dhost, sizeof (edst));
545  	bcopy((caddr_t)is->is_addr, (caddr_t)il->ether_shost,
546 	    sizeof(il->ether_shost));
547 
548 	/*
549 	 * Queue message on interface, and start output if interface
550 	 * not yet active.
551 	 */
552 	s = splimp();
553 	if (IF_QFULL(&ifp->if_snd)) {
554 		IF_DROP(&ifp->if_snd);
555 		splx(s);
556 		m_freem(m);
557 		return (ENOBUFS);
558 	}
559 	IF_ENQUEUE(&ifp->if_snd, m);
560 	if ((is->is_flags & ILF_OACTIVE) == 0)
561 		ilstart(ifp->if_unit);
562 	splx(s);
563 	return (0);
564 
565 bad:
566 	m_freem(m0);
567 	return (error);
568 }
569 
570 /*
571  * Watchdog routine, request statistics from board.
572  */
573 ilwatch(unit)
574 	int unit;
575 {
576 	register struct il_softc *is = &il_softc[unit];
577 	register struct ifnet *ifp = &is->is_if;
578 	int s;
579 
580 	if (is->is_flags & ILF_STATPENDING) {
581 		ifp->if_timer = is->is_scaninterval;
582 		return;
583 	}
584 	s = splimp();
585 	is->is_flags |= ILF_STATPENDING;
586 	if ((is->is_flags & ILF_OACTIVE) == 0)
587 		ilstart(ifp->if_unit);
588 	splx(s);
589 	ifp->if_timer = is->is_scaninterval;
590 }
591 
592 /*
593  * Total up the on-board statistics.
594  */
595 iltotal(is)
596 	register struct il_softc *is;
597 {
598 	register u_short *interval, *sum, *end;
599 
600 	interval = &is->is_stats.ils_frames;
601 	sum = &is->is_sum.ils_frames;
602 	end = is->is_sum.ils_fill2;
603 	while (sum < end)
604 		*sum++ += *interval++;
605 	is->is_if.if_collisions = is->is_sum.ils_collis;
606 }
607 
608 /*
609  * Process an ioctl request.
610  */
611 ilioctl(ifp, cmd, data)
612 	register struct ifnet *ifp;
613 	int cmd;
614 	caddr_t data;
615 {
616 	register struct ifaddr *ifa = (struct ifaddr *)data;
617 	int s = splimp(), error = 0;
618 
619 	switch (cmd) {
620 
621 	case SIOCSIFADDR:
622 		ifp->if_flags |= IFF_UP;
623 		ilinit(ifp->if_unit);
624 
625 		switch (ifa->ifa_addr.sa_family) {
626 		case AF_INET:
627 			((struct arpcom *)ifp)->ac_ipaddr =
628 				IA_SIN(ifa)->sin_addr;
629 			arpwhohas((struct arpcom *)ifp, &IA_SIN(ifa)->sin_addr);
630 			break;
631 		}
632 		break;
633 
634 	default:
635 		error = EINVAL;
636 	}
637 	splx(s);
638 	return (error);
639 }
640