netisr: Inline netisr_cpuport() and netisr_curport()
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Thu, 2 May 2013 06:29:30 +0000 (14:29 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Thu, 2 May 2013 06:29:30 +0000 (14:29 +0800)
These two functions do nothing more than just return pointer to the
element in the array.

Per our header file naming convention, put these two functions in
net/netisr2.h

34 files changed:
sys/dev/acpica/acpi_cpu_pstate.c
sys/kern/uipc_socket.c
sys/kern/uipc_socket2.c
sys/net/bpf.c
sys/net/bridge/if_bridge.c
sys/net/bridge/if_bridgevar.h
sys/net/dummynet/ip_dummynet.c
sys/net/dummynet/ip_dummynet_glue.c
sys/net/if.c
sys/net/if_ethersubr.c
sys/net/if_poll.c
sys/net/ipfw/ip_fw2.h
sys/net/netisr.c
sys/net/netisr.h
sys/net/netisr2.h [copied from sys/net/netisr.h with 53% similarity]
sys/net/pf/pf.c
sys/net/pfil.c
sys/net/rtsock.c
sys/net/vlan/if_vlan.c
sys/netinet/if_ether.c
sys/netinet/in.c
sys/netinet/ip_carp.c
sys/netinet/ip_demux.c
sys/netinet/ip_divert.c
sys/netinet/ip_flow.c
sys/netinet/ip_input.c
sys/netinet/tcp_output.c
sys/netinet/tcp_subr.c
sys/netinet/tcp_syncache.c
sys/netinet/tcp_usrreq.c
sys/netinet/udp_usrreq.c
sys/netinet6/ip6_input.c
sys/netinet6/udp6_usrreq.c
tools/tools/netrate/pktgen/pktgen.c

index ab0bec4..4f6851f 100644 (file)
@@ -43,7 +43,7 @@
 #include <sys/sysctl.h>
 #include <sys/msgport2.h>
 
-#include <net/netisr.h>
+#include <net/netisr2.h>
 #include <net/netmsg2.h>
 #include <net/if_var.h>
 
index 62a52be..32ebecf 100644 (file)
@@ -92,6 +92,7 @@
 #include <vm/vm_zone.h>
 #include <vm/pmap.h>
 #include <net/netmsg2.h>
+#include <net/netisr2.h>
 
 #include <sys/thread2.h>
 #include <sys/socketvar2.h>
index 9b292db..0dc5e53 100644 (file)
@@ -59,6 +59,8 @@
 #include <sys/msgport2.h>
 #include <sys/socketvar2.h>
 
+#include <net/netisr2.h>
+
 int    maxsockets;
 
 /*
index d0d47de..95dfbcf 100644 (file)
@@ -67,6 +67,7 @@
 #include <net/bpf.h>
 #include <net/bpfdesc.h>
 #include <net/netmsg2.h>
+#include <net/netisr2.h>
 
 #include <netinet/in.h>
 #include <netinet/if_ether.h>
index 0e1e793..7af7913 100644 (file)
 #include <net/bridge/if_bridgevar.h>
 #include <net/if_llc.h>
 #include <net/netmsg2.h>
+#include <net/netisr2.h>
 
 #include <net/route.h>
 #include <sys/in_cksum.h>
index 8b3e90f..902892d 100644 (file)
@@ -78,6 +78,7 @@
 
 #include <sys/callout.h>
 #include <sys/queue.h>
+#include <net/netisr2.h>
 
 /*
  * Commands used in the SIOCSDRVSPEC ioctl.  Note the lookup of the
index 5a0b8a6..6d6868e 100644 (file)
@@ -59,6 +59,7 @@
 
 #include <net/ethernet.h>
 #include <net/netmsg2.h>
+#include <net/netisr2.h>
 #include <net/route.h>
 
 #include <netinet/in_var.h>
index fa80131..13745cb 100644 (file)
@@ -43,7 +43,7 @@
 #include <net/if_var.h>
 #include <net/route.h>
 #include <net/ethernet.h>
-#include <net/netisr.h>
+#include <net/netisr2.h>
 #include <net/netmsg2.h>
 
 #include <netinet/in.h>
index 504184f..53c1324 100644 (file)
@@ -74,7 +74,7 @@
 #include <net/radix.h>
 #include <net/route.h>
 #include <net/if_clone.h>
-#include <net/netisr.h>
+#include <net/netisr2.h>
 #include <net/netmsg2.h>
 
 #include <machine/atomic.h>
index 072a395..e295be0 100644 (file)
@@ -71,6 +71,7 @@
 #include <net/vlan/if_vlan_ether.h>
 #include <net/vlan/if_vlan_var.h>
 #include <net/netmsg2.h>
+#include <net/netisr2.h>
 
 #if defined(INET) || defined(INET6)
 #include <netinet/in.h>
index f4e392a..947d121 100644 (file)
@@ -47,6 +47,7 @@
 #include <net/if.h>
 #include <net/if_poll.h>
 #include <net/netmsg2.h>
+#include <net/netisr2.h>
 
 /*
  * Polling support for network device drivers.
index 1ccd986..2a6701a 100644 (file)
@@ -29,6 +29,8 @@
 #ifndef _IPFW2_H
 #define _IPFW2_H
 
+#include <net/netisr2.h>
+
 /*
  * The kernel representation of ipfw rules is made of a list of
  * 'instructions' (for all practical purposes equivalent to BPF
index 06ebdcc..a7faf91 100644 (file)
@@ -48,7 +48,7 @@
 #include <sys/socketvar.h>
 #include <net/if.h>
 #include <net/if_var.h>
-#include <net/netisr.h>
+#include <net/netisr2.h>
 #include <machine/cpufunc.h>
 #include <machine/smp.h>
 
@@ -91,7 +91,7 @@ static TAILQ_HEAD(,netmsg_port_registration) netreglist;
 static TAILQ_HEAD(,netmsg_rollup) netrulist;
 
 /* Per-CPU thread to handle any protocol.  */
-static struct thread netisr_cpu[MAXCPU];
+struct thread netisr_cpu[MAXCPU];
 lwkt_port netisr_afree_rport;
 lwkt_port netisr_afree_free_so_rport;
 lwkt_port netisr_adone_rport;
@@ -524,26 +524,6 @@ netisr_register_rollup(netisr_ru_t ru_func, int prio)
        TAILQ_INSERT_TAIL(&netrulist, new_ru, ru_entry);
 }
 
