summaryrefslogtreecommitdiff
path: root/sys/dev/etherswitch
AgeCommit message (Collapse)Author
2025-06-25IfAPI: Finish etherswitch driver conversionsJustin Hibbits
These drivers are not compiled by default, so were missed in the conversion. Sponsored by: Juniper Networks, Inc.
2025-06-21newbus: replace leftover device unit wildcardsAhmad Khalifa
Reviewed by: imp, jhb Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D50913
2025-06-11machine/stdarg.h -> sys/stdarg.hBrooks Davis
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
2025-05-15e6000sw: fix bus ordering; don't panic if miibus devices are destroyedAdrian Chadd
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
2025-04-27e6000sw: add support for 88E6190XAdrian Chadd
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
2025-04-27e6000sw: schedule e6000sw_tick() to occur once a secondAdrian Chadd
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
2025-04-27e6000sw: stop / drain the taskqueue (and tick) during detachAdrian Chadd
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
2025-04-27e6000sw: unlock the driver lock in the error path during attachAdrian Chadd
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
2025-04-27e6000sw: correctly depend upon etherswitchAdrian Chadd
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
2025-04-27miiproxy: add missing dependency on mdioAdrian Chadd
This is required for it to be a module Differential Revision: https://reviews.freebsd.org/D50024 Reviewed by: imp
2025-02-15ar40xx: fix to compile/run under the new ifnet rulesAdrian Chadd
Locally tested: * IPQ4018, Asus router, w/ ethernet driver Differential Revision: https://reviews.freebsd.org/D49025 Reviewed by: imp, zlei
2025-01-02etherswitch: Cleanup detach and delete of child devices during detachJohn Baldwin
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
2025-01-02Use bus_generic_detach instead of device_delete_children in detachJohn Baldwin
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
2025-01-02Check for errors from bus_generic_detach in various driversJohn Baldwin
In some cases, move the call to bus_generic_detach earlier so that any detach failures from child devices do not leave the parent device partially detached. Differential Revision: https://reviews.freebsd.org/D47966
2025-01-02bus_generic_detach: Delete children after detaching themJohn Baldwin
This provides better semantics as a standalone DEVMETHOD for device_attach as bus drivers should remove child devices they created as part of detach cleanup. The implementation calls bus_detach_children() first to permit child devices an opportunity to veto the detach operation. If that succeeds, device_delete_children() is used to delete the child devices. This requires fixing various drivers that were deleting devices explicitly (via a device_t pointer cached in the softc) after calling bus_generic_detach to stop doing that and just rely on bus_generic_detach to remove child devices. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47959
2024-12-06Replace calls to bus_generic_attach with bus_attach_childrenJohn Baldwin
Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47675
2024-12-06Replace calls to bus_generic_probe with bus_identify_childrenJohn Baldwin
Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47674
2024-09-03etherswitch: Stop checking for failures from malloc(M_WAITOK)Zhenlei Huang
MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45852
2024-07-24newbus: replace -1 in BUS_ADD_CHILD(...-1) with DEVICE_UNIT_ANYWarner Losh
Sponsored by: Netflix
2024-07-24newbus: globally replace device_add_child(..., -1) with DEVICE_UNIT_ANYWarner Losh
Sponsored by: Netflix
2024-06-28net: Remove unneeded NULL check for the allocated ifnetZhenlei Huang
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
2024-06-02etherswitch: Use device_set_desc(f)()Mark Johnston
No functional change intended. MFC after: 1 week
2024-05-10ukswitch: fix non-debug buildEd Maste
PR: 278847 Sponsored by: The FreeBSD Foundation
2024-05-09ip17x: fix non-debug buildEd Maste
PR: 278847 Reviewed by: jhibbits Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45133
2024-01-10hwreset: Move reset code in dev/hwresetEmmanuel Vadot
We've removed kernel option EXT_RESOURCES almost two years ago. While it was ok to have some code under a common 'extres' subdirectory at first, we now have a lot of consumer of it and we made it mandatory so no need to have it under a cryptic name. Reviewed by: imp Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D43192
2024-01-10clk: Move clock code in dev/clkEmmanuel Vadot
We've removed kernel option EXT_RESOURCES almost two years ago. While it was ok to have some code under a common 'extres' subdirectory at first, we now have a lot of consumer of it and we made it mandatory so no need to have it under a cryptic name. Reviewed by: mhorne Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D43191
2023-11-26sys: Automated cleanup of cdefs and other formattingWarner Losh
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
2023-11-06e6000sw: Fix locking in miibus_{read,write}reg implementationsMark Johnston
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
2023-08-21e6000sw: support building without FDTLuiz Otavio O Souza
This enables the use of this driver on platorms without device tree, such as Netgate's XG-7100. Sponsored by: Rubicon Communications, LLC ("Netgate")
2023-08-16sys: Remove $FreeBSD$: one-line sh patternWarner Losh
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16sys: Remove $FreeBSD$: one-line .c patternWarner Losh
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16sys: Remove $FreeBSD$: one-line .h patternWarner Losh
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
2023-08-16sys: Remove $FreeBSD$: two-line .h patternWarner Losh
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-09arswitch(4): Remove support for AR{7240,9340} found in MIPS SoCs onlyMarius Strobl
With the general removal of MIPS support there's no longer a need to support these integrated switches. Approved by: adrian Differential Revision: https://reviews.freebsd.org/D41394
2023-08-08etherswitch/arswitch: correct version detectionMichael Zhilin
During porting of etherswitch to NetBSD mistypo was discovered in Atheros switch version detection. Reported by: Hiroki Mori yamori813@yahoo.co.jp MFC after: 1 week
2023-05-12spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh
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
2023-02-14etherswitch: Fix leftovers from IfAPI conversionJustin Hibbits
Sponsored by: Juniper Networks, Inc.
2023-01-31etherswitch: Clean up whitespace after IfAPI conversionJustin Hibbits
Sponsored by: Juniper Networks, Inc. Fixes: 2e6a8c1ae
2023-01-24Mechanically convert etherswitch drivers to IfAPIJustin Hibbits
Reviewed by: kd Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D37813
2022-11-02sys: Nuke double-semicolonsElliott Mitchell
A distinct number of double-semicolons have ended up in FreeBSD. Take a pass at getting rid of many of these harmless typos. Reviewed by: emaste, rrs Pull Request: https://github.com/freebsd/freebsd-src/pull/609 Differential Revision: https://reviews.freebsd.org/D31716
2022-09-04etherswitch(4): Remove a double word in a source code commentGordon Bergling
- s/the the/the/ MFC after: 3 days
2022-08-19e6000sw: fix incorrect lockingKristof Provost
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
2022-07-07e6000sw: add readphy and writephy wrappersAlbert Jakiela
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
2022-07-04e6000sw: Fix direct register write logicKornel Dulęba
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
2022-05-09etherswitch drivers: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin
2022-05-09Remove unused miiproxy_devclass.John Baldwin
2022-05-09Remove unused etherswitch_devclass.John Baldwin
2022-05-06Remove unused mdio_devclass.John Baldwin
2022-05-06Remove unused miibus_devclass and miibus_fdt_devclass.John Baldwin
2022-04-12arswitch: Remove unused variable.John Baldwin