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