aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/re/if_re.c
Commit message (Collapse)AuthorAgeFilesLines
* dev: Use recently added improvements to PME# support to simplify driversJohn Baldwin2025-03-271-10/+4
| | | | | | | | | | 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-5/+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
* re(4): Add support for 8168FP HW revBrad Smith2023-11-231-0/+2
| | | | | MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D42671
* if_re: add Realtek Killer Ethernet E2600 IDsSk Razee2023-10-061-0/+2
| | | | | | | PR: 274292 MFC after: 1 week Reviewed by: kp Event: Oslo Hackathon at Modirum
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* if_re: Drop redundant assignments for ifq_maxlen and ifq_drv_maxlenZhenlei Huang2023-03-211-1/+0
| | | | Fixes: 4519a073c326b Mechanically convert if_re(4) to DrvAPI
* if_re: Generate an address if there is none in the EEPROMEvgeni Golov2023-02-271-0/+5
| | | | | | | | | | | | | There exists hardware that has no ethernet address burned into the EEPROM. Loading if_re on such a HW brings the device up with '00:00:00:00:00:00' as the address, and that doesn't get you too far in a real network. PR: 262406 Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/670 Signed-off-by: Evgeni Golov <evgeni@debian.org> Differential Revision: https://reviews.freebsd.org/D34485
* re(4): Fix whitespace from IfAPI conversionJustin Hibbits2023-01-311-7/+7
| | | | | Fixes: 4519a073c326b Sponsored by: Juniper Networks, Inc.
* Mechanically convert if_re(4) to DrvAPIJustin Hibbits2023-01-311-175/+175
| | | | | | Reviewed By: kevlo Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D37790
* re/rl: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-061-3/+1
|
* Remove unused miibus_devclass and miibus_fdt_devclass.John Baldwin2022-05-061-1/+1
|
* re: Avoid subobject overread when setting IDRnJessica Clarke2021-12-231-9/+5
| | | | | | | | | | | | | | | | | | | IDR0-IDR5 can be read byte-by-byte but must be written to as 4-byte words. The current code to do this is rather clunky and ends up reading past the end of the union's eaddr member due to MAC addresses only being 6 bytes. In practice this ends up being fine because the align_dummy member will pad the union to a multiple of 4 bytes, but this is dodgy, and on CHERI with subobject bounds enforcement enabled, as is done in CheriBSD's pure-capability kernel, will trap. Instead, make the buffer in use the right size, just use an array of uint32_t's rather than a char buffer that's then cast to uint32_t * to simplify it in the process, and zero-initialise it first to avoid reading uninitialised data in the trailing bytes. Found by: CHERI Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D33617
* re: netmap: enable/disable krings on interface reinitVincenzo Maffione2021-01-101-0/+8
| | | | | | | | This prevents krings from being used during an interface reset, and notifies the active applications. See also 1d238b07d5d4d9660ae0. MFC after: 1 week
* re(4): Add a 8168-compatible device IDMark Johnston2020-10-051-0/+2
| | | | | | | | | | | This is described in RealTek's driver as a "RTL8168 Series add-on card." PR: 250037 Submitted by: Hiroshi HASEGAWA <hhase1973@gmail.com> MFC after: 1 week Notes: svn path=/head/; revision=366464
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-261-4/+5
| | | | | | | | | | | | | | | | | | | 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
* Use NET_TASK_INIT() and NET_GROUPTASK_INIT() for drivers that processGleb Smirnoff2020-02-111-6/+2
| | | | | | | | | | incoming packets in taskqueue context. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D23518 Notes: svn path=/head/; revision=357772
* re(4) uses taskqueue to process input packets. Enter network epochGleb Smirnoff2020-01-241-1/+5
| | | | | | | in there. Notes: svn path=/head/; revision=357090
* Convert to if_foreach_llmaddr() KPI.Gleb Smirnoff2019-10-211-15/+17
| | | | Notes: svn path=/head/; revision=353823
* Split out a more generic debugnet(4) from netdump(4)Conrad Meyer2019-10-171-11/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Debugnet is a simplistic and specialized panic- or debug-time reliable datagram transport. It can drive a single connection at a time and is currently unidirectional (debug/panic machine transmit to remote server only). It is mostly a verbatim code lift from netdump(4). Netdump(4) remains the only consumer (until the rest of this patch series lands). The INET-specific logic has been extracted somewhat more thoroughly than previously in netdump(4), into debugnet_inet.c. UDP-layer logic and up, as much as possible as is protocol-independent, remains in debugnet.c. The separation is not perfect and future improvement is welcome. Supporting INET6 is a long-term goal. Much of the diff is "gratuitous" renaming from 'netdump_' or 'nd_' to 'debugnet_' or 'dn_' -- sorry. I thought keeping the netdump name on the generic module would be more confusing than the refactoring. The only functional change here is the mbuf allocation / tracking. Instead of initiating solely on netdump-configured interface(s) at dumpon(8) configuration time, we watch for any debugnet-enabled NIC for link activation and query it for mbuf parameters at that time. If they exceed the existing high-water mark allocation, we re-allocate and track the new high-water mark. Otherwise, we leave the pre-panic mbuf allocation alone. In a future patch in this series, this will allow initiating netdump from panic ddb(4) without pre-panic configuration. No other functional change intended. Reviewed by: markj (earlier version) Some discussion with: emaste, jhb Objection from: marius Differential Revision: https://reviews.freebsd.org/D21421 Notes: svn path=/head/; revision=353685
* 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
* Add netdump support to re(4).Mark Johnston2018-05-061-1/+71
| | | | | | | | | | | | Tested with a RealTek 8101E adapter. Reviewed by: sbruno MFC after: 1 month Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D15260 Notes: svn path=/head/; revision=333289
* netmap: align codebase to the current upstream (commit id 3fb001303718146)Vincenzo Maffione2018-04-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changelist: - Turn tx_rings and rx_rings arrays into arrays of pointers to kring structs. This patch includes fixes for ixv, ixl, ix, re, cxgbe, iflib, vtnet and ptnet drivers to cope with the change. - Generalize the nm_config() callback to accept a struct containing many parameters. - Introduce NKR_FAKERING to support buffers sharing (used for netmap pipes) - Improved API for external VALE modules. - Various bug fixes and improvements to the netmap memory allocator, including support for externally (userspace) allocated memory. - Refactoring of netmap pipes: now linked rings share the same netmap buffers, with a separate set of kring pointers (rhead, rcur, rtail). Buffer swapping does not need to happen anymore. - Large refactoring of the control API towards an extensible solution; the goal is to allow the addition of more commands and extension of existing ones (with new options) without the need of hacks or the risk of running out of configuration space. A new NIOCCTRL ioctl has been added to handle all the requests of the new control API, which cover all the functionalities so far supported. The netmap API bumps from 11 to 12 with this patch. Full backward compatibility is provided for the old control command (NIOCREGIF), by means of a new netmap_legacy module. Many parts of the old netmap.h header has now been moved to netmap_legacy.h (included by netmap.h). Approved by: hrs (mentor) Notes: svn path=/head/; revision=332423
* spdx: initial adoption of licensing ID tags.Pedro F. Giffuni2017-11-181-0/+2
| | | | | | | | | | | | | | | | | | | | 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
* Disable CLKREQ for ASPM since re(4) doesn't implement link level power saving.Kevin Lo2016-10-271-3/+5
| | | | | | | Reviewed by: yongari Notes: svn path=/head/; revision=307982
* Add support for the TP-Link TG-3468 v2.Kevin Lo2016-09-211-0/+2
| | | | | | | | | | | | This is an RTL8168 chip, which we already support so all we have to do is add the vendor ID. PR: 212876 Submitted by: Tobias Kortkamp <t@tobik.me> MFC after: 3 days Notes: svn path=/head/; revision=306102
* sys/dev: use our nitems() macro when it is avaliable through param.h.Pedro F. Giffuni2016-04-191-1/+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
* Remove taskqueue_enqueue_fast().John Baldwin2016-03-011-2/+2
| | | | | | | | | | | | | taskqueue_enqueue() was changed to support both fast and non-fast taskqueues 10 years ago in r154167. It has been a compat shim ever since. It's time for the compat shim to go. Submitted by: Howard Su <howard0su@gmail.com> Reviewed by: sephe Differential Revision: https://reviews.freebsd.org/D5131 Notes: svn path=/head/; revision=296272
* With r290566 in place it turned out that WOL previously only worked byMarius Strobl2015-11-161-1/+7
| | | | | | | | | | | | | accident with RTL8168G and later chips when the interface actually was brought up. This is due to the fact that with these MAC variants, RXDV gate needs be disabled for WOL to work. So do just that in re_setwol() when IFCAP_WOL is requested. Reported and tested by: dhw MFC after: 3 days Notes: svn path=/head/; revision=290946
* - Although it doesn't make a whole lot of sense to enable RX and TXMarius Strobl2015-11-091-17/+33
| | | | | | | | | | | | | | | | | | | | | | | | before their initial configuration is done, it turns out that r281337 has the inverse effect on some older chips. Moreover, as with newer chips before, two chips seemingly identical according to their MAC revisions may behave differently in this regard, with most working but a few not, making changes extremely hard to test. Closer inspection of the corresponding Linux code suggests that RX and TX should only be enabled after their initial configuration with RTL8168G and later chips, i. e. RTL8106E{,US}, RTL8107E, as well as RTL8168{EP,G,GU,H}, so limit the new code path to these. [1] - Distinguish between RTL8168H and RTL8107E, with the latter being the 10/100-Mbit/s-only variant of the former. - For MAC variants that can only do Fast Ethernet at a maximum, ensure that we don't advertise Gigabit Ethernet speed. - In re_stop(), do the inverse of re_init_locked() and enable RXDV gate on RTL8168G and later chips again, matching what Linux does. PR: 203422 [1] MFC after: 1 week Notes: svn path=/head/; revision=290566
* Add preliminary support for RTL8168H, tested by Sreenath Battalahalli.Marius Strobl2015-09-131-0/+2
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=287768
* Sync netmap sources with the version in our private tree.Luigi Rizzo2015-07-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit contains large contributions from Giuseppe Lettieri and Stefano Garzarella, is partly supported by grants from Verisign and Cisco, and brings in the following: - fix zerocopy monitor ports and introduce copying monitor ports (the latter are lower performance but give access to all traffic in parallel with the application) - exclusive open mode, useful to implement solutions that recover from crashes of the main netmap client (suggested by Patrick Kelsey) - revised memory allocator in preparation for the 'passthrough mode' (ptnetmap) recently presented at bsdcan. ptnetmap is described in S. Garzarella, G. Lettieri, L. Rizzo; Virtual device passthrough for high speed VM networking, ACM/IEEE ANCS 2015, Oakland (CA) May 2015 http://info.iet.unipi.it/~luigi/research.html - fix rx CRC handing on ixl - add module dependencies for netmap when building drivers as modules - minor simplifications to device-specific routines (*txsync, *rxsync) - general code cleanup (remove unused variables, introduce macros to access rings and remove duplicate code, Applications do not need to be recompiled, unless of course they want to use the new features (monitors and exclusive open). Those willing to try this code on stable/10 can just update the sys/dev/netmap/*, sys/net/netmap* with the version in HEAD and apply the small patches to individual device drivers. MFC after: 1 month Sponsored by: (partly) Verisign, Cisco Notes: svn path=/head/; revision=285349
* Don't enable RX and TX before their initial configuration is done, i. e.Marius Strobl2015-04-091-9/+5
| | | | | | | | | | | | | | after setting up interrupt moderation but before turning interrupts on. This matches what Realtek's r8168 Linux driver does as of version 8.039.00 and fixes problems with certain incarnations of certain MAC revisions like the interface requiring an extra up/down-cycle after boot to start working or DMA configuration not being adhered to. PR: 193743, 197535 MFC after: 1 week Notes: svn path=/head/; revision=281337
* It seems multicast filtering of RTL8168F does not work. WorkaroundPyun YongHyeon2014-10-211-0/+6
| | | | | | | | | | the silicon bug by accepting any multicast packets. PR: 193488 MFC After: 1 week Notes: svn path=/head/; revision=273359
* Move rl(4) to dev/rl.Gleb Smirnoff2014-09-191-1/+1
| | | | Notes: svn path=/head/; revision=271864
* Mechanically convert to if_inc_counter().Gleb Smirnoff2014-09-191-7/+7
| | | | Notes: svn path=/head/; revision=271849
* 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-6/+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
* Disable TX IP/TCP/UDP checksum offloading for RTL8168C/RTL8168CP.Pyun YongHyeon2014-05-131-15/+10
| | | | | | | | | | | | | Previously only TX IP checksum offloading was disabled but it's reported that TX checksum offloading for UDP datagrams with IP options also generates corrupted frames. Reporter's controller is RTL8168CP but I guess RTL8168C also have the same issue since it shall share the same core. Reported and tested by: tuexen Notes: svn path=/head/; revision=265943
* - Implement the RX EARLYOFF and RXDV GATED bits as done by RealTek's LinuxMarius Strobl2014-02-051-7/+24
| | | | | | | | | | | | | driver as version 8.037.00 for RTL8168{E-VL,EP,F,G,GU} and RTL8111B. This makes reception of packets work with the RTL8168G (HW rev. 0x4c000000) in my Shuttle DS47. - Consistently use RL_MSI_MESSAGES. In joint forces with: yongari MFC after: 5 days Notes: svn path=/head/; revision=261531
* update to the latest netmap snapshot.Luigi Rizzo2013-11-011-3/+2
| | | | | | | | | | | | | | | | | | | | | | | This includes the following: - use separate memory regions for VALE ports - locking fixes - some simplifications in the NIC-specific routines - performance improvements for the VALE switch - some new features in the pkt-gen test program - documentation updates There are small API changes that require programs to be recompiled (NETMAP_API has been bumped so you will detect old binaries at runtime). In particular: - struct netmap_slot now is 16 bytes to support an extra pointer, which may save one data copy when using VALE ports or VMs; - the struct netmap_if has two extra fields; MFC after: 3 days Notes: svn path=/head/; revision=257529
* Add preliminary support for RTL8168EP.Pyun YongHyeon2013-10-291-0/+2
| | | | | | | Submitted by: Edward O'Callaghan (eocallaghan <> alterapraxis dot com) Notes: svn path=/head/; revision=257306
* Add preliminary support for RTL8168G, RTL8168GU and RTL8411B.Pyun YongHyeon2013-10-291-2/+20
| | | | | | | | | | | | RTL8168GU has two variants(GMII and MII) but it uses the same chip revision id. Driver checks PCI device id of controller and sets internal capability flag(i.e. jumbo frame and link speed down in WOL). H/W donated by: RealTek Semiconductor Corp. Notes: svn path=/head/; revision=257305
* 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
* Add preliminary support for RTL8106E PCIe FastEthernet.Pyun YongHyeon2013-10-211-0/+2
| | | | | | | H/W donated by: RealTek Semiconductor Corp. Notes: svn path=/head/; revision=256828
* Correct MAC revision bits. Previously it always cleared bit 20 andPyun YongHyeon2013-10-211-2/+3
| | | | | | | bit 21. Notes: svn path=/head/; revision=256827
* Correct comment typos.Sergey Kandaurov2013-06-281-5/+5
| | | | Notes: svn path=/head/; revision=252341
* use netmap_rx_irq() / netmap_tx_irq() to handle interrupts inLuigi Rizzo2013-04-301-7/+3
| | | | | | | | | netmap mode, removing the logic from individual drivers. (note: if_lem.c not updated yet due to some other pending modifications) Notes: svn path=/head/; revision=250108
* Disable TX IP header checksum offloading on RL_HWREV_8168CP. ThePyun YongHyeon2013-03-131-2/+4
| | | | | | | | | | controller generates wrong checksummed frame if the IP packet has IP options. Submitted by: Alexander Bluhm via brad@openbsd Notes: svn path=/head/; revision=248227
* Mechanically substitute flags from historic mbuf allocator withGleb Smirnoff2012-12-041-6/+6
| | | | | | | malloc(9) flags in sys/dev. Notes: svn path=/head/; revision=243857