mirror of
https://github.com/opnsense/src.git
synced 2026-06-06 23:32:52 -04:00
LinuxKPI: always use contig allocations in linux_alloc_kmem()
In linux_alloc_kmem() [used by *get_page*()] we always at least allocate PAGE_SIZE and we want the allocation to be contiguous so it can be passed to DMA. Always use kmem_alloc_contig() and only change the low argument depending on the GFP_DMA32 flag being given or not. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: jhb, dumbbell Differential Revision: https://reviews.freebsd.org/D46661
This commit is contained in:
parent
d2a55e6a93
commit
a5c7b44d6a
1 changed files with 4 additions and 6 deletions
|
|
@ -182,12 +182,10 @@ linux_alloc_kmem(gfp_t flags, unsigned int order)
|
|||
size_t size = ((size_t)PAGE_SIZE) << order;
|
||||
void *addr;
|
||||
|
||||
if ((flags & GFP_DMA32) == 0) {
|
||||
addr = kmem_malloc(size, flags & GFP_NATIVE_MASK);
|
||||
} else {
|
||||
addr = kmem_alloc_contig(size, flags & GFP_NATIVE_MASK, 0,
|
||||
BUS_SPACE_MAXADDR_32BIT, PAGE_SIZE, 0, VM_MEMATTR_DEFAULT);
|
||||
}
|
||||
addr = kmem_alloc_contig(size, flags & GFP_NATIVE_MASK, 0,
|
||||
((flags & GFP_DMA32) == 0) ? -1UL : BUS_SPACE_MAXADDR_32BIT,
|
||||
PAGE_SIZE, 0, VM_MEMATTR_DEFAULT);
|
||||
|
||||
return ((vm_offset_t)addr);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue