summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mediatek
Commit message (Collapse)AuthorAgeFilesLines
* net: ethernet: mediatek: enhance with avoiding superfluous assignment inside ↵Sean Wang2016-09-211-1/+2
| | | | | | | | | | | mtk_get_ethtool_stats data_src is unchanged inside the loop, so this patch moves the assignment to outside the loop to avoid unnecessarily assignment Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: ethernet: mediatek: add ethtool functions to configure RX flows of HW LRONelson Chang2016-09-191-0/+236
| | | | | | | | | | | | | The codes add ethtool functions to set RX flows for HW LRO. Because the HW LRO hardware can only recognize the destination IP of TCP/IP RX flows, the ethtool command to add HW LRO flow is as below: ethtool -N [devname] flow-type tcp4 dst-ip [ip_addr] loc [0~1] Otherwise, cause the hardware can set total four destination IPs, each GMAC (GMAC1/GMAC2) can set two IPs separately at most. Signed-off-by: Nelson Chang <nelson.chang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: ethernet: mediatek: add HW LRO functions of PDMA RX ringsNelson Chang2016-09-192-25/+265
| | | | | | | | | | | | | | | | The codes add the large receive offload (LRO) functions by hardware as below: 1) PDMA has total four RX rings that one is the normal ring, and others can be configured as LRO rings. 2) Only TCP/IP RX flows can be offloaded. The hardware can set four IP addresses at most, if the destination IP of the RX flow matches one of them, it has the chance to be offloaded. 3) There three RX flows can be offloaded at most, and one flow is mapped to one RX ring. 4) If there are more than three candidate RX flows, the hardware can choose three of them by throughput comparison results. Signed-off-by: Nelson Chang <nelson.chang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: ethernet: mediatek: avoid race condition during the reset processSean Wang2016-09-162-1/+38
| | | | | | | | | add the protection of the race condition between the reset process and hardware access happening on the related callbacks. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: ethernet: mediatek: add more resets for internal ethernet circuit blockSean Wang2016-09-162-13/+20
| | | | | | | | | | | struct mtk_eth has already contained struct regmap ethsys pointer to the address range of the internal circuit reset, so we reuse it to reset more internal blocks on ethernet hardware such as packet processing engine (PPE) and frame engine (FE) instead of rstc which deals with FE only. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: ethernet: mediatek: add the whole ethernet reset into the reset processSean Wang2016-09-162-8/+51
| | | | | | | | | | | | | | | | | | | | | | 1) original driver only resets DMA used by descriptor rings which can't guarantee it can recover all various kinds of fatal errors, so the patch tries to reset the underlying hardware resource from scratch on Mediatek SoC required for ethernet running, including power, pin mux control, clock and internal circuits on the ethernet in order to restore into the initial state which the rebooted machine gives. 2) add state variable inside structure mtk_eth to help distinguish mtk_hw_init is called between the initialization during boot time or re-initialization during the reset process. 3) add ge_mode variable inside structure mtk_mac for restoring the interface mode of the current setup for the target MAC. 4) remove __init attribute from mtk_hw_init definition Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: ethernet: mediatek: add controlling power domain the ethernet belongs toSean Wang2016-09-161-0/+7
| | | | | | | | | | | introduce power domain control which the digital circuit of the ethernet belongs to inside the flow of hardware initialization and deinitialization which helps the entire ethernet hardware block could restart cleanly and completely as being back to the initial state when the whole machine reboot. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: ethernet: mediatek: cleanup error path inside mtk_hw_initSean Wang2016-09-161-5/+29
| | | | | | | | | This cleans up the error path inside mtk_hw_init call, causing it able to exit appropriately when something fails and also includes refactoring mtk_cleanup call to make the partial logic reusable on the error path. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: ethernet: mediatek: add mtk_hw_deinit call as the opposite to ↵Sean Wang2016-09-161-4/+11
| | | | | | | | | | | mtk_hw_init call grouping things related to the deinitialization of what mtk_hw_init call does that help to be reused by the reset process and the error path handling. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: ethernet: mediatek: refactoring mtk_hw_init to be reusedSean Wang2016-09-161-28/+34
| | | | | | | | | | | | | | the existing mtk_hw_init includes hardware and software initialization inside so that it is slightly hard to reuse them for the process of the reset recovery, so some splitting is made here for keeping hardware initializing relevant thing and the else such as IRQ registration and MDIO initialization what are all about to the interface of core driver moved to the other proper place because they have no needs to register IRQ and re-initialize structure again during the reset process. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller2016-09-132-45/+55
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: drivers/net/ethernet/mediatek/mtk_eth_soc.c drivers/net/ethernet/qlogic/qed/qed_dcbx.c drivers/net/phy/Kconfig All conflicts were cases of overlapping commits. Signed-off-by: David S. Miller <davem@davemloft.net>
| * net: ethernet: mediatek: fix error handling inside mtk_mdio_initSean Wang2016-09-011-1/+1
| | | | | | | | | | | | | | | | | | Return -ENODEV if the MDIO bus is disabled in the device tree. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Acked-by: John Crispin <john@phrozen.org> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net: ethernet: mediatek: use devm_mdiobus_alloc instead of mdiobus_alloc ↵Sean Wang2016-09-011-17/+6Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | inside mtk_mdio_init a lot of parts in the driver uses devm_* APIs to gain benefits from the device resource management, so devm_mdiobus_alloc is also used instead of mdiobus_alloc to have more elegant code flow. Using common code provided by the devm_* helps to 1) have simplified the code flow as [1] says 2) decrease the risk of incorrect error handling by human 3) only a few drivers used it since it was proposed on linux 3.16, so just hope to promote for this. Ref: [1] https://patchwork.ozlabs.org/patch/344093/ Signed-off-by: Sean Wang <sean.wang@mediatek.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net: ethernet: mediatek: fix the missing of_node_put() after node is used ↵Sean Wang2016-09-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | done inside mtk_mdio_init This patch adds the missing of_node_put() after finishing the usage of of_get_child_by_name. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Acked-by: John Crispin <john@phrozen.org> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net: ethernet: mediatek: fix issue of driver removal with interface is upSean Wang2016-09-011-0/+8
| | | | | | | | | | | | | | | | | | mtk_stop() must be called to stop for freeing DMA resources acquired and restoring state changed by mtk_open() firstly when module removal. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net: ethernet: mediatek: fix logic unbalance between probe and removeSean Wang2016-09-011-1/+1
| | | | | | | | | | | | | | | | | | original mdio_cleanup is not in the symmetric place against where mdio_init is, so relocate mdio_cleanup to the right one. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Acked-by: John Crispin <john@phrozen.org> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net: ethernet: mediatek: remove redundant free_irq for devm_request_irq ↵Sean Wang2016-09-011-2/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | allocated irq these irqs are not used for shared irq and disabled during ethernet stops. irq requested by devm_request_irq is safe to be freed automatically on driver detach. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Acked-by: John Crispin <john@phrozen.org> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net: ethernet: mediatek: fix API usage with skb_free_fragSean Wang2016-09-011-1/+1
| | | | | | | | | | | | | | | | use skb_free_frag() instead of legacy put_page() Signed-off-by: Sean Wang <sean.wang@mediatek.com> Acked-by: John Crispin <john@phrozen.org> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net: ethernet: mediatek: fix incorrect return value of devm_clk_get with ↵Sean Wang2016-09-012-25/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | EPROBE_DEFER 1) If the return value of devm_clk_get is EPROBE_DEFER, we should defer probing the driver. The change is verified and works based on 4.8-rc1 staying with the latest clk-next code for MT7623. 2) Changing with the usage of loops to work out if all clocks required are fine Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net: ethernet: mediatek: fix fails from TX housekeeping due to incorrect ↵Sean Wang2016-09-011-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | port setup which net device the SKB is complete for depends on the forward port on txd4 on the corresponding TX descriptor, but the information isn't set up well in case of SKB fragments that would lead to watchdog timeout from the upper layer, so fix it up. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Acked-by: John Crispin <john@phrozen.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* | net: ethernet: mediatek: enhance RX path by aggregating more SKBs into NAPISean Wang2016-09-061-14/+17
| | | | | | | | | | | | | | | | | | | | | | The patch adds support for aggregating more SKBs feed into NAPI in order to get more benefits from generic receive offload (GRO) by peeking at the RX ring status and moving more packets right before returning from NAPI RX polling handler if NAPI budgets are still available and some packets already present in hardware. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | net: ethernet: mediatek: enhance RX path by reducing the frequency of the ↵Sean Wang2016-09-061-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | memory barrier used The patch makes move wmb() to outside the loop that could help RX path handling more faster although that RX descriptors aren't freed for DMA to use as soon as possible, but based on my experiment and the result shows it still can reach about 943Mbpis without performance drop that is tested based on the setup with one port using Giga PHY and 256 RX descriptors for DMA to move. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | net: mediatek: constify ethtool_ops structuresJulia Lawall2016-09-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check for ethtool_ops structures that are only stored in the ethtool_ops field of a net_device structure or passed as the second argument to netdev_set_default_ethtool_ops. These contexts are declared const, so ethtool_ops structures that have these properties can be declared as const also. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r disable optional_qualifier@ identifier i; position p; @@ static struct ethtool_ops i@p = { ... }; @ok1@ identifier r.i; struct net_device e; position p; @@ e.ethtool_ops = &i@p; @ok2@ identifier r.i; expression e; position p; @@ netdev_set_default_ethtool_ops(e, &i@p) @bad@ position p != {r.p,ok1.p,ok2.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct ethtool_ops i = { ... }; // </smpl> Suggested-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: David S. Miller <davem@davemloft.net>
* | net: ethernet: mediatek: modify GDM to send packets to the PDMA for RXNelson Chang2016-08-271-2/+1Star
| | | | | | | | | | | | | | | | | | Because we change to use the PDMA as the Ethernet RX DMA engine, the patch modifies to set GDM to send packets to PDMA for RX. Acked-by: John Crispin <john@phrozen.org> Signed-off-by: Nelson Chang <nelson.chang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | net: ethernet: mediatek: modify to use the PDMA instead of the QDMA for ↵Nelson Chang2016-08-272-33/+74
| | | | | | | | | | | | | | | | | | | | | | | | Ethernet RX Because the PDMA has richer features than the QDMA for Ethernet RX (such as multiple RX rings, HW LRO, etc.), the patch modifies to use the PDMA to handle Ethernet RX. Acked-by: John Crispin <john@phrozen.org> Signed-off-by: Nelson Chang <nelson.chang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller2016-08-181-16/+33
|\| | | | | | | | | | | | | | | | | Minor overlapping changes for both merge conflicts. Resolution work done by Stephen Rothwell was used as a reference. Signed-off-by: David S. Miller <davem@davemloft.net>
| * net: ethernet: mediatek: fix runtime warning raised by inconsistent struct ↵sean.wang@mediatek.com2016-08-161-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | device pointers passed to DMA API Runtime warning occurs if DMA-API debug feature is enabled that would be raised by pointers passed to DMA API as arguments to inconsistent struct device objects, so that the patch makes them usage aligned between DMA operations such as dma_map_*() and dma_unmap_*() to eliminate the warning. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net: ethernet: mediatek: fix flow control settings on GMAC0 is not being ↵sean.wang@mediatek.com2016-08-161-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | enabled properly Commit 08ef55c6f257acf3bdc6940813f80e8f0f5d90ec ("net-next: mediatek: fix gigabit and flow control advertisement") had supported proper flow control settings for GMAC1. But for GMAC0, 1.GMAC0 shares the common logic with GMAC1 inside mtk_phy_link_adjust() to adapt various settings for the target phy. 2.GMAC0 uses fixed-phy to connect to a builtin gigabit switch with fixed link speed as commit 0c72c50f6f93b0c3daa9ea35d89ab3a933c7b5a0 ("net-next: mediatek: add fixed-phy support") describes. 3.However, fixed-phy doesn't enable SUPPORTED_Pause & SUPPORTED_Asym_Pause supported flag on default that would cause mtk_phy_link_adjust() not to enable flow control setting on GMAC0 properly and cause packet dropped when high traffic. Due to these reasons, the patch adds SUPPORTED_Pause & SUPPORTED_Asym_Pause supported flags on fixed-phy used by the driver to have proper handling on the both GMAC with the shared common logic. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net: ethernet: mediatek: fix RMII mode and add REVMII supported by GMACsean.wang@mediatek.com2016-08-161-3/+12
| | | | | | | | | | | | | | | | | | The patch fixes up the incorrect setup of reduced MII (RMII) on GMAC and adds the supplement for the setup of reverse MII (REVMII) on GMAC , and rearranges the error handling for invalid PHY argument. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net: ethernet: mediatek: add the missing of_node_put() after node is used donesean.wang@mediatek.com2016-08-131-0/+2
| | | | | | | | | | | | | | | | This patch adds the missing of_node_put() after finishing the usage of of_parse_phandle() or of_node_get() used by fixed_phy. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net: ethernet: mediatek: fixed that initializing u64_stats_sync is missingsean.wang@mediatek.com2016-08-131-0/+1
| | | | | | | | | | | | | | | | To fix runtime warning with lockdep is enabled due that u64_stats_sync is not initialized well, so add it. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | net: mediatek: remove unnecessary platform_set_drvdata()Wei Yongjun2016-08-161-1/+0Star
| | | | | | | | | | | | | | | | | | The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | net: ethernet: mediatek: enhance the locking using the lightweight onesSean Wang2016-08-131-11/+8Star
|/ | | | | | | | | | Since these critical sections protected by page_lock are all entered from the user context or bottom half context, they can be replaced with the spin_lock() or spin_lock_bh instead of spin_lock_irqsave(). Signed-off-by: Sean Wang <sean.wang@mediatek.com> Acked-by: John Crispin <john@phrozen.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: mediatek: fix non static symbol warningsWei Yongjun2016-07-121-3/+3
| | | | | | | | | | | | Fixes the following sparse warnings: drivers/net/ethernet/mediatek/mtk_eth_soc.c:79:5: warning: symbol '_mtk_mdio_write' was not declared. Should it be static? drivers/net/ethernet/mediatek/mtk_eth_soc.c:98:5: warning: symbol '_mtk_mdio_read' was not declared. Should it be static? Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: mediatek: remove .owner field for driverWei Yongjun2016-07-071-1/+0Star
| | | | | | | | Remove .owner field since calls to module_platform_driver() will set it automatically. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: David S. Miller <davem@davemloft.net>
* net-next: mediatek: remove superfluous free_irq() callJohn Crispin2016-07-051-1/+0Star
| | | | | | | | | | | | Commit 8067302973a1 ("net-next: mediatek: add support for IRQ grouping") adds handling for irq 1 and 2 to the uninit function but did not remove irq 0 which is not used since irq grouping was introduced. Fix this by removing the superfluous call to free_irq(). Reported-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: John Crispin <john@phrozen.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: David S. Miller <davem@davemloft.net>
* net-next: mediatek: fix compile error inside mtk_poll_controller()John Crispin2016-07-021-1/+1
| | | | | | | | | | commit 8067302973a1 ("net-next: mediatek: add support for IRQ grouping") failed to properly update the irq handling inside mtk_poll_controller() causing compile errors if netconsole was enabled. Fix this by updating the code to use the new separated irq handler function for RX. Signed-off-by: John Crispin <john@phrozen.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* net-next: mediatek: add support for IRQ groupingJohn Crispin2016-06-302-59/+111
| | | | | | | | | | | The ethernet core has 3 IRQs. Using the IRQ grouping registers we are able to separate TX and RX IRQs, which allows us to service them on separate cores. This patch splits the IRQ handler into 2 separate functions, one for TX and another for RX. The TX housekeeping is split out into its own NAPI handler. Signed-off-by: John Crispin <john@phrozen.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* net-next: mediatek: add IRQ lockingJohn Crispin2016-06-302-0/+8
| | | | | | | | | | The code that enables and disables IRQs is missing proper locking. After adding the IRQ grouping patch and routing the RX and TX IRQs to different cores we experienced IRQ stalls. Fix this by adding proper locking. We use a dedicated lock to reduce the latency if the IRQ code. Signed-off-by: John Crispin <john@phrozen.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* net-next: mediatek: don't use intermediate variables to store IRQ masksJohn Crispin2016-06-301-12/+10Star
| | | | | | | | | | | The code currently uses variables to store and never modify the bit masks of interrupts. This is legacy code from an early version of the driver that supported MIPS based SoCs where the IRQ bits depended on the actual SoC. As the bits are the same for all ARM based SoCs using this driver we can remove the intermediate variables. Signed-off-by: John Crispin <john@phrozen.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* net-next: mediatek: remove superfluous register readsJohn Crispin2016-06-301-4/+0Star
| | | | | | | | | | The driver was originally written for MIPS based SoC. These required the IRQ mask register to be read after writing it to ensure that the content was actually applied. As this version only works on ARM based SoCs, we can safely remove the 2 reads as they are no longer required. Signed-off-by: John Crispin <john@phrozen.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: mediatek: remove superfluous queue wake up callJohn Crispin2016-06-111-5/+2Star
| | | | | | | | | | | | | The code checks if the queue should be stopped because we are below the threshold of free descriptors only to check if it should be started again. If we do end up in a state where we are at the threshold limit, it makes more sense to just stop the queue and wait for the next IRQ to trigger the TX housekeeping again. There is no rush in enqueuing the next packet, it needs to wait for all the others in the queue to be dispatched first anyway. Signed-off-by: John Crispin <john@phrozen.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: mediatek: only wake the queue if it is stoppedJohn Crispin2016-06-111-1/+16
| | | | | | | | | The current code unconditionally wakes up the queue at the end of each tx_poll action. Change the code to only wake up the queues if any of them have actually been stopped before. Signed-off-by: John Crispin <john@phrozen.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: mediatek: fix off by one in the TX ring allocationJohn Crispin2016-06-111-2/+1Star
| | | | | | | | | | The TX ring setup has an off by one error causing it to not utilise all descriptors. This has the side effect that we need to reset the next pointer at runtime to make it work. Fix the off by one and remove the code fixing the ring at runtime. Signed-off-by: John Crispin <john@phrozen.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: mediatek: increase watchdog_timeoJohn Crispin2016-06-111-1/+1
| | | | | | | | | | During stress testing, after reducing the threshold value, we have seen TX timeouts that were caused by the watchdog_timeo value being too low. Increase the value to 5 * HZ which is a value commonly used by many other drivers. Signed-off-by: John Crispin <john@phrozen.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: mediatek: fix threshold valueJohn Crispin2016-06-111-2/+1Star
| | | | | | | | | | The logic to calculate the threshold value for stopping the TX queue is bad. Currently it will always use 1/2 of the rings size, which is way too much. Set the threshold to MAX_SKB_FRAGS. This makes sure that the queue is stopped when there is not enough room to accept an additional segment.  Signed-off-by: John Crispin <john@phrozen.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: mediatek: disable all interrupts during probeJohn Crispin2016-06-111-1/+1
| | | | | | | | | The current code only disables those IRQs that we will later use. To ensure that we have a predefined state, we really want to disable all IRQs. Change the code to disable all IRQs to achieve this. Signed-off-by: John Crispin <john@phrozen.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: mediatek: add next data pointer coherency protectionJohn Crispin2016-06-112-1/+2
| | | | | | | | | | The QDMA engine can fail to update the register pointing to the next TX descriptor if this bit does not get set in the QDMA configuration register. Not setting this bit can result in invalid values inside the TX rings registers which will causes TX stalls. Signed-off-by: John Crispin <john@phrozen.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: mediatek: dropped rx packets are not being counted properlyJohn Crispin2016-06-111-0/+2
| | | | | | | | | There are two places inside mtk_poll_rx where rx_dropped is not being incremented properly. Fix this by adding the missing code to increment the counter. Signed-off-by: John Crispin <john@phrozen.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: mediatek: invalid buffer lookup in mtk_tx_map()John Crispin2016-06-111-1/+1
| | | | | | | | | The lookup of the tx_buffer in the error path inside mtk_tx_map() uses the wrong descriptor pointer. This looks like a copy & paste error. Change the code to use the correct pointer. Signed-off-by: John Crispin <john@phrozen.org> Signed-off-by: David S. Miller <davem@davemloft.net>