aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/vge
Commit message (Collapse)AuthorAgeFilesLines
* dev: Use recently added improvements to PME# support to simplify driversJohn Baldwin2025-03-272-22/+2
| | | | | | | | | | Depend on the PCI bus driver clearing PME# after resume to remove the need for clearing PME# from DEVICE_RESUME methods. Use pci_has_pm and pci_enable_pme. Reviewed by: Krzysztof Galazka <krzysztof.galazka@intel.com> Differential Revision: https://reviews.freebsd.org/D49251
* Remove now-redundant calls to device_delete_childJohn Baldwin2025-01-021-2/+0
| | | | | | | | Deleting a child explicitly before calling bus_generic_detach is now redundant, so remove those calls and rely on bus_generic_detach to delete children instead. Differential Revision: https://reviews.freebsd.org/D47961
* net: Remove unneeded NULL check for the allocated ifnetZhenlei Huang2024-06-281-6/+0
| | | | | | | | | | | Change 4787572d0580 made if_alloc_domain() never fail, then also do the wrappers if_alloc(), if_alloc_dev(), and if_gethandle(). No functional change intended. Reviewed by: kp, imp, glebius, stevek MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D45740
* vge(4): Fix a typo in a source code commentGordon Bergling2024-02-271-1/+1
| | | | | | - s/opration/operation/ MFC after: 3 days
* vge(4): Fix a typo in a source code commentGordon Bergling2024-02-221-1/+1
| | | | | | - s/embadded/embedded/ MFC after: 3 days
* vge: correct pause_frames sysctl descriptionPriit Trees2023-09-241-1/+1
| | | | | Reviewed by: emaste Pull Request: https://github.com/freebsd/freebsd-src/pull/806
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-162-4/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* Mechanically convert if_vge(4) to IfAPIJustin Hibbits2023-02-062-117/+116
| | | | | Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D37801
* vge: Remove unused devclass argument to DRIVER_MODULE.John Baldwin2022-05-061-3/+1
|
* Remove unused miibus_devclass and miibus_fdt_devclass.John Baldwin2022-05-061-1/+1
|
* vge: clean up empty lines in .c and .h filesMateusz Guzik2020-09-013-4/+0
| | | | Notes: svn path=/head/; revision=365141
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-261-6/+6
| | | | | | | | | | | | | | | | | | | r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718 Notes: svn path=/head/; revision=358333
* Convert to if_foreach_llmaddr() KPI.Gleb Smirnoff2019-10-211-25/+33
| | | | Notes: svn path=/head/; revision=353831
* ifnet: Replace if_addr_lock rwlock with epoch + mutexMatt Macy2018-05-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Run on LLNW canaries and tested by pho@ gallatin: Using a 14-core, 28-HTT single socket E5-2697 v3 with a 40GbE MLX5 based ConnectX 4-LX NIC, I see an almost 12% improvement in received packet rate, and a larger improvement in bytes delivered all the way to 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 GBfree 4.98 0.00 4.42 0.00 4235592 33 83.80 4720653 2149771 1235 247.32 4.73 0.00 4.20 0.00 4025260 33 82.99 4724900 2139833 1204 247.32 4.72 0.00 4.20 0.00 4035252 33 82.14 4719162 2132023 1264 247.32 4.71 0.00 4.21 0.00 4073206 33 83.68 4744973 2123317 1347 247.32 4.72 0.00 4.21 0.00 4061118 33 80.82 4713615 2188091 1490 247.32 4.72 0.00 4.21 0.00 4051675 33 85.29 4727399 2109011 1205 247.32 4.73 0.00 4.21 0.00 4039056 33 84.65 4724735 2102603 1053 247.32 After the patch InMpps OMpps InGbs OGbs err TCP Est %CPU syscalls csw irq GBfree 5.43 0.00 4.20 0.00 3313143 33 84.96 5434214 1900162 2656 245.51 5.43 0.00 4.20 0.00 3308527 33 85.24 5439695 1809382 2521 245.51 5.42 0.00 4.19 0.00 3316778 33 87.54 5416028 1805835 2256 245.51 5.42 0.00 4.19 0.00 3317673 33 90.44 5426044 1763056 2332 245.51 5.42 0.00 4.19 0.00 3314839 33 88.11 5435732 1792218 2499 245.52 5.44 0.00 4.19 0.00 3293228 33 91.84 5426301 1668597 2121 245.52 Similarly, netperf reports 230Mb/s before the patch, and 270Mb/s after the patch Reviewed by: gallatin Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D15366 Notes: svn path=/head/; revision=333813
* spdx: initial adoption of licensing ID tags.Pedro F. Giffuni2017-11-183-0/+6
| | | | | | | | | | | | | | | | | | | | The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that 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 of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Initially, only tag files that use BSD 4-Clause "Original" license. RelNotes: yes Differential Revision: https://reviews.freebsd.org/D13133 Notes: svn path=/head/; revision=325966
* Mechanically convert to if_inc_counter().Gleb Smirnoff2014-09-181-13/+14
| | | | Notes: svn path=/head/; revision=271815
* Use define from if_var.h to access a field inside struct if_data,Gleb Smirnoff2014-08-301-1/+1
| | | | | | | | | that resides in struct ifnet. Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=270856
* Fix various NIC drivers to properly cleanup static DMA resources.John Baldwin2014-06-111-8/+6
| | | | | | | | | | | | | | | | | | In particular, don't check the value of the bus_dma map against NULL to determine if either bus_dmamem_alloc() or bus_dmamap_load() succeeded. Instead, assume that bus_dmamap_load() succeeeded (and thus that bus_dmamap_unload() should be called) if the bus address for a resource is non-zero, and assume that bus_dmamem_alloc() succeeded (and thus that bus_dmamem_free() should be called) if the virtual address for a resource is not NULL. In many cases these bugs could result in leaks when a driver was detached. Reviewed by: yongari MFC after: 2 weeks Notes: svn path=/head/; revision=267363
* The r48589 promised to remove implicit inclusion of if_var.h soon. PrepareGleb Smirnoff2013-10-261-0/+1
| | | | | | | | | | | to this event, adding if_var.h to files that do need it. Also, include all includes that now are included due to implicit pollution via if_var.h Sponsored by: Netflix Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=257176
* Mechanically substitute flags from historic mbuf allocator withGleb Smirnoff2012-12-041-4/+4
| | | | | | | malloc(9) flags in sys/dev. Notes: svn path=/head/; revision=243857
* Remove unused variable miiKevin Lo2012-02-111-2/+0
| | | | Notes: svn path=/head/; revision=231510
* - There's no need to overwrite the default device method with the defaultMarius Strobl2011-11-221-5/+1
| | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=227843
* Announce flow control capability to underlying PHY driver.Pyun YongHyeon2011-11-221-4/+11
| | | | | | | | | Pause timer value is initialized to 0xFFFF. Controller allows just 4 different TX pause thresholds. The lowest possible threshold value looks too aggressive so use next available threshold value. Notes: svn path=/head/; revision=227837
* Rework link establishment and link state detection logic.Pyun YongHyeon2011-11-221-18/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Remove MIIBUS statchg callback and program VGE_DIAGCTL before initiating link establishment. Previously driver used to program VGE_DIAGCTL after getting a link in statchg callback. It seems the VGE_DIAGCTL register works like a kind of MII register such that it requires setting a 'to be' mode in advance rather than relying on resolved speed/duplex of established link. This means the statchg callback is not needed in driver. In addition, if there was no link at the time of media change, this was not called at all. - Introduce vge_ifmedia_upd_locked() to change current media to configured one. Actual media change is performed only after PHY reset and VGE_DIAGCTL setup. - In WOL configuration, make sure to clear forced mode such that controller can rely on auto-negotiation. - Unlike most other drivers that use miibus(4), vge(4) used controller's auto-polling feature for link state tracking via interrupt. This came from controller's inefficient mechanism to access MII registers. On link state change interrupt, vge(4) used to get current link state with series of MII register accesses. Because vge(4) already enabled auto polling, read PHY status register to resolved speed/duplex/flow control parameters. vge(4) still does not drive MII_TICK to reduce number of MII register accesses which in turn means the driver does not know the status of auto-negotiation. This was a one of long standing issue of vge(4). Probably driver may be able to implement a timer that keeps track of auto-negotiation state and restart auto-negotiation when driver couldn't establish a link within a specified period. However the controller does not provide a reliable way to detect auto-negotiation failure so I'm not sure whether it's worth to implement it in driver. Alternatively driver can completely disable MII auto-polling and let miibus(4) poll link state by driving MII_TICK. This may reduce unnecessary overhead of stopping/restarting MII auto-polling of controller. Unfortunately it was known that some variants of controller does not work correctly if MII auto-polling is disabled. Notes: svn path=/head/; revision=227835
* Always start MII auto polling before accessing any MII registers.Pyun YongHyeon2011-11-221-0/+2
| | | | Notes: svn path=/head/; revision=227828
* Close a race where SIOCGIFMEDIA ioctl get inconsistent link status.Pyun YongHyeon2011-10-171-1/+1
| | | | | | | | | | | Because driver is accessing a common MII structure in mii_pollstat(), updating user supplied structure should be done before dropping a driver lock. Reported by: Karim (fodillemlinkarimi <> gmail dot com) Notes: svn path=/head/; revision=226478
* vge(4) hardwares poll media status and generates an interruptPyun YongHyeon2011-09-072-7/+13
| | | | | | | | | | | | | | | | | | | | | | whenever the link state is changed. Using software based polling for media status tracking is known to cause MII access failure under certain conditions once link is established so vge(4) used to rely on link status change interrupt. However DEVICE_POLLING completely disables generation of all kind of interrupts on vge(4) such that this resulted in not detecting link state change event. This means vge(4) does not correctly detect established/lost link with DEVICE_POLLING. Losing the interrupt made vge(4) not to send any packets to peer since vge(4) does not try to send any packets when there is no established link. Work around the issue by generating link state change interrupt with DEVICE_POLLING. PR: kern/160442 Approved by: re (kib) Notes: svn path=/head/; revision=225440
* Datasheet says vge(4) controllers support DAC but it seems that'sPyun YongHyeon2011-05-201-2/+17
| | | | | | | | | | | | | | | not true on old PCI based controllers. DAC configuration is read from EEPROM in device reset phase and driver can override DAC configuration. However I guess there is an undocumented reason why EEPROM configuration does not enable DAC so do not blindly override DAC configuration. Recent PCIe based controllers are supposed to support 64bit DMA so allow 64bit DMA only on PCIe based controllers. PR: kern/157184 MFC after: 1 week Notes: svn path=/head/; revision=222142
* Do a sweep of the tree replacing calls to pci_find_extcap() with calls toJohn Baldwin2011-03-231-2/+2
| | | | | | | pci_find_cap() instead. Notes: svn path=/head/; revision=219902
* Convert the PHY drivers to honor the mii_flags passed down and convertMarius Strobl2010-10-151-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | the NIC drivers as well as the PHY drivers to take advantage of the mii_attach() introduced in r213878 to get rid of certain hacks. For the most part these were: - Artificially limiting miibus_{read,write}reg methods to certain PHY addresses; we now let mii_attach() only probe the PHY at the desired address(es) instead. - PHY drivers setting MIIF_* flags based on the NIC driver they hang off from, partly even based on grabbing and using the softc of the parent; we now pass these flags down from the NIC to the PHY drivers via mii_attach(). This got us rid of all such hacks except those of brgphy() in combination with bce(4) and bge(4), which is way beyond what can be expressed with simple flags. While at it, I took the opportunity to change the NIC drivers to pass up the error returned by mii_attach() (previously by mii_phy_probe()) and unify the error message used in this case where and as appropriate as mii_attach() actually can fail for a number of reasons, not just because of no PHY(s) being present at the expected address(es). Reviewed by: jhb, yongari Notes: svn path=/head/; revision=213893
* Remove wrong assertion.Pyun YongHyeon2009-12-251-2/+0
| | | | Notes: svn path=/head/; revision=200972
* Disable jumbo frame support for PCIe VT6130/VT6132 controllers.Pyun YongHyeon2009-12-202-3/+13
| | | | | | | | | | | | | | Quite contrary to VT6130 datasheet which says it supports up to 8K jumbo frame, VT6130 does not seem to send jumbo frame that is larger than 4K in length. Trying to send a frame that is larger than 4K cause TX MAC hang. Even though it's possible to allow 4K jumbo frame for VT6130, I think it's meaningless to allow 4K jumbo frame. I'm not sure VT6132 also has the same limitation but I guess it uses the same MAC of VT6130. Notes: svn path=/head/; revision=200759
* VT6130 datasheet was wrong. If VT6130 receive a jumbo frame thePyun YongHyeon2009-12-201-1/+1
| | | | | | | | | | | | controller will split the jumbo frame into multiple RX buffers. However it seems the hardware always dma the frame to 8 bytes boundary for the split frames. Only the first part of the fragment can have 4 byte alignment and subsequent buffers should be 8 bytes aligned. Change RX buffer the alignment requirement to 8 bytes from 4 bytes. Notes: svn path=/head/; revision=200758
* Correct fragment bit definition in comments.Pyun YongHyeon2009-12-201-2/+2
| | | | Notes: svn path=/head/; revision=200756
* Swap VGE_TXQTIMER and VGE_RXQTIMER register definition. PendingPyun YongHyeon2009-12-191-2/+2
| | | | | | | timer for Tx queue is at 0x3E. Notes: svn path=/head/; revision=200740
* Add rudimentary WOL support. While I'm here remove enablingPyun YongHyeon2009-12-183-17/+227
| | | | | | | | busmastering/memory address in resume path. Bus driver will handle that. Notes: svn path=/head/; revision=200696
* Remove unused member variable of softc.Pyun YongHyeon2009-12-171-1/+0
| | | | Notes: svn path=/head/; revision=200644
* Actually clear interrupts. Writing 0 has no effect.Pyun YongHyeon2009-12-171-1/+1
| | | | Notes: svn path=/head/; revision=200639
* Implement interrupt moderation scheme supported by VT61xxPyun YongHyeon2009-12-173-80/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | controllers. TX/RX interrupt mitigation is controlled by VGE_TXSUPPTHR and VGE_RXSUPPTHR register. These registers suppress generation of interrupts until the programmed frames counter equals to the registers. VT61xx also supports interrupt hold off timer register. If this interrupt hold off timer is active all interrupts would be disabled until the timer reaches to 0. The timer value is reloaded whenever VGE_ISR register written. The timer resolution is about 20us. Previously vge(4) used single shot timer to reduce Tx completion interrupts. This required VGE_CRS1 register access in Tx start/completion handler to rearm new timeout value and it did not show satisfactory result(more than 50k interrupts under load). Rx interrupts was not moderated at all such that vge(4) used to generate too many interrupts which in turn made polling(4) better approach under high network load. This change activates all interrupt moderation mechanism and initial values were tuned to generate interrupt less than 8k per second. That number of interrupts wouldn't add additional packet latencies compared to polling(4). These interrupt parameters could be changed with sysctl. dev.vge.%d.int_holdoff dev.vge.%d.rx_coal_pkt dev.vge.%d.tx_coal_pkt Interface has be brought down and up again before change take effect. With interrupt moderation there is no more need to loop in interrupt handler. This loop always added one more register access. While I'm here remove dead code which tried to implement subset of interrupt moderation. Notes: svn path=/head/; revision=200638
* Remove unused VGE_ETHER_ALIGN definition.Pyun YongHyeon2009-12-171-6/+0
| | | | Notes: svn path=/head/; revision=200635
* Add "Velocity" to probe message which will make it clearer whichPyun YongHyeon2009-12-161-1/+1
| | | | | | | | | | ethernet controller was recognized. VIA consistently calls "Velocity" family for gigabit ethernet controllers. For fast ethernet controllers they uses "Rhine" family(vr(4) controllers)) and vr(4) already shows "Rhine" in probe message. Notes: svn path=/head/; revision=200617
* Add new flag VGE_FLAG_SUSPENDED to mark suspended state andPyun YongHyeon2009-12-162-11/+6
| | | | | | | remove suspended member in softc. Notes: svn path=/head/; revision=200616
* Add hardware MAC statistics support. This statistics could bePyun YongHyeon2009-12-163-3/+322
| | | | | | | extracted from dev.vge.%d.stats sysctl node. Notes: svn path=/head/; revision=200615
* Rewrite RX filter setup and simplify code.Pyun YongHyeon2009-12-161-57/+44
| | | | | | | | Now promiscuous mode and multicast handling is performed in single function, vge_rxfilter(). Notes: svn path=/head/; revision=200613
* All vge(4) controllers support RX/TX checksum offloading for VLANPyun YongHyeon2009-12-161-6/+33
| | | | | | | | | tagged frames so add checksum offloading capabilities. Also add missing VLAN hardware tagging control in ioctl handler and let upper stack know current VLAN capabilities. Notes: svn path=/head/; revision=200609
* Tell upper layer vge(4) supports long frames. This should be donePyun YongHyeon2009-12-141-1/+3
| | | | | | | | | | after ether_ifattach(), as ether_ifattach() initializes it with ETHER_HDR_LEN. While I'm here remove setting if_mtu, it's already handled in ether_ifattach(). Notes: svn path=/head/; revision=200558
* Don't report current link status if interface is not UP.Pyun YongHyeon2009-12-141-0/+4
| | | | | | | | If interface is not UP, the current link status wouldn't reflect the negotiated status. Notes: svn path=/head/; revision=200555
* Report media change result to caller instead of returning successPyun YongHyeon2009-12-141-2/+3
| | | | | | | without regard to the result. Notes: svn path=/head/; revision=200552
* Whenever link state change interrupt is raised, vge_tick() isPyun YongHyeon2009-12-141-4/+4
| | | | | | | | | | | | | called and vge(4) used to drive auto-negotiation timer(mii_tick) in vge_tick(). Therefore the mii_tick was not called for every hz such that auto-negotiation complete was never handled in vge(4). Use mii_pollstat to extract current negotiated speed/duplex instead of mii_tick. The latter is valid only for auto-negotiation case. While I'm here change the confusing function name vge_tick() to vge_link_statchg(). Notes: svn path=/head/; revision=200551