aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/etherswitch/e6000sw
Commit message (Collapse)AuthorAgeFilesLines
* e6000/fdt: Ignore disabled switch portsJustin Hibbits2026-04-161-0/+2
| | | | | Instead of trying to parse a bogus node, just skip it if marked disabled.
* etherswitch: Add minimal support for mv88e6170 switchJustin Hibbits2026-04-162-0/+5
|
* IfAPI: Finish etherswitch driver conversionsJustin Hibbits2025-06-251-4/+4
| | | | | | | These drivers are not compiled by default, so were missed in the conversion. Sponsored by: Juniper Networks, Inc.
* newbus: replace leftover device unit wildcardsAhmad Khalifa2025-06-211-1/+1
| | | | | | Reviewed by: imp, jhb Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D50913
* machine/stdarg.h -> sys/stdarg.hBrooks Davis2025-06-111-1/+1
| | | | | | | | | | | | | Switch to using sys/stdarg.h for va_list type and va_* builtins. Make an attempt to insert the include in a sensible place. Where style(9) was followed this is easy, where it was ignored, aim for the first block of sys/*.h headers and don't get too fussy or try to fix other style bugs. Reviewed by: imp Exp-run by: antoine (PR 286274) Pull Request: https://github.com/freebsd/freebsd-src/pull/1595
* e6000sw: fix bus ordering; don't panic if miibus devices are destroyedAdrian Chadd2025-05-161-2/+8
| | | | | | | | | | | | | | | | | | | Unloading the e6000sw driver with a "fixed" ixgbe (which is doing MDIO transfers faster than 8ms per) has exposed another fun race condition - the MII busses were being torn down before the etherswitch device. * Modify e6000sw_miiforphy() to return NULL if the mii bus device isn't setup, which stops the panic * Change the module order so the e6000sw module is detached first, before the miibus entries and attached PHYs are destroyed. This ensures that the miibus entries aren't destroyed outside of the driver lock, and e6000sw_tick() doesn't try dereferencing dead miibus device_t's. Differential Revision: https://reviews.freebsd.org/D50294 Reviewed by: jhb
* e6000sw: add support for 88E6190XAdrian Chadd2025-04-272-11/+31
| | | | | | | | | | | | | | | | | | | | This adds the minimum support required to probe/attach the 88E6190X. I've tested this against an AT&T ATT-150 OCP device (Silicom i3000) with local changes to export MDIO via ixge(4). Hints are required to probe/attach/configure the switch on amd64, but with the mentioned diffs, it does work. Thanks to Stas Alekseev <stas@alekseev.us> for the pull request and Stas / Jason Hensler <omegadraconis@gmail.com> for chasing down information about the chipset, linux stuff and AT&T OCP hardware information. PR: kern/281211 Pull Request: https://github.com/freebsd/freebsd-src/pull/1408 Differential Revision: https://reviews.freebsd.org/D50044 Reviewed by: imp
* e6000sw: schedule e6000sw_tick() to occur once a secondAdrian Chadd2025-04-271-0/+12
| | | | | | | | | | | | | | | Although all the machinery is present, the tick routine only ran once. It was never rescheduled. So, reschedule it. However in practice I've discovered that the tick routine is running whilst a bunch of phys are actually being probe/attached on each per-port MII bus being created and probed off of the switch itself. Until that's debugged (and likely the whole PHY management stuff is cleaned up here), just add a NULL check and thus don't panic. Differential Revision: https://reviews.freebsd.org/D50031 Reviewed by: imp
* e6000sw: stop / drain the taskqueue (and tick) during detachAdrian Chadd2025-04-271-3/+15
| | | | | | | | | | | | Although the tick isn't running every hz right now, when it /is/ running at hz, the shutdown path will race with an existing running tick routine, causing unpredictable panics. * Introduce a shutdown flag which will abort doing the tick work if set * set the shutdown flag and start cancel/draining the taskqueue during detach. Differential Revision: https://reviews.freebsd.org/D50030
* e6000sw: unlock the driver lock in the error path during attachAdrian Chadd2025-04-271-0/+1
| | | | | | | | The driver sleep lock was being held during most of the error paths, and not unlocking it will panic the kernel during detach. So, fix it. Differential Revision: https://reviews.freebsd.org/D50029 Reviewed by: imp
* e6000sw: correctly depend upon etherswitchAdrian Chadd2025-04-271-1/+1
| | | | | | | | This fixes the driver to load correctly as a module when etherswitch is also a module. Differential Revision: https://reviews.freebsd.org/D50027 Reviewed by: imp
* etherswitch: Cleanup detach and delete of child devices during detachJohn Baldwin2025-01-021-4/+5
| | | | | | | Call bus_generic_detach first and return any error. Remove no longer needed individual device_delete_child calls. Differential Revision: https://reviews.freebsd.org/D47970
* Use bus_generic_detach instead of device_delete_children in detachJohn Baldwin2025-01-021-3/+5
| | | | | | | While here, check for errors from bus_generic_detach and move it to the start of detach if necessary. Differential Revision: https://reviews.freebsd.org/D47969
* Replace calls to bus_generic_attach with bus_attach_childrenJohn Baldwin2024-12-062-4/+2
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47675
* Replace calls to bus_generic_probe with bus_identify_childrenJohn Baldwin2024-12-062-2/+2
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47674
* newbus: replace -1 in BUS_ADD_CHILD(...-1) with DEVICE_UNIT_ANYWarner Losh2024-07-251-1/+1
| | | | Sponsored by: Netflix
* net: Remove unneeded NULL check for the allocated ifnetZhenlei Huang2024-06-282-8/+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
* etherswitch: Use device_set_desc(f)()Mark Johnston2024-06-021-3/+1
| | | | | | No functional change intended. MFC after: 1 week
* e6000sw: Fix locking in miibus_{read,write}reg implementationsMark Johnston2023-11-061-12/+19
| | | | | | | | | | | | | | | | | | Commit 469290648005e13b819a19353032ca53dda4378f made e6000sw's implementation of miibus_(read|write)reg assume that the softc lock is held. I presume that is to avoid lock recursion in e6000sw_attach() -> e6000sw_attach_miibus() -> mii_attach() -> MIIBUS_READREG(). However, the lock assertion in e6000sw_readphy_locked() can fail if a different driver uses the interface to probe registers. Work around the problem by providing implementations which lock the softc if it is not already locked. PR: 274795 Fixes: 469290648005 ("e6000sw: add readphy and writephy wrappers") Reviewed by: kp, imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42466
* e6000sw: support building without FDTLuiz Otavio O Souza2023-08-211-2/+101
| | | | | | | This enables the use of this driver on platorms without device tree, such as Netgate's XG-7100. Sponsored by: Rubicon Communications, LLC ("Netgate")
* 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/
* etherswitch: Fix leftovers from IfAPI conversionJustin Hibbits2023-02-141-2/+2
| | | | Sponsored by: Juniper Networks, Inc.
* etherswitch: Clean up whitespace after IfAPI conversionJustin Hibbits2023-01-312-5/+5
| | | | | Sponsored by: Juniper Networks, Inc. Fixes: 2e6a8c1ae
* Mechanically convert etherswitch drivers to IfAPIJustin Hibbits2023-01-242-24/+24
| | | | | | Reviewed by: kd Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D37813
* etherswitch(4): Remove a double word in a source code commentGordon Bergling2022-09-041-1/+1
| | | | | | - s/the the/the/ MFC after: 3 days
* e6000sw: fix incorrect lockingKristof Provost2022-08-191-9/+0
| | | | | | | | | | | | | | | During attach we release the lock to call e6000sw_attach_miibus(), which calls mii_attach(). The mii_attach() function calls miibus_readreg() / miibus_writereg(). However, these are set to be e6000sw_readphy_locked(). That is, the read/write phy functions do not acquire the lock, but expect to be called while locked. Simply do not unlock and relock while calling mii_attach(). Reviewed by: Hubert Mazur <hum@semihalf.com> Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D36117
* e6000sw: add readphy and writephy wrappersAlbert Jakiela2022-07-071-16/+37
| | | | | | | | | | | | New functions take lock and give lock after operation. Removed locking and unlocking within other methods, to prevent from recursive locking on non recursive lock. Tested on EspressoBin. Reviewed by: mw Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D35656
* e6000sw: Fix direct register write logicKornel Dulęba2022-07-041-1/+1
| | | | | | | | | | | | | When accessing a register directly from etherswitchcfg one must specify a register group(e.g. registers of portN) and the register offset within the group. The latter is passed as the 5 least significant bits. Extract the former by dividing the register address by 32, not by 5. Approved by: mw(mentor) Obtained from: Semihalf Sponsored by: Stormshield MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D35672
* etherswitch drivers: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-092-5/+2
|
* Remove unused etherswitch_devclass.John Baldwin2022-05-092-3/+2
|
* Remove unused mdio_devclass.John Baldwin2022-05-061-1/+1
|
* Remove unused miibus_devclass and miibus_fdt_devclass.John Baldwin2022-05-062-2/+2
|
* e6000sw_set_atustat: eliminate write only ret variableWarner Losh2022-04-051-2/+1
| | | | Sponsored by: Netflix
* e6000sw: Build the driver as a kernel moduleHubert Mazur2021-09-131-46/+29
| | | | | | | | | | Fix detach routine. Driver was tested on EspressoBin. Remove it from GENERIC, since now it can be loaded automatically. Obtained from: Semihalf Reviewed by: manu Differential revision: https://reviews.freebsd.org/D31580
* e6000sw: Use taskqueue subsytem for MDIO pollingHubert Mazur2021-09-131-27/+38
| | | | | | | | | Previosuly the link status was pooled in an infinite loop in a separate kproc. Use taskqueue subsytem instead. This is a prequisite for making this driver work as a loadable module. Obtained from: Semihalf Differential revision: https://reviews.freebsd.org/D31579
* Fix panic when running etherswitchcfg port command.Ganbold Tsagaankhuu2019-12-251-1/+2
| | | | Notes: svn path=/head/; revision=356075
* Add support for the Marvell 88E6190 11 ports switch.Luiz Otavio O Souza2019-07-012-48/+186
| | | | | | | | | | | With more ports, some of the registers are shifted a bit to accommodate. This switch also adds two high speed Serdes/SGMII interfaces (2.5 Gb/s). Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=349578
* Add the 802.1q support for the Marvell e6000 series of ethernet switches.Luiz Otavio O Souza2019-06-282-310/+595
| | | | | | | | Tested on: espressobin, Clearfog, SG-3100 and others Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=349521
* Do not overwrite the RGMII bits in the CPU port register of Switch.Luiz Otavio O Souza2019-06-062-2/+5
| | | | | | | | | | | Fixes the network on Espressobin. The GENERIC kernel now boots over NFS. Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=348762
* Update mvneta/e6000sw for new DSA Device Tree BindingsMarcin Wojtas2019-03-231-36/+79
| | | | | | | | | | | | | | | | | | | In the latest Linux kernel revisions the DSA (Distributed Switch Architecture) device tree binding was changed. Instead of the top level dsa@ node, the switch and its ports is represented as a child node of the mdio bus. With that other modifications were added, such as relation with the ethernet port of the SoC. Adjust e6000sw etherswitch and mvneta drivers to that. Tested on Armada 3720 EspressoBin and Armada 388 Clearfog Pro boards. Submitted by: Bert JW Regeer <xistence@0x58.com> Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D19036 Notes: svn path=/head/; revision=345432
* Improve detection of addressing mode in e6000swMarcin Wojtas2018-04-101-1/+3
| | | | | | | | | | | | | | Some devices cannot rely on the switch MDIO address passed in the DTB for specifying single/multi-chip addressing mode. Introduce new property "single-chip-addressing" which added to DTS will force single-chip mode. Submitted by: Michal Mazur <mkm@semihalf.com> Obtained from: Semihalf Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D14800 Notes: svn path=/head/; revision=332354
* Clean up OF_getprop_alloc APIOleksandr Tymoshenko2018-04-081-2/+2
| | | | | | | | | | | | | | | | | | | | OF_getprop_alloc takes element size argument and returns number of elements in the property. There are valid use cases for such behavior but mostly API consumers pass 1 as element size to get string properties. What API users would expect from OF_getprop_alloc is to be a combination of malloc + OF_getprop with the same semantic of return value. This patch modifies API signature to match these expectations. For the valid use cases with element size != 1 and to reduce modification scope new OF_getprop_alloc_multi function has been introduced that behaves the same way OF_getprop_alloc behaved prior to this patch. Reviewed by: ian, manu Differential Revision: https://reviews.freebsd.org/D14850 Notes: svn path=/head/; revision=332310
* [etherswitch] check if_alloc returns NULLMichael Zhilin2018-01-241-0/+6
| | | | | | | | | | | This patch is cosmetic. It checks if allocation of ifnet structure failed. It's better to have this check rather than assume positive scenario. Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com> Reported by: Dmitry Luhtionov <dmitryluhtionov@gmail.com> Notes: svn path=/head/; revision=328377
* Fix the port vlan support in e6000 based switches.Luiz Otavio O Souza2017-07-272-92/+85
| | | | | | | | | | | | Reduce the use of local copies of switch register data. The switch now works with the upstream dsa node (i.e. the upstream DTS). Tested on: ClearFog Pro (88E6176), SG-3100 (88E6141) Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=321602
* Add support to 2.5G uplink for the MV88E6141 and MV88E6341 switches.Luiz Otavio O Souza2017-06-202-43/+111
| | | | | | | | | | Force the switch port settings for fixed media types. Tested with: 88E6176, 88E6141 Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=320157
* Prevent multiple lock initialization in e6000sw probeZbigniew Bodek2017-06-131-3/+8
| | | | | | | | | | | | | | | | r319886 ("Add the initial support for the Marvell 88E6141 and 88E6341 switches.") unveiled a problem with possible multiple lock creation. Move its initialization to the driver attach and for obtaining the switch ID create a temprorary one, which is immediately destroyed after the check. Submitted by: Zbigniew Bodek <zbb@semihalf.com> Marcin Wojtas <mw@semihalf.com> Obtained from: Semihalf Notes: svn path=/head/; revision=319906
* Add the initial support for the Marvell 88E6141 and 88E6341 switches.Luiz Otavio O Souza2017-06-131-18/+66
| | | | | | | | | | | | | Right now the driver only supports port VLANs, so make sure etherswitch_getinfo() return the proper switch capabilities. Handle the cases where not all ports are in use (that will also require etherswitch cooperation). Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=319886
* Remove an unnecessary variable from the switch softc structure and make theLuiz Otavio O Souza2017-06-091-19/+22
| | | | | | | | | functions that are used as booleans return real boolean values. Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=319760
* style(9) fixes, remove unnecessary headers, remove duplicate #defines andLuiz Otavio O Souza2017-06-022-136/+88
| | | | | | | | | | | in some cases, shuffle the code around to simplify locking. No functional changes. Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=319498