Up to [DragonFly] / src / sys / dev / netif / aue
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
MFC if_aue.c rev1.39: In aue(4) txeof, differ ifnet.if_start to ifnet's CPU to: 1) Keep if_start serialized 2) Avoid deadlock between USB sync operations and holding serializer in USB task thread (e.g. in txeof callback) Dragonfly-bug: <http://bugs.dragonflybsd.org/issue1123> Tested-by: Tim <email@example.com>
In aue(4) txeof, differ ifnet.if_start to ifnet's CPU to: 1) Keep if_start serialized 2) Avoid deadlock between USB sync operations and holding serializer in USB task thread (e.g. in txeof callback) Dragonfly-bug: <http://bugs.dragonflybsd.org/issue1123> Tested-by: Tim <firstname.lastname@example.org>
Reduce ifnet.if_serializer contention on output path: - Push ifnet.if_serializer holding down into each ifnet.if_output implementation - Add a serializer into ifaltq, which is used to protect send queue instead of its parent's if_serializer. This change has following implication: o On output path, enqueueing packets and calling ifnet.if_start are decoupled o In device drivers, poll->dev_encap_ok->dequeue operation sequence is no longer safe, instead dequeue->dev_encap_fail->prepend should be used This serializer will be held by using lwkt_serialize_adaptive_enter() - Add altq_started field into ifaltq, which is used to interlock the calling of its parent's if_start, to reduce ifnet.if_serializer contention. if_devstart(), a helper function which utilizes ifaltq.altq_started, is added to reduce code duplication in ethernet device drivers. - Add if_cpuid into ifnet. This field indicates on which CPU device driver's interrupt will happen. - Add ifq_dispatch(). This function will try to hold ifnet.if_serializer in order to call ifnet.if_start. If this attempt fails, this function will schedule ifnet.if_start to be called on CPU located by ifnet.if_start_cpuid if_start_nmsg, which is per-CPU netmsg, is added to ifnet to facilitate ifnet.if_start scheduling. ifq_dispatch() is called by ether_output_frame() currently - Use ifq_classic_ functions, if altq is not enabled - Fix various device drivers bugs in their if_start implementation - Add ktr for ifq classic enqueue and dequeue - Add ktr for ifnet.if_start
Remove bogus checks after kmalloc(M_WAITOK) which never returns NULL. Reviewed-by: hasso
Kill devinfo handling in drivers, set device description in one place - usbd_probe_and_attach() and let generic device code to output descriptions. Obtained-from: FreeBSD with modifications
Nuke usbdevs and references to it.
Kill usage of USB_VENDOR_FOO and USB_PRODUCT_BAR defines mostly using two methods: - USB_DEVICE(vendor_id, product_id) macro. - Using C99 structure initialisers. While at it, kill all custom "vendor and product id pair" structures and custom walkthrough methods for these structures.
Nuke USB_MATCH*, USB_ATTACH* and USB_DETACH* macros.
Nuke device_ptr_t, USBBASEDEVICE, USBDEVNAME(), USBDEVUNIT(), USBGETSOFTC(), USBDEVPTRNAME() and Static with help from sed(1).
Do a major clean-up of the BUSDMA architecture. A large number of essentially machine-independant drivers use the structures and definitions in machine-dependant directories that are really machine-independant in nature. Split <machine/bus_dma.h> into machine-depdendant and machine-independant parts and make the primary access run through <sys/bus_dma.h>. Remove <machine/bus.h>, <machine/bus_memio.h> and <machine/bus_pio.h>. The optimizations related to bus_memio.h and bus_pio.h made a huge mess, introduced machine-specific knowledge into essentially machine-independant drivers, and required specific #include file orderings to do their job. They may be reintroduced in some other form later on. Move <machine/resource.h> to <sys/bus_resource.h>. The contents of the file is machine-independant or can be made a superset across many platforms. Make <sys/bus.h> include <sys/bus_dma.h> and <sys/bus_resource.h> and include <sys/bus.h> where necessary. Remove all #include's of <machine/resource.h> and <machine/bus.h>. That is, make the BUSDMA infrastructure integral to I/O-mapped and memory-mapped accesses to devices and remove a large chunk of machine-specific dependancies from drivers. bus_if.h and device_if.h are now required to be present when using <sys/bus.h>.
Rename malloc->kmalloc, free->kfree, and realloc->krealloc. Pass 1
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.
Fix the design of ifq_dequeue/altq_dequeue by adding an mbuf pointer and requiring that a polled mbuf be passed as an argument to the dequeue function. Assert that the passed argument matches the mbuf that is actually dequeued. Also remove assignments of the return value from ifq_dequeue() in such cases which implied that the mbuf might be different when, in fact, it had better not be.
check pointer for NULL before calling free()
Remove unnecessary bzero(softc). With following exceptions: - ed(4) if_ed_cbus.c - snc(4) They are PC-98 only.
Add support for HP hn210e usb ethernet. Submitted-by: Sepherosa Ziehau <email@example.com> Obtained-from: FreeBSD
Deprecate MCLGET() in favor of m_getcl() or m_getl() in order to take advantage of cluster caching.
Use ether_crc32_le. Obtained-from: FreeBSD
No machine/clock.h needed.
No FreeBSD 5/6 support here.
if_printf / device_printf. Submitted-by: Sepherosa Ziehau <firstname.lastname@example.org>
Rearm receiver, it was lost in the conversion.
Remove some duplicate FreeBSD CVS IDs, move some IDs to better places. Submitted-by: Sarunas Vancevicius <email@example.com>
The old USB ethernet code utilized a netisr to hand packets over the ether_input and cleanup after txeof. This was broken some time ago and is a workaround for the different IPL of USB and the network stack. Reduce the amount of hacks by removing usb_tx_done, it can be done mostly in-place with a slight race-condition in the enqueue code. usb_ether_input now directly calls ether_input, the caller is responsible for rearming the receiver. That's doesn't open a race since the receiver doesn't have to handle the interface queues, for the driver state is the driver responsible. The IPL protection of the USB ethernet drivers has to be reviewed, it's mostly not existing.
Remove the 'ether' module dependancy, it is not defined anywhere and will prevent the loader from pre-loading the modules in question. Do not partially initialize the related struct sockaddr_in when a non-existant or "0.0.0.0" pxe related kenv is found. In particular, if the gateway is not specified by the DHCP server we avoid attempting to add a bad default route (which results in a panic) later on.
timeout/untimeout ==> callout_*
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
Announce MAC address in ether_ifattach, not in each NIC indepently. aue(4), axe(4), cue(4), kue(4), pcn(4): - Don't bcopy the MAC address, ether_ifattach does it. lnc(4): - sc->arpcom.ac_if ==> ifp in lnc_attach_common, more changes coming. awi(4): - Nuke local copy of ether_sprintf, use %6D directly. - Use if_printf instead of printf("%s: ...", sc->sc_dev.dv_xname, ...).
Change mbug allocation flags from M_ to MB_ to avoid confusion with malloc flags. Requested by: Jeffrey Hsu
General netif malloc() flags cleanup. Use M_INTWAIT or M_WAITOK instead of M_NOWAIT. Generally use M_WAITOK in the attach code or ioctl code typically called from userland, and M_INTWAIT for routines that might be called during non-boot operations. Since M*WAIT flags guarentee a non-NULL result, also remove now-unnecessary NULL checks.
Eliminate use of curthread in if_ioctl functions by passing down the ucred structure.
BPF has been in the kernel for ages and is supported by all NICs but I4B. This removes the second argument of ether_ifattach and ether_ifdetach as done by sam in FreeBSD's rev. 1.130 of net/if_ethersubr.c. Add an argument for the link layer address to ether_ifattach as done by is in NetBSD's rev 18.104.22.168 of the same file. Adjust if_ef.c based on FreeBSD's version of that file. Remove the now unused ETHER_BPF_[UN]SUPPORTED define from ethernet.h.
Fix gcc3 compilation
Bring in the entire FreeBSD-5 USB infrastructure. As of this commit my USB camera, Hard Drive, Mouse, and Sony memory key all work and I can even unplug and replug them in without crashing the port. Not all drivers and subsystems compile as of this commit, but the ones that do not are very close.
Add a DECLARE_DUMMY_MODULE() so we can get linker_set module names for modules that normally use DRIVER_MODULE(). The problem is that DRIVER_MODULE() will define names that do not match the module name, so a DECLARE_DUMMY_MODULE() is needed for the kernel to be able to figure out that a module has been statitically compiled in.
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.
Register keyword removal Approved by: Matt Dillon
Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most ids have been removed from !lint sections and moved into comment sections.
import from FreeBSD RELENG_4 22.214.171.124