Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump Register netisr's from component constructors inste...
details: https://anonhg.NetBSD.org/src/rev/3e42ef837bca
branches: trunk
changeset: 326700:3e42ef837bca
user: pooka <pooka%NetBSD.org@localhost>
date: Fri Feb 14 01:43:13 2014 +0000
description:
Register netisr's from component constructors instead of via a hardcoded
global list.
diffstat:
sys/rump/librump/rumpnet/netisr.c | 54 ++--------------------------
sys/rump/librump/rumpnet/rump_net.c | 5 +-
sys/rump/librump/rumpnet/rump_net_private.h | 4 +-
sys/rump/net/lib/libnetinet/component.c | 10 ++++-
sys/rump/net/lib/libnetinet6/component.c | 12 +++++-
sys/rump/net/lib/libnetmpls/component.c | 9 +++-
6 files changed, 34 insertions(+), 60 deletions(-)
diffs (242 lines):
diff -r bae8d10449f1 -r 3e42ef837bca sys/rump/librump/rumpnet/netisr.c
--- a/sys/rump/librump/rumpnet/netisr.c Fri Feb 14 01:27:48 2014 +0000
+++ b/sys/rump/librump/rumpnet/netisr.c Fri Feb 14 01:43:13 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netisr.c,v 1.6 2013/07/18 15:59:27 kefren Exp $ */
+/* $NetBSD: netisr.c,v 1.7 2014/02/14 01:43:13 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@@ -26,17 +26,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netisr.c,v 1.6 2013/07/18 15:59:27 kefren Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netisr.c,v 1.7 2014/02/14 01:43:13 pooka Exp $");
#include <sys/param.h>
#include <sys/intr.h>
-#include <netinet/in.h>
-#include <netinet/ip_var.h>
-#include <netinet/if_inarp.h>
-#include <netinet/ip6.h>
-#include <netinet6/ip6_var.h>
-#include <netmpls/mpls_var.h>
#include <net/netisr.h>
#include <rump/rumpuser.h>
@@ -51,48 +45,10 @@
softint_schedule(netisrs[isr]);
}
-/*
- * Aliases are needed only for static linking (dlsym() is not supported).
- */
-void __netisr_stub(void);
void
-__netisr_stub(void)
+rump_netisr_register(int level, void (*handler)(void))
{
- panic("netisr called but networking stack missing");
+ netisrs[level] = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,
+ (void (*)(void *))handler, NULL);
}
-__weak_alias(ipintr,__netisr_stub);
-__weak_alias(arpintr,__netisr_stub);
-__weak_alias(ip6intr,__netisr_stub);
-__weak_alias(mplsintr,__netisr_stub);
-
-void
-rump_netisr_init(void)
-{
- void *iphand, *arphand, *ip6hand, *mplshand, *sym;
-
- iphand = ipintr;
- if ((sym = rumpuser_dl_globalsym("rumpns_ipintr")) != NULL)
- iphand = sym;
-
- arphand = arpintr;
- if ((sym = rumpuser_dl_globalsym("rumpns_arpintr")) != NULL)
- arphand = sym;
-
- ip6hand = ip6intr;
- if ((sym = rumpuser_dl_globalsym("rumpns_ip6intr")) != NULL)
- ip6hand = sym;
-
- mplshand = mplsintr;
- if ((sym = rumpuser_dl_globalsym("rumpns_mplsintr")) != NULL)
- mplshand = sym;
-
- netisrs[NETISR_IP] = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,
- (void (*)(void *))iphand, NULL);
- netisrs[NETISR_ARP] = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,
- (void (*)(void *))arphand, NULL);
- netisrs[NETISR_IPV6] = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,
- (void (*)(void *))ip6hand, NULL);
- netisrs[NETISR_MPLS] = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,
- (void (*)(void *))mplshand, NULL);
-}
diff -r bae8d10449f1 -r 3e42ef837bca sys/rump/librump/rumpnet/rump_net.c
--- a/sys/rump/librump/rumpnet/rump_net.c Fri Feb 14 01:27:48 2014 +0000
+++ b/sys/rump/librump/rumpnet/rump_net.c Fri Feb 14 01:43:13 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_net.c,v 1.16 2013/01/14 16:50:54 pooka Exp $ */
+/* $NetBSD: rump_net.c,v 1.17 2014/02/14 01:43:13 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump_net.c,v 1.16 2013/01/14 16:50:54 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_net.c,v 1.17 2014/02/14 01:43:13 pooka Exp $");
#include <sys/param.h>
@@ -50,7 +50,6 @@
soinit();
domaininit(false);
- rump_netisr_init();
rump_component_init(RUMP_COMPONENT_NET);
rump_component_init(RUMP_COMPONENT_NET_ROUTE);
diff -r bae8d10449f1 -r 3e42ef837bca sys/rump/librump/rumpnet/rump_net_private.h
--- a/sys/rump/librump/rumpnet/rump_net_private.h Fri Feb 14 01:27:48 2014 +0000
+++ b/sys/rump/librump/rumpnet/rump_net_private.h Fri Feb 14 01:43:13 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_net_private.h,v 1.8 2014/02/14 01:27:48 pooka Exp $ */
+/* $NetBSD: rump_net_private.h,v 1.9 2014/02/14 01:43:13 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
#ifndef _SYS_RUMP_NET_PRIVATE_H_
#define _SYS_RUMP_NET_PRIVATE_H_
-void rump_netisr_init(void);
+void rump_netisr_register(int, void (*)(void));
#define DOMAINADD(dom) \
do { \
diff -r bae8d10449f1 -r 3e42ef837bca sys/rump/net/lib/libnetinet/component.c
--- a/sys/rump/net/lib/libnetinet/component.c Fri Feb 14 01:27:48 2014 +0000
+++ b/sys/rump/net/lib/libnetinet/component.c Fri Feb 14 01:43:13 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: component.c,v 1.9 2014/01/02 18:29:01 pooka Exp $ */
+/* $NetBSD: component.c,v 1.10 2014/02/14 01:43:13 pooka Exp $ */
/*
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.9 2014/01/02 18:29:01 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.10 2014/02/14 01:43:13 pooka Exp $");
#include <sys/param.h>
#include <sys/domain.h>
@@ -36,8 +36,11 @@
#include <sys/socketvar.h>
#include <net/if.h>
+#include <net/netisr.h>
#include <netinet/in.h>
#include <netinet/in_var.h>
+#include <netinet/ip_var.h>
+#include <netinet/if_inarp.h>
#include "rump_private.h"
#include "rump_net_private.h"
@@ -52,6 +55,9 @@
DOMAINADD(inetdomain);
carpattach(1);
+
+ rump_netisr_register(NETISR_IP, ipintr);
+ rump_netisr_register(NETISR_ARP, arpintr);
}
RUMP_COMPONENT(RUMP_COMPONENT_NET_IFCFG)
diff -r bae8d10449f1 -r 3e42ef837bca sys/rump/net/lib/libnetinet6/component.c
--- a/sys/rump/net/lib/libnetinet6/component.c Fri Feb 14 01:27:48 2014 +0000
+++ b/sys/rump/net/lib/libnetinet6/component.c Fri Feb 14 01:43:13 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: component.c,v 1.3 2014/01/02 18:29:01 pooka Exp $ */
+/* $NetBSD: component.c,v 1.4 2014/02/14 01:43:13 pooka Exp $ */
/*
* Copyright (c) 2013 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.3 2014/01/02 18:29:01 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.4 2014/02/14 01:43:13 pooka Exp $");
#include <sys/param.h>
#include <sys/domain.h>
@@ -34,6 +34,12 @@
#include <sys/socketvar.h>
#include <net/if.h>
+#include <net/netisr.h>
+
+#include <netinet/in.h>
+#include <netinet/ip_var.h>
+#include <netinet/ip6.h>
+#include <netinet6/ip6_var.h>
#include "rump_private.h"
#include "rump_net_private.h"
@@ -43,6 +49,8 @@
extern struct domain inet6domain;
DOMAINADD(inet6domain);
+
+ rump_netisr_register(NETISR_IPV6, ip6intr);
}
RUMP_COMPONENT(RUMP_COMPONENT_NET_IFCFG)
diff -r bae8d10449f1 -r 3e42ef837bca sys/rump/net/lib/libnetmpls/component.c
--- a/sys/rump/net/lib/libnetmpls/component.c Fri Feb 14 01:27:48 2014 +0000
+++ b/sys/rump/net/lib/libnetmpls/component.c Fri Feb 14 01:43:13 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: component.c,v 1.1 2013/07/18 15:59:28 kefren Exp $ */
+/* $NetBSD: component.c,v 1.2 2014/02/14 01:43:13 pooka Exp $ */
/*
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
@@ -31,15 +31,18 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.1 2013/07/18 15:59:28 kefren Exp $");
+__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.2 2014/02/14 01:43:13 pooka Exp $");
#include <sys/param.h>
#include <sys/domain.h>
#include <sys/protosw.h>
#include <net/if.h>
+#include <net/netisr.h>
#include <net/route.h>
+#include <netmpls/mpls_var.h>
+
#include "rump_private.h"
#include "rump_net_private.h"
@@ -50,6 +53,8 @@
extern struct domain mplsdomain;
DOMAINADD(mplsdomain);
+
+ rump_netisr_register(NETISR_MPLS, mplsintr);
}
RUMP_COMPONENT(RUMP_COMPONENT_NET_IF)
Home |
Main Index |
Thread Index |
Old Index