mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-07 14:32:23 +00:00
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>
This commit is contained in:
parent
b707659213
commit
d9973cec9d
@ -14,6 +14,7 @@
|
|||||||
#include <linux/netdevice.h>
|
#include <linux/netdevice.h>
|
||||||
#include <linux/rtnetlink.h>
|
#include <linux/rtnetlink.h>
|
||||||
#include <linux/idr.h>
|
#include <linux/idr.h>
|
||||||
|
#include <linux/highmem.h>
|
||||||
|
|
||||||
#include "xdp_umem.h"
|
#include "xdp_umem.h"
|
||||||
#include "xsk_queue.h"
|
#include "xsk_queue.h"
|
||||||
@ -164,6 +165,14 @@ void xdp_umem_clear_dev(struct xdp_umem *umem)
|
|||||||
umem->zc = false;
|
umem->zc = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void xdp_umem_unmap_pages(struct xdp_umem *umem)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < umem->npgs; i++)
|
||||||
|
kunmap(umem->pgs[i]);
|
||||||
|
}
|
||||||
|
|
||||||
static void xdp_umem_unpin_pages(struct xdp_umem *umem)
|
static void xdp_umem_unpin_pages(struct xdp_umem *umem)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -207,6 +216,7 @@ static void xdp_umem_release(struct xdp_umem *umem)
|
|||||||
|
|
||||||
xsk_reuseq_destroy(umem);
|
xsk_reuseq_destroy(umem);
|
||||||
|
|
||||||
|
xdp_umem_unmap_pages(umem);
|
||||||
xdp_umem_unpin_pages(umem);
|
xdp_umem_unpin_pages(umem);
|
||||||
|
|
||||||
kfree(umem->pages);
|
kfree(umem->pages);
|
||||||
@ -369,7 +379,7 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < umem->npgs; i++)
|
for (i = 0; i < umem->npgs; i++)
|
||||||
umem->pages[i].addr = page_address(umem->pgs[i]);
|
umem->pages[i].addr = kmap(umem->pgs[i]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user