summarylogtreecommitdiffstats
path: root/vmnet.patch
diff options
context:
space:
mode:
authorJean-Marc Lenoir2020-03-13 20:15:31 +0100
committerJean-Marc Lenoir2020-03-13 20:15:31 +0100
commit33379f2ada4244215ed4cd83f68e143f6980325d (patch)
treeb4383892b3462da655fe264e49389ae11874112a /vmnet.patch
parent1adb99d37b092d344b05501c6d8956a1700092e5 (diff)
downloadaur-33379f2ada4244215ed4cd83f68e143f6980325d.tar.gz
Compatibility with Linux 5.6
Diffstat (limited to 'vmnet.patch')
-rw-r--r--vmnet.patch120
1 files changed, 55 insertions, 65 deletions
diff --git a/vmnet.patch b/vmnet.patch
index 82cf37ca89a..5f1159bc712 100644
--- a/vmnet.patch
+++ b/vmnet.patch
@@ -35,8 +35,56 @@
MODULEBUILDDIR=$(MODULEBUILDDIR) modules
$(MAKE) -C $$PWD SRCROOT=$$PWD/$(SRCROOT) \
MODULEBUILDDIR=$(MODULEBUILDDIR) postbuild
+--- a/vmnet/procfs.c
++++ a/vmnet/procfs.c
+@@ -137,6 +137,7 @@
+ }
+
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0)
+ /*
+ *----------------------------------------------------------------------
+ *
+@@ -168,6 +169,7 @@
+ .release = single_release,
+ };
+ #endif
++#endif
+
+
+ /*
+@@ -203,7 +205,12 @@
+ } else {
+ ent->data = data;
+ ent->fn = fn;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0)
++ ent->pde = proc_create_single_data(name, mode, parent->pde,
++ VNetProcShow, ent);
++#else
+ ent->pde = proc_create_data(name, mode, parent->pde, &fops, ent);
++#endif
+ }
+ if (ent->pde != NULL) {
+ *ret = ent;
--- a/vmnet/userif.c
+++ b/vmnet/userif.c
+@@ -78,11 +78,11 @@
+ extern unsigned int vnet_max_qlen;
+
+ #if COMPAT_LINUX_VERSION_CHECK_LT(3, 2, 0)
+-# define compat_kmap(page) kmap(page)
+-# define compat_kunmap(page) kunmap(page)
+-#else
+-# define compat_kmap(page) kmap((page).p)
+-# define compat_kunmap(page) kunmap((page).p)
++# define skb_frag_page(frag) (frag)->page
++# define skb_frag_size(frag) (frag)->size
++#endif
++#if COMPAT_LINUX_VERSION_CHECK_LT(5, 4, 0)
++# define skb_frag_off(frag) (frag)->page_offset
+ #endif
+
+ /*
@@ -137,16 +137,21 @@
*/
@@ -90,69 +138,12 @@
&recvClusterPage,
&recvClusterCount)) < 0) {
goto error_free;
-From f404bc6855ea2c731b617d3b0a2971481eb31cbd Mon Sep 17 00:00:00 2001
-From: Michal Kubecek <mkubecek@suse.cz>
-Date: Thu, 19 Sep 2019 12:20:20 +0200
-Subject: [PATCH] vmnet: handle switch of skb_frag_t to bio_vec
-
-The switch from custom skb_frag_t implementation to bio_vec in v5.4-rc1 is
-mostly transparent for modules which use accessor for skb_frag_t members.
-Unfortunately many users access the members directly and function
-VNetCsumCopyDatagram() in vmnet is one of those.
-
-Use accessors everywhere so that vmnet code is compatible with kernel 5.4
-and newer. Use "compat_" prefix to avoid clashes with backports adding the
-accessors to older codebase.
----
- vmnet-only/userif.c | 39 +++++++++++++++++++++++++++++----------
- 1 file changed, 29 insertions(+), 10 deletions(-)
-
-diff --git a/vmnet-only/userif.c b/vmnet-only/userif.c
-index d385088..aab9478 100644
---- a/vmnet-only/userif.c
-+++ b/vmnet-only/userif.c
-@@ -78,13 +78,31 @@ static int VNetUserIfSetUplinkState(VNetPort *port, uint8 linkUp);
- extern unsigned int vnet_max_qlen;
-
- #if COMPAT_LINUX_VERSION_CHECK_LT(3, 2, 0)
--# define compat_kmap(page) kmap(page)
--# define compat_kunmap(page) kunmap(page)
-+# define compat_kmap_frag(frag) kmap((frag)->page)
-+# define compat_kunmap_frag(page) kunmap((frag)->page)
- #else
--# define compat_kmap(page) kmap((page).p)
--# define compat_kunmap(page) kunmap((page).p)
-+# define compat_kmap_frag(frag) kmap(skb_frag_page(frag))
-+# define compat_kunmap_frag(frag) kunmap(skb_frag_page(frag))
- #endif
-
-+static unsigned int compat_skb_frag_size(const skb_frag_t *frag)
-+{
-+#if COMPAT_LINUX_VERSION_CHECK_LT(3, 2, 0)
-+ return frag->size;
-+#else
-+ return skb_frag_size(frag);
-+#endif
-+}
-+
-+static unsigned int compat_skb_frag_off(const skb_frag_t *frag)
-+{
-+#if COMPAT_LINUX_VERSION_CHECK_LT(5, 4, 0)
-+ return frag->page_offset;
-+#else
-+ return skb_frag_off(frag);
-+#endif
-+}
-+
- /*
- *-----------------------------------------------------------------------------
- *
-@@ -564,20 +582,21 @@ VNetCsumCopyDatagram(const struct sk_buff *skb, // IN: skb to copy
+@@ -559,20 +564,20 @@
for (frag = skb_shinfo(skb)->frags;
frag != skb_shinfo(skb)->frags + skb_shinfo(skb)->nr_frags;
frag++) {
- if (frag->size > 0) {
-+ if (compat_skb_frag_size(frag) > 0) {
++ if (skb_frag_size(frag) > 0) {
unsigned int tmpCsum;
const void *vaddr;
@@ -160,18 +151,17 @@ index d385088..aab9478 100644
- tmpCsum = csum_and_copy_to_user(vaddr + frag->page_offset,
- curr, frag->size, 0, &err);
- compat_kunmap(frag->page);
-+ vaddr = compat_kmap_frag(frag);
-+ tmpCsum = csum_and_copy_to_user(vaddr + compat_skb_frag_off(frag),
-+ curr, compat_skb_frag_size(frag), 0,
-+ &err);
-+ compat_kunmap_frag(frag);
++ vaddr = kmap(skb_frag_page(frag));
++ tmpCsum = csum_and_copy_to_user(vaddr + skb_frag_off(frag),
++ curr, skb_frag_size(frag), 0, &err);
++ kunmap(skb_frag_page(frag));
if (err) {
return err;
}
csum = csum_block_add(csum, tmpCsum, curr - buf);
- curr += frag->size;
-+ curr += compat_skb_frag_size(frag);
++ curr += skb_frag_size(frag);
}
}