Initialise the intrq_present fields at runtime, not link time. This allows

us to load protocols at runtime, and avoids the use of common variables.

Also fix the ip6_intrq assignment so that it works at all.
This commit is contained in:
Mike Smith 2002-01-08 10:34:03 +00:00
parent 46c8c4207d
commit bedbd47e6a
8 changed files with 26 additions and 19 deletions

View File

@ -41,17 +41,17 @@
/*
* If the appropriate intrq_present variable is zero, don't use
* the queue (as it'll never get processed).
* When defined, each of the network stacks declares their own
* *intrq_present variable to be non-zero.
* Each of the active network stacks sets their own
* *intrq_present variable non-zero.
*/
const int atintrq1_present;
const int atintrq2_present;
const int atmintrq_present;
const int ipintrq_present;
const int ip6intrq_present;
const int ipxintrq_present;
const int natmintrq_present;
const int nsintrq_present;
int atintrq1_present;
int atintrq2_present;
int atmintrq_present;
int ipintrq_present;
int ip6intrq_present;
int ipxintrq_present;
int natmintrq_present;
int nsintrq_present;
struct ifqueue atintrq1;
struct ifqueue atintrq2;

View File

@ -30,6 +30,15 @@
#define _NET_INTRQ_H_
#ifdef _KERNEL
extern int atintrq1_present;
extern int atintrq2_present;
extern int atmintrq_present;
extern int ipintrq_present;
extern int ip6intrq_present;
extern int ipxintrq_present;
extern int natmintrq_present;
extern int nsintrq_present;
extern int family_enqueue __P((sa_family_t, struct mbuf *));
#endif

View File

@ -79,7 +79,6 @@ int atm_dev_print = 0;
int atm_print_data = 0;
int atm_version = ATM_VERSION;
struct timeval atm_debugtime = {0, 0};
const int atmintrq_present = 1;
struct sp_info atm_attributes_pool = {
"atm attributes pool", /* si_name */
@ -133,9 +132,10 @@ atm_initialize()
return;
atm_init = 1;
atm_intrq.ifq_maxlen = ATM_INTRQ_MAX;
mtx_init(&atm_intrq.ifq_mtx, "atm_inq", MTX_DEF);
atmintrq_present = 1;
#ifdef sgi
atm_intr_index = register_isr(atm_intr);
#endif

View File

@ -171,7 +171,6 @@ SYSCTL_STRUCT(_net_inet_ip, IPCTL_STATS, stats, CTLFLAG_RW,
static TAILQ_HEAD(ipqhead, ipq) ipq[IPREASS_NHASH];
static int nipq = 0; /* total # of reass queues */
static int maxnipq;
const int ipintrq_present = 1;
#ifdef IPCTL_DEFMTU
SYSCTL_INT(_net_inet_ip, IPCTL_DEFMTU, mtu, CTLFLAG_RW,
@ -255,6 +254,7 @@ ip_init()
#endif
ipintrq.ifq_maxlen = ipqmaxlen;
mtx_init(&ipintrq.ifq_mtx, "ip_inq", MTX_DEF);
ipintrq_present = 1;
register_netisr(NETISR_IP, ipintr);
}

View File

@ -135,7 +135,6 @@ extern struct callout in6_tmpaddrtimer_ch;
int ip6_forward_srcrt; /* XXX */
int ip6_sourcecheck; /* XXX */
int ip6_sourcecheck_interval; /* XXX */
const int int6intrq_present = 1;
int ip6_ours_check_algorithm;
@ -183,6 +182,7 @@ ip6_init()
ip6_protox[pr->pr_protocol] = pr - inet6sw;
ip6intrq.ifq_maxlen = ip6qmaxlen;
mtx_init(&ip6intrq.ifq_mtx, "ip6_inq", MTX_DEF);
ip6intrq_present = 1;
register_netisr(NETISR_IPV6, ip6intr);
nd6_init();
frag6_init();

View File

@ -89,7 +89,6 @@ struct ipxpcb ipxrawpcb;
static int ipxqmaxlen = IFQ_MAXLEN;
long ipx_pexseq;
const int ipxintrq_present = 1;
static int ipx_do_route(struct ipx_addr *src, struct route *ro);
static void ipx_undo_route(struct route *ro);
@ -108,6 +107,7 @@ ipx_init()
read_random(&ipx_pexseq, sizeof ipx_pexseq);
ipxintrq.ifq_maxlen = ipxqmaxlen;
mtx_init(&ipxintrq.ifq_mtx, "ipx_inq", MTX_DEF);
ipxintrq_present = 1;
ipxpcb.ipxp_next = ipxpcb.ipxp_prev = &ipxpcb;
ipxrawpcb.ipxp_next = ipxrawpcb.ipxp_prev = &ipxrawpcb;

View File

@ -114,8 +114,6 @@ u_int natm_sookcnt = 0; /* # mbufs ok */
u_int natm_sookbytes = 0; /* # of bytes ok */
#endif
const int natmintrq_present = 1;
void natm_init()
@ -124,6 +122,7 @@ void natm_init()
bzero(&natmintrq, sizeof(natmintrq));
natmintrq.ifq_maxlen = natmqmaxlen;
mtx_init(&natmintrq.ifq_mtx, "natm_inq", MTX_DEF);
natmintrq_present = 1;
}

View File

@ -79,8 +79,6 @@ int nsqmaxlen = IFQ_MAXLEN;
int idpcksum = 1;
long ns_pexseq;
const int nsintrq_present = 1;
ns_init()
{
extern struct timeval time;
@ -91,6 +89,7 @@ ns_init()
nsrawpcb.nsp_next = nsrawpcb.nsp_prev = &nsrawpcb;
nsintrq.ifq_maxlen = nsqmaxlen;
mtx_init(&nsintrq.ifq_mtx, "ns_inq", MTX_DEF);
nsintrq_present = 1;
ns_pexseq = time.tv_usec;
ns_netmask.sns_len = 6;
ns_netmask.sns_addr.x_net = ns_broadnet;