Make all network interrupt service routines MPSAFE part 1/3. Replace the critical section that was previously used to serialize access with the LWKT serializer. Integrate the serializer into the IFNET structure. Note that kern.intr_mpsafe must be set to 1 for network interrupts to actually run MPSAFE. Also note that any interrupts shared with othre non-MP drivers will cause all drivers on that interrupt to run with the Big Giant Lock. Network interrupt - Each network driver then simply passes that serializer to bus_setup_intr() so only a single serializer is required to process the entire interrupt path. LWKT serialization support is already 100% integrated into the interrupt subsystem so it will already be held as of when the registered interrupt procedure is called. Ioctl and if_* functions - All callers of if_* functions (such as if_start, if_ioctl, etc) now obtain the IFNET serializer before making the call. Thus all of these entry points into the driver will now be serialized. if_input - All code that calls if_input now ensures that the serializer is held. It will either already be held (when called from a driver), or the serializer will be wrapped around the call. When packets are forwarded or bridged between interfaces, the target interface serializer will be dropped temporarily to avoid a deadlock. Device Driver access - dev_* entry points into certain pseudo-network devices now obtain and release the serializer. This had to be done on a device-by-device basis (but there are only a few such devices). Thanks to several people for helping test the patch, in particular Sepherosa Ziehau.
Add a new macro IF_LLSOCKADDR which maps a ifnet pointer to the associated link layer sockaddr. Use it to implement IF_LLADDR. Replace most references of ifnet_addrs with one of those macros. This makes the sometimes explicitly encoded assumption of each interface having a link-layer address implicit and is the preparation for removing ifnet_addrs.
Import ALTQ support from KAME. This is based on the FreeBSD 4 snapshot. This includes neither the ALTQ3 compat code nor the !DragonFly defines. The macros have been replaced with inline functions in net/ifq_var.h. This also renames pkthdr.pf_flags as it is intended as general flag bit. Currently supported are ppp(4), sppp(4), tun(4) and wi(4), more drivers are coming later. Reviewed-by: corecode, dillon, hsu Comments-from: hmp
Now that I understand the poorly written BSD routing code and what it was trying to do, rewrite it in a clear and concise manner. The old rtalloc1() code written by CSRG had a number of problems: 1. it was not clear which route was being returned 2. it was not clear what was being reported 3. it hid the essential radix tree lookup operation inside a series of conditional tests and inline assignments 4. it had multiple gotos to the inside of if statements 5. it intermixed reporting code with the operational logic of lookup and cloning 6. it assigns multiple times to key variables 7. it has unnecessary assignments to key variables 8. it overloaded the "report" argument parameter, to have two different semantics 9. it misnamed the key route lookup function "rtalloc1", obscuring all uses of route lookup. In contrast to the rtalloc1 code in FreeBSD 4 or the even more convoluted rtalloc1 code in FreeBSD 5, the DragonFlyBSD version A. has a clear control flow that makes the common case obvious by highlighting the core call to the radix tree look up function, eliminating gotos into if statements, and completely separating out the special-case cloning logic B. makes it clear which route is being returned by only assigning once to the key "rt" variable and by expliciting returning "rt" or "clonedroute" C. abstracts out the reporting code into its own reporting API D. cleans up the semantics of the "report" argument parameter to only indicate whether to report a miss and not whether to clone E. introduces a simple single-argument API for caller that want to clone and those that do not.
Unify the input handling of the low-level network stack by introducing a new field if_input in struct ifnet. Initialize if_input and if_output in the low-level _ifattach routines. Make the _output and _input routines static, they are now called via (*ifp->if_input) and (*ifp->if_output) accordingly. The exception is ether_input which is still used with the second argument, the pointer to the Ethernet header instead of always taking it from the mbuf. Move the if_attach and bpfattach from the devices into fddi_ifattach, atm_ifattach. Remove the first argument to VLAN_INPUT_TAG, the pointer to the Ethernet header. Expect it at the beginning of the mbuf. Adjust the network for the changed API. Exceptions are wl(4), le(4), ie(4), el(4), ed(4) and de(4), because they use a on-stack Ethernet header. Another exception is the ATM stack, which uses a fourth argument to atm_input. Inspired-by: NetBSd net/if.h, rev 1.36
if_xname support Part 2/2: Convert remaining netif devices and implement full support for if_xname. Restructure struct ifnet in net/if_var.h, pulling in a few minor additional changes from current including making if_dunit an int, and making if_flags an int. Submitted-by: Max Laier <max@love2party.net>
kernel tree reorganization stage 1: Major cvs repository work (not logged as commits) plus a major reworking of the #include's to accomodate the relocations. * CVS repository files manually moved. Old directories left intact and empty (temporary). * Reorganize all filesystems into vfs/, most devices into dev/, sub-divide devices by function. * Begin to move device-specific architecture files to the device subdirs rather then throwing them all into, e.g. i386/include * Reorganize files related to system busses, placing the related code in a new bus/ directory. Also move cam to bus/cam though this may not have been the best idea in retrospect. * Reorganize emulation code and place it in a new emulation/ directory. * Remove the -I- compiler option in order to allow #include file localization, rename all config generated X.h files to use_X.h to clean up the conflicts. * Remove /usr/src/include (or /usr/include) dependancies during the kernel build, beyond what is normally needed to compile helper programs. * Make config create 'machine' softlinks for architecture specific directories outside of the standard <arch>/include. * Bump the config rev. WARNING! after this commit /usr/include and /usr/src/sys/compile/* should be regenerated from scratch.