Skip to content

Commit bb41c13

Browse files
Chunhao Lindavem330
authored andcommitted
r8169: fix dmar pte write access is not set error
When close device, if wol is enabled, rx will be enabled. When open device it will cause rx packet to be dma to the wrong memory address after pci_set_master() and system log will show blow messages. DMAR: DRHD: handling fault status reg 3 DMAR: [DMA Write] Request device [02:00.0] PASID ffffffff fault addr ffdd4000 [fault reason 05] PTE Write access is not set In this patch, driver disable tx/rx when close device. If wol is enabled, only enable rx filter and disable rxdv_gate(if support) to let hardware only receive packet to fifo but not to dma it. Signed-off-by: Chunhao Lin <[email protected]> Reviewed-by: Heiner Kallweit <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ad42566 commit bb41c13

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/net/ethernet/realtek/r8169_main.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2438,6 +2438,9 @@ static void rtl_wol_enable_rx(struct rtl8169_private *tp)
24382438
if (tp->mac_version >= RTL_GIGA_MAC_VER_25)
24392439
RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) |
24402440
AcceptBroadcast | AcceptMulticast | AcceptMyPhys);
2441+
2442+
if (tp->mac_version >= RTL_GIGA_MAC_VER_40)
2443+
rtl_disable_rxdvgate(tp);
24412444
}
24422445

24432446
static void rtl_prepare_power_down(struct rtl8169_private *tp)
@@ -3872,7 +3875,7 @@ static void rtl8169_tx_clear(struct rtl8169_private *tp)
38723875
netdev_reset_queue(tp->dev);
38733876
}
38743877

3875-
static void rtl8169_cleanup(struct rtl8169_private *tp, bool going_down)
3878+
static void rtl8169_cleanup(struct rtl8169_private *tp)
38763879
{
38773880
napi_disable(&tp->napi);
38783881

@@ -3884,9 +3887,6 @@ static void rtl8169_cleanup(struct rtl8169_private *tp, bool going_down)
38843887

38853888
rtl_rx_close(tp);
38863889

3887-
if (going_down && tp->dev->wol_enabled)
3888-
goto no_reset;
3889-
38903890
switch (tp->mac_version) {
38913891
case RTL_GIGA_MAC_VER_28:
38923892
case RTL_GIGA_MAC_VER_31:
@@ -3907,7 +3907,7 @@ static void rtl8169_cleanup(struct rtl8169_private *tp, bool going_down)
39073907
}
39083908

39093909
rtl_hw_reset(tp);
3910-
no_reset:
3910+
39113911
rtl8169_tx_clear(tp);
39123912
rtl8169_init_ring_indexes(tp);
39133913
}
@@ -3918,7 +3918,7 @@ static void rtl_reset_work(struct rtl8169_private *tp)
39183918

39193919
netif_stop_queue(tp->dev);
39203920

3921-
rtl8169_cleanup(tp, false);
3921+
rtl8169_cleanup(tp);
39223922

39233923
for (i = 0; i < NUM_RX_DESC; i++)
39243924
rtl8169_mark_to_asic(tp->RxDescArray + i);
@@ -4605,7 +4605,7 @@ static void rtl8169_down(struct rtl8169_private *tp)
46054605
pci_clear_master(tp->pci_dev);
46064606
rtl_pci_commit(tp);
46074607

4608-
rtl8169_cleanup(tp, true);
4608+
rtl8169_cleanup(tp);
46094609
rtl_disable_exit_l1(tp);
46104610
rtl_prepare_power_down(tp);
46114611
}

0 commit comments

Comments
 (0)