summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/realtek
AgeCommit message (Collapse)AuthorFilesLines
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>
2020-05-08r8169: improve reset handling for chips from RTL8168gHeiner Kallweit1-1/+4
Sync the reset preparation for chips from RTL8168g with the r8168 and r8125 vendor drivers. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-05-08r8169: add helper rtl_wait_txrx_fifo_emptyHeiner Kallweit1-14/+21
Add a helper for waiting for FIFO's to be empty, again the name is borrowed from the vendor driver. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-05-08r8169: add helper rtl_enable_rxdvgateHeiner Kallweit1-2/+8
Add a helper for setting RXDV_GATED_EN, the 2ms delay is copied from the vendor driver. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-05-08r8169: add helper r8168g_wait_ll_share_fifo_readyHeiner Kallweit1-10/+9
Create a helper for this waiting function, name of the helper is borrowed from the vendor driver. In addition don't return in the two hw_init functions if the first wait runs into a timeout, there's no benefit in doing so. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-05-08r8169: re-establish support for RTL8401 chip versionHeiner Kallweit1-0/+2
r8169 never had native support for the RTL8401, however it reportedly worked with the fallback to RTL8101e [0]. Therefore let's add this as an explicit assignment. [0] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=956868 Fixes: b4cc2dcc9c7c ("r8169: remove default chip versions") Reported-by: CamaleĆ³n <noelamac@gmail.com> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-05-06r8169: use fsleep in polling functionsHeiner Kallweit1-64/+44
Use new flexible sleep function fsleep() to merge the udelay and msleep polling functions. We can safely do this because no polling function is used in atomic context in this driver. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-04r8169: use new helper eth_hw_addr_crcHeiner Kallweit1-2/+1
Use new helper eth_hw_addr_crc to simplify the code. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-01r8169: switch from netif_xxx message functions to netdev_xxxHeiner Kallweit1-46/+22
Considering the few messages we have in the driver, there's not really a benefit in being able to control them on a message type level. Therefore simplify the code and switch to the netdev_xxx message functions. In addition add net_ratelimit() to messages that can be printed from a hot path. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-01r8169: remove "out of memory" error message from rtl_request_firmwareHeiner Kallweit1-3/+1
When preparing an unrelated change, checkpatch complained about this redundant out-of-memory message. Therefore remove it. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-01r8169: simplify counter handlingHeiner Kallweit1-25/+13
The counter handling functions can only fail if rtl8169_do_counters() times out. In the poll function we emit an error message in case of timeout, therefore we don't have to propagate the timeout all the way up just to print another message basically saying the same. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-01r8169: remove redundant driver message when entering promiscuous modeHeiner Kallweit1-2/+0
Net core - __dev_set_promiscuity - prints a message already when promiscuous mode in entered/left, therefore we don't have to do this in the driver too. Also the driver message would be misleading (would be because "link" message level is disabled per default) because it would print "promisc mode enabled" even if it's being left. Reason is that __dev_change_flags() calls dev_set_rx_mode() before touching the promisc flag. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-01r8169: remove not needed parameter in rtl8169_set_magic_regHeiner Kallweit1-2/+2
Remove a not needed parameter in rtl8169_set_magic_reg. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30r8169: configure PME_SIGNAL for RTL8125 tooHeiner Kallweit1-1/+1
RTL8125 supports the same PME_SIGNAL handling as all later RTL8168 chip variants. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30r8169: improve max jumbo packet size definitionHeiner Kallweit1-4/+4
Sync definition of max jumbo packet size with vendor driver and reserve 22 bytes for VLAN ethernet header plus checksum. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30r8169: add check for invalid parameter combination in rtl_set_coalesceHeiner Kallweit1-0/+5
Realtek provided information about a HW constraint that time limit must not be set to 0 if the frame limit is >0. Add a check for this and reject invalid parameter combinations. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30r8169: improve rtl_set_coalesceHeiner Kallweit1-40/+30
Use FIELD_PREP() to make the code better readable, and avoid the loop. No functional change intended. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30r8169: improve interrupt coalescing parameter handlingHeiner Kallweit1-6/+6
The chip supports only frame limits 0, 4, 8, .. 60 internally. Returning EINVAL for all val % 4 != 0 seems to be a little bit too unfriendly to the user. Therefore round up the frame limit to the next supported value. In addition round up the time limit, else a very low limit could be rounded down to 0, and interpreted as "ignore value" by the chip. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30r8169: improve rtl_coalesce_choose_scaleHeiner Kallweit1-6/+7
The time limit provided by userspace is multiplied with 1000, what could result in an overflow. Therefore change the time limit parameter unit from ns to us, and avoid the problematic operation. If there's no matching scale because provided time limit is too big, return ERANGE instead of EINVAL to provide a hint to the user what's wrong. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30r8169: improve rtl_get_coalesceHeiner Kallweit1-26/+20
Use FIELD_GET() macro to make the code better readable. In addition change the logic to round the time limit up, not down. Reason is that a time limit <1us would be rounded to 0 currently, what would be interpreted as "no time limit set". Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30r8169: merge scale for tx and rx irq coalescingHeiner Kallweit1-40/+25
Rx and tx scale are the same always. Simplify the code by using one scale for rx and tx only. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-30r8169: don't pass net_device to irq coalescing sub-functionsHeiner Kallweit1-6/+6
The net_device argument is just used to get a struct rtl8169_private pointer via netdev_priv(). Therefore pass the struct rtl8169_private pointer directly. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-27r8169: improve error message if no dedicated PHY driver is foundHeiner Kallweit1-1/+2
There's a number of consumer mainboards where the BIOS leaves the PHY in a state that it's reporting an invalid PHY ID. To detect such cases add the PHY ID to the error message if no dedicated PHY driver is found. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-27r8169: improve configuring RxConfig registerHeiner Kallweit1-18/+20
Two bits in RxConfig are controlled by the following dev->feature's: - NETIF_F_RXALL - NETIF_F_HW_VLAN_CTAG_RX (since RTL8125) We have to take care that RxConfig gets fully configured in rtl_hw_start() after e.g. resume from hibernation. Therefore: - Factor out setting the feature-controlled RxConfig bits to a new function rtl_set_rx_config_features() that is called from rtl8169_set_features() and rtl_hw_start(). - Don't deal with RX_VLAN_8125 in rtl_init_rxcfg(), it will be set by rtl_set_rx_config_features(). - Don't handle NETIF_F_RXALL in rtl_set_rx_mode(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>