netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] r8169: set RxConfig after tx/rx is enabled for RTL8169sb/8110sb devices
@ 2018-08-26 14:03 Azat Khuzhin
  2018-08-27 22:25 ` David Miller
  2018-08-30  1:07 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Azat Khuzhin @ 2018-08-26 14:03 UTC (permalink / raw)
  To: netdev
  Cc: Azat Khuzhin, Heiner Kallweit, David S . Miller,
	Realtek linux nic maintainers

I have two Ethernet adapters:
  r8169 0000:03:01.0 eth0: RTL8169sb/8110sb, 00:14:d1:14:2d:49, XID 10000000, IRQ 18
  r8169 0000:01:00.0 eth0: RTL8168e/8111e, 64:66:b3:11:14:5d, XID 2c200000, IRQ 30
And after upgrading from linux 4.15 [1] to linux 4.18+ [2] RTL8169sb failed to
receive any packets. tcpdump shows a lot of checksum mismatch.

  [1]: a0f79386a4968b4925da6db2d1daffd0605a4402
  [2]: 0519359784328bfa92bf0931bf0cff3b58c16932 (4.19 merge window opened)

I started bisecting and the found that [3] breaks it. According to [4]:
  "For 8110S, 8110SB, and 8110SC series, the initial value of RxConfig
  needs to be set after the tx/rx is enabled."
So I moved rtl_init_rxcfg() after enabling tx/rs and now my adapter works
(RTL8168e works too).

  [3]: 3559d81e76bfe3803e89f2e04cf6ef7ab4f3aace
  [4]: e542a2269f232d61270ceddd42b73a4348dee2bb ("r8169: adjust the RxConfig
settings.")

Also drop "rx" from rtl_set_rx_tx_config_registers(), since it does nothing
with it already.

Fixes: 3559d81e76bfe3803e89f2e04cf6ef7ab4f3aace ("r8169: simplify
rtl_hw_start_8169")

Cc: Heiner Kallweit <hkallweit1@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
Signed-off-by: Azat Khuzhin <a3at.mail@gmail.com>
---
It looks like calling rtl_init_rxcfg() the second time is fine, but I
can move it into rtl_hw_start_8169())

 drivers/net/ethernet/realtek/r8169.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 0efa977c422d..ac306797590e 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -4522,7 +4522,7 @@ static void rtl8169_hw_reset(struct rtl8169_private *tp)
 	rtl_hw_reset(tp);
 }
 
-static void rtl_set_rx_tx_config_registers(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) |
@@ -4633,12 +4633,14 @@ static void rtl_hw_start(struct  rtl8169_private *tp)
 
 	rtl_set_rx_max_size(tp);
 	rtl_set_rx_tx_desc_registers(tp);
-	rtl_set_rx_tx_config_registers(tp);
+	rtl_set_tx_config_registers(tp);
 	RTL_W8(tp, Cfg9346, Cfg9346_Lock);
 
 	/* Initially a 10 us delay. Turned it into a PCI commit. - FR */
 	RTL_R8(tp, IntrMask);
 	RTL_W8(tp, ChipCmd, CmdTxEnb | CmdRxEnb);
+	rtl_init_rxcfg(tp);
+
 	rtl_set_rx_mode(tp->dev);
 	/* no early-rx interrupts */
 	RTL_W16(tp, MultiIntr, RTL_R16(tp, MultiIntr) & 0xf000);
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] r8169: set RxConfig after tx/rx is enabled for RTL8169sb/8110sb devices
  2018-08-26 14:03 [PATCH] r8169: set RxConfig after tx/rx is enabled for RTL8169sb/8110sb devices Azat Khuzhin
@ 2018-08-27 22:25 ` David Miller
  2018-08-30  1:07 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-08-27 22:25 UTC (permalink / raw)
  To: a3at.mail; +Cc: netdev, hkallweit1, nic_swsd

From: Azat Khuzhin <a3at.mail@gmail.com>
Date: Sun, 26 Aug 2018 17:03:09 +0300

