Convert to if_foreach_llmaddr() KPI.
ifnet: Replace if_addr_lock rwlock with epoch + mutexRun on LLNW canaries and tested by pho@gallatin:Using a 14-core, 28-HTT single socket E5-2697 v3 with a 40GbE MLX5based ConnectX 4-LX NIC, I
ifnet: Replace if_addr_lock rwlock with epoch + mutexRun on LLNW canaries and tested by pho@gallatin:Using a 14-core, 28-HTT single socket E5-2697 v3 with a 40GbE MLX5based ConnectX 4-LX NIC, I see an almost 12% improvement in receivedpacket rate, and a larger improvement in bytes delivered all the wayto userspace.When the host receiving 64 streams of netperf -H $DUT -t UDP_STREAM -- -m 1,I see, using nstat -I mce0 1 before the patch:InMpps OMpps InGbs OGbs err TCP Est %CPU syscalls csw irq GBfree4.98 0.00 4.42 0.00 4235592 33 83.80 4720653 2149771 1235 247.324.73 0.00 4.20 0.00 4025260 33 82.99 4724900 2139833 1204 247.324.72 0.00 4.20 0.00 4035252 33 82.14 4719162 2132023 1264 247.324.71 0.00 4.21 0.00 4073206 33 83.68 4744973 2123317 1347 247.324.72 0.00 4.21 0.00 4061118 33 80.82 4713615 2188091 1490 247.324.72 0.00 4.21 0.00 4051675 33 85.29 4727399 2109011 1205 247.324.73 0.00 4.21 0.00 4039056 33 84.65 4724735 2102603 1053 247.32After the patchInMpps OMpps InGbs OGbs err TCP Est %CPU syscalls csw irq GBfree5.43 0.00 4.20 0.00 3313143 33 84.96 5434214 1900162 2656 245.515.43 0.00 4.20 0.00 3308527 33 85.24 5439695 1809382 2521 245.515.42 0.00 4.19 0.00 3316778 33 87.54 5416028 1805835 2256 245.515.42 0.00 4.19 0.00 3317673 33 90.44 5426044 1763056 2332 245.515.42 0.00 4.19 0.00 3314839 33 88.11 5435732 1792218 2499 245.525.44 0.00 4.19 0.00 3293228 33 91.84 5426301 1668597 2121 245.52Similarly, netperf reports 230Mb/s before the patch, and 270Mb/s after the patchReviewed by: gallatinSponsored by: Limelight NetworksDifferential Revision: https://reviews.freebsd.org/D15366
show more ...
spdx: initial adoption of licensing ID tags.The Software Package Data Exchange (SPDX) group provides a specificationto make it easier for automated tools to detect and summarize well knownopensou
spdx: initial adoption of licensing ID tags.The Software Package Data Exchange (SPDX) group provides a specificationto make it easier for automated tools to detect and summarize well knownopensource licenses. We are gradually adopting the specification, notingthat the tags are considered only advisory and do not, in any way,superceed or replace the license texts.Special thanks to Wind River for providing access to "The Duke ofHighlander" tool: an older (2014) run over FreeBSD tree was useful as astarting point.Initially, only tag files that use BSD 4-Clause "Original" license.RelNotes: yesDifferential Revision: https://reviews.freebsd.org/D13133
Enable receive filter in sis_rxfilter().While I'm here add a check for driver running state for multicastfilter handling.Suggested by: [email protected]
Fix a bug introdiced in r217548. According to NS DP83815 datasheet, RX filter should be disabled before programming.Previously it was clearing wrong bits so RX filter was notdisabled in RX filter
Fix a bug introdiced in r217548. According to NS DP83815 datasheet, RX filter should be disabled before programming.Previously it was clearing wrong bits so RX filter was notdisabled in RX filter configuration.Reported by: [email protected]
Mechanically convert to if_inc_counter().
Use define from if_var.h to access a field inside struct if_data,that resides in struct ifnet.Sponsored by: Nginx, Inc.
Pull in r267961 and r267973 again. Fix for issues reported will follow.
Revert r267961, r267973:These changes prevent sysctl(8) from returning proper output,such as: 1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1
Revert r267961, r267973:These changes prevent sysctl(8) from returning proper output,such as: 1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1) truss: can not get etype: Cannot allocate memory
Extend the meaning of the CTLFLAG_TUN flag to automatically check ifthere is an environment variable which shall initialize the SYSCTLduring early boot. This works for all SYSCTL types both statica
Extend the meaning of the CTLFLAG_TUN flag to automatically check ifthere is an environment variable which shall initialize the SYSCTLduring early boot. This works for all SYSCTL types both statically anddynamically created ones, except for the SYSCTL NODE type and SYSCTLswhich belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added tobe used in the case a tunable sysctl has a custom initialisationfunction allowing the sysctl to still be marked as a tunable. Thekernel SYSCTL API is mostly the same, with a few exceptions for somespecial operations like iterating childrens of a static/extern SYSCTLnode. This operation should probably be made into a factored outcommon macro, hence some device drivers use this. The reason forchanging the SYSCTL API was the need for a SYSCTL parent OID pointerand not only the SYSCTL parent OID list pointer in order to quicklygenerate the sysctl path. The motivation behind this patch is to avoidparameter loading cludges inside the OFED driver subsystem. Instead ofadding special code to the OFED driver subsystem to post-load tunablesinto dynamically created sysctls, we generalize this in the kernel.Other changes:- Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask"to "hw.pcic.intr_mask".- Removed redundant TUNABLE statements throughout the kernel.- Some minor code rewrites in connection to removing not neededTUNABLE statements.- Added a missing SYSCTL_DECL().- Wrapped two very long lines.- Avoid malloc()/free() inside sysctl string handling, in case it iscalled to initialize a sysctl from a tunable, hence malloc()/free() isnot ready when sysctls from the sysctl dataset are registered.- Bumped FreeBSD version to indicate SYSCTL API change.MFC after: 2 weeksSponsored by: Mellanox Technologies
Fix various NIC drivers to properly cleanup static DMA resources.In particular, don't check the value of the bus_dma map against NULLto determine if either bus_dmamem_alloc() or bus_dmamap_load() s
Fix various NIC drivers to properly cleanup static DMA resources.In particular, don't check the value of the bus_dma map against NULLto determine if either bus_dmamem_alloc() or bus_dmamap_load() succeeded.Instead, assume that bus_dmamap_load() succeeeded (and thus thatbus_dmamap_unload() should be called) if the bus address for a resourceis non-zero, and assume that bus_dmamem_alloc() succeeded (and thusthat bus_dmamem_free() should be called) if the virtual address for aresource is not NULL.In many cases these bugs could result in leaks when a driver was detached.Reviewed by: yongariMFC after: 2 weeks
Remove some unused variables.Found with: Clang Static AnalyzerMFC after: 2 weeks
The r48589 promised to remove implicit inclusion of if_var.h soon. Prepareto this event, adding if_var.h to files that do need it. Also, includeall includes that now are included due to implicit po
The r48589 promised to remove implicit inclusion of if_var.h soon. Prepareto this event, adding if_var.h to files that do need it. Also, includeall includes that now are included due to implicit pollution via if_var.hSponsored by: NetflixSponsored by: Nginx, Inc.
r119712 introduced SIS_TYPE_83816 but it was not actually set indriver such that checking against the type was always false.To detect NS DP83816, driver should have checked silicon revisionregiste
r119712 introduced SIS_TYPE_83816 but it was not actually set indriver such that checking against the type was always false.To detect NS DP83816, driver should have checked silicon revisionregister for NS controllers. While here, remove SIS_TYPE_83816 tonot make the similar mistake again.Reported by: Brad Smith ( brad@openbsd )
Mechanically substitute flags from historic mbuf allocator withmalloc(9) flags in sys/dev.
Remove duplicate const specifiers in many drivers (I hope I got all ofthem, please let me know if not). Most of these are of the form:static const struct bzzt_type { [...list of members...]} co
Remove duplicate const specifiers in many drivers (I hope I got all ofthem, please let me know if not). Most of these are of the form:static const struct bzzt_type { [...list of members...]} const bzzt_devs[] = { [...list of initializers...]};The second const is unnecessary, as arrays cannot be modified anyway,and if the elements are const, the whole thing is const automatically(e.g. it is placed in .rodata).I have verified this does not change the binary output of a full kernelbuild (except for build timestamps embedded in the object files).Reviewed by: yongari, mariusMFC after: 1 week
ether_ifattach() sets if_mtu to ETHERMTU, don't bother set it againReviewed by: yongari
- There's no need to overwrite the default device method with the default one. Interestingly, these are actually the default for quite some time (bus_generic_driver_added(9) since r52045 and bus_
- There's no need to overwrite the default device method with the default one. Interestingly, these are actually the default for quite some time (bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9) since r52045) but even recently added device drivers do this unnecessarily. Discussed with: jhb, marcel- While at it, use DEVMETHOD_END. Discussed with: jhb- Also while at it, use __FBSDID.
- Import the common MII bitbang'ing code from NetBSD and convert drivers to take advantage of it instead of duplicating it. This reduces the size of the i386 GENERIC kernel by about 4k. The only
- Import the common MII bitbang'ing code from NetBSD and convert drivers to take advantage of it instead of duplicating it. This reduces the size of the i386 GENERIC kernel by about 4k. The only potential in-tree user left unconverted is xe(4), which generally should be changed to use miibus(4) instead of implementing PHY handling on its own, as otherwise it makes not much sense to add a dependency on miibus(4)/mii_bitbang(4) to xe(4) just for the MII bitbang'ing code. The common MII bitbang'ing code also is useful in the embedded space for using GPIO pins to implement MII access.- Based on lessons learnt with dc(4) (see r185750), add bus barriers to the MII bitbang read and write functions of the other drivers converted in order to ensure the intended ordering. Given that register access via an index register as well as register bank/window switching is subject to the same problem, also add bus barriers to the respective functions of smc(4), tl(4) and xl(4).- Sprinkle some const.Thanks to the following testers:Andrew Bliznak (nge(4)), nwhitehorn@ (bm(4)), yongari@ (sis(4) and ste(4))Thanks to Hans-Joerg Sirtl for supplying hardware to test stge(4).Reviewed by: yongari (subset of drivers)Obtained from: NetBSD (partially)
Close a race where SIOCGIFMEDIA ioctl get inconsistent link status.Because driver is accessing a common MII structure inmii_pollstat(), updating user supplied structure should be donebefore droppi
Close a race where SIOCGIFMEDIA ioctl get inconsistent link status.Because driver is accessing a common MII structure inmii_pollstat(), updating user supplied structure should be donebefore dropping a driver lock.Reported by: Karim (fodillemlinkarimi <> gmail dot com)
Remove duplicate header includes
- Remove attempts to implement setting of BMCR_LOOP/MIIF_NOLOOP (reporting IFM_LOOP based on BMCR_LOOP is left in place though as it might provide useful for debugging). For most mii(4) drivers i
- Remove attempts to implement setting of BMCR_LOOP/MIIF_NOLOOP (reporting IFM_LOOP based on BMCR_LOOP is left in place though as it might provide useful for debugging). For most mii(4) drivers it was unclear whether the PHYs driven by them actually support loopback or not. Moreover, typically loopback mode also needs to be activated on the MAC, which none of the Ethernet drivers using mii(4) implements. Given that loopback media has no real use (and obviously hardly had a chance to actually work) besides for driver development (which just loopback mode should be sufficient for though, i.e one doesn't necessary need support for loopback media) support for it is just dropped as both NetBSD and OpenBSD already did quite some time ago.- Let mii_phy_add_media() also announce the support of IFM_NONE.- Restructure the PHY entry points to use a structure of entry points instead of discrete function pointers, and extend this to include a "reset" entry point. Make sure any PHY-specific reset routine is always used, and provide one for lxtphy(4) which disables MII interrupts (as is done for a few other PHYs we have drivers for). This includes changing NIC drivers which previously just called the generic mii_phy_reset() to now actually call the PHY-specific reset routine, which might be crucial in some cases. While at it, the redundant checks in these NIC drivers for mii->mii_instance not being zero before calling the reset routines were removed because as soon as one PHY driver attaches mii->mii_instance is incremented and we hardly can end up in their media change callbacks etc if no PHY driver has attached as mii_attach() would have failed in that case and not attach a miibus(4) instance. Consequently, NIC drivers now no longer should call mii_phy_reset() directly, so it was removed from EXPORT_SYMS.- Add a mii_phy_dev_attach() as a companion helper to mii_phy_dev_probe(). The purpose of that function is to perform the common steps to attach a PHY driver instance and to hook it up to the miibus(4) instance and to optionally also handle the probing, addition and initialization of the supported media. So all a PHY driver without any special requirements has to do in its bus attach method is to call mii_phy_dev_attach() along with PHY-specific MIIF_* flags, a pointer to its PHY functions and the add_media set to one. All PHY drivers were updated to take advantage of mii_phy_dev_attach() as appropriate. Along with these changes the capability mask was added to the mii_softc structure so PHY drivers taking advantage of mii_phy_dev_attach() but still handling media on their own do not need to fiddle with the MII attach arguments anyway.- Keep track of the PHY offset in the mii_softc structure. This is done for compatibility with NetBSD/OpenBSD.- Keep track of the PHY's OUI, model and revision in the mii_softc structure. Several PHY drivers require this information also after attaching and previously had to wrap their own softc around mii_softc. NetBSD/OpenBSD also keep track of the model and revision on their mii_softc structure. All PHY drivers were updated to take advantage as appropriate.- Convert the mebers of the MII data structure to unsigned where appropriate. This is partly inspired by NetBSD/OpenBSD.- According to IEEE 802.3-2002 the bits actually have to be reversed when mapping an OUI to the MII ID registers. All PHY drivers and miidevs where changed as necessary. Actually this now again allows to largely share miidevs with NetBSD, which fixed this problem already 9 years ago. Consequently miidevs was synced as far as possible.- Add MIIF_NOMANPAUSE and mii_phy_flowstatus() calls to drivers that weren't explicitly converted to support flow control before. It's unclear whether flow control actually works with these but typically it should and their net behavior should be more correct with these changes in place than without if the MAC driver sets MIIF_DOPAUSE.Obtained from: NetBSD (partially)Reviewed by: yongari (earlier version), silence on arch@ and net@
Do a sweep of the tree replacing calls to pci_find_extcap() with calls topci_find_cap() instead.
Make sure changing ownership of RX descriptor to be done as lastoperation. Previously ownership was transferred to hardware beforesetting address of new RX buffer such that it was possible forhar
Make sure changing ownership of RX descriptor to be done as lastoperation. Previously ownership was transferred to hardware beforesetting address of new RX buffer such that it was possible forhardware to use wrong RX buffer address.While here keep compiler from re-ordering instructions by declaringdescriptor members volatile. Memory barriers would do the same jobbut volatile is supposed to be cheaper than using memory barriers,especially on MP systems.Submitted by: mariusMFC after: 1 week
Rework RX filter programming by providing separate handler forDP8381[56] and SiS 900/7016 controllers. After r212119, sis(4) nolonger reinitializes controller if ALLMULTI/PROMISC was changed.Howe
Rework RX filter programming by providing separate handler forDP8381[56] and SiS 900/7016 controllers. After r212119, sis(4) nolonger reinitializes controller if ALLMULTI/PROMISC was changed.However, RX filter handling code assumed some bits of the RX filteris programmed by driver initialization. This caused ALLMULTI/PROMISCconfiguration is ignored under certain conditions.Fix that issue by reprogramming all bits of RX filter register.While I'm here follow recommended RX filter programming stepsrecommended by National DP8381[56] data sheet(RX filter should beis disabled before programming).Reported by: Paul Schenkeveld < freebsd () psconsult dot nl >Tested by: Paul Schenkeveld < freebsd () psconsult dot nl >MFC after: 3 days
123