Skip to content

Commit

Permalink
r8169: use helper rtl_is_8168evl_up for setting register MaxTxPacketSize
Browse files Browse the repository at this point in the history
>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>
  • Loading branch information
Heiner Kallweit authored and David S. Miller committed Jun 14, 2019
1 parent 9e9f33b commit 272b226
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions drivers/net/ethernet/realtek/r8169_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4331,8 +4331,6 @@ static void rtl_hw_start_8168bef(struct rtl8169_private *tp)
{
rtl_hw_start_8168bb(tp);

RTL_W8(tp, MaxTxPacketSize, TxPacketMax);

RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~(1 << 0));
}

Expand Down Expand Up @@ -4384,8 +4382,6 @@ static void rtl_hw_start_8168cp_3(struct rtl8169_private *tp)
/* Magic. */
RTL_W8(tp, DBG_REG, 0x20);

RTL_W8(tp, MaxTxPacketSize, TxPacketMax);

if (tp->dev->mtu <= ETH_DATA_LEN)
rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
}
Expand Down Expand Up @@ -4439,8 +4435,6 @@ static void rtl_hw_start_8168d(struct rtl8169_private *tp)

rtl_disable_clock_request(tp);

RTL_W8(tp, MaxTxPacketSize, TxPacketMax);

if (tp->dev->mtu <= ETH_DATA_LEN)
rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
}
Expand All @@ -4452,8 +4446,6 @@ static void rtl_hw_start_8168dp(struct rtl8169_private *tp)
if (tp->dev->mtu <= ETH_DATA_LEN)
rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);

RTL_W8(tp, MaxTxPacketSize, TxPacketMax);

rtl_disable_clock_request(tp);
}

Expand All @@ -4469,8 +4461,6 @@ static void rtl_hw_start_8168d_4(struct rtl8169_private *tp)

rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);

RTL_W8(tp, MaxTxPacketSize, TxPacketMax);

rtl_ephy_init(tp, e_info_8168d_4);

rtl_enable_clock_request(tp);
Expand Down Expand Up @@ -4501,8 +4491,6 @@ static void rtl_hw_start_8168e_1(struct rtl8169_private *tp)
if (tp->dev->mtu <= ETH_DATA_LEN)
rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);

RTL_W8(tp, MaxTxPacketSize, TxPacketMax);

rtl_disable_clock_request(tp);

/* Reset tx FIFO pointer */
Expand Down Expand Up @@ -4534,8 +4522,6 @@ static void rtl_hw_start_8168e_2(struct rtl8169_private *tp)
rtl_eri_set_bits(tp, 0x1b0, ERIAR_MASK_0001, BIT(4));
rtl_w0w1_eri(tp, 0x0d4, ERIAR_MASK_0011, 0x0c00, 0xff00);

RTL_W8(tp, MaxTxPacketSize, EarlySize);

rtl_disable_clock_request(tp);

RTL_W8(tp, MCU, RTL_R8(tp, MCU) & ~NOW_IS_OOB);
Expand Down Expand Up @@ -4564,8 +4550,6 @@ static void rtl_hw_start_8168f(struct rtl8169_private *tp)
rtl_eri_write(tp, 0xcc, ERIAR_MASK_1111, 0x00000050);
rtl_eri_write(tp, 0xd0, ERIAR_MASK_1111, 0x00000060);

RTL_W8(tp, MaxTxPacketSize, EarlySize);

rtl_disable_clock_request(tp);

RTL_W8(tp, MCU, RTL_R8(tp, MCU) & ~NOW_IS_OOB);
Expand Down Expand Up @@ -4622,7 +4606,6 @@ static void rtl_hw_start_8168g(struct rtl8169_private *tp)
rtl_eri_write(tp, 0x2f8, ERIAR_MASK_0011, 0x1d8f);

RTL_W32(tp, MISC, RTL_R32(tp, MISC) & ~RXDV_GATED_EN);
RTL_W8(tp, MaxTxPacketSize, EarlySize);

rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000);
rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000);
Expand Down Expand Up @@ -4720,7 +4703,6 @@ static void rtl_hw_start_8168h_1(struct rtl8169_private *tp)
rtl_eri_write(tp, 0x5f0, ERIAR_MASK_0011, 0x4f87);

RTL_W32(tp, MISC, RTL_R32(tp, MISC) & ~RXDV_GATED_EN);
RTL_W8(tp, MaxTxPacketSize, EarlySize);

rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000);
rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000);
Expand Down Expand Up @@ -4796,7 +4778,6 @@ static void rtl_hw_start_8168ep(struct rtl8169_private *tp)
rtl_eri_write(tp, 0x5f0, ERIAR_MASK_0011, 0x4f87);

RTL_W32(tp, MISC, RTL_R32(tp, MISC) & ~RXDV_GATED_EN);
RTL_W8(tp, MaxTxPacketSize, EarlySize);

rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000);
rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000);
Expand Down Expand Up @@ -5068,7 +5049,10 @@ static void rtl_hw_start_8168(struct rtl8169_private *tp)
pcie_capability_set_word(tp->pci_dev, PCI_EXP_DEVCTL,
PCI_EXP_DEVCTL_NOSNOOP_EN);

RTL_W8(tp, MaxTxPacketSize, TxPacketMax);
if (rtl_is_8168evl_up(tp))
RTL_W8(tp, MaxTxPacketSize, EarlySize);
else
RTL_W8(tp, MaxTxPacketSize, TxPacketMax);

rtl_hw_config(tp);
}
Expand Down

0 comments on commit 272b226

Please sign in to comment.