aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/etherswitch
Commit message (Collapse)AuthorAgeFilesLines
...
* etherswitch: Remove unused variable.John Baldwin2022-04-091-3/+1
|
* e6000sw_set_atustat: eliminate write only ret variableWarner Losh2022-04-051-2/+1
| | | | Sponsored by: Netflix
* etherswitch(4): Fix a few common typos in source code commentsGordon Bergling2022-04-021-4/+4
| | | | | | - s/accomodate/accommodate/ MFC after: 3 days
* ar40xx_switch: add initial switch for the IPQ4018/IPQ4019.Adrian Chadd2022-02-0422-0/+4044
| | | | | | | | | | | | | | | | Summary: This switch is based off of the AR8327/AR8337 external switch/PHY. However unlike the AR8327/AR8337 it itself doesn't have any PHYs; instead an external PHY connects to it using the PSGMII port. Differential Revision: https://reviews.freebsd.org/D34112 Reviewed by: manu This code is inspired by the ar40xx code in openwrt, which itself is based on the Qualcomm QCA-SSDK. Both of these sources are, amusingly, BSD licenced - and thus I have included some of the comments in the hardware workaround paths to document some of the magic numbers.
* felix: Add support for PHY interruptsKornel Duleba2021-11-241-1/+8
| | | | | | | | - Replace miibus with newly created miibus_fdt. - Use generic passthrough resource allocation devmethods. Obtained from: Semihalf Sponsored by: Alstom Group
* etherswitch/felix: remove unused functionBjoern A. Zeeb2021-11-091-13/+0
| | | | | | | | Remove unused file-local static function felix_phyforport() which was missed in 29cf6a79acb7 to avoid compile time warning. Reviewed by: Kornel Duleba (mindal semihalf.com) Differential Revision: https://reviews.freebsd.org/D32906
* felix: Add a sysctl to control timer routine frequencyKornel Duleba2021-10-292-1/+39
| | | | | | | | | | Driver polls status of all PHYs connected to the switch in a fixed interval. Add a sysctl that allows to control frequency of that. The value is expressed in ticks and defaults to "hz", or 1 second. Obtained from: Semihalf Sponsored by: Alstom Group
* felix: Use internal MDIO regs for PHY communicationKornel Duleba2021-10-293-41/+33
| | | | | | | | | | Previously we would use an external MDIO device found on the PCI bus. Switch to using MDIO mapped in a separate BAR of the switch device. It is much easier this way since we don't have to depend on another driver anymore. Obtained from: Semihalf Sponsored by: Alstom Group
* 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
* enetc_mdio: Support building the driver as a loadable module.Kornel Duleba2021-08-031-0/+2
| | | | | | | | After recent arm64 GENERIC config cleanup the ENETC MDIO in NXP LS1028A SoC should support being loaded as a module. Obtained from: Semihalf Sponsored by: Alstom Group
* Introduce driver for Freescale Felix switchMarcin Wojtas2021-08-033-0/+1201
| | | | | | | | | | | | | | It is found on boards equipped with LS1028A SoC. 802.1q VLAN grouping is supported. An external MDIO device is used for communicating with PHYs. The driver is built as a module by default, it is not included in GENERIC kernel config. Submitted by: Lukasz Hajec <lha@semihalf.com> Kornel Duleba <mindal@semihalf.com> Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D30923
* etherswitch: Add a new striptagingress port flagKornel Duleba2021-08-031-9/+10
| | | | | | | | | | | Felix switch found in LS1028A supports stripping VLAN tag on ingress, instead of egress. The striptag flag excepts the latter behaviour. Add a new flag to support the feature. Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D30922
* [etherswitch] bump register width to 32 bits.Adrian Chadd2020-05-081-1/+1
| | | | | | | | | | Some ethernet switches have very large register windows; for example the AR8316 switch MIB starts at 0x20000. Submitted by: Mori Hiroki <yamori813@yahoo.co.jp> Notes: svn path=/head/; revision=360827
* remove extraneous double ;s in sys/Ed Maste2020-03-301-1/+1
| | | | Notes: svn path=/head/; revision=359441
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-262-2/+4
| | | | | | | | | | | | | | | | | | | 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
* 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-49/+187
| | | | | | | | | | | 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-323/+608
| | | | | | | | Tested on: espressobin, Clearfog, SG-3100 and others Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=349521
* Add the 'drop tagged' flag support for ethernet switch ports.Luiz Otavio O Souza2019-06-281-1/+3
| | | | | | | | | This is intended to drop all 802.1q tagged packets on a port. Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=349520
* 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
* [arswitch] Implement the switch MAC address fetch API.Adrian Chadd2018-02-063-0/+65
| | | | | | | | | | | | The placeholders are here for some future "set" MAC address API. Tested: * AR9340 switch * AR8327 switch Notes: svn path=/head/; revision=328924
* [etherswitch] add initial support for potentially configuring and fetching ↵Adrian Chadd2018-02-061-0/+2
| | | | | | | | | | | | the switch MAC address. Switches that originate their own frames (eg obvious ones like Pause frames) need a MAC address to use to send those frames from. This API will hopefully begin to allow that to be configurable. Notes: svn path=/head/; revision=328922
* [arswitch] disable ARP copy-to-CPU port for AR9340 for now.Adrian Chadd2018-02-051-0/+2
| | | | | | | | | | | I'll have to go double check to see if it does indeed pass ARP frames between switch ports with this disabled, but it seems required for the CPU port to see ARP traffic. I'll dig into this some more. Notes: svn path=/head/; revision=328901
* [arswitch] fix build breakage.Adrian Chadd2018-02-051-1/+1
| | | | | | | | Apparently the last time I checked building this it didn't pick up that the header had changed. Notes: svn path=/head/; revision=328900
* [arswitch] Enable ATU dump support for the AR9340.Adrian Chadd2018-02-051-11/+11
| | | | | | | | | | | | | | | | This indeed uses the same registers as the AR8216 and later chips. There seems to be an issue with ARP requests being sent out from the CPU through this switch here, so figuring that out is next. Learning works fine on the AR8327 ethernet switch on the /other/ gigabit ethernet port, so I don't think it's the network stack or ethernet driver. Tested: * DB120 - AR9340 SOC + ethernet switch (and other bits.) Notes: svn path=/head/; revision=328873
* [arswitch] fix mac address field definition.Adrian Chadd2018-02-051-4/+18
| | | | | | | | | | | | | Whilst here, add some further fields for future experimenting. Tested: * AR9340 switch * AR9330 switch * AR7240 switch Notes: svn path=/head/; revision=328872
* [arswitch] Break out of the loop upon any error, not just -1.Adrian Chadd2018-02-051-1/+1
| | | | | | | This fixes the AR9340 "unimplemented" thingy for now. Notes: svn path=/head/; revision=328871
* [arswitch] fix up issues on the AR8327.Adrian Chadd2018-02-042-7/+7
| | | | | | | | | | | | | | | | | | | | This correctly dumps the ethernet bridge contents on an AR8327 switch. Tested: * AP135 - QCA9550 + AR8327 ethernet switch: # etherswitchcfg atu dump [0] c0:3f:d5:7e:6f:45: portmask 0x00000004 [1] f6:b6:03:96:1e:ba: portmask 0x00000004 [2] 00:03:7f:11:38:4f: portmask 0x00000040 # arp -na ? (192.168.3.170) at 00:03:7f:11:38:4f on arge0 permanent [ethernet] ? (192.168.3.12) at c0:3f:d5:7e:6f:45 on arge0 expires in 1188 seconds [ethernet] ? (192.168.3.1) at f6:b6:03:96:1e:ba on arge0 expires in 1186 seconds [ethernet] Notes: svn path=/head/; revision=328838
* [arswitch] add initial functionality for AR8327 ATU management.Adrian Chadd2018-02-032-5/+108
| | | | | | | | | | | | | * Add the bulk of the ATU table read function * Correct how the ATU function and WAIT bits work TODO: * more testing, figure out how the multi-vlan table stuff works and push that up to userspace Notes: svn path=/head/; revision=328823
* [arswitch] Stub out the ATU table dump in AR9340 switches until I implementAdrian Chadd2018-02-021-0/+11
| | | | | | | this. Notes: svn path=/head/; revision=328814
* [arswitch] begin tidying up the learning and ATU management, introduce ATU APIs.Adrian Chadd2018-02-027-29/+406
| | | | | | | | | | | | | | | | | | | | | | | | | * Refactor the initial learning configuration (port learning, address expiry, handling address moving between ports, etc, etc) into a separate HAL routine * and ensure that it's consistent between switch chips - the AR8216,8316,724x,9331 SoCs all share the same switch code. * .. the AR8327 needs doing - the defaults seem OK for now * .. the AR9340 is different but it's also programmed now. * Add support for flushing a single port worth of ATU entries * Add support for fetching the ATU table from AR8216 and derived chips Tested: * AR9344, Carambola 2 TODO: * Further testing on other chips * Add AR9340 support * Add AR8327 support Notes: svn path=/head/; revision=328812
* [etherswitch] add the first pass of a simple API to flush and fetch the L2 ↵Adrian Chadd2018-02-023-0/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | address table from the ethernet switch. This stuff may be a bit fluid during this -HEAD cycle as various other switch features are added, but the current stuff is enough to drive initial development and features on the atheros range of integrated and external switches. * add a method to flush the whole address table; * add a method to flush all addresses on a given port; * add a method to download the address table; * .. and then a method to fetch entries from the address table. The table fetch/read methods pass through to the drivers for now since the drivers may implement different ways of fetching/caching the address table data. The atheros devices for example fetch the table by iterating over the table through a set of registers and so you need to keep that locked whilst you iterate otherwise you may have the table flushed half way by a port status change. This is a no-op until the userland and arswitch code shows up. Notes: svn path=/head/; revision=328766
* [arswitch] Fix ATU programming on the AR8327 switch.Adrian Chadd2018-01-311-1/+1
| | | | | | | Doing a flush actually requires setting this bit. Notes: svn path=/head/; revision=328619
* [arswitch] Fix ATU flushing on AR8216/AR8316 and most of the later chips.Adrian Chadd2018-01-311-1/+1
| | | | | | | | | | | | | | The switch hardware requires this bit to be set in order to kick start the actual ATU update. This was being masked on some chips by the learning programming (what to do when a MAC address moves, hash table collision, etc) which is currently inconsistent between chips. Tested: * AR9344 SoC (AR7240 style switch internal) Notes: svn path=/head/; revision=328618
* [arswitch] add a new debug section for upcoming address table management.Adrian Chadd2018-01-311-0/+3
| | | | Notes: svn path=/head/; revision=328617
* [etherswitch] fix LINT build for rtl8366rbMichael Zhilin2018-01-251-1/+1
| | | | | | | | | | | Build with rtl8366rb has been broken due to incorrect retrieval of pointer to device_t. Reported by: lwhsu Differential Revision: https://reviews.freebsd.org/D14044 Notes: svn path=/head/; revision=328389
* [etherswitch] check if_alloc returns NULLMichael Zhilin2018-01-248-0/+48
| | | | | | | | | | | 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
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-2738-0/+76
| | | | | | | | | | | | | | | 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
* 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
* [etherswitch] [rtl8366] add phy4cpu setting and support mdioproxyMichael Zhilin2017-05-282-33/+80
| | | | | | | | | | Tested on WZR-HP-G301NH(RTL8366RB) and WZR-HP-G300NH(RTL8366SR). Submitted by: Hiroki Mori <yamori813@yahoo.co.jp> Differential Revision: https://reviews.freebsd.org/D10740 Notes: svn path=/head/; revision=319070
* [arswitch] add phy debugging to the internal PHY read/write functions.Adrian Chadd2017-05-231-0/+15
| | | | Notes: svn path=/head/; revision=318690