xsk: Remove unnecessary member in xdp_umem
Remove the unnecessary member of address in struct xdp_umem as it is only used during the umem registration. No need to carry this around as it is not used during run-time nor when unregistering the umem. Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Jonathan Lemon <jonathan.lemon@gmail.com> Link: https://lore.kernel.org/bpf/1588599232-24897-3-git-send-email-magnus.karlsson@intel.com
This commit is contained in:

committed by
Daniel Borkmann

parent
e4e5aefc11
commit
07bf2d97d1
@@ -50,7 +50,6 @@ struct xdp_umem {
|
|||||||
u32 headroom;
|
u32 headroom;
|
||||||
u32 chunk_size_nohr;
|
u32 chunk_size_nohr;
|
||||||
struct user_struct *user;
|
struct user_struct *user;
|
||||||
unsigned long address;
|
|
||||||
refcount_t users;
|
refcount_t users;
|
||||||
struct work_struct work;
|
struct work_struct work;
|
||||||
struct page **pgs;
|
struct page **pgs;
|
||||||
|
@@ -279,7 +279,7 @@ void xdp_put_umem(struct xdp_umem *umem)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int xdp_umem_pin_pages(struct xdp_umem *umem)
|
static int xdp_umem_pin_pages(struct xdp_umem *umem, unsigned long address)
|
||||||
{
|
{
|
||||||
unsigned int gup_flags = FOLL_WRITE;
|
unsigned int gup_flags = FOLL_WRITE;
|
||||||
long npgs;
|
long npgs;
|
||||||
@@ -291,7 +291,7 @@ static int xdp_umem_pin_pages(struct xdp_umem *umem)
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
down_read(¤t->mm->mmap_sem);
|
down_read(¤t->mm->mmap_sem);
|
||||||
npgs = pin_user_pages(umem->address, umem->npgs,
|
npgs = pin_user_pages(address, umem->npgs,
|
||||||
gup_flags | FOLL_LONGTERM, &umem->pgs[0], NULL);
|
gup_flags | FOLL_LONGTERM, &umem->pgs[0], NULL);
|
||||||
up_read(¤t->mm->mmap_sem);
|
up_read(¤t->mm->mmap_sem);
|
||||||
|
|
||||||
@@ -385,7 +385,6 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
|
|||||||
if (headroom >= chunk_size - XDP_PACKET_HEADROOM)
|
if (headroom >= chunk_size - XDP_PACKET_HEADROOM)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
umem->address = (unsigned long)addr;
|
|
||||||
umem->chunk_mask = unaligned_chunks ? XSK_UNALIGNED_BUF_ADDR_MASK
|
umem->chunk_mask = unaligned_chunks ? XSK_UNALIGNED_BUF_ADDR_MASK
|
||||||
: ~((u64)chunk_size - 1);
|
: ~((u64)chunk_size - 1);
|
||||||
umem->size = size;
|
umem->size = size;
|
||||||
@@ -404,7 +403,7 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
|
|||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
err = xdp_umem_pin_pages(umem);
|
err = xdp_umem_pin_pages(umem, (unsigned long)addr);
|
||||||
if (err)
|
if (err)
|
||||||
goto out_account;
|
goto out_account;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user