qcacmn: Add qdf_flex_mem pool allocator

It often happens that the WLAN driver needs to allocate some pool of
structures to handle bursty operations. The traditional approach is to
statically allocate the maximum number of structures that we want to be
able to handle concurrently. This has the significant down side of
requiring manual tuning for every hardware combination for optimal
behavior, and wasting large amounts of memory during non-burst periods.

Add a new flexible, segmented memory allocator in QDF to help address
such scenarios. A small static buffer segment is used to service the
vast majority of operations, while additional segments are dynamically
allocated as needed to meet demand. Critically, these additional
segments are freed when not in use to reduce memory consumption. The
result is a self-tuning buffer that combines most of the benefits of
pure dynamic allocation with most of the benefits of pure static
allocation.

Change-Id: I5c27ecce72a450826494b5d13d6c9fdebda650a6
CRs-Fixed: 2224534
Этот коммит содержится в:
Dustin Brown
2018-04-03 12:10:38 -07:00
коммит произвёл nshrivas
родитель c60a22b88d
Коммит 19911f3a06
4 изменённых файлов: 286 добавлений и 3 удалений

Просмотреть файл

@@ -527,6 +527,14 @@ static inline uint8_t *qdf_get_u32(uint8_t *ptr, uint32_t *value)
*/
#define qdf_min(a, b) __qdf_min(a, b)
/**
* qdf_ffz() - find first (least significant) zero bit
* @mask: the bitmask to check
*
* Return: The zero-based index of the first zero bit, or -1 if none are found
*/
#define qdf_ffz(mask) __qdf_ffz(mask)
/**
* qdf_get_pwr2() - get next power of 2 integer from input value
* @value: input value to find next power of 2 integer