aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/realtek (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-08-26r8169: improve DMA handling in rtl_rxHeiner Kallweit1-4/+3
Move the call to dma_sync_single_for_cpu after calling napi_alloc_skb. This avoids calling dma_sync_single_for_cpu w/o handing control back to device if the memory allocation should fail. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-08-23r8169: fix DMA issue on MIPS platformHeiner Kallweit1-0/+4
As reported by Aaro this patch causes network problems on MIPS Loongson platform. Therefore revert it. Fixes: f072218cca5b ("r8169: remove not needed call to dma_sync_single_for_device") Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-08-15r8169: sync EEE handling for RTL8168h with vendor driverHeiner Kallweit1-1/+11
Sync EEE init for RTL8168h with vendor driver and add two writes to vendor-specific registers. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-08-15r8169: use the generic EEE management functionsHeiner Kallweit1-148/+24
Now that the Realtek PHY driver maps the vendor-specific EEE registers to the standard MMD registers, we can remove all special handling and use the generic functions phy_ethtool_get/set_eee. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-08-14r8169: fix sporadic transmit timeout issueHeiner Kallweit1-0/+1
Holger reported sporadic transmit timeouts and it turned out that one path misses ringing the doorbell. Fix was suggested by Eric. Fixes: ef14358546b1 ("r8169: make use of xmit_more") Suggested-by: Eric Dumazet <edumazet@google.com> Tested-by: Holger Hoffstätte <holger@applied-asynchrony.com> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-08-11r8169: inline rtl8169_free_rx_databuffHeiner Kallweit1-17/+7
rtl8169_free_rx_databuff is used in only one place, so let's inline it. We can improve the loop because rtl8169_init_ring zero's RX_databuff before calling rtl8169_rx_fill, and rtl8169_rx_fill fills Rx_databuff starting from index 0. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-08-09r8169: fix performance issue on RTL8168evlHolger Hoffstätte1-3/+3
Disabling TSO but leaving SG active results is a significant performance drop. Therefore disable also SG on RTL8168evl. This restores the original performance. Fixes: 93681cd7d94f ("r8169: enable HW csum and TSO") Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-08-08r8169: allocate rx buffers using alloc_pages_nodeHeiner Kallweit1-26/+19
We allocate 16kb per rx buffer, so we can avoid some overhead by using alloc_pages_node directly instead of bothering kmalloc_node. Due to this change buffers are page-aligned now, therefore the alignment check can be removed. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Acked-by: Hayes Wang <hayeswang@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-08-06Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netDavid S. Miller1-6/+8
Just minor overlapping changes in the conflicts here. Signed-off-by: David S. Miller <davem@davemloft.net>
2019-08-06r8169: sync PCIe PHY init with vendor driver 8.047.01Heiner Kallweit1-22/+38
Synchronize PCIe PHY initialization with vendor driver version 8.047.01. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-08-06r8169: add helper r8168_mac_ocp_modifyHeiner Kallweit1-46/+19
Add a helper for MAC OCP read-modify-write operations. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-08-06r8169: remove access to legacy register MultiIntrHeiner Kallweit1-4/+0
This code piece was inherited from RTL8139 code, the register at address 0x5c however has a different meaning on RTL8169 and is unused. So we can remove this. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-07-29r8169: make use of xmit_moreHeiner Kallweit1-5/+12
There was a previous attempt to use xmit_more, but the change had to be reverted because under load sometimes a transmit timeout occurred [0]. Maybe this was caused by a missing memory barrier, the new attempt keeps the memory barrier before the call to netif_stop_queue like it is used by the driver as of today. The new attempt also changes the order of some calls as suggested by Eric. [0] https://lkml.org/lkml/2019/2/10/39 Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-07-27r8169: don't use MSI before RTL8168dHeiner Kallweit1-2/+7
It was reported that after resuming from suspend network fails with error "do_IRQ: 3.38 No irq handler for vector", see [0]. Enabling WoL can work around the issue, but the only actual fix is to disable MSI. So let's mimic the behavior of the vendor driver and disable MSI on all chip versions before RTL8168d. [0] https://bugzilla.kernel.org/show_bug.cgi?id=204079 Fixes: 6c6aa15fdea5 ("r8169: improve interrupt handling") Reported-by: Dušan Dragić <dragic.dusan@gmail.com> Tested-by: Dušan Dragić <dragic.dusan@gmail.com> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-07-27Revert ("r8169: remove 1000/Half from supported modes")Heiner Kallweit1-4/+1
This reverts commit a6851c613fd7fccc5d1f28d5d8a0cbe9b0f4e8cc. It was reported that RTL8111b successfully finishes 1000/Full autoneg but no data flows. Reverting the original patch fixes the issue. It seems to be a HW issue with the integrated RTL8211B PHY. This PHY version used also e.g. on RTL8168d, so better revert the original patch. Reported-by: Bernhard Held <berny156@gmx.de> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-07-27r8169: enable HW csum and TSOHeiner Kallweit1-5/+11
Enable HW csum and TSO per default except on known buggy chip versions. Realtek confirmed that RTL8168evl has a HW issue with TSO. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-07-27r8169: remove r8169_csum_workaroundHeiner Kallweit1-37/+2
The loop in r8169_csum_workaround is called only if in msdn_giant_send_check a copy of the skb header needs to be made and we don't have enough memory. Let's simply drop the packet in that case so that we can remove r8169_csum_workaround. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-07-27r8169: implement callback ndo_features_checkHeiner Kallweit1-24/+36
Implement callback ndo_features_check and move all feature checks there. This will allow us to get rid of r8169_csum_workaround() completely in a subsequent step. Like in the vendor driver disable HW csum for short packets on RTL8168b. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-07-27r8169: set GSO size and segment limitsHeiner Kallweit1-1/+12
Set GSO max size and max segment number as in the vendor driver. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-07-27r8169: align setting PME with vendor driverHeiner Kallweit1-2/+6
Align setting PME with the vendor driver. PMEnable is writable on RTL8169 only, on later chip versions it's read-only. PME_SIGNAL is used on chip versions from RTL8168evl with the exception of the RTL8168f family. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-07-24r8169: improve rtl_set_rx_modeHeiner Kallweit1-30/+22
This patch improves and simplifies rtl_set_rx_mode a little. No functional change intended. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-07-24r8169: fix a typo in a commentCorentin Musard1-1/+1
Replace "additonal" by "additional" in a comment. Typo found by checkpatch.pl. Signed-off-by: Corentin Musard <corentinmusard@gmail.com> Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-07-22r8169: improve rtl_rxHeiner Kallweit1-28/+15
This patch improves few aspects of rtl_rx, no functional change intended. 1. inline rtl8169_try_rx_copy 2. make pkt_size unsigned 3. use constant ETH_FCS_LEN instead of value 4 4. We just created the skb, so we don't need the checks in skb_put. Also we don't need the return value of skb_put. Set skb->tail and skb->len directly. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-07-20r8169: fix RTL8168g PHY initThomas Voegtle1-2/+2
This fixes a copy&paste error in the original patch. Setting the wrong register resulted in massive packet loss on some systems. Fixes: a2928d28643e ("r8169: use paged versions of phylib MDIO access functions") Tested-by: Thomas Voegtle <tv@lio96.de> Signed-off-by: Thomas Voegtle <tv@lio96.de> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-07-13r8169: fix issue with confused RX unit after PHY power-down on RTL8411bHeiner Kallweit1-0/+137
On RTL8411b the RX unit gets confused if the PHY is powered-down. This was reported in [0] and confirmed by Realtek. Realtek provided a sequence to fix the RX unit after PHY wakeup. The issue itself seems to have been there longer, the Fixes tag refers to where the fix applies properly. [0] https://bugzilla.redhat.com/show_bug.cgi?id=1692075 Fixes: a99790bf5c7f ("r8169: Reinstate ASPM Support") Tested-by: Ionut Radu <ionut.radu@gmail.com> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-07-07r8169: sync few chip names with vendor driverHeiner Kallweit1-4/+4
This patch syncs the name of few chip versions with the latest vendor driver version. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-07-02r8169: add random MAC address fallbackHeiner Kallweit1-13/+27
It was reported that the GPD MicroPC is broken in a way that no valid MAC address can be read from the network chip. The vendor driver deals with this by assigning a random MAC address as fallback. So let's do the same. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-07-02Revert "r8169: improve handling VLAN tag"Heiner Kallweit1-3/+2
This reverts commit 759d095741721888b6ee51afa74e0a66ce65e974. The patch was based on a misunderstanding. As Al Viro pointed out [0] it's simply wrong on big endian. So let's revert it. [0] https://marc.info/?t=156200975600004&r=1&w=2 Reported-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-29r8169: remove not needed call to dma_sync_single_for_deviceHeiner Kallweit1-1/+0
DMA_API_HOWTO.txt includes an example explaining when dma_sync_single_for_device() is not needed, and that example matches our use case. The buffer isn't changed by the CPU and direction is DMA_FROM_DEVICE, so we can remove the call to dma_sync_single_for_device(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-29r8169: consider that 32 Bit DMA is the defaultHeiner Kallweit1-8/+1
Documentation/DMA-API-HOWTO.txt states: By default, the kernel assumes that your device can address 32-bits of DMA addressing. For a 64-bit capable device, this needs to be increased, and for a device with limitations, it needs to be decreased. Therefore we don't need the 32 Bit DMA fallback configuration and can remove it. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-29r8169: improve handling VLAN tagHeiner Kallweit1-2/+3
The VLAN tag is stored in the descriptor in network byte order. Using swab16 works on little endian host systems only. Better play safe and use ntohs or htons respectively. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-21r8169: don't activate ASPM in chip if OS can't control ASPMHeiner Kallweit1-2/+6
Certain chip version / board combinations have massive problems if ASPM is active. If BIOS enables ASPM and doesn't let OS control it, then we may have a problem with the current code. Therefore check the return code of pci_disable_link_state() and don't enable ASPM in the network chip if OS can't control ASPM. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-15r8169: improve handling of Abit Fatal1ty F-190HDHeiner Kallweit1-8/+6
The Abit Fatal1ty F-190HD has a PCI ID quirk and the entry marks this board as not GBit-capable, what is wrong. According to [0] the board has a RTL8111B that is GBit-capable, therefore remove the RTL_CFG_NO_GBIT flag. [0] https://www.centos.org/forums/viewtopic.php?t=23390 Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-14r8169: use helper rtl_is_8168evl_up for setting register MaxTxPacketSizeHeiner Kallweit1-20/+4
>From RTL8168e-vl the value in register MaxTxPacketSize is interpreted differently, therefore use new helper rtl_is_8168evl_up to set this register. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-14r8169: add helper rtl_is_8168evl_upHeiner Kallweit1-17/+12
Add helper rtl_is_8168evl_up to make the code better readable and to simplify it. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-13r8169: improve rtl_coalesce_infoHeiner Kallweit1-15/+6
tp->coalesce_info is used in rtl_coalesce_info() only, so we can remove this member. In addition replace phy_ethtool_get_link_ksettings with a direct access to tp->phydev->speed. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-13r8169: let mdio read functions return -ETIMEDOUTHeiner Kallweit1-4/+4
In case of a timeout currently ~0 is returned. Callers often just check whether a certain bit is set and therefore may behave incorrectly. So let's return -ETIMEDOUT in case of a timeout. r8168_phy_ocp_read is used in r8168g_mdio_read only, therefore we can apply the same change. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-10r8169: remove struct rtl_cfg_infoHeiner Kallweit1-37/+19
Simplify the code by removing struct rtl_cfg_info. Only info we need per PCI ID is whether it supports GBit or not. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-10r8169: remove member coalesce_info from struct rtl_cfg_infoHeiner Kallweit1-5/+5
To prepare removal of struct rtl_cfg_info, set the coalesce config based on the chip version number. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-10r8169: remove callback hw_start from struct rtl_cfg_infoHeiner Kallweit1-64/+53
After the latest changes we don't need separate functions rtl_hw_start_8168 and rtl_hw_start_8101 any longer. This allows us to simplify the code. For this change we need to move rtl_hw_start() and rtl_hw_start_8169(). rtl_hw_start_8169() is unchanged. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-10r8169: rename CPCMD_QUIRK_MASK and apply it on all chip versionsHeiner Kallweit1-19/+4
CPCMD_QUIRK_MASK isn't specific to certain chip versions. The vendor driver applies this mask to all 8168 versions. Therefore remove QUIRK from the mask name and apply it on all chip versions. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-10r8169: improve setting interrupt maskHeiner Kallweit1-14/+14
So far several places in the code deal with setting the interrupt mask for the respective chip versions. Improve this by having one function for this only. In addition don't set RxFIFOOver for all 8101 chip versions like in the vendor driver. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-06r8169: silence sparse warning in rtl8169_start_xmitHeiner Kallweit1-1/+1
The opts[] array is of type u32. Therefore remove the wrong cpu_to_le32(). The opts[] array members are converted to little endian later when being assigned to the respective descriptor fields. This is not a new issue, it just popped up due to r8169.c having been renamed and more thoroughly checked. Due to the renaming this patch applies to net-next only. Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-05r8169: factor out firmware handlingHeiner Kallweit4-241/+274
Let's factor out firmware handling into a separate source code file. This simplifies reading the code and makes clearer what the interface between driver and firmware handling is. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-05r8169: rename r8169.c to r8169_main.cHeiner Kallweit2-0/+1
In preparation of factoring out firmware handling rename r8169.c to r8169_main.c. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-03r8169: add rtl_fw_request_firmware and rtl_fw_release_firmwareHeiner Kallweit1-24/+34
Add rtl_fw_request_firmware and rtl_fw_release_firmware which will be part of the API when factoring out the firmware handling code. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-03r8169: make rtl_fw_format_ok and rtl_fw_data_ok more independentHeiner Kallweit1-39/+19
In preparation of factoring out the firmware handling code avoid any usage of struct rtl8169_private internals. As part of it we can inline rtl_check_firmware. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-03r8169: simplify rtl_fw_write_firmwareHeiner Kallweit1-14/+5
Similar to rtl_fw_data_ok() we can simplify the code by moving incrementing the index to the for loop initialization. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-03r8169: add enum rtl_fw_opcodeHeiner Kallweit1-18/+18
Replace the firmware opcode defines with a proper enum. The BUG() in rtl_fw_write_firmware() can be removed because the call to rtl_fw_data_ok() ensures all opcodes are valid. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-03r8169: use paged versions of phylib MDIO access functionsHeiner Kallweit1-72/+33
Use paged versions of phylib MDIO access functions to simplify the code. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>