Page MenuHomeFreeBSD

D49990.id154193.diff
No OneTemporary

D49990.id154193.diff

diff --git a/sys/compat/linuxkpi/common/src/linux_skbuff.c b/sys/compat/linuxkpi/common/src/linux_skbuff.c
--- a/sys/compat/linuxkpi/common/src/linux_skbuff.c
+++ b/sys/compat/linuxkpi/common/src/linux_skbuff.c
@@ -67,33 +67,11 @@
static uma_zone_t skbzone;
-#define SKB_DMA32_MALLOC
-#ifdef SKB_DMA32_MALLOC
-/*
- * Realtek wireless drivers (e.g., rtw88) require 32bit DMA in a single segment.
- * busdma(9) has a hard time providing this currently for 3-ish pages at large
- * quantities (see lkpi_pci_nseg1_fail in linux_pci.c).
- * Work around this for now by allowing a tunable to enforce physical addresses
- * allocation limits using "old-school" contigmalloc(9) to avoid bouncing.
- * Note: with the malloc/contigmalloc + kmalloc changes also providing physical
- * contiguous memory, and the nseg=1 limit for bouncing we should in theory be
- * fine now and not need any of this anymore, however busdma still has troubles
- * boncing three contiguous pages so for now this stays.
- */
-static int linuxkpi_skb_memlimit;
-SYSCTL_INT(_compat_linuxkpi_skb, OID_AUTO, mem_limit, CTLFLAG_RDTUN,
- &linuxkpi_skb_memlimit, 0, "SKB memory limit: 0=no limit, "
- "1=32bit, 2=36bit, other=undef (currently 32bit)");
-
-static MALLOC_DEFINE(M_LKPISKB, "lkpiskb", "Linux KPI skbuff compat");
-#endif
-
struct sk_buff *
linuxkpi_alloc_skb(size_t size, gfp_t gfp)
{
struct sk_buff *skb;
void *p;
- size_t len;
skb = uma_zalloc(skbzone, linux_check_m_flags(gfp) | M_ZERO);
if (skb == NULL)
@@ -106,32 +84,7 @@
if (size == 0)
return (skb);
- len = size;
-#ifdef SKB_DMA32_MALLOC
- /*
- * Using our own type here not backing my kmalloc.
- * We assume no one calls kfree directly on the skb.
- */
- if (__predict_false(linuxkpi_skb_memlimit != 0)) {
- vm_paddr_t high;
-
- switch (linuxkpi_skb_memlimit) {
-#ifdef __LP64__
- case 2:
- high = (0xfffffffff); /* 1<<36 really. */
- break;
-#endif
- case 1:
- default:
- high = (0xffffffff); /* 1<<32 really. */
- break;
- }
- len = roundup_pow_of_two(len);
- p = contigmalloc(len, M_LKPISKB,
- linux_check_m_flags(gfp) | M_ZERO, 0, high, PAGE_SIZE, 0);
- } else
-#endif
- p = __kmalloc(len, linux_check_m_flags(gfp) | M_ZERO);
+ p = __kmalloc(size, linux_check_m_flags(gfp) | M_ZERO);
if (p == NULL) {
uma_zfree(skbzone, skb);
return (NULL);
@@ -275,11 +228,6 @@
skb->head = NULL;
}
-#ifdef SKB_DMA32_MALLOC
- if (__predict_false(linuxkpi_skb_memlimit != 0))
- free(skb->head, M_LKPISKB);
- else
-#endif
kfree(skb->head);
uma_zfree(skbzone, skb);
}

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 26, 11:48 PM (2 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17769955
Default Alt Text
D49990.id154193.diff (2 KB)

Event Timeline