aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/jme
Commit message (Collapse)AuthorAgeFilesLines
* jme: Convert driver to CTLFLAG_MPSAFEAbdelkader Boudih2026-01-121-5/+5
| | | | | | | | | | | | | | | | | Replace CTLFLAG_NEEDGIANT with CTLFLAG_MPSAFE for all interrupt coalescing sysctls. The driver uses jme_mtx mutex for proper synchronization and does not require Giant lock. Sysctls converted: - dev.jme.X.tx_coal_to (TX coalescing timeout) - dev.jme.X.tx_coal_pkt (TX coalescing packet count) - dev.jme.X.rx_coal_to (RX coalescing timeout) - dev.jme.X.rx_coal_pkt (RX coalescing packet count) - dev.jme.X.process_limit (max RX events to process) Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D54618
* dev: Use recently added improvements to PME# support to simplify driversJohn Baldwin2025-03-272-22/+5
| | | | | | | | | | 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-4/+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
* jme(4): Stop checking for failures from taskqueue_create_fast(M_WAITOK)Zhenlei Huang2024-09-031-6/+0
| | | | | MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45853
* 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
* sys: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-1/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* 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/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-123-3/+3
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* Mechanically convert jme(4) to IfAPIJustin Hibbits2023-02-062-120/+119
| | | | | Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D37839
* jme(4): Fix a typo in a source code commentGordon Bergling2022-07-031-1/+1
| | | | | | - s/fuctions/functions/ MFC after: 3 days
* jme: 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
|
* jme(4): Fix a typo in a source code commentGordon Bergling2022-04-021-1/+1
| | | | | | - s/verion/version/ MFC after: 3 days
* jme(4): Fix a typo in a source code commentGordon Bergling2022-04-021-1/+1
| | | | | | - s/watchog/watchdog MFC after: 3 days
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-261-16/+16
| | | | | | | | | | | | | | | | | | | 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-17/+17
| | | | Notes: svn path=/head/; revision=353848
* Fix a harmless typo.Mark Johnston2019-09-231-1/+1
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=352626
* Revert r316820.Mark Johnston2019-09-231-17/+17
| | | | | | | | | | | | Despite appearing correct, r316820 breaks packet rx/tx for jme(4) interfaces. With 12.1 approaching, let's just revert the commit for now. PR: 233952 Tested by: Armin Gruner <ag-freebsd@muc.de> MFC after: 3 days Notes: svn path=/head/; revision=352625
* ifnet: Replace if_addr_lock rwlock with epoch + mutexMatt Macy2018-05-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-273-0/+6
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. 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. Notes: svn path=/head/; revision=326255
* Don't overwrite mapped bits.Pyun YongHyeon2017-04-141-17/+17
| | | | | | | Found by: PVS-Studio Notes: svn path=/head/; revision=316820
* sys/dev: minor spelling fixes.Pedro F. Giffuni2016-05-032-2/+2
| | | | | | | Most affect comments, very few have user-visible effects. Notes: svn path=/head/; revision=298955
* sys/dev: extend use of the howmany() macro when available.Pedro F. Giffuni2016-04-261-1/+1
| | | | | | | | We have a howmany() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read. Notes: svn path=/head/; revision=298646
* sys/dev: use our nitems() macro when it is avaliable through param.h.Pedro F. Giffuni2016-04-191-2/+1
| | | | | | | | | | 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 Notes: svn path=/head/; revision=298307
* Fix variable assignment.Pyun YongHyeon2016-02-181-1/+1
| | | | | | | Found by: PVS-Studio Notes: svn path=/head/; revision=295735
* Mechanically convert to if_inc_counter().Gleb Smirnoff2014-09-241-10/+10
| | | | Notes: svn path=/head/; revision=272066
* 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-11/+9
| | | | | | | | | | | | | | | | | | 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
* Increase the number of TX DMA segments from 32 to 35. It turnedPyun YongHyeon2014-03-311-1/+1
| | | | | | | | | | | | | out 32 is not enough to support a full sized TSO packet. While I'm here fix a long standing bug introduced in r169632 in bce(4) where it didn't include L2 header length of TSO packet in the maximum DMA segment size calculation. In collaboration with: rmacklem MFC after: 2 weeks Notes: svn path=/head/; revision=263957
* 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
* Change local variable tso_segsz to tsosegsz to avoid mbuf.h macro conflicts.Andre Oppermann2013-08-241-4/+4
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=254803
* Mechanically substitute flags from historic mbuf allocator withGleb Smirnoff2012-12-041-3/+3
| | | | | | | malloc(9) flags in sys/dev. Notes: svn path=/head/; revision=243857
* Align the PCI Express #defines with the style used for the PCI-XGavin Atkinson2012-09-181-1/+1
| | | | | | | | | | | | | | | | | | | | #defines. This also has the advantage that it makes the names more compact, iand also allows us to correct the non-uniform naming of the PCIM_LINK_* defines, making them all consistent amongst themselves. This is a mostly mechanical rename: s/PCIR_EXPRESS_/PCIER_/g s/PCIM_EXP_/PCIEM_/g s/PCIM_LINK_/PCIEM_LINK_/g When this is MFC'd, #defines will be added for the old names to assist out-of-tree drivers. Discussed with: jhb MFC after: 1 week Notes: svn path=/head/; revision=240680
* Fix a logic error when use PCIY_PMG capabilityKevin Lo2012-06-071-1/+1
| | | | | | | Reviewed by: yongari Notes: svn path=/head/; revision=236700
* - Remove attempts to implement setting of BMCR_LOOP/MIIF_NOLOOPMarius Strobl2011-05-031-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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@ Notes: svn path=/head/; revision=221407
* Do a sweep of the tree replacing calls to pci_find_extcap() with calls toJohn Baldwin2011-03-231-4/+4
| | | | | | | pci_find_cap() instead. Notes: svn path=/head/; revision=219902
* - Add a locked variant of jme_start() and invoke it directly while holdingJohn Baldwin2011-01-132-25/+22
| | | | | | | | | | | | | | the lock instead of queueing it to a task. - Do not invoke jme_rxintr() to reclaim any unprocessed but received packets when shutting down the interface. Instead, just drop these packets to match the behavior of other drivers. - Hold the driver lock in the interrupt handler to avoid races with ioctl requests to down the interface. Reviewed by: yongari Notes: svn path=/head/; revision=217353
* Add support for JMicron JMC251/JMC261 Gigabit/Fast ethernetPyun YongHyeon2010-12-183-36/+355
| | | | | | | | | | | | | | | | | | | | | | | controller with Card Read Host Controller. These controllers are multi-function devices and have the same ethernet core of JMC250/JMC260. Starting from REVFM 5(chip full mask revision) controllers have the following features. o eFuse support o PCD(Packet Completion Deferring) o More advanced PHY power saving Because these controllers started to use eFuse, station address modified by driver is permanent as if it was written to EEPROM. If you have to change station address please save your controller default address to safe place before reprogramming it. There is no way to restore factory default station address. Many thanks to JMicron for continuing to support FreeBSD. HW donated by: JMicron Notes: svn path=/head/; revision=216551
* Use system defined PCIR_EXPRESS_DEVICE_CTL instead of using magicPyun YongHyeon2010-12-181-1/+1
| | | | | | | number. Notes: svn path=/head/; revision=216550
* Make sure whether driver allocated resource before releasing it.Pyun YongHyeon2010-12-181-2/+4
| | | | Notes: svn path=/head/; revision=216549
* Fix a regression introduced in r213893. FPGA version requires PHYPyun YongHyeon2010-12-181-2/+3
| | | | | | | probing so allow PHY probing on all possible addresses. Notes: svn path=/head/; revision=216548
* Consistently put a tab character between #define and the macro name.Pyun YongHyeon2010-12-181-14/+14
| | | | Notes: svn path=/head/; revision=216546
* Remove unecessary and clearly wrong usage of atomic(9).Pyun YongHyeon2010-12-101-7/+5
| | | | | | | Reported by: avg, jhb, attilio Notes: svn path=/head/; revision=216362
* Enable ethernet flow-control on all jme(4) controllers.Pyun YongHyeon2010-11-261-3/+1
| | | | Notes: svn path=/head/; revision=215849
* Allocate 1 MSI/MSI-X vector. Originally jme(4) was designed toPyun YongHyeon2010-11-261-28/+12
| | | | | | | | | | support multi-queue but the hardware limitation made it hard to implement supporting multi-queue. Allocating more than necessary vectors is resource waste and it can be added back when we implement multi-queue support. Notes: svn path=/head/; revision=215848
* Disable retrying RX descriptor loading. The counter is used to setPyun YongHyeon2010-11-261-2/+2
| | | | | | | | | | | | | number of retry to be performed whenever controller found RX descriptor was empty. RX empty interrupt is generated only when the retry counter is over. Experimentation shows retrying RX descriptor loading increased number of dropped frames under flow-control enabled environments so disable it and have controller generate RX empty interrupt as fast as it can. While I'm here fix RXCSR_DESC_RT_CNT macro. Notes: svn path=/head/; revision=215847
* Convert the PHY drivers to honor the mii_flags passed down and convertMarius Strobl2010-10-151-17/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Make sure to not use stale ip/tcp header pointers. The ip/tcpPyun YongHyeon2010-10-141-1/+2
| | | | | | | | | | | | | | header parser uses m_pullup(9) to get access to mbuf chain. m_pullup(9) can allocate new mbuf chain and free old one if the space left in the mbuf chain is not enough to hold requested contiguous bytes. Previously drivers can use stale ip/tcp header pointer if m_pullup(9) returned new mbuf chain. Reported by: Andrew Boyer (aboyer <> averesystems dot com) MFC after: 10 days Notes: svn path=/head/; revision=213844
* Add TSO support on VLANs. jme(4) controllers do not require VLANPyun YongHyeon2010-02-221-1/+4
| | | | | | | hardware tagging to make TSO work over VLANs. Notes: svn path=/head/; revision=204225