xref: /csrg-svn/sys/netinet/in_systm.h (revision 6263)
1*6263Swnj /* in_systm.h 4.8 82/03/19 */
24806Swnj 
34806Swnj /*
44806Swnj  * Miscellaneous internetwork
54806Swnj  * definitions for kernel.
64806Swnj  */
74806Swnj 
8*6263Swnj #ifndef LOCORE
94806Swnj /*
104806Swnj  * Network types.
114806Swnj  *
124806Swnj  * Internally the system keeps counters in the headers with the bytes
134806Swnj  * swapped so that VAX instructions will work on them.  It reverses
144806Swnj  * the bytes before transmission at each protocol level.  The n_ types
154806Swnj  * represent the types with the bytes in ``high-ender'' order.
164806Swnj  */
174806Swnj typedef u_short n_short;		/* short as received from the net */
184806Swnj typedef u_long	n_long;			/* long as received from the net */
194806Swnj 
204806Swnj typedef	u_long	n_time;			/* ms since 00:00 GMT, byte rev */
21*6263Swnj #endif
224806Swnj 
234806Swnj /*
245084Swnj  * The internet code runs off software interrupts.
255084Swnj  *
264806Swnj  * You can switch into the network by doing splnet() and return by splx().
274806Swnj  * The software interrupt level for the network is higher than the software
284806Swnj  * level for the clock (so you can enter the network in routines called
294806Swnj  * at timeout time).  Splimp is an ipl high enough to block all imps.
304923Swnj  * While manipulating the mbuf buffer pool you have to block imps.
314806Swnj  */
32*6263Swnj 
33*6263Swnj /* splnet is defined in ../sys/asm.sed */
344806Swnj #define	splimp		spl5
35*6263Swnj #define	setsoftnet()	mtpr(SIRR, 12)
364806Swnj 
37*6263Swnj /*
38*6263Swnj  * Each ``pup-level-1'' input queue has a bit in a ``netisr'' status
39*6263Swnj  * word which is used to de-multiplex a single software
40*6263Swnj  * interrupt used for scheduling the network code to calls
41*6263Swnj  * on the lowest level routine of each protocol.
42*6263Swnj  */
43*6263Swnj #define	NETISR_RAW	0		/* same as AF_UNSPEC */
44*6263Swnj #define	NETISR_IP	2		/* same as AF_INET */
45*6263Swnj #define	NETISR_NS	6		/* same as AF_NS */
46*6263Swnj 
47*6263Swnj #define	schednetisr(anisr)	{ netisr |= 1<<(anisr); setsoftnet(); }
48*6263Swnj 
49*6263Swnj #ifndef LOCORE
50*6263Swnj #ifdef KERNEL
51*6263Swnj int	netisr;				/* scheduling bits for network */
52*6263Swnj #endif
53*6263Swnj 
54*6263Swnj 
554806Swnj #ifdef	KERNEL
564923Swnj n_time	iptime();
574806Swnj #endif
584806Swnj 
594806Swnj #ifdef KPROF
604806Swnj #include "../inet/count.h"
614806Swnj #define	COUNT(i)	nrcount[i]++
624806Swnj int	nrcount[NCOUNTERS+1];
634806Swnj #else
644806Swnj #define	COUNT(i)
654806Swnj #endif
66*6263Swnj #endif
67