qcacmn: Allocate pdev attach bufs from page frag

Use page frag init time rx buffer allocation for efficient usage of memory.
Add ini dp_bufs_page_frag_allocs to disable and revert to original slab
nbuf allocations.

Change-Id: Iac78895addfe9da0118bc071c691a26216d6fda1
CRs-Fixed: 3553800
这个提交包含在:
Prakash Manjunathappa
2023-07-08 00:33:26 -07:00
提交者 Rahul Choudhary
父节点 02622819d0
当前提交 fab64e0adc
修改 4 个文件,包含 49 行新增6 行删除

查看文件

@@ -2981,14 +2981,23 @@ static QDF_STATUS
dp_pdev_nbuf_alloc_and_map(struct dp_soc *dp_soc,
struct dp_rx_nbuf_frag_info *nbuf_frag_info_t,
struct dp_pdev *dp_pdev,
struct rx_desc_pool *rx_desc_pool)
struct rx_desc_pool *rx_desc_pool,
bool dp_buf_page_frag_alloc_enable)
{
QDF_STATUS ret = QDF_STATUS_E_FAILURE;
(nbuf_frag_info_t->virt_addr).nbuf =
qdf_nbuf_alloc(dp_soc->osdev, rx_desc_pool->buf_size,
RX_BUFFER_RESERVATION,
rx_desc_pool->buf_alignment, FALSE);
if (dp_buf_page_frag_alloc_enable) {
(nbuf_frag_info_t->virt_addr).nbuf =
qdf_nbuf_frag_alloc(dp_soc->osdev,
rx_desc_pool->buf_size,
RX_BUFFER_RESERVATION,
rx_desc_pool->buf_alignment, FALSE);
} else {
(nbuf_frag_info_t->virt_addr).nbuf =
qdf_nbuf_alloc(dp_soc->osdev, rx_desc_pool->buf_size,
RX_BUFFER_RESERVATION,
rx_desc_pool->buf_alignment, FALSE);
}
if (!((nbuf_frag_info_t->virt_addr).nbuf)) {
dp_err("nbuf alloc failed");
DP_STATS_INC(dp_pdev, replenish.nbuf_alloc_fail, 1);
@@ -3043,6 +3052,7 @@ dp_pdev_rx_buffers_attach(struct dp_soc *dp_soc, uint32_t mac_id,
union dp_rx_desc_list_elem_t *tail = NULL;
int sync_hw_ptr = 1;
uint32_t num_entries_avail;
bool dp_buf_page_frag_alloc_enable;
if (qdf_unlikely(!dp_pdev)) {
dp_rx_err("%pK: pdev is null for mac_id = %d",
@@ -3050,6 +3060,9 @@ dp_pdev_rx_buffers_attach(struct dp_soc *dp_soc, uint32_t mac_id,
return QDF_STATUS_E_FAILURE;
}
dp_buf_page_frag_alloc_enable =
wlan_cfg_is_dp_buf_page_frag_alloc_enable(dp_soc->wlan_cfg_ctx);
if (qdf_unlikely(!rxdma_srng)) {
DP_STATS_INC(dp_pdev, replenish.rxdma_err, num_req_buffers);
return QDF_STATUS_E_FAILURE;
@@ -3125,7 +3138,8 @@ dp_pdev_rx_buffers_attach(struct dp_soc *dp_soc, uint32_t mac_id,
else
ret = dp_pdev_nbuf_alloc_and_map(dp_soc,
&nf_info[nr_nbuf], dp_pdev,
rx_desc_pool);
rx_desc_pool,
dp_buf_page_frag_alloc_enable);
if (QDF_IS_STATUS_ERROR(ret))
break;

查看文件

@@ -1522,6 +1522,10 @@
CFG_INI_BOOL("dp_rx_refill_buff_pool", false, \
"Enable/Disable DP RX refill buffer pool support")
#define CFG_DP_BUFS_PAGE_FRAG_ALLOCS \
CFG_INI_BOOL("dp_bufs_page_frag_allocs", true, \
"Enable/Disable forced DP page frage buffer allocations")
#define CFG_DP_POLL_MODE_ENABLE \
CFG_INI_BOOL("dp_poll_mode_enable", false, \
"Enable/Disable Polling mode for data path")
@@ -2049,6 +2053,7 @@
CFG(CFG_DP_PEER_LINK_STATS) \
CFG(CFG_DP_RX_BUFF_POOL_ENABLE) \
CFG(CFG_DP_RX_REFILL_BUFF_POOL_ENABLE) \
CFG(CFG_DP_BUFS_PAGE_FRAG_ALLOCS) \
CFG(CFG_DP_RX_PENDING_HL_THRESHOLD) \
CFG(CFG_DP_RX_PENDING_LO_THRESHOLD) \
CFG(CFG_DP_LEGACY_MODE_CSUM_DISABLE) \

查看文件

@@ -4117,6 +4117,8 @@ wlan_cfg_soc_attach(struct cdp_ctrl_objmgr_psoc *psoc)
cfg_get(psoc, CFG_DP_RX_BUFF_POOL_ENABLE);
wlan_cfg_ctx->is_rx_refill_buff_pool_enabled =
cfg_get(psoc, CFG_DP_RX_REFILL_BUFF_POOL_ENABLE);
wlan_cfg_ctx->enable_dp_buf_page_frag_alloc =
cfg_get(psoc, CFG_DP_BUFS_PAGE_FRAG_ALLOCS);
wlan_cfg_ctx->rx_pending_high_threshold =
cfg_get(psoc, CFG_DP_RX_PENDING_HL_THRESHOLD);
wlan_cfg_ctx->rx_pending_low_threshold =
@@ -4342,6 +4344,8 @@ wlan_cfg_soc_attach(struct cdp_ctrl_objmgr_psoc *psoc)
cfg_get(psoc, CFG_DP_RX_BUFF_POOL_ENABLE);
wlan_cfg_ctx->is_rx_refill_buff_pool_enabled =
cfg_get(psoc, CFG_DP_RX_REFILL_BUFF_POOL_ENABLE);
wlan_cfg_ctx->enable_dp_buf_page_frag_alloc =
cfg_get(psoc, CFG_DP_BUFS_PAGE_FRAG_ALLOCS);
#ifdef WLAN_FEATURE_RX_PREALLOC_BUFFER_POOL
wlan_cfg_ctx->rx_refill_buff_pool_size =
DP_RX_REFILL_BUFF_POOL_SIZE;
@@ -5480,6 +5484,11 @@ bool wlan_cfg_is_peer_link_stats_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
qdf_export_symbol(wlan_cfg_is_peer_link_stats_enabled);
bool wlan_cfg_is_dp_buf_page_frag_alloc_enable(struct wlan_cfg_dp_soc_ctxt *cfg)
{
return cfg->enable_dp_buf_page_frag_alloc;
}
#ifdef WLAN_FEATURE_RX_PREALLOC_BUFFER_POOL
bool wlan_cfg_is_rx_buffer_pool_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
{

查看文件

@@ -289,6 +289,8 @@ struct wlan_srng_cfg {
* pool support
* @is_rx_refill_buff_pool_enabled: flag to enable/disable RX refill buffer
* pool support
* @enable_dp_buf_page_frag_alloc: Flag to control DP allocation from page frag
* cache.
* @rx_refill_buff_pool_size: RX refill buffer pool size
* @rx_pending_high_threshold: threshold of starting pkt drop
* @rx_pending_low_threshold: threshold of stopping pkt drop
@@ -477,6 +479,7 @@ struct wlan_cfg_dp_soc_ctxt {
bool pext_stats_enabled;
bool is_rx_buff_pool_enabled;
bool is_rx_refill_buff_pool_enabled;
bool enable_dp_buf_page_frag_alloc;
int rx_refill_buff_pool_size;
uint32_t rx_pending_high_threshold;
uint32_t rx_pending_low_threshold;
@@ -2001,6 +2004,18 @@ bool wlan_cfg_is_rx_buffer_pool_enabled(struct wlan_cfg_dp_soc_ctxt *cfg);
*/
bool wlan_cfg_is_rx_refill_buffer_pool_enabled(struct wlan_cfg_dp_soc_ctxt *cfg);
/**
* wlan_cfg_is_dp_buf_page_frag_alloc_enable() - Get nbuf allocations from page
* frags.
*
* @cfg: soc configuration context
*
* Return: true if enabled, false otherwise.
*/
bool
wlan_cfg_is_dp_buf_page_frag_alloc_enable(struct wlan_cfg_dp_soc_ctxt *cfg);
#ifdef WLAN_FEATURE_RX_PREALLOC_BUFFER_POOL
/**
* wlan_cfg_get_rx_refill_buf_pool_size() - Get Rx refill buf pool size