-/*
- * Return the message port for the general protocol message servicing
- * thread for a particular cpu.
- */
-lwkt_port_t
-netisr_cpuport(int cpu)
-{
-       KKASSERT(cpu >= 0 && cpu < ncpus);
-       return (&netisr_cpu[cpu].td_msgport);
-}
-
-/*
- * Return the current cpu's network protocol thread.
- */
-lwkt_port_t
-netisr_curport(void)
-{
-       return(netisr_cpuport(mycpuid));
-}
-
 /*
  * Return a default protocol control message processing thread port
  */
index 05af905..c55f05f 100644 (file)
@@ -165,9 +165,6 @@ extern lwkt_port netisr_afree_free_so_rport;
 extern lwkt_port netisr_apanic_rport;
 extern lwkt_port netisr_sync_port;
 
-lwkt_port_t    netisr_cpuport(int cpu);
-lwkt_port_t    netisr_curport(void);
-
 void           netisr_register(int, netisr_fn_t, netisr_cpufn_t);
 void           netisr_register_hashcheck(int, netisr_hashck_t);
 void           netisr_register_rollup(netisr_ru_t ru_func, int ru_prio);
similarity index 53%
copy from sys/net/netisr.h
copy to sys/net/netisr2.h
index 05af905..2ce4438 100644 (file)
  * $FreeBSD: src/sys/net/netisr.h,v 1.21.2.5 2002/02/09 23:02:39 luigi Exp $
  */
 
-#ifndef _NET_NETISR_H_
-#define _NET_NETISR_H_
-
-/*
- * The networking code runs off software interrupts.
- *
- * You can switch into the network by doing splnet() and return by splx().
- * The software interrupt level for the network is higher than the software
- * level for the clock (so you can enter the network in routines called
- * at timeout time).
- */
-
-/*
- * Each ``pup-level-1'' input queue has a bit in a ``netisr'' status
- * word which is used to de-multiplex a single software
- * interrupt used for scheduling the network code to calls
- * on the lowest level routine of each protocol.
- */
-#define NETISR_RESERVED0 0             /* cannot be used */
-#define        NETISR_IP       2               /* same as AF_INET */
-#define        NETISR_NS       6               /* same as AF_NS */
-#define        NETISR_ARP      18              /* same as AF_LINK */
-#define        NETISR_MPLS     21              /* MPLS */
-#define        NETISR_IPX      23              /* same as AF_IPX */
-#define        NETISR_USB      25              /* USB soft interrupt */
-#define        NETISR_PPP      27              /* PPP soft interrupt */
-#define        NETISR_IPV6     28              /* same as AF_INET6 */
-#define        NETISR_NATM     29              /* same as AF_NATM */
-#define        NETISR_NETGRAPH 30              /* same as AF_NETGRAPH */
-#define        NETISR_BLUETOOTH 31
+#ifndef _NET_NETISR2_H_
+#define _NET_NETISR2_H_
 
