qcacmn: Add new API for custom page frag cache nbuf allocations

SKBs that are allocated using __netdev_alloc_skb() share a single
page frag cache that is maintained in the network layer and is
common for all network drivers/devices. There is always a chance
where memory can be fragmented when the WLAN driver shares a page
frag cache with other slow network devices. Over the time, lot of
memory would be wasted due to fragmentation eventually resulting
in SKB allocation failures due to OOM.

To circumvent this, define a QDF NBUF allocation API which accepts
custom page frag cache maintained in the driver as an input and
allocates memory for skb->head from the custom page frag cache.

Such an API will be of great help when used for allocating reusable
SKBs in the driver. This also avoids the aforementioned memory
fragmentation issue.

Change-Id: I33f3096bba4057fd06ef55bbed5dc7a3f0f5c759
CRs-Fixed: 3543424
这个提交包含在:
Manikanta Pubbisetty
2023-06-27 16:19:58 +05:30
提交者 Rahul Choudhary
父节点 cbe8170798
当前提交 d621993b84
修改 3 个文件,包含 168 行新增79 行删除

查看文件

@@ -2414,6 +2414,14 @@ void
qdf_nbuf_dev_kfree_list_debug(qdf_nbuf_queue_head_t *nbuf_queue_head,
const char *func_name,
uint32_t line_num);
#define qdf_nbuf_page_frag_alloc(d, s, r, a, p) \
qdf_nbuf_page_frag_alloc_debug(d, s, r, a, p, __func__, __LINE__)
qdf_nbuf_t
qdf_nbuf_page_frag_alloc_debug(qdf_device_t osdev, qdf_size_t size, int reserve,
int align, qdf_frag_cache_t *pf_cache,
const char *func, uint32_t line);
#else /* NBUF_MEMORY_DEBUG */
static inline void qdf_net_buf_debug_init(void) {}
@@ -2569,6 +2577,19 @@ qdf_nbuf_dev_kfree_list(qdf_nbuf_queue_head_t *nbuf_queue_head)
{
__qdf_nbuf_dev_kfree_list(nbuf_queue_head);
}
#define qdf_nbuf_page_frag_alloc(osdev, size, reserve, align, pf_cache) \
qdf_nbuf_page_frag_alloc_fl(osdev, size, reserve, align, pf_cache, \
__func__, __LINE__)
static inline qdf_nbuf_t
qdf_nbuf_page_frag_alloc_fl(qdf_device_t osdev, qdf_size_t size, int reserve,
int align, qdf_frag_cache_t *pf_cache,
const char *func, uint32_t line)
{
return __qdf_nbuf_page_frag_alloc(osdev, size, reserve, align, pf_cache,
func, line);
}
#endif /* NBUF_MEMORY_DEBUG */
#if defined(QCA_DP_NBUF_FAST_PPEDS)