Reapply, with minor tweaks, r338025, from the original commit:Remove unused and easy to misuse PNP macro parameterInspired by r338025, just remove the element size parameter to theMODULE_PNP_INF
Reapply, with minor tweaks, r338025, from the original commit:Remove unused and easy to misuse PNP macro parameterInspired by r338025, just remove the element size parameter to theMODULE_PNP_INFO macro entirely. The 'table' parameter is now required tohave correct pointer (or array) type. Since all invocations of the macroalready had this property and the emitted PNP data continues to include theelement size, there is no functional change.Mostly done with the coccinelle 'spatch' tool: $ cat modpnpsize0.cocci @normaltables@ identifier b,c; expression a,d,e; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,d, -sizeof(d[0]), e); @singletons@ identifier b,c,d; expression a; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,&d, -sizeof(d), 1); $ rg -l MODULE_PNP_INFO -- sys | \ xargs spatch --in-place --sp-file modpnpsize0.cocci(Note that coccinelle invokes diff(1) via a PATH search and expects diff totolerate the -B flag, which BSD diff does not. So I had to link gdiff intoPATH as diff to use spatch.)Tinderbox'd (-DMAKE_JUST_KERNELS).Approved by: re (glen)
show more ...
Back out r338035 until Warner is finished churning GSoC PNP patchesI was not aware Warner was making or planning to make forward progress inthis area and have since been informed of that.It's ea
Back out r338035 until Warner is finished churning GSoC PNP patchesI was not aware Warner was making or planning to make forward progress inthis area and have since been informed of that.It's easy to apply/reapply when churn dies down.
Remove unused and easy to misuse PNP macro parameterInspired by r338025, just remove the element size parameter to theMODULE_PNP_INFO macro entirely. The 'table' parameter is now required tohave
Remove unused and easy to misuse PNP macro parameterInspired by r338025, just remove the element size parameter to theMODULE_PNP_INFO macro entirely. The 'table' parameter is now required tohave correct pointer (or array) type. Since all invocations of the macroalready had this property and the emitted PNP data continues to include theelement size, there is no functional change.Mostly done with the coccinelle 'spatch' tool: $ cat modpnpsize0.cocci @normaltables@ identifier b,c; expression a,d,e; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,d, -sizeof(d[0]), e); @singletons@ identifier b,c,d; expression a; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,&d, -sizeof(d), 1); $ rg -l MODULE_PNP_INFO -- sys | \ xargs spatch --in-place --sp-file modpnpsize0.cocci(Note that coccinelle invokes diff(1) via a PATH search and expects diff totolerate the -B flag, which BSD diff does not. So I had to link gdiff intoPATH as diff to use spatch.)Tinderbox'd (-DMAKE_JUST_KERNELS).
Add PNP info to PCI attachments of age driverReviewed by: imp, chuckSubmitted by: Lakhan Shiva Kamireddy <[email protected]>Sponsored by: Google, Inc. (GSoC 2018)
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
sys/dev: further adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using misidentified many licenses so this was mostly a manual - error
sys/dev: further adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using misidentified many licenses so this was mostly a manual - errorprone - task.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.
Remove dead code.
sys/dev: extend use of the howmany() macro when available.We have a howmany() macro in the <sys/param.h> header that isconvenient to re-use as it makes things easier to read.
sys/dev: use our nitems() macro when it is avaliable through param.h.No functional change, only trivial cases are done in this sweep,Drivers that can get further enhancements will be done independ
sys/dev: use our nitems() macro when it is avaliable through param.h.No functional change, only trivial cases are done in this sweep,Drivers that can get further enhancements will be done independently.Discussed in: freebsd-current
Fix variable assignment.Found by: PVS-Studio
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.
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
Increase the number of TX DMA segments from 32 to 35. It turnedout 32 is not enough to support a full sized TSO packet.While I'm here fix a long standing bug introduced in r169632 inbce(4) where
Increase the number of TX DMA segments from 32 to 35. It turnedout 32 is not enough to support a full sized TSO packet.While I'm here fix a long standing bug introduced in r169632 inbce(4) where it didn't include L2 header length of TSO packet inthe maximum DMA segment size calculation.In collaboration with: rmacklemMFC 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.
Be sure to actually decrement the "count" parameter for each processeddescriptor so that we return when the threshold has been reached.Reviewed by: yongariMFC after: 1 week
Rework jumbo frame handling. QAC confirmed that the controllerrequires 8 bytes alignment on RX buffer. Given that non-jumboframe works on any alignments I guess this DMA limitation for RXbuffer
Rework jumbo frame handling. QAC confirmed that the controllerrequires 8 bytes alignment on RX buffer. Given that non-jumboframe works on any alignments I guess this DMA limitation for RXbuffer could be jumbo frame specific one. Also I'm not surewhether this DMA limitation is related with 64bit DMA. Previouslyage(4) disabled 64bit DMA addressing due to silent data corruption.So we may need more testing on re-enabling 64bit DMA in future.While I'm here, change mbuf chaining algorithm to use fixed sizedbuffer and force software checksum if controller reports lengtherror. According to QAC, RFD is not updated at all for jumbo frameso it works just like alc(4) controllers. This change also addedalignment fixup for strict alignment architectures. Because I'mnot aware of any non-x86 machines that use age(4) controllers it'sjust for completeness at this moment.Wit this change, jumbo frame should work with age(4).Tested by: Christian Gusenbauer < c47g <> gmx dot at >MFC after: 1 week
Mechanically substitute flags from historic mbuf allocator withmalloc(9) flags in sys/dev.
TSO engine of L1 requires a separate DMA descriptor for TCPpayload. This means driver has to split a TX buffer into twopieces of TX buffers when the TX buffer contains bothethernet/IP/TCP header
TSO engine of L1 requires a separate DMA descriptor for TCPpayload. This means driver has to split a TX buffer into twopieces of TX buffers when the TX buffer contains bothethernet/IP/TCP header and partial TCP payload. The controllerdoes not require all header should be in a TX buffer but driverforced it to compute IP/TCP header size/offset which is requiredparameter to configure DMA descriptor for TSO.While here, slightly reorder DMA descriptor setup to enhancereadability and remove unnecessary code for TSO(upper stack neverrequests TSO when the frame length is less than or equal to MTU).Reported by: Yamagi Burmeister <lists <> yamagi dot org>Tested by: Yamagi Burmeister <lists <> yamagi dot org>MFC After: 1 week
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 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@
Partially revert r184106. RX buffer ring also needs bus_dmamap_sync().Tested by: Yamagi Burmeister (lists <> yamagi dot org)MFC after: 1 week
64bit DMA caused data corruption. Unfortunately there is no knownworkaround to use 64bit DMA.Disable 64bit DMA on Attansic L1 controller.Tested by: Yamagi Burmeister (lists <> yamagi dot org)MFC
64bit DMA caused data corruption. Unfortunately there is no knownworkaround to use 64bit DMA.Disable 64bit DMA on Attansic L1 controller.Tested by: Yamagi Burmeister (lists <> yamagi dot org)MFC after: 1 week
Do a sweep of the tree replacing calls to pci_find_extcap() with calls topci_find_cap() instead.
Forgot to remove unlock of the driver lock from age_start_locked() whenconverting it to a locked variant.PR: kern/153948
12