Re: kernel 4.18.5 Realtek 8111G network adapter stops responding under high system load

2018-09-27 Thread David Arendt
Hi,

Heiner Kallweit's patch seems to resolve the problem. The machine was
under high disk and network io pressure today and networking was
perfectly stable.

Bye,
David Arendt

On 9/25/18 11:03 PM, Heiner Kallweit wrote:
> On 19.09.2018 06:12, David Arendt wrote:
>> Hi,
>>
>> Thanks for the patch.
>>
>> I just applied it and the TxConfig register now contains 0x4f000f80.
>> The next day will show if it really solves the problem.
>>
>> Thanks in advance,
>> David Arendt
>>
>> On 9/19/18 12:30 AM, Maciej S. Szmigiero wrote:
>>> Hi,
>>>
>>> On 18.09.2018 12:23, David Arendt wrote:
 Hi,

 Today I had the network adapter problems again.
 So the patch doesn't seem to change anything regarding this problem.
 This week my time is unfortunately very limited, but I will try to
 find some time next weekend to look a bit more into the issue.
>>> If the problem is caused by missing TXCFG_AUTO_FIFO bit in TxConfig,
>>> as the register difference would suggest, then you can try applying
>>> the following patch (hack) on top of 4.18.8 that is already patched
>>> with commit f74dd480cf4e:
>>> --- a/drivers/net/ethernet/realtek/r8169.c
>>> +++ b/drivers/net/ethernet/realtek/r8169.c
>>> @@ -5043,7 +5043,8 @@
>>>  {
>>> /* Set DMA burst size and Interframe Gap Time */
>>> RTL_W32(tp, TxConfig, (TX_DMA_BURST << TxDMAShift) |
>>> -   (InterFrameGap << TxInterFrameGapShift));
>>> +   (InterFrameGap << TxInterFrameGapShift)
>>> +   | TXCFG_AUTO_FIFO);
>>>  }
>>>  
>>>  static void rtl_set_rx_max_size(struct rtl8169_private *tp)
>>>
>>> This hack will probably only work properly on RTL_GIGA_MAC_VER_40 or
>>> later NICs.
>>>
>>> Before running any tests please verify with "ethtool -d enp3s0" that
>>> TxConfig register now contains 0x4f000f80, as it did in the old,
>>> working driver version.
>>>
>>> If this does not help then a bisection will most likely be needed.
>>>
 Thanks in advance,
 David Arendt
>>> Maciej
>>
>>
> @Gabriel:
> Thanks for the hint, I wasn't fully aware of this thread.
> @Maciej:
> Thanks for the analysis.
>
> It seems that all chip versions from 34 (= RTL8168E-VL) with the
> exception of version 39 (= RTL8106E, first sub-version) need
> bit TXCFG_AUTO_FIFO.
>
> And indeed, due to reordering of calls this bit is overwritten.
> Following patch moves setting the bit from the chip-specific
> hw_start function to rtl_set_tx_config_registers().
>
> Whoever is hit by the issue and has the option to build a kernel,
> could you please test whether the patch fixes the issue for you?
>
> Thanks, Heiner
>
> ---
>  drivers/net/ethernet/realtek/r8169.c | 20 
>  1 file changed, 8 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/ethernet/realtek/r8169.c 
> b/drivers/net/ethernet/realtek/r8169.c
> index f882be49f..ae8abe900 100644
> --- a/drivers/net/ethernet/realtek/r8169.c
> +++ b/drivers/net/ethernet/realtek/r8169.c
> @@ -4514,9 +4514,14 @@ static void rtl8169_hw_reset(struct rtl8169_private 
> *tp)
>  
>  static void rtl_set_tx_config_registers(struct rtl8169_private *tp)
>  {
> - /* Set DMA burst size and Interframe Gap Time */
> - RTL_W32(tp, TxConfig, (TX_DMA_BURST << TxDMAShift) |
> - (InterFrameGap << TxInterFrameGapShift));
> + u32 val = TX_DMA_BURST << TxDMAShift |
> +   InterFrameGap << TxInterFrameGapShift;
> +
> + if (tp->mac_version >= RTL_GIGA_MAC_VER_34 &&
> + tp->mac_version != RTL_GIGA_MAC_VER_39)
> + val |= TXCFG_AUTO_FIFO;
> +
> + RTL_W32(tp, TxConfig, val);
>  }
>  
>  static void rtl_set_rx_max_size(struct rtl8169_private *tp)
> @@ -5011,7 +5016,6 @@ static void rtl_hw_start_8168e_2(struct rtl8169_private 
> *tp)
>  
>   rtl_disable_clock_request(tp);
>  
> - RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO);
>   RTL_W8(tp, MCU, RTL_R8(tp, MCU) & ~NOW_IS_OOB);
>  
>   /* Adjust EEE LED frequency */
> @@ -5045,7 +5049,6 @@ static void rtl_hw_start_8168f(struct rtl8169_private 
> *tp)
>  
>   rtl_disable_clock_request(tp);
>  
> - RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO);
>   RTL_W8(tp, MCU, RTL_R8(tp, MCU) & ~NOW_IS_OOB);
>   RTL_W8(tp, DLLPR, RTL_R8(tp, DLLPR) | PFM_EN);
>   RTL_W32(tp, MISC, RTL_R32(tp, MISC) | PWM_EN);
> @@ -5090,8 +5093,6 @@ static void rtl_hw_start_8411(struct rtl8169_private 
> *tp)
>  
>  static void rtl_hw_start_8168g(struct rtl8169_private *tp)
>  {
> - RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO);
> -
>   rtl_eri_write(tp, 0xc8, ERIAR_MASK_0101, 0x080002, ERIAR_EXGMAC);
>   rtl_eri_write(tp, 0xcc, ERIAR_MASK_0001, 0x38, ERIAR_EXGMAC);
>   rtl_eri_write(tp, 0xd0, ERIAR_MASK_0001, 0x48, ERIAR_EXGMAC);
> @@ -5189,8 +5190,6 @@ static void rtl_hw_start_8168h_1(struct rtl8169_private 
> *tp)
>   rtl_hw_aspm_clkreq_enable(tp, false);
>   rtl_ephy_init(tp, e_info_8168h_1, ARRAY_SIZE(e_info_8168h_1));
>  
> - 