-#define        NETISR_MAX      32
-
-#if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
-
-#ifndef _SYS_TYPES_H_
-#include <sys/types.h>
-#endif
-#ifndef _SYS_QUEUE_H_
-#include <sys/queue.h>
-#endif
-#ifndef _SYS_PROTOSW_H_
-#include <sys/protosw.h>
-#endif
-#ifndef _SYS_MSGPORT_H_
-#include <sys/msgport.h>
-#endif
-#ifndef _NET_NETMSG_H_
-#include <net/netmsg.h>
+#ifndef _KERNEL
+#error "kernel only header file"
 #endif
 
+#ifndef _SYS_THREAD_H_
+#include <sys/thread.h>
 #endif
-
-#ifdef _KERNEL
-
-void netmsg_so_notify(netmsg_t);
-void netmsg_so_notify_abort(netmsg_t);
-void netmsg_so_notify_doabort(lwkt_msg_t);
-
+#ifndef _NET_NETISR_H_
+#include <net/netisr.h>
 #endif
 
-#if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
+extern struct thread netisr_cpu[MAXCPU];
 
 /*
- * Temporary pktinfo structure passed directly from the driver to
- * ether_input_pkt(), allows us to bypass numerous checks.
+ * Return the message port for the general protocol message servicing
+ * thread for a particular cpu.
  */
-struct pktinfo {
-       int             pi_netisr;      /* netisr index, e.g. NETISR_IP */
-       uint32_t        pi_flags;       /* PKTINFO_FLAG_ */
-       int             pi_l3proto;     /* layer3 protocol number */
-};
-
-#define PKTINFO_FLAG_FRAG      0x1
+static __inline lwkt_port_t
+netisr_cpuport(int cpu)
+{
+       KKASSERT(cpu >= 0 && cpu < ncpus);
+       return &netisr_cpu[cpu].td_msgport;
+}
 
 /*
- * NETISR_xxx registrations
+ * Return the current cpu's network protocol thread.
  */
-struct netisr {
-       netisr_fn_t     ni_handler;     /* packet handler function */
-       netisr_hashck_t ni_hashck;      /* hash check function */
-       netisr_cpufn_t  ni_cpufn;       /* characterize pkt return cpu */
-       struct netmsg_base ni_netmsg;   /* for sched_netisr() (no-data) */
-};
-
-#endif
-
-#ifdef _KERNEL
-
-#define NETISR_ROLLUP_PRIO_TCP         200
-#define NETISR_ROLLUP_PRIO_IFSTART     50
-
-extern lwkt_port netisr_adone_rport;
-extern lwkt_port netisr_afree_rport;
-extern lwkt_port netisr_afree_free_so_rport;
-extern lwkt_port netisr_apanic_rport;
-extern lwkt_port netisr_sync_port;
-
-lwkt_port_t    netisr_cpuport(int cpu);
-lwkt_port_t    netisr_curport(void);
-
-void           netisr_register(int, netisr_fn_t, netisr_cpufn_t);
-void           netisr_register_hashcheck(int, netisr_hashck_t);
-void           netisr_register_rollup(netisr_ru_t ru_func, int ru_prio);
-
-void           netisr_characterize(int num, struct mbuf **mp, int hoff);
-void           netisr_hashcheck(int num, struct mbuf *m,
-                   const struct pktinfo *pi);
-int            netisr_queue(int, struct mbuf *);
-int            netisr_handle(int, struct mbuf *);
-
-struct netisr_barrier *netisr_barrier_create(void);
-void           netisr_barrier_set(struct netisr_barrier *);
-void           netisr_barrier_rem(struct netisr_barrier *);
-
-void           netmsg_service_port_init(lwkt_port_t);
-void           netmsg_service_sync(void);
-void           netmsg_sync_handler(netmsg_t);
-void           schednetisr(int);
-
-#endif /* _KERNEL */
+static __inline lwkt_port_t
+netisr_curport(void)
+{
+       return netisr_cpuport(mycpuid);
+}
 
-#endif /* _NET_NETISR_H_ */
+#endif /* _NET_NETISR2_H_ */
index c57e3d9..10f264a 100644 (file)
@@ -61,7 +61,7 @@
 #include <net/if.h>
 #include <net/if_types.h>
 #include <net/bpf.h>
-#include <net/netisr.h>
+#include <net/netisr2.h>
 #include <net/route.h>
 
 #include <netinet/in.h>
index 2241cf5..5160a5d 100644 (file)
@@ -41,6 +41,7 @@
 #include <net/if.h>
 #include <net/pfil.h>
 #include <net/netmsg2.h>
