kernel: Remove explicit dependencies on <sys/malloc.h> in headers. All except <net/if_var.h> for now, it needs decoupling in drm first. * Include <sys/malloc.h> in foo.c if they have kmalloc()/kfree() calls. * Consistently check if MALLOC_DECLARE was declared before. * <sys/mountctl.h>: include <sys/thread.h> for _KERNEL_STRUCTURES too since the "struct journal" embeds "struct thread". * <sys/tty.h>: Only two kernel sources makes use of M_TTYS. * <sys/socketvar2.h>: Make it kernel only header.
dummynet - Poll only if operational, change default freq for vkernel * Default frequency for vkernel is now 100 hz instead of 1000 hz. The frequency can be changed at any time with a sysctl. * The systimer is only configured when there are pipes or flows present, and will be deconfigured when there aren't. This saves us from doing any unnecessary polling. * dummynet still has some considerable holes related to SMP operation. It really needs a rewrite to some degree.
<net/if.h>: Do not include <net/if_var.h> for _KERNEL * Clean up an ancient leftover: do not include <net/if_var.h> from <net/if.h> for kernel stuffs. * Adjust various files to include the necessary <net/if_var.h> header. NOTE: I have also tested removing the inclusion of <net/if.h> from <net/if_var.h>, therefore add <net/if.h> inclusion for those files that need it but only included <net/if_var.h>. For some files, the header inclusion orderings are also adjusted.
kernel - Change time_second to time_uptime for all expiration calculations * Vet the entire kernel and change use cases for expiration calculations using time_second to use time_uptime instead. * Protects these expiration calculations from step changes in the wall time, particularly needed for route table entries. * Probably requires further variable type adjustments but the use of time_uptime instead if time_second is highly unlikely to ever overrun any demotions to int still present.
netisr: Inline netisr_cpuport() and netisr_curport() 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
netisr: Function renaming; no functional changes This cleans up code for keeping input packets' hash instead of masking the hash with ncpus2_mask. netisr_hashport(), which maps packet hash to netisr port, will be added soon.
systimer: Fix statclock() intr% counting for i8254 interrupt cputimer If i8254 is used as interrupt cputimer, it will send IPIs to APs to get statclock() called. In order to detect fast interrupt, statclock() tests gd_intr_nesting_level to see whether it should bump intr% or not, however, during IPI processing, gd_intr_nesting_level is bumped up, which tricks statclock() to believe that intr% should be incremented. This usually leads to 100% interrupt time on APs reported by utilities like systat(1). To solve this problem: - Pass in_ipi to systimer functions to indicate whether the functions are called during IPI processing or not. - In statclock(): if it is called during IPI processing, using (gd_intr_nesting_level - 1) to test whether intr% should be incremented or not. Additional cleanup: - Make systimer_init_*() interface stricter, by using "systimer_func_t" instead of "void *"
network - Major netmsg retooling, part 1 * Remove all the netmsg shims and make all pr_usrreqs and some proto->pr_* requests directly netmsg'd. * Fix issues with tcp implied connects and tcp6->tcp4 fallbacks with implied connects. * Fix an issue with a stack-based udp netmsg (allocate it) * Consolidate struct ip6protosw and struct protosw into a single structure and normalize the API functions which differed between the two (primarily proto->pr_input()). * Remove protosw->pr_soport() * Replace varargs protocol *_input() functions (ongoing) with fixed arguments.
network - Move socket from netmsg ext to netmsg header, add port to socket These changes should make it easier to debug mbufs routed to the wrong protocol threads. Note that IPV6 is routed to netisr0, even for tcp and udp packets, so for now we do not KKASSERT that the port matches directly. The TCP code still KKASSERTs that the timers are running on the correct cpu, since the cpu is still correct for IPV6 TCP/UDP packets even when the protocol thread is wrong (netisr_cpu 0 instead of tcp_thread 0 or udp_thread 0). * Instead of recalculating the port based on the inp or mbuf all the time, add a so_port field to the socket structure directly. * The socket pointer is now part of the netmsg header, even though some subsystems do not need it. This allows us to validate the message port more easily.