summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/realtek
AgeCommit message (Collapse)AuthorFilesLines
2020-08-23treewide: Use fallthrough pseudo-keywordGustavo A. R. Silva1-2/+2
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
2020-07-21r8169: allow to enable ASPM on RTL8125AHeiner Kallweit1-0/+2
For most chip versions this has been added already. Allow also for RTL8125A to enable ASPM. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-14r8169: add support for RTL8125BHeiner Kallweit3-23/+141
Add support for RTL8125B rev.b. In my tests 2.5Gbps worked well w/o firmware, however for a stable link at 1Gbps firmware revision 0.0.2 is needed. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-30net: phy: don't abuse devres in devm_mdiobus_register()Bartosz Golaszewski1-1/+1
We currently have two managed helpers for mdiobus - devm_mdiobus_alloc() and devm_mdiobus_register(). The idea behind devres is that the release callback releases whatever resource the devm function allocates. In the mdiobus case however there's no devres associated with the device by devm_mdiobus_register(). Instead the release callback for devm_mdiobus_alloc(): _devm_mdiobus_free() unregisters the device if it is marked as managed. This all seems wrong. The managed structure shouldn't need to know or care about whether it's managed or not - and this is the case now for struct mii_bus. The devres wrapper should be opaque to the managed resource. This changeset makes devm_mdiobus_alloc() and devm_mdiobus_register() conform to common devres standards: devm_mdiobus_alloc() allocates a devres structure and registers a callback that will call mdiobus_free(). __devm_mdiobus_register() allocated another devres and registers a callback that will unregister the bus. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-28r8169: sync support for RTL8401 with vendor driverHeiner Kallweit3-2/+25
So far RTL8401 was treated like a RTL8101e, means we relied on the BIOS to configure MAC and PHY properly. Make RTL8401 a separate chip version and copy MAC / PHY config from r8101 vendor driver. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-28r8169: merge handling of RTL8101e and RTL8100eHeiner Kallweit3-11/+3
Chip versions 13, 14, 15 are treated the same by the driver, therefore let's merge them. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-25Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netDavid S. Miller1-1/+4
Minor overlapping changes in xfrm_device.c, between the double ESP trailing bug fix setting the XFRM_INIT flag and the changes in net-next preparing for bonding encryption support. Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-23r8169: rename RTL8125 to RTL8125AHeiner Kallweit2-21/+21
Realtek added new members to the RTL8125 chip family, therefore rename RTL8125 to RTL8125a. Then we use the same chip naming as in the r8125 vendor driver. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-22r8169: improve rtl8169_runtime_resumeHeiner Kallweit1-10/+3
Simplify rtl8169_runtime_resume() by calling rtl8169_resume(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-22r8169: remove driver-specific mutexHeiner Kallweit1-45/+0
Now that the critical sections are protected with RTNL lock, we don't need a separate mutex any longer. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-22r8169: use RTNL to protect critical sectionsHeiner Kallweit1-0/+8
Most relevant ops (open, close, ethtool ops) are protected with RTNL lock by net core. Make sure that such ops can't be interrupted by e.g. (runtime-)suspending by taking the RTNL lock in suspend ops and the PCI error handler. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-22r8169: add rtl8169_upHeiner Kallweit1-32/+16
Factor out bringing device up to a new function rtl8169_up(), similar to rtl8169_down() for bringing the device down. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-22r8169: remove no longer needed checks for device being runtime-activeHeiner Kallweit1-48/+6
Because the netdevice is marked as detached now when parent is not accessible we can remove quite some checks. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-22r8169: mark device as not present when in PCI D3Heiner Kallweit1-11/+14
Mark the netdevice as detached whenever we go into PCI D3hot. This allows to remove some checks e.g. from ethtool ops because dev_ethtool() checks for netif_device_present() in the beginning. In this context move waking up the queue out of rtl_reset_work() because in cases where netif_device_attach() is called afterwards the queue should be woken up by the latter function only. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-20r8169: fix firmware not resetting tp->ocp_baseHeiner Kallweit1-1/+4
Typically the firmware takes care that tp->ocp_base is reset to its default value. That's not the case (at least) for RTL8117. As a result subsequent PHY access reads/writes the wrong page and the link is broken. Fix this be resetting tp->ocp_base explicitly. Fixes: 229c1e0dfd3d ("r8169: load firmware for RTL8168fp/RTL8117") Reported-by: Aaron Ma <mapengyu@gmail.com> Tested-by: Aaron Ma <mapengyu@gmail.com> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-18r8169: allow setting irq coalescing if link is downHeiner Kallweit1-4/+8
So far we can not configure irq coalescing when link is down. Allow the user to do this, and assume that he wants to configure irq coalescing for highest speed. Otherwise the irq rate is low enough anyway. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-18r8169: move switching optional clock on/off to pll power functionsHeiner Kallweit1-3/+4
Relevant chip clocks are disabled in rtl_pll_power_down(), therefore move calling clk_disable_unprepare() there. Similar for enabling the clock. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-18r8169: move updating counters to rtl8169_downHeiner Kallweit1-6/+2
Counters are updated whenever we go down, therefore move the call to rtl8169_down(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-18r8169: move napi_disable call and rename rtl8169_hw_resetHeiner Kallweit1-5/+5
rtl8169_hw_reset() meanwhile does more than a hw reset, therefore rename it to rtl8169_cleanup(). In addition move calling napi_disable() to this function. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-18r8169: replace synchronize_rcu with synchronize_netHeiner Kallweit1-1/+1
rtl8169_hw_reset() may be called under RTNL lock, therefore switch to synchronize_net(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-18r8169: improve setting WoL on runtime-resumeHeiner Kallweit1-4/+2
In the following scenario WoL isn't configured properly: - Driver is loaded, interface isn't brought up within 10s, so driver runtime-suspends. - WoL is set. - Interface is brought up, stored WoL setting isn't applied. It has always been like that, but the scenario seems to be quite theoretical as I haven't seen any bug report yet. Therefore treat the change as an improvement. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-18r8169: remove unused constant RsvdMaskHeiner Kallweit1-2/+0
Since 9d3679fe0f30 ("r8169: inline rtl8169_make_unusable_by_asic") this constant isn't used any longer, so remove it. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-18r8169: add info for DASH being enabledHeiner Kallweit1-1/+3
In case of problems it facilitates the bug analysis if we know whether DASH is active. Therefore emit a message in probe if this is the case. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-06-14treewide: replace '---help---' in Kconfig files with 'help'Masahiro Yamada1-9/+9
Since commit 84af7a6194e4 ("checkpatch: kconfig: prefer 'help' over '---help---'"), the number of '---help---' has been gradually decreasing, but there are still more than 2400 instances. This commit finishes the conversion. While I touched the lines, I also fixed the indentation. There are a variety of indentation styles found. a) 4 spaces + '---help---' b) 7 spaces + '---help---' c) 8 spaces + '---help---' d) 1 space + 1 tab + '---help---' e) 1 tab + '---help---' (correct indentation) f) 1 tab + 1 space + '---help---' g) 1 tab + 2 spaces + '---help---' In order to convert all of them to 1 tab + 'help', I ran the following commend: $ find . -name 'Kconfig*' | xargs sed -i 's/^[[:space:]]*---help---/\thelp/' Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-06-04r8169: fix failing WoLHeiner Kallweit1-6/+7
Th referenced change added an extra hw reset to rtl8169_net_suspend() what makes WoL fail on few chip versions. Therefore skip the extra reset if we're going down and WoL is enabled. In rtl_shutdown() rtl8169_hw_reset() is called by rtl8169_net_suspend() already if needed, therefore avoid issues issue by removing the extra call. The fix was tested on a system with RTL8168g. Meanwhile rtl8169_hw_reset() does more than a hw reset and should be renamed. But that's net-next material. Fixes: 8ac8e8c64b53 ("r8169: make rtl8169_down central chip quiesce function") Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-30r8169: improve handling power management opsHeiner Kallweit1-19/+9
Simplify handling the power management callbacks. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-30r8169: make rtl8169_down central chip quiesce functionHeiner Kallweit1-22/+11
Functionality for quiescing the chip is spread across different functions currently. Move it to rtl8169_down(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-30r8169: move some calls to rtl8169_hw_resetHeiner Kallweit1-39/+36
Move calls that are needed before and after calling rtl8169_hw_reset() into this function. This requires to move the function in the code. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-30r8169: don't reset tx ring indexes in rtl8169_tx_clearHeiner Kallweit1-1/+0
In places where the indexes have to be reset, we call rtl8169_init_ring_indexes() anyway after rtl8169_tx_clear(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-30r8169: enable WAKE_PHY as only WoL source when runtime-suspendingHeiner Kallweit1-1/+1
We go to runtime-suspend few secs after cable removal. As cable is removed "physical link up" is the only meaningful WoL source. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-30r8169: change driver data typeHeiner Kallweit1-35/+25
Change driver private data type to struct rtl8169_private * to avoid some overhead. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-26r8169: improve rtl_remove_oneHeiner Kallweit1-7/+5
Don't call netif_napi_del() manually, free_netdev() does this for us. In addition reorder calls to match reverse order of calls in probe(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-25r8169: sync RTL8168f/RTL8411 hw config with vendor driverHeiner Kallweit1-3/+3
Sync hw config for RTL8168f/RTL8411 with r8168 vendor driver. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-25r8169: sync RTL8168evl hw config with vendor driverHeiner Kallweit1-3/+5
Sync hw config for RTL8168evl with r8168 vendor driver. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-25r8169: sync RTL8168h hw config with vendor driverHeiner Kallweit1-2/+1
Sync hw config for RTL8168h with r8168 vendor driver. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-25r8169: sync RTL8168g hw config with vendor driverHeiner Kallweit1-0/+1
Sync hw config for RTL8168g with r8168 vendor driver. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-24Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netDavid S. Miller1-2/+15
The MSCC bug fix in 'net' had to be slightly adjusted because the register accesses are done slightly differently in net-next. Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-23r8169: remove mask argument from r8168ep_ocp_readHeiner Kallweit1-7/+5
Remove the mask argument as it's not used by r8168ep_ocp_read(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-23r8169: remove mask argument from r8168dp_ocp_readHeiner Kallweit1-4/+4
All callers read the full 32bit value, therefore the mask argument can be removed. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-23r8169: remove mask argument from rtl_w0w1_eriHeiner Kallweit1-36/+30
rtl_eri_read() returns the full 32bit value, therefore there's no benefit in writing back parts of it only. handle it like the vendor driver and write the full 32 bit always. Omitting the mask argument avoids some overhead and makes the code better readable. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-22r8169: fix OCP access on RTL8117Heiner Kallweit1-2/+15
According to r8168 vendor driver DASHv3 chips like RTL8168fp/RTL8117 need a special addressing for OCP access. Fix is compile-tested only due to missing test hardware. Fixes: 1287723aa139 ("r8169: add support for RTL8117") Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-19realtek/8139cp: use generic power managementVaibhav Gupta1-17/+8
compile-tested only With legacy PM hooks, it was the responsibility of a driver to manage PCI states and also device's power state. The generic approach is to let PCI core handle the work. The suspend callback enables/disables PCI wake on the basis of "cp->wol_enabled" variable which is unknown to PCI core. To utilise its need, call device_set_wakeup_enable(). Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-19realtek/8139too: use generic power managementVaibhav Gupta1-19/+7
compile-tested only With legacy PM hooks, it was the responsibility of a driver to manage PCI states and also device's power state. The generic approach is to let PCI core handle the work. PCI core passes "struct device*" as an argument to the .suspend() and .resume() callbacks. As these callabcks work with "struct net_device*", extract it from "struct device*" using dev_get_drv_data(). Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-18r8169: work around an irq coalescing related tx timeoutHeiner Kallweit1-0/+9
In [0] a user reported reproducible tx timeouts on RTL8168f except PktCntrDisable is set and irq coalescing is enabled. Realtek told me that they are not aware of any related hw issue on this chip version, therefore root cause is still unknown. It's not clear whether the issue affects one or more chip versions in general, or whether issue is specific to reporter's system. Due to this level of uncertainty, and due to the fact that I'm aware of this one report only, let's apply the workaround on net-next only. After this change setting irq coalescing via ethtool can reliably avoid the issue on the affected system. [0] https://bugzilla.kernel.org/show_bug.cgi?id=207205 Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-18r8169: improve rtl8169_mark_to_asicHeiner Kallweit1-3/+2
Let the compiler decide about inlining, and as confirmed by Eric it's better to use WRITE_ONCE here to ensure that the descriptor ownership is transferred to NIC immediately. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-18r8169: make rtl_rx better readableHeiner Kallweit1-51/+48
Avoid the goto from the rx error handling branch into the else branch, and in general avoid having the main rx work in the else branch. In addition ensure proper reverse xmas tree order of variables in the for loop. No functional change intended. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-16r8169: remove remaining call to mdiobus_unregisterHeiner Kallweit1-1/+0
After having switched to devm_mdiobus_register() also this remaining call to mdiobus_unregister() can be removed. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-15Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netDavid S. Miller1-0/+2
Move the bpf verifier trace check into the new switch statement in HEAD. Resolve the overlapping changes in hinic, where bug fixes overlap the addition of VF support. Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-14r8169: don't include linux/moduleparam.hHeiner Kallweit1-1/+0
93882c6f210a ("r8169: switch from netif_xxx message functions to netdev_xxx") removed the last module parameter from the driver, therefore there's no need any longer to include linux/moduleparam.h. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-14r8169: remove not needed checks in rtl8169_set_eeeHeiner Kallweit1-6/+0
After 9de5d235b60a ("net: phy: fix aneg restart in phy_ethtool_set_eee") we don't need the check for aneg being enabled any longer, and as discussed with Russell configuring the EEE advertisement should be supported even if we're in a half-duplex mode currently. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>