+#include <net/netisr2.h>
 #include <sys/mplock2.h>
 
 #define PFIL_CFGPORT   netisr_cpuport(0)
index 791b0d0..354ef42 100644 (file)
@@ -88,6 +88,7 @@
 #include <net/route.h>
 #include <net/raw_cb.h>
 #include <net/netmsg2.h>
+#include <net/netisr2.h>
 
 #ifdef SCTP
 extern void sctp_add_ip_address(struct ifaddr *ifa);
index b8f14ec..cd5a7e9 100644 (file)
 #include <net/ifq_var.h>
 #include <net/if_clone.h>
 #include <net/netmsg2.h>
+#include <net/netisr2.h>
 
 #ifdef INET
 #include <netinet/in.h>
index 9b13314..65bd0b2 100644 (file)
 #include <sys/thread2.h>
 #include <sys/msgport2.h>
 #include <net/netmsg2.h>
+#include <net/netisr2.h>
 #include <sys/mplock2.h>
 
 #ifdef CARP
index 6ee859c..fe91745 100644 (file)
@@ -54,6 +54,7 @@
 #include <net/if_types.h>
 #include <net/route.h>
 #include <net/netmsg2.h>
+#include <net/netisr2.h>
 
 #include <netinet/in.h>
 #include <netinet/in_var.h>
index 7c0e511..00ec432 100644 (file)
@@ -61,6 +61,7 @@
 #include <net/if_var.h>
 #include <net/ifq_var.h>
 #include <net/netmsg2.h>
+#include <net/netisr2.h>
 
 #ifdef INET
 #include <netinet/in.h>
index 7a462d9..c6b0113 100644 (file)
@@ -44,7 +44,7 @@
 #include <sys/globaldata.h>
 
 #include <net/if.h>
-#include <net/netisr.h>
+#include <net/netisr2.h>
 #include <net/toeplitz2.h>
 
 #include <netinet/in_systm.h>
index ea7aaf0..44fcb9f 100644 (file)
@@ -63,6 +63,7 @@
 #include <net/route.h>
 
 #include <net/netmsg2.h>
+#include <net/netisr2.h>
 #include <sys/thread2.h>
 #include <sys/mplock2.h>
 
index 33722b8..1a9b573 100644 (file)
@@ -51,7 +51,7 @@
 #include <net/if.h>
 #include <net/if_var.h>
 #include <net/route.h>
-#include <net/netisr.h>
+#include <net/netisr2.h>
 #include <net/netmsg2.h>
 
 #include <netinet/in.h>
index c549f44..3fe9a73 100644 (file)
 #include <net/if_dl.h>
 #include <net/pfil.h>
 #include <net/route.h>
-#include <net/netisr.h>
+#include <net/netisr2.h>
 
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
index a542ce4..0671dc8 100644 (file)
@@ -88,6 +88,7 @@
 #include <net/if_var.h>
 #include <net/route.h>
 #include <net/netmsg2.h>
+#include <net/netisr2.h>
 
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
index 093e4fd..188bfd0 100644 (file)
@@ -96,7 +96,7 @@
 
 #include <net/route.h>
 #include <net/if.h>
-#include <net/netisr.h>
+#include <net/netisr2.h>
 
 #define        _IP_VHL
 #include <netinet/in.h>
index 3df6eb0..9f1ed62 100644 (file)
@@ -90,6 +90,7 @@
 
 #include <sys/msgport2.h>
 #include <net/netmsg2.h>
+#include <net/netisr2.h>
 
 #include <net/if.h>
 #include <net/route.h>
index 959c256..13f4939 100644 (file)
@@ -98,6 +98,7 @@
 #include <net/route.h>
 
 #include <net/netmsg2.h>
+#include <net/netisr2.h>
 
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
index 9a25834..7323cf1 100644 (file)
@@ -94,6 +94,7 @@
 #include <net/if.h>
 #include <net/route.h>
 #include <net/netmsg2.h>
+#include <net/netisr2.h>
 
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
index cf373e9..6d2582f 100644 (file)
@@ -95,6 +95,7 @@
 #include <sys/thread2.h>
 #include <sys/msgport2.h>
 #include <net/netmsg2.h>
+#include <net/netisr2.h>
 
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
index 042d339..c84b481 100644 (file)
@@ -90,6 +90,7 @@
 #include <net/if.h>
 #include <net/route.h>
 #include <net/if_types.h>
+#include <net/netisr2.h>
 
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
index 441c34c..87bedda 100644 (file)
@@ -56,6 +56,7 @@
 #include <net/ifq_var.h>
 #include <net/ethernet.h>
 #include <net/netmsg2.h>
+#include <net/netisr2.h>
 
 #include <netinet/in.h>
 #include <netinet/ip.h>