summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/realtek
AgeCommit message (Collapse)Author
2020-04-06r8169: change back SG and TSO to be disabled by defaultHeiner Kallweit
There has been a number of reports that using SG/TSO on different chip versions results in tx timeouts. However for a lot of people SG/TSO works fine. Therefore disable both features by default, but allow users to enable them. Use at own risk! Fixes: 93681cd7d94f ("r8169: enable HW csum and TSO") Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-30r8169: factor out rtl8169_tx_mapHeiner Kallweit
Factor out mapping the tx skb to a new function rtl8169_tx_map(). This allows to remove redundancies, and rtl8169_get_txd_opts1() has only one user left, so it can be inlined. As a result rtl8169_xmit_frags() is significantly simplified, and in rtl8169_start_xmit() the code is simplified and better readable. No functional change intended. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-30r8169: improve handling of TD_MSS_MAXHeiner Kallweit
If the mtu is greater than TD_MSS_MAX, then TSO is disabled, see rtl8169_fix_features(). Because mss is less than mtu, we can't have the case mss > TD_MSS_MAX in the TSO path. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-29Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller
Minor comment conflict in mac80211. Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-27r8169: fix PHY driver check on platforms w/o module softdepsHeiner Kallweit
On Android/x86 the module loading infrastructure can't deal with softdeps. Therefore the check for presence of the Realtek PHY driver module fails. mdiobus_register() will try to load the PHY driver module, therefore move the check to after this call and explicitly check that a dedicated PHY driver is bound to the PHY device. Fixes: f32593773549 ("r8169: check that Realtek PHY driver module is loaded") Reported-by: Chih-Wei Huang <cwhuang@android-x86.org> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-25Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netDavid S. Miller
Overlapping header include additions in macsec.c A bug fix in 'net' overlapping with the removal of 'version' string in ena_netdev.c Overlapping test additions in selftests Makefile Overlapping PCI ID table adjustments in iwlwifi driver. Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-24r8169: re-enable MSI on RTL8168cHeiner Kallweit
The original change fixed an issue on RTL8168b by mimicking the vendor driver behavior to disable MSI on chip versions before RTL8168d. This however now caused an issue on a system with RTL8168c, see [0]. Therefore leave MSI disabled on RTL8168b, but re-enable it on RTL8168c. [0] https://bugzilla.redhat.com/show_bug.cgi?id=1792839 Fixes: 003bd5b4a7b4 ("r8169: don't use MSI before RTL8168d") Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-23r8169: improve RTL8168b FIFO overflow workaroundHeiner Kallweit
So far only the reset bit it set, but the handler executing the reset is not scheduled. Therefore nothing will happen until some other action schedules the handler. Improve this by ensuring that the handler is scheduled. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-23r8169: improve rtl_schedule_taskHeiner Kallweit
The current implementation makes the implicit assumption that if a bit is set, then the work is scheduled already. Remove the need for this implicit assumption and call schedule_work() always. It will check internally whether the work is scheduled already. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-23r8169: simplify rtl_taskHeiner Kallweit
Currently rtl_task() is designed to handle a large number of tasks. However we have just one, so we can remove some overhead. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-23r8169: add new helper rtl8168g_enable_gphy_10mHeiner Kallweit
Factor out setting GPHY 10M to new helper rtl8168g_enable_gphy_10m. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-14net: r8169: reject unsupported coalescing paramsJakub Kicinski
Set ethtool_ops->supported_coalesce_params to let the core reject unsupported coalescing parameters. This driver did not previously reject unsupported parameters. Signed-off-by: Jakub Kicinski <kuba@kernel.org> Acked-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-10r8169: simplify getting stats by using netdev_stats_to_stats64Heiner Kallweit
Let netdev_stats_to_stats64() do the copy work for us. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-10r8169: let rtl8169_mark_to_asic clear rx descriptor field opts2Heiner Kallweit
Clearing opts2 belongs to preparing the descriptor for DMA engine use. Therefore move it into rtl8169_mark_to_asic(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-09r8169: remove now unneeded barrier in rtl_txHeiner Kallweit
Until ae84bc187337 ("r8169: don't use bit LastFrag in tx descriptor after send") we used to access another bit in the descriptor, therefore it seems the barrier was needed. Since this commit DescOwn is the only bit we're interested in, so the barrier isn't needed any longer. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-09r8169: simplify usage of rtl8169_unmap_tx_skbHeiner Kallweit
Simplify the parameters taken by rtl8169_unmap_tx_skb, this makes usage of this function easier to read and understand. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-09r8169: ensure tx_skb is fully reset after calling rtl8169_unmap_tx_skbHeiner Kallweit
So far tx_skb->skb is the only member of the two structs that is not reset. Make understanding the code easier by resetting both structs completely in rtl8169_unmap_tx_skb. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-09r8169: convert while to for loop in rtl_txHeiner Kallweit
Slightly improve the code by converting this while to a for loop. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-04r8169: use pci_status_get_and_clear_errorsHeiner Kallweit
Use new helper pci_status_get_and_clear_errors() to simplify the code. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-04r8169: add PCI_STATUS_PARITY to PCI status error bitsHeiner Kallweit
In preparation of factoring out PCI_STATUS error bit handling let drivers use the same collection of error bits. To facilitate bisecting we do this in a separate patch per affected driver. For the r8169 driver we have to add PCI_STATUS_PARITY to the error bits. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-02-23r8169: improve rtl8169_start_xmitHeiner Kallweit
Only call rtl8169_xmit_frags() if the skb is actually fragmented. This avoid a small overhead for non-fragmented skb's, and it allows to simplify rtl8169_xmit_frags() a little. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-02-22r8169: remove RTL_EVENT_NAPI constantsHeiner Kallweit
These constants are used in one place only, so we can remove them and use the values directly. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-02-19r8169: use new helper tcp_v6_gso_csum_prepHeiner Kallweit
Simplify the code by using the new helper tcp_v6_gso_csum_prep. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-02-16r8169: improve statistics of missed rx packetsHeiner Kallweit
Register RxMissed exists on few early chip versions only, however all chip versions have the number of missed RX packets in the hardware counters. Therefore remove using RxMissed and get the number of missed RX packets from the hardware stats. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-02-16r8169: improve rtl_jumbo_configHeiner Kallweit
Merge enabling and disabling jumbo packets to one function to make the code a little simpler. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-02-16r8169: improve rtl8169_get_mac_versionHeiner Kallweit
Currently code snippet (RTL_R32(tp, TxConfig) >> 20) & 0xfcf is used in few places to extract the chip XID. Change the code to do the XID extraction only once. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-02-16r8169: add helper rtl_pci_commitHeiner Kallweit
In few places we do a PCI commit by reading an arbitrary chip register. It's not always obvious that the read is meant to be a PCI commit, therefore add a helper for it. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-02-16r8169: simplify setting netdev featuresHeiner Kallweit
Setting dev->features a few lines later allows to simplify the code. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-02-16r8169: remove setting PCI_CACHE_LINE_SIZE in rtl_hw_start_8169Heiner Kallweit
This is done for all RTL8169 chip versions in rtl8169_init_phy already. Therefore we can remove it here. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-02-16r8169: remove unneeded check from rtl_link_chg_patchHeiner Kallweit
rtl_link_chg_patch() can be called from rtl_open() to rtl8169_close() only. And in rtl8169_close() phy_stop() ensures that this function isn't called afterwards. So we don't need this check. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-02-06r8169: fix performance regression related to PCIe max read request sizeHeiner Kallweit
It turned out that on low performance systems the original change can cause lower tx performance. On a N3450-based mini-PC tx performance in iperf3 was reduced from 950Mbps to ~900Mbps. Therefore effectively revert the original change, just use pcie_set_readrq() now instead of changing the PCIe capability register directly. Fixes: 2df49d365498 ("r8169: remove fiddling with the PCIe max read request size") Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-27r8169: don't set min_mtu/max_mtu if not neededHeiner Kallweit
Defaults for min_mtu and max_mtu are set by ether_setup(), which is called from devm_alloc_etherdev(). Let rtl_jumbo_max() only return a positive value if actually jumbo packets are supported. This also allows to remove constant Jumbo_1K which is a little misleading anyway. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-21net: phy: rename phy_do_ioctl to phy_do_ioctl_runningHeiner Kallweit
We just added phy_do_ioctl, but it turned out that we need another version of this function that doesn't check whether net_device is running. So rename phy_do_ioctl to phy_do_ioctl_running. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-20r8169: use generic ndo_do_ioctl handler phy_do_ioctlHeiner Kallweit
Replace rtl8169_ioctl with new generic function phy_do_ioctl. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10r8169: factor out PHY configuration to r8169_phy_config.cHeiner Kallweit
Move chip-specific PHY configurations to separate source file r8169_phy_config.c. This improves maintainability of the driver. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10r8169: add r8169.hHeiner Kallweit
In preparation of factoring out PHY configuration to a separate source file move commonly used definitions to new header file r8169.h. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10r8169: rename rtl_apply_firmwareHeiner Kallweit
Rename rtl_apply_firmware() to r8169_apply_firmware() before exporting it to avoid namespace clashes with other drivers for Realtek hardware. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10r8169: add phydev argument to rtl8168d_apply_firmware_condHeiner Kallweit
Pass the phy_device as parameter to rtl8168d_apply_firmware_cond(), this avoids having to access rtl8169_private internals. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10r8169: use phy_read/write instead of rtl_readphy/writephyHeiner Kallweit
Replace rtl_writephy and rtl_readphy with the respective phylib functions. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10r8169: replace rtl_w0w1_phyHeiner Kallweit
Replace rtl_w0w1_phy with phylib functions. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10r8169: replace rtl_patchphyHeiner Kallweit
Replace rtl_patchphy with phylib functions. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10r8169: move disabling MAC EEE for RTL8402/RTL8106eHeiner Kallweit
Move configuring EEE on MAC side out of the PHY configuration. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10r8169: move setting ERI register 0x1d0 for RTL8106Heiner Kallweit
Writing this ERI register is a MAC setting, so move it to rtl_hw_start_8106(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10r8169: switch to phylib functions in rtl_writephy_batchHeiner Kallweit
Switch rtl_writephy_batch() to phylib functions, as a result we can avoid passing a rtl8169_private parameter. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10r8169: change argument type of RTL8168g-specific PHY config functionsHeiner Kallweit
These functions use only the phy_device member of rtl8169_private, so we can pass the phy_device as parameter directly. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10r8169: change argument type of EEE PHY functionsHeiner Kallweit
These functions use only the phy_device member of rtl8169_private, so we can pass the phy_device as parameter directly. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10r8169: move RTL8169scd Gigabyte PHY quirkHeiner Kallweit
In preparation of factoring out rtl8169scd_hw_phy_config() move this quirk to rtl8169_init_phy(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10r8169: remove not needed debug print in rtl8169_init_phyHeiner Kallweit
Remove a useless debug statement. This also allows to remove the net_device parameter from rtl8169_init_phy(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-10r8169: prepare for exporting rtl_hw_phy_configHeiner Kallweit
In preperation of factoring out the PHY configuration to a separate source file this patch: - avoids accessing rtl8169_private internals by passing the phy_device and mac_version as separate parameters - renames rtl_hw_phy_config to r8169_hw_phy_config to avoid namespace clashes with other drivers for Realtek hardware Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-08r8169: add constant EnAnaPLLHeiner Kallweit
Use constant EnAnaPLL for bit 14 as in vendor driver. The vendor driver sets this bit for chip version 02 only, but I'm not aware of any issues, so better leave it as it is. In addition remove the useless debug message. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>