summaryrefslogtreecommitdiff
blob: 60a0be288765c40242d8eb72ef909ec7d34cbd93 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
diff --git a/vmmon-only/linux/iommu.c b/vmmon-only/linux/iommu.c
index c692c2d..e8b6099 100644
--- a/vmmon-only/linux/iommu.c
+++ b/vmmon-only/linux/iommu.c
@@ -42,6 +42,12 @@
 #define PCI_BDF_SLOTFUNC(bdf) PCI_DEVFN(PCI_SLOT(bdf), PCI_FUNC(bdf))
 #define PCI_BDF_BUS(bdf)      (((bdf) >> 8) & 0xff)
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
+#include <linux/pci.h>
+#define iommu_found() iommu_present(&pci_bus_type)
+#define iommu_domain_alloc() iommu_domain_alloc(&pci_bus_type)
+#endif
+
 typedef struct PassthruDevice {
    uint32 bdf;
    struct pci_dev *pdev;
diff --git a/vmnet-only/filter.c b/vmnet-only/filter.c
index 491add5..74f7a3b 100644
--- a/vmnet-only/filter.c
+++ b/vmnet-only/filter.c
@@ -40,6 +40,10 @@
 #include "vnetInt.h"
 #include "vmnetInt.h"
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
+#include <linux/export.h>
+#endif
+
 // VNet_FilterLogPacket.action for dropped packets
 #define VNET_FILTER_ACTION_DRP         (1)
 #define VNET_FILTER_ACTION_DRP_SHORT   (2)
diff --git a/vmnet-only/netif.c b/vmnet-only/netif.c
index 4bdb643..540301c 100644
--- a/vmnet-only/netif.c
+++ b/vmnet-only/netif.c
@@ -62,7 +62,9 @@ static int  VNetNetifClose(struct net_device *dev);
 static int  VNetNetifStartXmit(struct sk_buff *skb, struct net_device *dev);
 static struct net_device_stats *VNetNetifGetStats(struct net_device *dev);
 static int  VNetNetifSetMAC(struct net_device *dev, void *addr);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
 static void VNetNetifSetMulticast(struct net_device *dev);
+#endif
 #if 0
 static void VNetNetifTxTimeout(struct net_device *dev);
 #endif
@@ -131,7 +133,9 @@ VNetNetIfSetup(struct net_device *dev)  // IN:
       .ndo_stop = VNetNetifClose,
       .ndo_get_stats = VNetNetifGetStats,
       .ndo_set_mac_address = VNetNetifSetMAC,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)
       .ndo_set_multicast_list = VNetNetifSetMulticast,
+#endif
       /*
        * We cannot stuck... If someone will report problems under
        * low memory conditions or some such, we should enable it.
@@ -612,11 +616,12 @@ VNetNetifSetMAC(struct net_device *dev, // IN:
  *----------------------------------------------------------------------
  */
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
 void
 VNetNetifSetMulticast(struct net_device *dev) // IN: unused
 {
 }
-
+#endif
 
 /*
  *----------------------------------------------------------------------
diff --git a/vmnet-only/userif.c b/vmnet-only/userif.c
index 541187b..77e0089 100644
--- a/vmnet-only/userif.c
+++ b/vmnet-only/userif.c
@@ -517,10 +517,18 @@ VNetCsumCopyDatagram(const struct sk_buff *skb,	// IN: skb to copy
 	 unsigned int tmpCsum;
 	 const void *vaddr;
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
+	 vaddr = kmap(skb_frag_page(frag));
+#else
 	 vaddr = kmap(frag->page);
+#endif
 	 tmpCsum = csum_and_copy_to_user(vaddr + frag->page_offset,
 					 curr, frag->size, 0, &err);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
+	 kunmap(skb_frag_page(frag));
+#else
 	 kunmap(frag->page);
+#endif
 	 if (err) {
 	    return err;
 	 }