netisr.h revision 1542
19781SMoriah.Waterland@Sun.COM/*
29781SMoriah.Waterland@Sun.COM * Copyright (c) 1980, 1986, 1989, 1993
39781SMoriah.Waterland@Sun.COM *	The Regents of the University of California.  All rights reserved.
49781SMoriah.Waterland@Sun.COM *
59781SMoriah.Waterland@Sun.COM * Redistribution and use in source and binary forms, with or without
69781SMoriah.Waterland@Sun.COM * modification, are permitted provided that the following conditions
79781SMoriah.Waterland@Sun.COM * are met:
89781SMoriah.Waterland@Sun.COM * 1. Redistributions of source code must retain the above copyright
99781SMoriah.Waterland@Sun.COM *    notice, this list of conditions and the following disclaimer.
109781SMoriah.Waterland@Sun.COM * 2. Redistributions in binary form must reproduce the above copyright
119781SMoriah.Waterland@Sun.COM *    notice, this list of conditions and the following disclaimer in the
129781SMoriah.Waterland@Sun.COM *    documentation and/or other materials provided with the distribution.
139781SMoriah.Waterland@Sun.COM * 3. All advertising materials mentioning features or use of this software
149781SMoriah.Waterland@Sun.COM *    must display the following acknowledgement:
159781SMoriah.Waterland@Sun.COM *	This product includes software developed by the University of
169781SMoriah.Waterland@Sun.COM *	California, Berkeley and its contributors.
179781SMoriah.Waterland@Sun.COM * 4. Neither the name of the University nor the names of its contributors
189781SMoriah.Waterland@Sun.COM *    may be used to endorse or promote products derived from this software
199781SMoriah.Waterland@Sun.COM *    without specific prior written permission.
209781SMoriah.Waterland@Sun.COM *
219781SMoriah.Waterland@Sun.COM * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
229781SMoriah.Waterland@Sun.COM * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
239781SMoriah.Waterland@Sun.COM * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
249781SMoriah.Waterland@Sun.COM * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
259781SMoriah.Waterland@Sun.COM * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
269781SMoriah.Waterland@Sun.COM * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
279781SMoriah.Waterland@Sun.COM * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
289781SMoriah.Waterland@Sun.COM * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
299781SMoriah.Waterland@Sun.COM * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
309781SMoriah.Waterland@Sun.COM * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
319781SMoriah.Waterland@Sun.COM * SUCH DAMAGE.
329781SMoriah.Waterland@Sun.COM *
339781SMoriah.Waterland@Sun.COM *	@(#)netisr.h	8.1 (Berkeley) 6/10/93
349781SMoriah.Waterland@Sun.COM */
359781SMoriah.Waterland@Sun.COM
369781SMoriah.Waterland@Sun.COM/*
379781SMoriah.Waterland@Sun.COM * The networking code runs off software interrupts.
389781SMoriah.Waterland@Sun.COM *
399781SMoriah.Waterland@Sun.COM * You can switch into the network by doing splnet() and return by splx().
409781SMoriah.Waterland@Sun.COM * The software interrupt level for the network is higher than the software
419781SMoriah.Waterland@Sun.COM * level for the clock (so you can enter the network in routines called
429781SMoriah.Waterland@Sun.COM * at timeout time).
439781SMoriah.Waterland@Sun.COM */
449781SMoriah.Waterland@Sun.COM#if defined(vax) || defined(tahoe)
459781SMoriah.Waterland@Sun.COM#define	setsoftnet()	mtpr(SIRR, 12)
469781SMoriah.Waterland@Sun.COM#endif
479781SMoriah.Waterland@Sun.COM
489781SMoriah.Waterland@Sun.COM/*
499781SMoriah.Waterland@Sun.COM * Each ``pup-level-1'' input queue has a bit in a ``netisr'' status
509781SMoriah.Waterland@Sun.COM * word which is used to de-multiplex a single software
519781SMoriah.Waterland@Sun.COM * interrupt used for scheduling the network code to calls
529781SMoriah.Waterland@Sun.COM * on the lowest level routine of each protocol.
539781SMoriah.Waterland@Sun.COM */
549781SMoriah.Waterland@Sun.COM#define	NETISR_RAW	0		/* same as AF_UNSPEC */
559781SMoriah.Waterland@Sun.COM#define	NETISR_IP	2		/* same as AF_INET */
569781SMoriah.Waterland@Sun.COM#define	NETISR_IMP	3		/* same as AF_IMPLINK */
579781SMoriah.Waterland@Sun.COM#define	NETISR_NS	6		/* same as AF_NS */
589781SMoriah.Waterland@Sun.COM#define	NETISR_ISO	7		/* same as AF_ISO */
599781SMoriah.Waterland@Sun.COM#define	NETISR_CCITT	10		/* same as AF_CCITT */
609781SMoriah.Waterland@Sun.COM#define	NETISR_ARP	18		/* same as AF_LINK */
619781SMoriah.Waterland@Sun.COM
629781SMoriah.Waterland@Sun.COM#define	schednetisr(anisr)	{ netisr |= 1<<(anisr); setsoftnet(); }
639781SMoriah.Waterland@Sun.COM
649781SMoriah.Waterland@Sun.COM#ifdef i386
659781SMoriah.Waterland@Sun.COM/* XXX Temporary -- soon to vanish - wfj */
669781SMoriah.Waterland@Sun.COM#define	NETISR_SCLK	11		/* softclock */
679781SMoriah.Waterland@Sun.COM#define	NETISR_AST	12		/* ast -- resched */
689781SMoriah.Waterland@Sun.COM
699781SMoriah.Waterland@Sun.COM#undef	schednetisr
709781SMoriah.Waterland@Sun.COM#define	schednetisr(anisr)	{\
719781SMoriah.Waterland@Sun.COM	if(netisr == 0) { \
729781SMoriah.Waterland@Sun.COM		softem++; \
739781SMoriah.Waterland@Sun.COM	} \
749781SMoriah.Waterland@Sun.COM	netisr |= 1<<(anisr); \
759781SMoriah.Waterland@Sun.COM}
769781SMoriah.Waterland@Sun.COM#ifndef LOCORE
779781SMoriah.Waterland@Sun.COM#ifdef KERNEL
789781SMoriah.Waterland@Sun.COMint	softem;
799781SMoriah.Waterland@Sun.COM#endif
809781SMoriah.Waterland@Sun.COM#endif
819781SMoriah.Waterland@Sun.COM#endif /* i386 */
829781SMoriah.Waterland@Sun.COM
839781SMoriah.Waterland@Sun.COM#ifndef LOCORE
849781SMoriah.Waterland@Sun.COM#ifdef KERNEL
859781SMoriah.Waterland@Sun.COMint	netisr;				/* scheduling bits for network */
869781SMoriah.Waterland@Sun.COM#endif
879781SMoriah.Waterland@Sun.COM#endif
889781SMoriah.Waterland@Sun.COM