1
0
Fork 0
Commit Graph

26 Commits (280b0b8e89ade4277147e598d5806de12bff5fbc)

Author SHA1 Message Date
Heiner Kallweit edcde3ee57 r8169: align setting PME with vendor driver
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-27 14:23:14 -07:00
Heiner Kallweit 81cd17a412 r8169: improve rtl_set_rx_mode
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-24 15:40:51 -07:00
Corentin Musard ed72a9bb9a r8169: fix a typo in a comment
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-24 14:11:03 -07:00
Heiner Kallweit fcd4e60885 r8169: improve rtl_rx
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-22 18:28:12 -07:00
Thomas Voegtle 1a03bb5329 r8169: fix RTL8168g PHY init
This fixes a copy&paste error in the original patch. Setting the wrong
register resulted in massive packet loss on some systems.

Fixes: a2928d2864 ("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-20 12:17:45 -07:00
Heiner Kallweit fe4e8db039 r8169: fix issue with confused RX unit after PHY power-down on RTL8411b
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: a99790bf5c ("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-13 19:25:53 -07:00
Heiner Kallweit 9e0773c387 r8169: sync few chip names with vendor driver
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-07 13:05:40 -07:00
Heiner Kallweit c782e204f7 r8169: add random MAC address fallback
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-02 15:28:19 -07:00
Heiner Kallweit 7424edbb55 Revert "r8169: improve handling VLAN tag"
This reverts commit 759d095741.

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-07-02 15:27:33 -07:00
Heiner Kallweit f072218cca r8169: remove not needed call to dma_sync_single_for_device
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-29 12:29:39 -07:00
Heiner Kallweit 3c18cbe337 r8169: consider that 32 Bit DMA is the default
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-29 12:29:39 -07:00
Heiner Kallweit 759d095741 r8169: improve handling VLAN tag
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-29 12:29:39 -07:00
Heiner Kallweit 62b1b3b3b6 r8169: don't activate ASPM in chip if OS can't control ASPM
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-21 22:05:42 -04:00
Heiner Kallweit 9d9f3fba4c r8169: improve handling of Abit Fatal1ty F-190HD
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-15 14:04:34 -07:00
Heiner Kallweit 272b2265c8 r8169: use helper rtl_is_8168evl_up for setting register MaxTxPacketSize
>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-14 08:38:27 -07:00
Heiner Kallweit 9e9f33bae8 r8169: add helper rtl_is_8168evl_up
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-14 08:38:27 -07:00
Heiner Kallweit 20023d3e50 r8169: improve rtl_coalesce_info
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-13 22:43:53 -07:00
Heiner Kallweit 9b994b4a07 r8169: let mdio read functions return -ETIMEDOUT
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-13 22:43:10 -07:00
Heiner Kallweit 145a40e87e r8169: remove struct rtl_cfg_info
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-10 10:37:34 -07:00
Heiner Kallweit 9fa0a8e1e1 r8169: remove member coalesce_info from struct rtl_cfg_info
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-10 10:37:34 -07:00
Heiner Kallweit 6c19156e29 r8169: remove callback hw_start from struct rtl_cfg_info
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-10 10:37:34 -07:00
Heiner Kallweit bc73241e29 r8169: rename CPCMD_QUIRK_MASK and apply it on all chip versions
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-10 10:37:34 -07:00
Heiner Kallweit ec9a408817 r8169: improve setting interrupt mask
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-10 10:37:34 -07:00
Heiner Kallweit 355f948adf r8169: silence sparse warning in rtl8169_start_xmit
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-06 10:23:31 -07:00
Heiner Kallweit 8197f9d246 r8169: factor out firmware handling
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-05 11:41:59 -07:00
Heiner Kallweit 25e992a460 r8169: rename r8169.c to r8169_main.c
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-05 11:41:59 -07:00