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
This commit is contained in:

committed by
Rahul Choudhary

parent
02622819d0
commit
fab64e0adc
@@ -2981,14 +2981,23 @@ static QDF_STATUS
|
|||||||
dp_pdev_nbuf_alloc_and_map(struct dp_soc *dp_soc,
|
dp_pdev_nbuf_alloc_and_map(struct dp_soc *dp_soc,
|
||||||
struct dp_rx_nbuf_frag_info *nbuf_frag_info_t,
|
struct dp_rx_nbuf_frag_info *nbuf_frag_info_t,
|
||||||
struct dp_pdev *dp_pdev,
|
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;
|
QDF_STATUS ret = QDF_STATUS_E_FAILURE;
|
||||||
|
|
||||||
|
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 =
|
(nbuf_frag_info_t->virt_addr).nbuf =
|
||||||
qdf_nbuf_alloc(dp_soc->osdev, rx_desc_pool->buf_size,
|
qdf_nbuf_alloc(dp_soc->osdev, rx_desc_pool->buf_size,
|
||||||
RX_BUFFER_RESERVATION,
|
RX_BUFFER_RESERVATION,
|
||||||
rx_desc_pool->buf_alignment, FALSE);
|
rx_desc_pool->buf_alignment, FALSE);
|
||||||
|
}
|
||||||
if (!((nbuf_frag_info_t->virt_addr).nbuf)) {
|
if (!((nbuf_frag_info_t->virt_addr).nbuf)) {
|
||||||
dp_err("nbuf alloc failed");
|
dp_err("nbuf alloc failed");
|
||||||
DP_STATS_INC(dp_pdev, replenish.nbuf_alloc_fail, 1);
|
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;
|
union dp_rx_desc_list_elem_t *tail = NULL;
|
||||||
int sync_hw_ptr = 1;
|
int sync_hw_ptr = 1;
|
||||||
uint32_t num_entries_avail;
|
uint32_t num_entries_avail;
|
||||||
|
bool dp_buf_page_frag_alloc_enable;
|
||||||
|
|
||||||
if (qdf_unlikely(!dp_pdev)) {
|
if (qdf_unlikely(!dp_pdev)) {
|
||||||
dp_rx_err("%pK: pdev is null for mac_id = %d",
|
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;
|
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)) {
|
if (qdf_unlikely(!rxdma_srng)) {
|
||||||
DP_STATS_INC(dp_pdev, replenish.rxdma_err, num_req_buffers);
|
DP_STATS_INC(dp_pdev, replenish.rxdma_err, num_req_buffers);
|
||||||
return QDF_STATUS_E_FAILURE;
|
return QDF_STATUS_E_FAILURE;
|
||||||
@@ -3125,7 +3138,8 @@ dp_pdev_rx_buffers_attach(struct dp_soc *dp_soc, uint32_t mac_id,
|
|||||||
else
|
else
|
||||||
ret = dp_pdev_nbuf_alloc_and_map(dp_soc,
|
ret = dp_pdev_nbuf_alloc_and_map(dp_soc,
|
||||||
&nf_info[nr_nbuf], dp_pdev,
|
&nf_info[nr_nbuf], dp_pdev,
|
||||||
rx_desc_pool);
|
rx_desc_pool,
|
||||||
|
dp_buf_page_frag_alloc_enable);
|
||||||
if (QDF_IS_STATUS_ERROR(ret))
|
if (QDF_IS_STATUS_ERROR(ret))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@@ -1522,6 +1522,10 @@
|
|||||||
CFG_INI_BOOL("dp_rx_refill_buff_pool", false, \
|
CFG_INI_BOOL("dp_rx_refill_buff_pool", false, \
|
||||||
"Enable/Disable DP RX refill buffer pool support")
|
"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 \
|
#define CFG_DP_POLL_MODE_ENABLE \
|
||||||
CFG_INI_BOOL("dp_poll_mode_enable", false, \
|
CFG_INI_BOOL("dp_poll_mode_enable", false, \
|
||||||
"Enable/Disable Polling mode for data path")
|
"Enable/Disable Polling mode for data path")
|
||||||
@@ -2049,6 +2053,7 @@
|
|||||||
CFG(CFG_DP_PEER_LINK_STATS) \
|
CFG(CFG_DP_PEER_LINK_STATS) \
|
||||||
CFG(CFG_DP_RX_BUFF_POOL_ENABLE) \
|
CFG(CFG_DP_RX_BUFF_POOL_ENABLE) \
|
||||||
CFG(CFG_DP_RX_REFILL_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_HL_THRESHOLD) \
|
||||||
CFG(CFG_DP_RX_PENDING_LO_THRESHOLD) \
|
CFG(CFG_DP_RX_PENDING_LO_THRESHOLD) \
|
||||||
CFG(CFG_DP_LEGACY_MODE_CSUM_DISABLE) \
|
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);
|
cfg_get(psoc, CFG_DP_RX_BUFF_POOL_ENABLE);
|
||||||
wlan_cfg_ctx->is_rx_refill_buff_pool_enabled =
|
wlan_cfg_ctx->is_rx_refill_buff_pool_enabled =
|
||||||
cfg_get(psoc, CFG_DP_RX_REFILL_BUFF_POOL_ENABLE);
|
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 =
|
wlan_cfg_ctx->rx_pending_high_threshold =
|
||||||
cfg_get(psoc, CFG_DP_RX_PENDING_HL_THRESHOLD);
|
cfg_get(psoc, CFG_DP_RX_PENDING_HL_THRESHOLD);
|
||||||
wlan_cfg_ctx->rx_pending_low_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);
|
cfg_get(psoc, CFG_DP_RX_BUFF_POOL_ENABLE);
|
||||||
wlan_cfg_ctx->is_rx_refill_buff_pool_enabled =
|
wlan_cfg_ctx->is_rx_refill_buff_pool_enabled =
|
||||||
cfg_get(psoc, CFG_DP_RX_REFILL_BUFF_POOL_ENABLE);
|
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
|
#ifdef WLAN_FEATURE_RX_PREALLOC_BUFFER_POOL
|
||||||
wlan_cfg_ctx->rx_refill_buff_pool_size =
|
wlan_cfg_ctx->rx_refill_buff_pool_size =
|
||||||
DP_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);
|
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
|
#ifdef WLAN_FEATURE_RX_PREALLOC_BUFFER_POOL
|
||||||
bool wlan_cfg_is_rx_buffer_pool_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
|
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
|
* pool support
|
||||||
* @is_rx_refill_buff_pool_enabled: flag to enable/disable RX refill buffer
|
* @is_rx_refill_buff_pool_enabled: flag to enable/disable RX refill buffer
|
||||||
* pool support
|
* 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_refill_buff_pool_size: RX refill buffer pool size
|
||||||
* @rx_pending_high_threshold: threshold of starting pkt drop
|
* @rx_pending_high_threshold: threshold of starting pkt drop
|
||||||
* @rx_pending_low_threshold: threshold of stopping 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 pext_stats_enabled;
|
||||||
bool is_rx_buff_pool_enabled;
|
bool is_rx_buff_pool_enabled;
|
||||||
bool is_rx_refill_buff_pool_enabled;
|
bool is_rx_refill_buff_pool_enabled;
|
||||||
|
bool enable_dp_buf_page_frag_alloc;
|
||||||
int rx_refill_buff_pool_size;
|
int rx_refill_buff_pool_size;
|
||||||
uint32_t rx_pending_high_threshold;
|
uint32_t rx_pending_high_threshold;
|
||||||
uint32_t rx_pending_low_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);
|
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
|
#ifdef WLAN_FEATURE_RX_PREALLOC_BUFFER_POOL
|
||||||
/**
|
/**
|
||||||
* wlan_cfg_get_rx_refill_buf_pool_size() - Get Rx refill buf pool size
|
* wlan_cfg_get_rx_refill_buf_pool_size() - Get Rx refill buf pool size
|
||||||
|
Reference in New Issue
Block a user