mirror of
https://git.yoctoproject.org/meta-ti
synced 2026-07-21 03:17:18 +00:00
6203cbca5c
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> Signed-off-by: Denys Dmytriyenko <denys@ti.com>
68 lines
1.9 KiB
Diff
68 lines
1.9 KiB
Diff
From 6c4e2ff1b19d58c2a2f016d25b96eee0f733d7aa Mon Sep 17 00:00:00 2001
|
|
From: Jason Wang <jasowang@redhat.com>
|
|
Date: Wed, 2 May 2012 11:41:30 +0800
|
|
Subject: [PATCH 016/109] macvtap: zerocopy: fix offset calculation when
|
|
building skb
|
|
|
|
commit 3afc9621f15701c557e60f61eba9242bac2771dd upstream.
|
|
|
|
This patch fixes the offset calculation when building skb:
|
|
|
|
- offset1 were used as skb data offset not vector offset
|
|
- reset offset to zero only when we advance to next vector
|
|
|
|
Signed-off-by: Jason Wang <jasowang@redhat.com>
|
|
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
|
|
---
|
|
drivers/net/macvtap.c | 13 +++++++------
|
|
1 files changed, 7 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
|
|
index 1b7082d..4505008 100644
|
|
--- a/drivers/net/macvtap.c
|
|
+++ b/drivers/net/macvtap.c
|
|
@@ -504,10 +504,11 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
|
|
if (copy > size) {
|
|
++from;
|
|
--count;
|
|
- }
|
|
+ offset = 0;
|
|
+ } else
|
|
+ offset += size;
|
|
copy -= size;
|
|
offset1 += size;
|
|
- offset = 0;
|
|
}
|
|
|
|
if (len == offset1)
|
|
@@ -518,13 +519,13 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
|
|
int num_pages;
|
|
unsigned long base;
|
|
|
|
- len = from->iov_len - offset1;
|
|
+ len = from->iov_len - offset;
|
|
if (!len) {
|
|
- offset1 = 0;
|
|
+ offset = 0;
|
|
++from;
|
|
continue;
|
|
}
|
|
- base = (unsigned long)from->iov_base + offset1;
|
|
+ base = (unsigned long)from->iov_base + offset;
|
|
size = ((base & ~PAGE_MASK) + len + ~PAGE_MASK) >> PAGE_SHIFT;
|
|
num_pages = get_user_pages_fast(base, size, 0, &page[i]);
|
|
if ((num_pages != size) ||
|
|
@@ -545,7 +546,7 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
|
|
len -= size;
|
|
i++;
|
|
}
|
|
- offset1 = 0;
|
|
+ offset = 0;
|
|
++from;
|
|
}
|
|
return 0;
|
|
--
|
|
1.7.7.6
|
|
|