Re: kernel 4.18.5 Realtek 8111G network adapter stops responding under high system load

2018-09-27 Thread Ortwin Glück

On 25.09.18 23:03, Heiner Kallweit wrote:

It seems that all chip versions from 34 (= RTL8168E-VL) with the
exception of version 39 (= RTL8106E, first sub-version) need
bit TXCFG_AUTO_FIFO.

And indeed, due to reordering of calls this bit is overwritten.
Following patch moves setting the bit from the chip-specific
hw_start function to rtl_set_tx_config_registers().

Whoever is hit by the issue and has the option to build a kernel,
could you please test whether the patch fixes the issue for you?


Hi,

Looks good so far! No problems for almost 24 hours. This is on a router/firewall that links various 
sites via IPSec and other VPNs and has >10 network interfaces, 5 of which are Realtek ones.


Thanks,

Ortwin

# uname -a
Linux lofw 4.18.10+ #72 SMP PREEMPT Wed Sep 26 17:07:07 CEST 2018 x86_64 Intel(R) Core(TM) i5-7500 
CPU @ 3.40GHz GenuineIntel GNU/Linux

# uptime
 17:42:37 up 22:54,  1 user,  load average: 0.48, 0.38, 0.30
# ifconfig wan
wan: flags=4163  mtu 1500
inet 81.7.230.226  netmask 255.255.255.248  broadcast 81.7.230.231
inet6 fe80::529a:4cff:fe2e:92be  prefixlen 64  scopeid 0x20
ether 50:9a:4c:2e:92:be  txqueuelen 100  (Ethernet)
RX packets 56342905  bytes 40589502599 (37.8 GiB)
RX errors 0  dropped 0  overruns 0  frame 0
TX packets 54032328  bytes 44607761646 (41.5 GiB)
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

# ifconfig lan
lan: flags=4163  mtu 1500
inet 10.11.1.1  netmask 255.255.255.0  broadcast 10.11.1.255
inet6 fe80::20a:cdff:fe31:6022  prefixlen 64  scopeid 0x20
ether 00:0a:cd:31:60:22  txqueuelen 100  (Ethernet)
RX packets 54799469  bytes 43111097607 (40.1 GiB)
RX errors 0  dropped 0  overruns 0  frame 0
TX packets 55158558  bytes 35746992802 (33.2 GiB)
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


Re: kernel 4.18.5 Realtek 8111G network adapter stops responding under high system load

2018-09-21 Thread Maciej S. Szmigiero
On 19.09.2018 18:34, David Arendt wrote:
> Hi,
> 
> the networking problem did not occur for 12 hours now, so I think this
> patch resolved the problem.

@Heiner:
It seems that the regression was introduced by your
commit 4fd48c4ac0a0 ("r8169: move common initializations to tp->hw_start").

Will you submit a fix for it?

Thanks,
Maciej