diff options
author | Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> | 2019-08-08 05:38:03 -0400 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2019-08-09 12:02:19 -0400 |
commit | d9973cec9d578b381235bb872a2d378c69c54915 (patch) | |
tree | 312f4730e73ac572f7884ae5729b6fc7d934308d /net/xdp | |
parent | b707659213d3c70f2c704ec950df6263b4bffe84 (diff) |
xdp: xdp_umem: fix umem pages mapping for 32bits systems
Use kmap instead of page_address as it's not always in low memory.
Acked-by: Björn Töpel <bjorn.topel@intel.com>
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'net/xdp')
-rw-r--r-- | net/xdp/xdp_umem.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c index 83de74ca729a..a0607969f8c0 100644 --- a/net/xdp/xdp_umem.c +++ b/net/xdp/xdp_umem.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/netdevice.h> | 14 | #include <linux/netdevice.h> |
15 | #include <linux/rtnetlink.h> | 15 | #include <linux/rtnetlink.h> |
16 | #include <linux/idr.h> | 16 | #include <linux/idr.h> |
17 | #include <linux/highmem.h> | ||
17 | 18 | ||
18 | #include "xdp_umem.h" | 19 | #include "xdp_umem.h" |
19 | #include "xsk_queue.h" | 20 | #include "xsk_queue.h" |
@@ -164,6 +165,14 @@ void xdp_umem_clear_dev(struct xdp_umem *umem) | |||
164 | umem->zc = false; | 165 | umem->zc = false; |
165 | } | 166 | } |
166 | 167 | ||
168 | static void xdp_umem_unmap_pages(struct xdp_umem *umem) | ||
169 | { | ||
170 | unsigned int i; | ||
171 | |||
172 | for (i = 0; i < umem->npgs; i++) | ||
173 | kunmap(umem->pgs[i]); | ||
174 | } | ||
175 | |||
167 | static void xdp_umem_unpin_pages(struct xdp_umem *umem) | 176 | static void xdp_umem_unpin_pages(struct xdp_umem *umem) |
168 | { | 177 | { |
169 | unsigned int i; | 178 | unsigned int i; |
@@ -207,6 +216,7 @@ static void xdp_umem_release(struct xdp_umem *umem) | |||
207 | 216 | ||
208 | xsk_reuseq_destroy(umem); | 217 | xsk_reuseq_destroy(umem); |
209 | 218 | ||
219 | xdp_umem_unmap_pages(umem); | ||
210 | xdp_umem_unpin_pages(umem); | 220 | xdp_umem_unpin_pages(umem); |
211 | 221 | ||
212 | kfree(umem->pages); | 222 | kfree(umem->pages); |
@@ -369,7 +379,7 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) | |||
369 | } | 379 | } |
370 | 380 | ||
371 | for (i = 0; i < umem->npgs; i++) | 381 | for (i = 0; i < umem->npgs; i++) |
372 | umem->pages[i].addr = page_address(umem->pgs[i]); | 382 | umem->pages[i].addr = kmap(umem->pgs[i]); |
373 | 383 | ||
374 | return 0; | 384 | return 0; |
375 | 385 | ||