Commit Graph

12 Commits

Author SHA1 Message Date
Sandeep Singh
afc7a80790 cnss_prealloc: check cnss_pools before returning memory
Check cnss_pools before returning memory to wlan
host driver.

Change-Id: I44e2a34b3c232e08e7e1d4bdb567cd4de09f3eb1
CRs-Fixed: 3506939
2023-05-23 16:04:31 +05:30
Naman Padhiar
6506428355 cnss_prealloc: Update memory pool table for WCN6750
The memory pool table decides number of reserved pools
needs to be preallocated during initialization. Update
the table for WCN6750.

Change-Id: I8679c574977026c9bb894e40384b74110d2c8ebd
CRs-Fixed: 3493255
2023-05-13 19:27:51 -07:00
Sandeep Singh
32e1756a19 cnss_prealloc: clean up prealloc mempool and cache on deinit
Cnss prealloc is trying to allocate memory from mempool
for wlan host driver even after cnss prealloc pool has been
destroyed by platform driver because mempool and cache is
not cleaned up on cnss pool deinit. Clean up mempool and
cache on prealloc deinit.

Change-Id: If28a27f5a21441e8650bb846ded889a33580ceaf
CRs-Fixed: 3488178
2023-05-08 12:15:19 -07:00
Sandeep Singh
97303bf330 cnss_prealloc: update prealloc mem pool based on device type
Update prealloc mem pool based on device type.

Change-Id: Ic7fc2145a0039aa55643672b8e125857c096a3ee
CRs-Fixed: 3459351
2023-04-25 23:46:44 -07:00
Rajesh Chauhan
ff372a6f1d cnss_prealloc: use slab_cache from slab struct to identify mempool id
CNSS prealloc maintains various prealloc pools of 8Kb, 16Kb, 32Kb
and so on, and allocates buffer from the pool for wlan driver. When
wlan driver requests to free the memory buffer then CNSS prealloc
needs to first find out mempool id from which this buffer was allocated.
Use slab_cache from slab struct to identify memory pool id. Until
kernel 5.16, slab_cache was part of page struct but in kernel 5.17,
slab_cache is moved out to mm/slab.h file.

Also change WCNSS_PRE_ALLOC_GET_THRESHOLD to 8Kb to match with
cnss_pool_alloc_threshold.

Change-Id: I4e34d8f0b855c210cc9af30c1f4a0d6c7e43ab00
CRs-Fixed: 3414037
2023-04-10 10:37:41 -07:00
Yu Wang
44ad9ad95f cnss_prealloc: Add null pointer check before accessing memory pool
Pointer for memory pool may be null if it fails to
create memory pool in cnss_pool_init().
Add null pointer check before accessing memory pool.

Change-Id: I8ae2b6a5193cffdcba3990b238178a1b93297925
CRs-Fixed: 3332360
2022-11-10 07:26:47 -08:00
Alan Chen
e3b36fcd46 cnss_prealloc: Update preallocation pool entries
Update pre allocation pool entries as below:

8kb: 22 -> 16
16kb: 16 -> 16
32kb: 6 -> 22
64kb: 8 -> 38
128kb: 2 -> 10

Change-Id: I2ba69d7332447229f0ad2907dd380f663a8a3fd8
CRs-Fixed: 3306034
2022-10-25 00:22:10 -07:00
Rajesh Chauhan
48cfe543c6 cnss_prealloc: add new functions to store cache at beginning of memory
CNSS prealloc maintains various prealloc pools of 8Kb, 16Kb, 32Kb
and so on, and allocates buffer from the pool for wlan driver. When
wlan driver requests to free the memory buffer then CNSS prealloc
derives slab_cache from virtual memory via page struct to identify
prealloc pool id to put memory buffer back into the pool.

In kernel 5.17, slab_cache is removed from the page struct. Add new
functions to store cache at the beginning of allocated buffer and
when wlan driver requests to free the memory then use that cache to
identify CNSS prealloc pool to put back memory.

Change-Id: I6b3a54d3f502d977c6a61cfa6aeae597df9c8e72
CRs-Fixed: 3309289
2022-10-17 21:23:29 -07:00
Yu Wang
a5a88a8d75 cnss_prealloc: replace in_atomic() with proper API
According to kernel comment for in_atomic(), it's
incorrect to use it outside core kernel code.
To follow this rule, replace
(irqs_disabled() || in_atomic()) with (!preemptible())
when getting GFP flags.

Change-Id: I7cdb28a7f12ffd60216c7bc1921a277de6113cb5
CRs-Fixed: 3273779
2022-08-26 12:28:06 -07:00
Yu Wang
728b08d683 cnss_prealloc: fix GFP flag for mempool_alloc
As per implementation of might_sleep(), rcu_read_lock()
nesting depth should be take into consideration too to
figure out whether sleeping is allowable or not.
To make align with it, allocate memory with GFP_ATOMIC
if rcu_read_lock() nesting depth is not zero.

Change-Id: Ib225a33b1a3f37b919e41daf064ce2de44428973
CRs-Fixed: 3271651
2022-08-22 04:51:13 -07:00
Yue Ma
7e3754303f wlan_platform: Add CONFIG_CNSS_OUT_OF_TREE flag
Use CONFIG_CNSS_OUT_OF_TREE to control if CNSS family drivers are
built from in-kernel-tree source or out-of-kernel-tree source since
the exposed header files will be in different paths. This is also
for backward compatibility.

Change-Id: I24111fdb76607bf911c29e415d42d25609f9b26c
2021-10-08 15:31:58 -07:00
Yue Ma
5b29459b17 wlan_platform: Bring initial files for CNSS family drivers
Bring CNSS family drivers from msm-5.10 kernel as of commit
cc3bc4b888af (cnss2: Fix a few switch statement fallthrough
issues) to WLAN platform project. Fix SPDX-License format for
a few files as well.

drivers/net/wireless/cnss* -> .
include/net/cnss* -> inc/

Above shows how directories and header files are relocated.

Change-Id: If8fd40a35c9fdbeb1aa76a8aac5fdb1fc1c7e786
2021-10-08 15:28:40 -07:00