summarylogtreecommitdiffstats
path: root/linux-5.18.patch
blob: aa0dd866ae0b2652fae1272f2a73ff22b1ec4d90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
diff -u -r r8168-8.050.00/src/r8168_n.c r8168-8.050.00-linux518/src/r8168_n.c
--- r8168-8.050.00/src/r8168_n.c	2022-05-06 09:48:25.000000000 +0000
+++ r8168-8.050.00-linux518/src/r8168_n.c	2022-05-24 21:31:05.802807395 +0000
@@ -3698,9 +3698,15 @@
         txd->opts2 = 0;
         while (1) {
                 memset(tmpAddr, pattern++, len - 14);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
                 pci_dma_sync_single_for_device(tp->pci_dev,
                                                le64_to_cpu(mapping),
                                                len, DMA_TO_DEVICE);
+#else
+                dma_sync_single_for_device(tp_to_dev(tp),
+                                           le64_to_cpu(mapping),
+                                           len, DMA_TO_DEVICE);
+#endif
                 txd->opts1 = cpu_to_le32(DescOwn | FirstFrag | LastFrag | len);
 
                 RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig)  | AcceptMyPhys);
@@ -3726,7 +3732,11 @@
                 if (rx_len == len) {
                         dma_sync_single_for_cpu(tp_to_dev(tp), le64_to_cpu(rxd->addr), tp->rx_buf_sz, DMA_FROM_DEVICE);
                         i = memcmp(skb->data, rx_skb->data, rx_len);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
                         pci_dma_sync_single_for_device(tp->pci_dev, le64_to_cpu(rxd->addr), tp->rx_buf_sz, DMA_FROM_DEVICE);
+#else
+                        dma_sync_single_for_device(tp_to_dev(tp), le64_to_cpu(rxd->addr), tp->rx_buf_sz, DMA_FROM_DEVICE);
+#endif
                         if (i == 0) {
 //              dev_printk(KERN_INFO, tp_to_dev(tp), "loopback test finished\n",rx_len,len);
                                 break;
@@ -26403,11 +26413,20 @@
 
         if ((sizeof(dma_addr_t) > 4) &&
             use_dac &&
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
             !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) &&
             !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) {
+#else
+            !dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) &&
+            !dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) {
+#endif
                 dev->features |= NETIF_F_HIGHDMA;
         } else {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
                 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
+#else
+                rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
+#endif
                 if (rc < 0) {
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
                         if (netif_msg_probe(tp))