xref: /csrg-svn/sys/netinet/in_systm.h (revision 4907)
1 /* in_systm.h 4.3 81/11/16 */
2 
3 /*
4  * Miscellaneous internetwork
5  * definitions for kernel.
6  */
7 
8 /*
9  * Network types.
10  *
11  * Internally the system keeps counters in the headers with the bytes
12  * swapped so that VAX instructions will work on them.  It reverses
13  * the bytes before transmission at each protocol level.  The n_ types
14  * represent the types with the bytes in ``high-ender'' order.
15  */
16 typedef u_short n_short;		/* short as received from the net */
17 typedef u_long	n_long;			/* long as received from the net */
18 typedef u_long	seq_t;			/* sequence number */
19 
20 typedef	u_long	n_time;			/* ms since 00:00 GMT, byte rev */
21 
22 /*
23  * The network runs as a software interrupt process.
24  * You can switch into the network by doing splnet() and return by splx().
25  * The software interrupt level for the network is higher than the software
26  * level for the clock (so you can enter the network in routines called
27  * at timeout time).  Splimp is an ipl high enough to block all imps.
28  * While manipulating the mbuf buffer pool you have to block imps since
29  * allocation occurs at interrupt level.  (It would be easier to
30  * use interlocked instructions, but we don't do this yet.)
31  */
32 #define	splimp		spl5
33 #define	setsoftnet()	mtpr(SIRR, 12)
34 /* splnet is defined in ../sys/asm.sed */
35 
36 /*
37  * Network statistics record.
38  *
39  * SHOULD BE KEPT PER INTERFACE, AND WITH CNT, RATE, SUM.
40  */
41 struct	net_stat {
42 	int	imp_resets;		/* # times imp reset */
43 	int	imp_flushes;		/* # packets flushed by imp */
44 	int	imp_drops;		/* # msgs from imp no-one wants */
45 	int	m_drops;		/* # mbuf drops from lack of bufs */
46 	int	ip_badsum;		/* # bad ip checksums */
47 	int	t_badsum;		/* # bad tcp checksums */
48 	int	t_badsegs;		/* # bad tcp segments */
49 	int	t_unack;		/* # tcp segs placed on rcv_unack */
50 };
51 
52 #ifdef	KERNEL
53 struct	net_stat netstat;		/* net statistics block */
54 #endif
55 
56 #ifdef KPROF
57 #include "../inet/count.h"
58 #define	COUNT(i)	nrcount[i]++
59 int	nrcount[NCOUNTERS+1];
60 #else
61 #define	COUNT(i)
62 #endif
63