> I have two Ethernet adapters:
>   r8169 0000:03:01.0 eth0: RTL8169sb/8110sb, 00:14:d1:14:2d:49, XID 10000000, IRQ 18
>   r8169 0000:01:00.0 eth0: RTL8168e/8111e, 64:66:b3:11:14:5d, XID 2c200000, IRQ 30
> And after upgrading from linux 4.15 [1] to linux 4.18+ [2] RTL8169sb failed to
> receive any packets. tcpdump shows a lot of checksum mismatch.
> 
>   [1]: a0f79386a4968b4925da6db2d1daffd0605a4402
>   [2]: 0519359784328bfa92bf0931bf0cff3b58c16932 (4.19 merge window opened)
> 
> I started bisecting and the found that [3] breaks it. According to [4]:
>   "For 8110S, 8110SB, and 8110SC series, the initial value of RxConfig
>   needs to be set after the tx/rx is enabled."
> So I moved rtl_init_rxcfg() after enabling tx/rs and now my adapter works
> (RTL8168e works too).
> 
>   [3]: 3559d81e76bfe3803e89f2e04cf6ef7ab4f3aace
>   [4]: e542a2269f232d61270ceddd42b73a4348dee2bb ("r8169: adjust the RxConfig
> settings.")
> 
> Also drop "rx" from rtl_set_rx_tx_config_registers(), since it does nothing
> with it already.
> 
> Fixes: 3559d81e76bfe3803e89f2e04cf6ef7ab4f3aace ("r8169: simplify
> rtl_hw_start_8169")
> 
> Cc: Heiner Kallweit <hkallweit1@gmail.com>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: netdev@vger.kernel.org
> Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
> Signed-off-by: Azat Khuzhin <a3at.mail@gmail.com>
> ---
> It looks like calling rtl_init_rxcfg() the second time is fine, but I
> can move it into rtl_hw_start_8169())

Heiner, please review.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] r8169: set RxConfig after tx/rx is enabled for RTL8169sb/8110sb devices
  2018-08-26 14:03 [PATCH] r8169: set RxConfig after tx/rx is enabled for RTL8169sb/8110sb devices Azat Khuzhin
  2018-08-27 22:25 ` David Miller
@ 2018-08-30  1:07 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-08-30  1:07 UTC (permalink / raw)
  To: a3at.mail; +Cc: netdev, hkallweit1, nic_swsd

From: Azat Khuzhin <a3at.mail@gmail.com>
Date: Sun, 26 Aug 2018 17:03:09 +0300

> I have two Ethernet adapters:
>   r8169 0000:03:01.0 eth0: RTL8169sb/8110sb, 00:14:d1:14:2d:49, XID 10000000, IRQ 18
>   r8169 0000:01:00.0 eth0: RTL8168e/8111e, 64:66:b3:11:14:5d, XID 2c200000, IRQ 30
> And after upgrading from linux 4.15 [1] to linux 4.18+ [2] RTL8169sb failed to
> receive any packets. tcpdump shows a lot of checksum mismatch.
> 
>   [1]: a0f79386a4968b4925da6db2d1daffd0605a4402
>   [2]: 0519359784328bfa92bf0931bf0cff3b58c16932 (4.19 merge window opened)
> 
> I started bisecting and the found that [3] breaks it. According to [4]:
>   "For 8110S, 8110SB, and 8110SC series, the initial value of RxConfig
>   needs to be set after the tx/rx is enabled."
> So I moved rtl_init_rxcfg() after enabling tx/rs and now my adapter works
> (RTL8168e works too).
> 
>   [3]: 3559d81e76bfe3803e89f2e04cf6ef7ab4f3aace
>   [4]: e542a2269f232d61270ceddd42b73a4348dee2bb ("r8169: adjust the RxConfig
> settings.")
> 
> Also drop "rx" from rtl_set_rx_tx_config_registers(), since it does nothing
> with it already.
> 
> Fixes: 3559d81e76bfe3803e89f2e04cf6ef7ab4f3aace ("r8169: simplify
> rtl_hw_start_8169")
> 
> Cc: Heiner Kallweit <hkallweit1@gmail.com>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: netdev@vger.kernel.org
> Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
> Signed-off-by: Azat Khuzhin <a3at.mail@gmail.com>

Applied and queued up for -stable.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-08-30  5:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-26 14:03 [PATCH] r8169: set RxConfig after tx/rx is enabled for RTL8169sb/8110sb devices Azat Khuzhin
2018-08-27 22:25 ` David Miller
2018-08-30  1:07 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).