netisr.h revision 22975
1240075Sdes/*
298937Sdes * Copyright (c) 1980, 1986, 1989, 1993
398937Sdes *	The Regents of the University of California.  All rights reserved.
498937Sdes *
598937Sdes * Redistribution and use in source and binary forms, with or without
698937Sdes * modification, are permitted provided that the following conditions
798937Sdes * are met:
898937Sdes * 1. Redistributions of source code must retain the above copyright
998937Sdes *    notice, this list of conditions and the following disclaimer.
1098937Sdes * 2. Redistributions in binary form must reproduce the above copyright
1198937Sdes *    notice, this list of conditions and the following disclaimer in the
1298937Sdes *    documentation and/or other materials provided with the distribution.
1398937Sdes * 3. All advertising materials mentioning features or use of this software
14124208Sdes *    must display the following acknowledgement:
1598937Sdes *	This product includes software developed by the University of
1698937Sdes *	California, Berkeley and its contributors.
1798937Sdes * 4. Neither the name of the University nor the names of its contributors
1898937Sdes *    may be used to endorse or promote products derived from this software
1998937Sdes *    without specific prior written permission.
2098937Sdes *
2198937Sdes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2298937Sdes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2398937Sdes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2498937Sdes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2598937Sdes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2698937Sdes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2798937Sdes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2898937Sdes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2998937Sdes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3098937Sdes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31157016Sdes * SUCH DAMAGE.
32157016Sdes *
33106121Sdes *	@(#)netisr.h	8.1 (Berkeley) 6/10/93
34240075Sdes * $Id$
35128456Sdes */
3698937Sdes
37240075Sdes#ifndef _NET_NETISR_H_
3898937Sdes#define _NET_NETISR_H_
3998937Sdes
4098937Sdes/*
41157016Sdes * The networking code runs off software interrupts.
42240075Sdes *
43113908Sdes * You can switch into the network by doing splnet() and return by splx().
44157016Sdes * The software interrupt level for the network is higher than the software
4598937Sdes * level for the clock (so you can enter the network in routines called
4698937Sdes * at timeout time).
4798937Sdes */
48240075Sdes#if defined(vax) || defined(tahoe)
4998937Sdes#define	setsoftnet()	mtpr(SIRR, 12)
50240075Sdes#endif
5198937Sdes
52240075Sdes/*
53240075Sdes * Each ``pup-level-1'' input queue has a bit in a ``netisr'' status
5498937Sdes * word which is used to de-multiplex a single software
55157016Sdes * interrupt used for scheduling the network code to calls
56240075Sdes * on the lowest level routine of each protocol.
5798937Sdes */
5898937Sdes#define	NETISR_RAW	0		/* same as AF_UNSPEC */
59240075Sdes#define	NETISR_IP	2		/* same as AF_INET */
60157016Sdes#define	NETISR_IMP	3		/* same as AF_IMPLINK */
61157016Sdes#define	NETISR_NS	6		/* same as AF_NS */
6298937Sdes#define	NETISR_ISO	7		/* same as AF_ISO */
6398937Sdes#define	NETISR_CCITT	10		/* same as AF_CCITT */
6498937Sdes#define NETISR_ATALK    16              /* same as AF_APPLETALK */
65240075Sdes#define	NETISR_ARP	18		/* same as AF_LINK */
6698937Sdes#define NETISR_IPX	23		/* same as AF_IPX */
6798937Sdes#define	NETISR_ISDN	26		/* same as AF_E164 */
6898937Sdes#define	NETISR_PPP	27		/* PPP soft interrupt */
6998937Sdes
7098937Sdes#define	schednetisr(anisr)	{ netisr |= 1<<(anisr); setsoftnet(); }
7198937Sdes
7298937Sdes#ifndef LOCORE
7398937Sdes#ifdef KERNEL
7498937Sdesextern volatile unsigned int	netisr;	/* scheduling bits for network */
7598937Sdes
7698937Sdestypedef void netisr_t(void);
77240075Sdes
78240075Sdesstruct netisrtab {
79240075Sdes	int nit_num;
80240075Sdes	netisr_t *nit_isr;
81240075Sdes};
82240075Sdes
83240075Sdes#define NETISR_SET(num, isr) \
84240075Sdes	static struct netisrtab mod_nit = { num, isr }; \
85240075Sdes	DATA_SET(netisr_set, mod_nit);
86240075Sdes
87240075Sdesint register_netisr __P((int, netisr_t *));
88240075Sdes
89240075Sdes#endif
90240075Sdes#endif
91240075Sdes
92240075Sdes#endif
93240075Sdes