aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ramips/files-4.14/drivers/net
Commit message (Collapse)AuthorAgeFilesLines
* ramips: mt7530: more detailed output for unexpected etag_ctrlYousong Zhou2020-03-031-1/+2
| | | | Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
* ramips: mt7530: remove redundant global attrs for port mirroringYousong Zhou2020-03-031-88/+0
| | | | | | | | | | | | | | | | | | | | Global attributes enable_mirror_tx/enable_mirror_rx depend on runtime value of another global attribute mirror_source_port which just resides in the memory The same functionality can be achieved by directly setting port attribute of the same names. E.g. the following two groups of commands achieve the same thing swconfig dev switch0 set mirror_source_port 3 swconfig dev switch0 set enable_mirror_tx 1 swconfig dev switch0 set mirror_source_port 4 swconfig dev switch0 set enable_mirror_tx 1 swconfig dev switch0 port 3 set enable_mirror_tx 1 swconfig dev switch0 port 4 set enable_mirror_tx 1 Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
* ramips: gsw_mt7621: disable PORT 5 MAC RX/TX flow control by defaultPetr Štetiar2020-02-201-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | Looking at the current upstream driver implementation, it seems like the TX/RX flow control is enabled only if the flow control pause option is resolved from the device/link partner advertisements (or otherwise set). On the other hand, our current in-tree driver force enables TX/RX flow control by default, thus possibly leading to TX timeouts if the other end sends pause frames (which are not properly handled?): WARNING: CPU: 3 PID: 0 at net/sched/sch_generic.c:320 dev_watchdog+0x1ac/0x324 NETDEV WATCHDOG: eth0 (mtk_soc_eth): transmit queue 0 timed out Disabling the flow control on PORT 5 MAC seems to fix this issues as the pause frames are then filtered out. While at it, I'm removing the if condition completely as suggested, since this code is run only on mt7621 SoC, so there is no need to check for the silicon revisions. Ref: https://lists.openwrt.org/pipermail/openwrt-devel/2017-November/009882.html Ref: https://forum.openwrt.org/t/mtk-soc-eth-watchdog-timeout-after-r11573/50000/12 Suggested-by: Felix Fietkau <nbd@nbd.name> Reported-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Petr Štetiar <ynezz@true.cz>
* ramips: apply LED_POLARITY rt3050-esw on MT7628AN/MT7688Maximilian Pachl2020-01-191-0/+4
| | | | | | | | | | | The device tree property "mediatek,led_polarity" is ignored for MT7628AN and MT7688. According to the datasheet both SoCs have the matching register. Therefore the property should be applied on these two devices as well. Signed-off-by: Maximilian Pachl <m@ximilian.info> Reviewed-by: Sungbo Eo <mans0n@gorani.run> Tested-by: Sungbo Eo <mans0n@gorani.run>
* ramips: ethernet: Replace random_ether_addr with eth_hw_addr_randomRosen Penev2019-10-271-1/+1
| | | | | | eth_hw_addr_random additionally sets addr_assign_type to NET_ADDR_RANDOM. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* ramips: add MT7530 switch port-mirroring supportDeng Qingfang2019-08-181-0/+228
| | | | | | | | Compile & run tested on MT7620, MT7621 Signed-off-by: Deng Qingfang <dengqf6@mail2.sysu.edu.cn> [Tested on Phicomm PSG1218 rev.A, MediaTek MT7620A ver:2 eco:6] Tested-by: MingHao Chen <cmheia@email.com>
* ramips: mt7620: add EPHY base mdio address changing possibilityPawel Dembicki2019-06-202-46/+62
| | | | | | | | | | | In some boards is requred to change the ephy mdio base address. This patch add of property "mediatek,ephy-base-address" in gsw part, which allows to change ephy base address. Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com> [fixed indentation in header file] Signed-off-by: Petr Štetiar <ynezz@true.cz>
* ramips: mt7620: fix external PHY autopollingPawel Dembicki2019-06-201-4/+6
| | | | | | | | | | | | | | | | | The port initialisation is based on assumption that phy address and port number is the same. SoC allow different numbers and some board have it. Use phy address instead the port number to make sure that correct addresses are polled. In situation when only one PHY with address 0x0 is conected to port 4, autopolling is broken. This patch make autopolling correct when port number and phy address are different. Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
* ramips: handle mdio address and switch port seperateMathias Kresin2019-06-204-11/+14
| | | | | | | | | | | | | | | The phy handling code forces a phy mdio address and the switch port to which a phy is attached to be the same. Albeit such a configuration is used for most boards, it isn't for all. Pass the switch port number to the ethernet phy connect functions, to ensure the correct list entry is edited and not the list entry that matches th phys mdio address. Use the mdio address with mdiobus_get_phy instead of the port number, to make sure the expected ethernet phy gets connected. Signed-off-by: Mathias Kresin <dev@kresin.me>
* ramips: ignore already handled ethernet physMathias Kresin2019-06-201-2/+8
| | | | | | | | | | | | The whole logic in fe_phy_connect() is based on the asumption that mdio address and switch port id are equal. Albeit it is true for most boards, it doesn't is for all. It isn't yet clear which subtargets/boards require the devicetree less ethernet phy handling. Hence change the code in a way that it doesn't touch ethernet phys which were early attached and are already handled. Signed-off-by: Mathias Kresin <dev@kresin.me>
* ramips: add support for Edimax EW-7476RPC / EW-7478ACBirger Koblitz2019-06-201-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SoC: MediaTek MT7620a @ 580MHz RAM: 64M (Winbond W9751G6KB-25) FLASH: 8MB (Macronix) WiFi: SoC-integrated: MediaTek MT7620a bgn WiFi: MediaTek MT7612EN nac GbE: 1x (RTL8211E) BTN: WPS - RFKILL/RF 50%/RF 100% toggle LED: - Wifi 5g (blue) - Wifi 2g (blue) - Crossband (green) - Power (green) - WPS (green) - LAN (Green) UART: UART is present as Pads with throughholes on the PCB. They are located next to the switch for the wifi configuration 3.3V - RX - GND - TX / 57600-8N1 3.3V is the square pad Installation ------------ Update the factory image via the web-interfaces (by default: 192.168.9.2/24). http://192.168.9.2/index.asp ramips: add Edimax EW-7478AC SoC: MediaTek MT7620a @ 580MHz RAM: 64M (Winbond W9751G6KB-25) FLASH: 8MB (Macronix) WiFi: SoC-integrated: MediaTek MT7620a bgn WiFi: MediaTek MT7612EN nac GbE: 1x (RTL8211E) BTN: WPS - RFKILL/RF 50%/RF 100% toggle LED: - Wifi 5g (blue) - Wifi 2g (blue) - Crossband (green) - Power (green) - WPS (green) - LAN (Green) UART: UART is present as Pads with throughholes on the PCB. They are located next to the switch for the wifi configuration 3.3V - RX - GND - TX / 57600-8N1 3.3V is the square pad Installation ------------ Update the factory image via the web-interfaces (by default: http://edimaxext.setup) Or push wpa button on power on and send firmware via tftp to 192.168.1.6 The EW-7478AC is identical to the EW-7476RPC, except instead of 2 internal antennas it has 2 external ones. Signed-off-by: Birger Koblitz <mail@birger-koblitz.de> [merge conflict in 01_leds] Signed-off-by: Petr Štetiar <ynezz@true.cz>
* ramips: ethernet: remove unused SIOCETHTOOL ioctl handlingPetr Štetiar2019-06-051-12/+1
| | | | | | | | | | | | | This ioctl is currently routed through generic interface code. dev_ioctl dev_ethtool __ethtool_get_link_ksettings phy_ethtool_ioctl Cc: Felix Fietkau <nbd@nbd.name> Cc: John Crispin <john@phrozen.org> Signed-off-by: Petr Štetiar <ynezz@true.cz>
* ramips: implement vlan rx offload on MT7621Felix Fietkau2019-04-033-4/+11
| | | | | | Avoids the overhead of software VLAN untagging in the network stack Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ramips: allow packets with ttl=0Felix Fietkau2019-03-241-2/+2
| | | | | | | Some broken ISPs (e.g. Comcast) send DHCPv6 packets with hop limit=0. This trips up the TTL=0 check in the PPE if enabled. Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ramips: fix two-way hash and auto ageout on MT7621HsiuWen Yen2019-01-231-17/+18
| | | | | | | | | | | | | | | | | | | | | | | | Current code directly writes the FOE entry to hash_val+1 position when hash collision occurs. However, it is found that this behavior will cause the cache and the hardware FOE table to be inconsistent. For example, there are three flows, and their hashed values are all equal to 100. The first flow is written to the position of 100. The second flow is written to the position of 100+1. Then, the logic of the current code will also write the third flow to 100+1. At this time, the cache has flow 1 and 2; and the hardware FOE table has flow 1 and 3, where these two parts store different contents. So it is necessary to check whether the hash_val+1 is also occupied before writing. If hash_val+1 is also occupied, we won’t bind th third flow to the FOE table. Addition to that, we also cancel the processing of foe_entry removal because the hardware has auto age-out ability. The hardware will periodically iterate through the FOE table to find out the time-out entry and set it as INVALID. Signed-off-by: HsiuWen Yen <y.hsiuwen@gmail.com>
* ramips: whitespace cleanup inside hnat driverJohn Crispin2019-01-071-6/+8
| | | | Signed-off-by: John Crispin <john@phrozen.org>
* ramips: add two-way hashing scheme for MT7621HsiuWen Yen2019-01-071-0/+11
| | | | | | | | | | Sometimes the tuples might be hashed to the same FOE entry. When this hash collision problem occurs, some of the connections will not be bound and consequently the CPU idle rate cannot reach 100%. Therefore, two-way hashing is adopted to alleviate this problem. Signed-off-by: HsiuWen Yen <y.hsiuwen@gmail.com>
* ramips: mt7620: add force use of mdio-modePawel Dembicki2018-11-261-0/+3
| | | | | | | | Some boards have external switches different than mt7530. This patch allow to use mdio-mode without 0x1f register. Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
* ramips: ethernet: unify tx descriptor buffer splittingFelix Fietkau2018-09-031-75/+83
| | | | | | | | A buffer is split into multiple descriptors if it exceeds 16 KB. Apply the same split for the skb head as well (to deal with corner cases on fraglist support) Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ramips: mt7620: fix bad indentMathias Kresin2018-08-161-7/+6
| | | | | | | Fix the indent to make the make it obvious which condition is the parent of the loop. Signed-off-by: Mathias Kresin <dev@kresin.me>
* ramips: mt7620: enable all ports unconditionallyPawel Dembicki2018-08-151-1/+10
| | | | | | | This patch make all mt7620 ephy ports turned on. It is necessary for some JBOOT devices. Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
* mt7620: gsw: make IntPHY and ExtPHY share mdio addr 4 possibleChen Minqiang2018-08-061-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | To share mdio addr for IntPHY and ExtPHY, as described in the documentation (MT7620_ProgrammingGuide.pdf). (refer: http://download.villagetelco.org/hardware/MT7620/MT7620_ProgrammingGuide.pdf) when port4 setup to work as gmac mode, dts like: &gsw { mediatek,port4 = "gmac"; }; we should set SYSCFG1.GE2_MODE==0x0 (RGMII). but SYSCFG1.GE2_MODE may have been set to 3(RJ-45) by uboot/default so we need to re-set it to 0x0 before this changes: gsw: 4FE + 2GE may not work correctly and MDIO addr 4 cannot be used by ExtPHY after this changes: gsw: 4FE + 2GE works and MDIO addr 4 can be used by ExtPHY Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
* ramips: fix gigabit switch PHY access on MDIODaniel Gimpelevich2018-08-061-1/+2
| | | | | | | | | | When PHY's are defined on the MDIO bus in the DTS, gigabit support was being masked out for no apparent reason, pegging all such ports to 10/100. If gigabit support must be disabled for some reason, there should be a "max-speed" property in the DTS. Reported-by: James McKenzie <openwrt@madingley.org> Signed-off-by: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
* ramips: remove superfluous & confusing DT bindingDaniel Gimpelevich2018-08-061-3/+24
| | | | | | | | | | | Mediatek has a reference platform that pairs an MT7620A with an MT7530W, where the latter responds on MDIO address 0x1f while both chips respond on 0x0 to 0x4. The driver special-cases this arrangement to make sure it's talking to the right chip, but two different ways in two different places. This patch consolidates the detection without the current requirement of both tests to be separately satisfied in the DTS. Signed-off-by: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
* ramips: ethernet: disable fraglist supportFelix Fietkau2018-07-141-1/+1
| | | | | | | The code has some remaining issues that cause ethernet hangs, so disable it for now until we can get it fixed Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ramips: ethernet: use own page_frag_cacheFelix Fietkau2018-07-122-3/+15
| | | | | | | | | | | | | | | | Using the NAPI or netdev frag cache along with other drivers can lead to 32 KiB pages being held for a long time, despite only being used for very few page fragment. This can happen if the ethernet driver grabs one or two fragments for rx ring refill, while other drivers use (and free up) the remaining fragments. The 32 KiB higher-order page can only be freed once all users have freed their fragments, which only happens after the rings of all drivers holding the fragments have wrapped around. Depending on the traffic patterns, this can waste a lot of memory and look a lot like a memory leak Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ramips: ethernet: use skb_free_frag to free fragmentsFelix Fietkau2018-07-121-3/+3
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ramips: improve ethernet driver performance with GRO/TSOFelix Fietkau2018-06-193-76/+105
| | | | | | | | | | | GRO stores packets as fraglist. If they are routed back to the ethernet device, they need to be re-segmented if the driver does not support sending fraglists. Add the missing support for that, along with a missing feature flag that allows full routed GRO->TSO offload. Considerably reduces CPU utilization for routing Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ramips: mt7621: fix mtu setting with kernel 4.14Mathias Kresin2018-06-161-11/+7
| | | | | | | | | | Since kernel 4.10 commit 61e84623ace3 ("net: centralize net_device min/max MTU checking"), the range of mtu is [min_mtu, max_mtu], which is [68, 1500] by default. It's necessary to set a max_mtu if a mtu > 1500 is supported. Signed-off-by: Mathias Kresin <dev@kresin.me>
* ramips: rename ethernet driver folder to the same one that upstream usesFelix Fietkau2018-06-1326-0/+0
| | | | | | | Preparation for sharing offload code with the mediatek target through generic files/ Signed-off-by: Felix Fietkau <nbd@nbd.name>
* staging: mt7621-eth: fix return value check in mt7621_gsw_probe()Wei Yongjun2018-05-153-6/+6
| | | | | | | | | | In case of error, the function devm_ioremap_resource() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: f079b6406348 ("staging: mt7621-eth: add gigabit switch driver (GSW)") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: mt7621-eth: fix return value check in mtk_connect_phy_node()Wei Yongjun2018-05-151-2/+2
| | | | | | | | | | In case of error, the function of_phy_connect() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Fixes: e3cbf478f846 ("staging: mt7621-eth: add the drivers core files") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: mt7621-eth: fix return value check in mtk_probe()Wei Yongjun2018-05-151-1/+1
| | | | | | | | | | In case of error, the function devm_ioremap_resource() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: e3cbf478f846 ("staging: mt7621-eth: add the drivers core files") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* ramips: fix locking issues in the ethernet driverFelix Fietkau2018-04-171-2/+3
| | | | | | | The stats update needs to protect against being interrupted by a tasklet The u64 stats seqlock needs to be initialized Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ramips: add missing unlock in fe_phy_link_adjustFelix Fietkau2018-04-141-0/+1
| | | | | | Based on patch by Neil Brown Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ramips: fix build error caused by missing ifdef guard in hwnat codeJohn Crispin2018-04-061-1/+4
| | | | Signed-off-by: John Crispin <john@phrozen.org>
* ramips: implement hardware NAT offload for MT7621John Crispin2018-04-067-3/+975
| | | | | | | | | | Supports IPv4 flow offloading on MT7621 for Routing, SNAT and DNAT Supported are regular ethernet->ethernet connections, including one 802.1q VLAN and/or PPPoE encapsulation Signed-off-by: John Crispin <john@phrozen.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ramips: remove dead (and potentially crashy) code in mt7621 gsw initFelix Fietkau2018-03-231-11/+0
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ramips: rename ethernet priv->device field to dev to match upstreamFelix Fietkau2018-03-237-26/+26
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ramips: mt7620: power up ephy port 4Pawel Dembicki2018-03-061-0/+1
| | | | | | | | | | | In some boards port 4 of mt7620 switch is powered down in bootloader configuration as lan/wan package leak mitigation. Reset ephy port 4 to default settings to power up the port. Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com> [clarify issue in commit message] Signed-off-by: Mathias Kresin <dev@kresin.me>
* ramips: fix MT7621 switch driver IRQ storm on init with linux 4.14Felix Fietkau2018-02-211-4/+7
| | | | | | | | The hardware emits some interrupts while initializing and handling them can mess up the state or cause infinite loops. Fix this by disabling IRQs during init and re-enabling them afterwards Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ramips: preliminary support for 4.14Roman Yeryomin2018-02-1523-0/+7314
- removed upstreamed patches - 0901-spansion_nand_id_fix.patch is disabled, not clear if it's needed Signed-off-by: Roman Yeryomin <roman@advem.lv> Signed-off-by: John Crispin <john@phrozen.org>