summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex/sdio.c
diff options
context:
space:
mode:
authorXinming Hu <huxm@marvell.com>2015-09-18 06:32:06 -0700
committerKalle Valo <kvalo@codeaurora.org>2015-09-29 10:47:31 +0300
commit9a9053c3420fcc5779319e4ea267c6dcbf8d7c04 (patch)
tree32f94e7d3395684ad31b93cd816ecb2e34cd3051 /drivers/net/wireless/mwifiex/sdio.c
parente3ad3d5b6ab2a9876773fe99d9d1866d3c1744ae (diff)
downloadlinux-stable-9a9053c3420fcc5779319e4ea267c6dcbf8d7c04.tar.gz
linux-stable-9a9053c3420fcc5779319e4ea267c6dcbf8d7c04.tar.bz2
linux-stable-9a9053c3420fcc5779319e4ea267c6dcbf8d7c04.zip
mwifiex: fix driver init failure under memory pressure
64k Tx and Rx buffers are allocated during driver initialization for SDIO level data aggregations. When host is under memory pressure situation, kzalloc() request for 64k may fail. We will try allocating 32k buffers and disable our rx single port aggreagation feature in this situation. If the allocation still fails, we will disable our sdio multport aggregation feature as well. In this way, we will transmit and receive packets one by one, thus reduce the demand for big memory. Signed-off-by: Xinming Hu <huxm@marvell.com> Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/mwifiex/sdio.c')
-rw-r--r--drivers/net/wireless/mwifiex/sdio.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c
index d35210caa94b..78a8474e1a3d 100644
--- a/drivers/net/wireless/mwifiex/sdio.c
+++ b/drivers/net/wireless/mwifiex/sdio.c
@@ -2058,16 +2058,26 @@ static int mwifiex_init_sdio(struct mwifiex_adapter *adapter)
ret = mwifiex_alloc_sdio_mpa_buffers(adapter,
card->mp_tx_agg_buf_size,
card->mp_rx_agg_buf_size);
- if (ret) {
- mwifiex_dbg(adapter, ERROR,
- "failed to alloc sdio mp-a buffers\n");
- kfree(card->mp_regs);
- return -1;
+
+ /* Allocate 32k MPA Tx/Rx buffers if 64k memory allocation fails */
+ if (ret && (card->mp_tx_agg_buf_size == MWIFIEX_MP_AGGR_BUF_SIZE_MAX ||
+ card->mp_rx_agg_buf_size == MWIFIEX_MP_AGGR_BUF_SIZE_MAX)) {
+ /* Disable rx single port aggregation */
+ adapter->host_disable_sdio_rx_aggr = true;
+
+ ret = mwifiex_alloc_sdio_mpa_buffers
+ (adapter, MWIFIEX_MP_AGGR_BUF_SIZE_32K,
+ MWIFIEX_MP_AGGR_BUF_SIZE_32K);
+ if (ret) {
+ /* Disable multi port aggregation */
+ card->mpa_tx.enabled = 0;
+ card->mpa_rx.enabled = 0;
+ }
}
adapter->auto_tdls = card->can_auto_tdls;
adapter->ext_scan = card->can_ext_scan;
- return ret;
+ return 0;
}
/*