فهرست منبع

qcacmn: Fix align issue for nbuf alloc

Current code it doesn't realize alignment.
Eg: if require 4096Bytes, it will alloc 4099Bytes,
which cause 2 pages here.

Fix is using qdf_align to align memory size.

Change-Id: I8eca9a085c0270f47318e64cefba686eac39a69a
CRs-Fixed: 2773627
Jingxiang Ge 4 سال پیش
والد
کامیت
3d5a0c6aba
1فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 3 3
      qdf/linux/src/qdf_nbuf.c

+ 3 - 3
qdf/linux/src/qdf_nbuf.c

@@ -401,7 +401,7 @@ struct sk_buff *__qdf_nbuf_alloc(qdf_device_t osdev, size_t size, int reserve,
 	uint32_t lowmem_alloc_tries = 0;
 
 	if (align)
-		size += (align - 1);
+		size = qdf_align(size, align);
 
 realloc:
 	skb = dev_alloc_skb(size);
@@ -474,7 +474,7 @@ struct sk_buff *__qdf_nbuf_alloc(qdf_device_t osdev, size_t size, int reserve,
 	int flags = GFP_KERNEL;
 
 	if (align)
-		size += (align - 1);
+		size = qdf_align(size, align);
 
 	if (in_interrupt() || irqs_disabled() || in_atomic()) {
 		flags = GFP_ATOMIC;
@@ -545,7 +545,7 @@ __qdf_nbuf_t __qdf_nbuf_alloc_no_recycler(size_t size, int reserve, int align,
 	unsigned long offset;
 
 	if (align)
-		size += (align - 1);
+		size = qdf_align(size, align);
 
 	nbuf = alloc_skb(size, GFP_ATOMIC);
 	if (!nbuf)