Message ID | 20130227230157.GA30053@electric-eye.fr.zoreil.com |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
From: Francois Romieu <romieu@fr.zoreil.com> Date: Thu, 28 Feb 2013 00:01:57 +0100 > Some hardware start settings implicitely assume an usual 1500 bytes mtu > that can't be guaranteed because changes of mtu may be requested both > before and after the hardware is started. > > Reported-by: Tomi Orava <tomimo@ncircle.nullnet.fi> > Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Applied. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 02/28/2013 01:01 AM, Francois Romieu wrote: > Some hardware start settings implicitely assume an usual 1500 bytes mtu > that can't be guaranteed because changes of mtu may be requested both > before and after the hardware is started. > > Reported-by: Tomi Orava <tomimo@ncircle.nullnet.fi> > Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> > Cc: Hayes Wang <hayeswang@realtek.com> > --- > > Tomi, can you give this one a try ? It should be the "don't break non > jumbo setup and fix similar problem on different chipsets" patch that > my previous hack wasn't. I'll try this one out tomorrow. However, it seems that I was able to get the same hang even with the previous patch when I turned the power on ... All the previous testing I've done were just normal reboot's and the one liner fixed those cases 100%, but once I turned the power completely off and then back on, the NIC hanged in the same way as before with the jumbo frames enabled from boot. In case it matters, this happened with 3.4.33 kernel, as the 3.7.x still have some unresolved nouveau bugs with my HTPC box graphics card. Tomi > > drivers/net/ethernet/realtek/r8169.c | 27 ++++++++++++++++++--------- > 1 file changed, 18 insertions(+), 9 deletions(-) > > diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c > index 8900398..28fb50a 100644 > --- a/drivers/net/ethernet/realtek/r8169.c > +++ b/drivers/net/ethernet/realtek/r8169.c > @@ -4765,8 +4765,10 @@ static void rtl_hw_start_8168bb(struct rtl8169_private *tp) > > RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) & ~R8168_CPCMD_QUIRK_MASK); > > - rtl_tx_performance_tweak(pdev, > - (0x5 << MAX_READ_REQUEST_SHIFT) | PCI_EXP_DEVCTL_NOSNOOP_EN); > + if (tp->dev->mtu <= ETH_DATA_LEN) { > + rtl_tx_performance_tweak(pdev, (0x5 << MAX_READ_REQUEST_SHIFT) | > + PCI_EXP_DEVCTL_NOSNOOP_EN); > + } > } > > static void rtl_hw_start_8168bef(struct rtl8169_private *tp) > @@ -4789,7 +4791,8 @@ static void __rtl_hw_start_8168cp(struct rtl8169_private *tp) > > RTL_W8(Config3, RTL_R8(Config3) & ~Beacon_en); > > - rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > + if (tp->dev->mtu <= ETH_DATA_LEN) > + rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > > rtl_disable_clock_request(pdev); > > @@ -4822,7 +4825,8 @@ static void rtl_hw_start_8168cp_2(struct rtl8169_private *tp) > > RTL_W8(Config3, RTL_R8(Config3) & ~Beacon_en); > > - rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > + if (tp->dev->mtu <= ETH_DATA_LEN) > + rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > > RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) & ~R8168_CPCMD_QUIRK_MASK); > } > @@ -4841,7 +4845,8 @@ static void rtl_hw_start_8168cp_3(struct rtl8169_private *tp) > > RTL_W8(MaxTxPacketSize, TxPacketMax); > > - rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > + if (tp->dev->mtu <= ETH_DATA_LEN) > + rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > > RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) & ~R8168_CPCMD_QUIRK_MASK); > } > @@ -4901,7 +4906,8 @@ static void rtl_hw_start_8168d(struct rtl8169_private *tp) > > RTL_W8(MaxTxPacketSize, TxPacketMax); > > - rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > + if (tp->dev->mtu <= ETH_DATA_LEN) > + rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > > RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) & ~R8168_CPCMD_QUIRK_MASK); > } > @@ -4913,7 +4919,8 @@ static void rtl_hw_start_8168dp(struct rtl8169_private *tp) > > rtl_csi_access_enable_1(tp); > > - rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > + if (tp->dev->mtu <= ETH_DATA_LEN) > + rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > > RTL_W8(MaxTxPacketSize, TxPacketMax); > > @@ -4972,7 +4979,8 @@ static void rtl_hw_start_8168e_1(struct rtl8169_private *tp) > > rtl_ephy_init(tp, e_info_8168e_1, ARRAY_SIZE(e_info_8168e_1)); > > - rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > + if (tp->dev->mtu <= ETH_DATA_LEN) > + rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > > RTL_W8(MaxTxPacketSize, TxPacketMax); > > @@ -4998,7 +5006,8 @@ static void rtl_hw_start_8168e_2(struct rtl8169_private *tp) > > rtl_ephy_init(tp, e_info_8168e_2, ARRAY_SIZE(e_info_8168e_2)); > > - rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > + if (tp->dev->mtu <= ETH_DATA_LEN) > + rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > > rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); > rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); > -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 02/28/2013 01:01 AM, Francois Romieu wrote: > Some hardware start settings implicitely assume an usual 1500 bytes mtu > that can't be guaranteed because changes of mtu may be requested both > before and after the hardware is started. > > Reported-by: Tomi Orava <tomimo@ncircle.nullnet.fi> > Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> > Cc: Hayes Wang <hayeswang@realtek.com> > --- > > Tomi, can you give this one a try ? It should be the "don't break non > jumbo setup and fix similar problem on different chipsets" patch that > my previous hack wasn't. This latest worked just fine, no matter if the system was cold booted or warm booted with jumbo frames enabled using this NIC: 03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01) 03:00.0 0200: 10ec:8168 (rev 01) Subsystem: 1043:8385 Flags: bus master, fast devsel, latency 0, IRQ 40 I/O ports at e800 [size=256] Memory at febff000 (64-bit, non-prefetchable) [size=4K] Expansion ROM at febc0000 [disabled] [size=128K] Capabilities: [40] Power Management version 2 Capabilities: [48] Vital Product Data Capabilities: [50] MSI: Enable+ Count=1/2 Maskable- 64bit+ Capabilities: [60] Express Endpoint, MSI 00 Capabilities: [84] Vendor Specific Information: Len=4c <?> Kernel driver in use: r8169 Ie. works for me. Thanks! Tomi > > drivers/net/ethernet/realtek/r8169.c | 27 ++++++++++++++++++--------- > 1 file changed, 18 insertions(+), 9 deletions(-) > > diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c > index 8900398..28fb50a 100644 > --- a/drivers/net/ethernet/realtek/r8169.c > +++ b/drivers/net/ethernet/realtek/r8169.c > @@ -4765,8 +4765,10 @@ static void rtl_hw_start_8168bb(struct rtl8169_private *tp) > > RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) & ~R8168_CPCMD_QUIRK_MASK); > > - rtl_tx_performance_tweak(pdev, > - (0x5 << MAX_READ_REQUEST_SHIFT) | PCI_EXP_DEVCTL_NOSNOOP_EN); > + if (tp->dev->mtu <= ETH_DATA_LEN) { > + rtl_tx_performance_tweak(pdev, (0x5 << MAX_READ_REQUEST_SHIFT) | > + PCI_EXP_DEVCTL_NOSNOOP_EN); > + } > } > > static void rtl_hw_start_8168bef(struct rtl8169_private *tp) > @@ -4789,7 +4791,8 @@ static void __rtl_hw_start_8168cp(struct rtl8169_private *tp) > > RTL_W8(Config3, RTL_R8(Config3) & ~Beacon_en); > > - rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > + if (tp->dev->mtu <= ETH_DATA_LEN) > + rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > > rtl_disable_clock_request(pdev); > > @@ -4822,7 +4825,8 @@ static void rtl_hw_start_8168cp_2(struct rtl8169_private *tp) > > RTL_W8(Config3, RTL_R8(Config3) & ~Beacon_en); > > - rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > + if (tp->dev->mtu <= ETH_DATA_LEN) > + rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > > RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) & ~R8168_CPCMD_QUIRK_MASK); > } > @@ -4841,7 +4845,8 @@ static void rtl_hw_start_8168cp_3(struct rtl8169_private *tp) > > RTL_W8(MaxTxPacketSize, TxPacketMax); > > - rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > + if (tp->dev->mtu <= ETH_DATA_LEN) > + rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > > RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) & ~R8168_CPCMD_QUIRK_MASK); > } > @@ -4901,7 +4906,8 @@ static void rtl_hw_start_8168d(struct rtl8169_private *tp) > > RTL_W8(MaxTxPacketSize, TxPacketMax); > > - rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > + if (tp->dev->mtu <= ETH_DATA_LEN) > + rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > > RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) & ~R8168_CPCMD_QUIRK_MASK); > } > @@ -4913,7 +4919,8 @@ static void rtl_hw_start_8168dp(struct rtl8169_private *tp) > > rtl_csi_access_enable_1(tp); > > - rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > + if (tp->dev->mtu <= ETH_DATA_LEN) > + rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > > RTL_W8(MaxTxPacketSize, TxPacketMax); > > @@ -4972,7 +4979,8 @@ static void rtl_hw_start_8168e_1(struct rtl8169_private *tp) > > rtl_ephy_init(tp, e_info_8168e_1, ARRAY_SIZE(e_info_8168e_1)); > > - rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > + if (tp->dev->mtu <= ETH_DATA_LEN) > + rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > > RTL_W8(MaxTxPacketSize, TxPacketMax); > > @@ -4998,7 +5006,8 @@ static void rtl_hw_start_8168e_2(struct rtl8169_private *tp) > > rtl_ephy_init(tp, e_info_8168e_2, ARRAY_SIZE(e_info_8168e_2)); > > - rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > + if (tp->dev->mtu <= ETH_DATA_LEN) > + rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); > > rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); > rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); > -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 8900398..28fb50a 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c @@ -4765,8 +4765,10 @@ static void rtl_hw_start_8168bb(struct rtl8169_private *tp) RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) & ~R8168_CPCMD_QUIRK_MASK); - rtl_tx_performance_tweak(pdev, - (0x5 << MAX_READ_REQUEST_SHIFT) | PCI_EXP_DEVCTL_NOSNOOP_EN); + if (tp->dev->mtu <= ETH_DATA_LEN) { + rtl_tx_performance_tweak(pdev, (0x5 << MAX_READ_REQUEST_SHIFT) | + PCI_EXP_DEVCTL_NOSNOOP_EN); + } } static void rtl_hw_start_8168bef(struct rtl8169_private *tp) @@ -4789,7 +4791,8 @@ static void __rtl_hw_start_8168cp(struct rtl8169_private *tp) RTL_W8(Config3, RTL_R8(Config3) & ~Beacon_en); - rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); + if (tp->dev->mtu <= ETH_DATA_LEN) + rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); rtl_disable_clock_request(pdev); @@ -4822,7 +4825,8 @@ static void rtl_hw_start_8168cp_2(struct rtl8169_private *tp) RTL_W8(Config3, RTL_R8(Config3) & ~Beacon_en); - rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); + if (tp->dev->mtu <= ETH_DATA_LEN) + rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) & ~R8168_CPCMD_QUIRK_MASK); } @@ -4841,7 +4845,8 @@ static void rtl_hw_start_8168cp_3(struct rtl8169_private *tp) RTL_W8(MaxTxPacketSize, TxPacketMax); - rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); + if (tp->dev->mtu <= ETH_DATA_LEN) + rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) & ~R8168_CPCMD_QUIRK_MASK); } @@ -4901,7 +4906,8 @@ static void rtl_hw_start_8168d(struct rtl8169_private *tp) RTL_W8(MaxTxPacketSize, TxPacketMax); - rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); + if (tp->dev->mtu <= ETH_DATA_LEN) + rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) & ~R8168_CPCMD_QUIRK_MASK); } @@ -4913,7 +4919,8 @@ static void rtl_hw_start_8168dp(struct rtl8169_private *tp) rtl_csi_access_enable_1(tp); - rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); + if (tp->dev->mtu <= ETH_DATA_LEN) + rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); RTL_W8(MaxTxPacketSize, TxPacketMax); @@ -4972,7 +4979,8 @@ static void rtl_hw_start_8168e_1(struct rtl8169_private *tp) rtl_ephy_init(tp, e_info_8168e_1, ARRAY_SIZE(e_info_8168e_1)); - rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); + if (tp->dev->mtu <= ETH_DATA_LEN) + rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); RTL_W8(MaxTxPacketSize, TxPacketMax); @@ -4998,7 +5006,8 @@ static void rtl_hw_start_8168e_2(struct rtl8169_private *tp) rtl_ephy_init(tp, e_info_8168e_2, ARRAY_SIZE(e_info_8168e_2)); - rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); + if (tp->dev->mtu <= ETH_DATA_LEN) + rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC);
Some hardware start settings implicitely assume an usual 1500 bytes mtu that can't be guaranteed because changes of mtu may be requested both before and after the hardware is started. Reported-by: Tomi Orava <tomimo@ncircle.nullnet.fi> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Hayes Wang <hayeswang@realtek.com> --- Tomi, can you give this one a try ? It should be the "don't break non jumbo setup and fix similar problem on different chipsets" patch that my previous hack wasn't. drivers/net/ethernet/realtek/r8169.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-)