From: Arend van Spriel <arend@broadcom.com>
To: Kalle Valo <kvalo@codeaurora.org>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
Hante Meuleman <meuleman@broadcom.com>,
Arend van Spriel <arend@broadcom.com>
Subject: [PATCH 02/21] brcmfmac: Limit memory allocs to <64K
Date: Wed, 17 Feb 2016 11:26:51 +0100 [thread overview]
Message-ID: <1455704830-10088-3-git-send-email-arend@broadcom.com> (raw)
In-Reply-To: <1455704830-10088-1-git-send-email-arend@broadcom.com>
From: Hante Meuleman <meuleman@broadcom.com>
Some systems have problems with allocating memory allocation larger
then 64K. Often on unload/load or suspend/resume a failure is
reported: Could not allocate wiphy device. This patch makes the
escan intermediate storage buf dynamically allocated, and smaller
than 64K.
Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
.../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 18 +++++++++---------
.../wireless/broadcom/brcm80211/brcmfmac/cfg80211.h | 11 ++++++-----
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 5a4a0c4..5478128 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -1125,7 +1125,7 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct brcmf_cfg80211_vif *vif,
/* Arm scan timeout timer */
mod_timer(&cfg->escan_timeout, jiffies +
- WL_ESCAN_TIMER_INTERVAL_MS * HZ / 1000);
+ BRCMF_ESCAN_TIMER_INTERVAL_MS * HZ / 1000);
return 0;
@@ -3020,7 +3020,7 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
list = (struct brcmf_scan_results *)
cfg->escan_info.escan_buf;
- if (bi_length > WL_ESCAN_BUF_SIZE - list->buflen) {
+ if (bi_length > BRCMF_ESCAN_BUF_SIZE - list->buflen) {
brcmf_err("Buffer is too small: ignoring\n");
goto exit;
}
@@ -3033,8 +3033,8 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
bss_info_le))
goto exit;
}
- memcpy(&(cfg->escan_info.escan_buf[list->buflen]),
- bss_info_le, bi_length);
+ memcpy(&cfg->escan_info.escan_buf[list->buflen], bss_info_le,
+ bi_length);
list->version = le32_to_cpu(bss_info_le->version);
list->buflen += bi_length;
list->count++;
@@ -5402,14 +5402,14 @@ static void brcmf_deinit_priv_mem(struct brcmf_cfg80211_info *cfg)
{
kfree(cfg->conf);
cfg->conf = NULL;
- kfree(cfg->escan_ioctl_buf);
- cfg->escan_ioctl_buf = NULL;
kfree(cfg->extra_buf);
cfg->extra_buf = NULL;
kfree(cfg->wowl.nd);
cfg->wowl.nd = NULL;
kfree(cfg->wowl.nd_info);
cfg->wowl.nd_info = NULL;
+ kfree(cfg->escan_info.escan_buf);
+ cfg->escan_info.escan_buf = NULL;
}
static s32 brcmf_init_priv_mem(struct brcmf_cfg80211_info *cfg)
@@ -5417,9 +5417,6 @@ static s32 brcmf_init_priv_mem(struct brcmf_cfg80211_info *cfg)
cfg->conf = kzalloc(sizeof(*cfg->conf), GFP_KERNEL);
if (!cfg->conf)
goto init_priv_mem_out;
- cfg->escan_ioctl_buf = kzalloc(BRCMF_DCMD_MEDLEN, GFP_KERNEL);
- if (!cfg->escan_ioctl_buf)
- goto init_priv_mem_out;
cfg->extra_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL);
if (!cfg->extra_buf)
goto init_priv_mem_out;
@@ -5431,6 +5428,9 @@ static s32 brcmf_init_priv_mem(struct brcmf_cfg80211_info *cfg)
GFP_KERNEL);
if (!cfg->wowl.nd_info)
goto init_priv_mem_out;
+ cfg->escan_info.escan_buf = kzalloc(BRCMF_ESCAN_BUF_SIZE, GFP_KERNEL);
+ if (!cfg->escan_info.escan_buf)
+ goto init_priv_mem_out;
return 0;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
index 97c327d..01f096f 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
@@ -28,8 +28,11 @@
#define WL_ROAM_TRIGGER_LEVEL -75
#define WL_ROAM_DELTA 20
-#define WL_ESCAN_BUF_SIZE (1024 * 64)
-#define WL_ESCAN_TIMER_INTERVAL_MS 10000 /* E-Scan timeout */
+/* Keep BRCMF_ESCAN_BUF_SIZE below 64K (65536). Allocing over 64K can be
+ * problematic on some systems and should be avoided.
+ */
+#define BRCMF_ESCAN_BUF_SIZE 65000
+#define BRCMF_ESCAN_TIMER_INTERVAL_MS 10000 /* E-Scan timeout */
#define WL_ESCAN_ACTION_START 1
#define WL_ESCAN_ACTION_CONTINUE 2
@@ -205,7 +208,7 @@ enum wl_escan_state {
struct escan_info {
u32 escan_state;
- u8 escan_buf[WL_ESCAN_BUF_SIZE];
+ u8 *escan_buf;
struct wiphy *wiphy;
struct brcmf_if *ifp;
s32 (*run)(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
@@ -278,7 +281,6 @@ struct brcmf_cfg80211_wowl {
* @escan_info: escan information.
* @escan_timeout: Timer for catch scan timeout.
* @escan_timeout_work: scan timeout worker.
- * @escan_ioctl_buf: dongle command buffer for escan commands.
* @vif_list: linked list of vif instances.
* @vif_cnt: number of vif instances.
* @vif_event: vif event signalling.
@@ -309,7 +311,6 @@ struct brcmf_cfg80211_info {
struct escan_info escan_info;
struct timer_list escan_timeout;
struct work_struct escan_timeout_work;
- u8 *escan_ioctl_buf;
struct list_head vif_list;
struct brcmf_cfg80211_vif_event vif_event;
struct completion vif_disabled;
--
1.9.1
next prev parent reply other threads:[~2016-02-17 10:27 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-17 10:26 [PATCH 00/21] brcmfmac: driver setting concept and other changes Arend van Spriel
2016-02-17 10:26 ` [PATCH 01/21] brcmfmac: change function name for brcmf_cfg80211_wait_vif_event_timeout() Arend van Spriel
2016-03-07 12:19 ` [01/21] brcmfmac: change function name forbrcmf_cfg80211_wait_vif_event_timeout() Kalle Valo
2016-03-07 12:49 ` Kalle Valo
2016-03-07 20:03 ` Arend Van Spriel
2016-03-08 8:46 ` Kalle Valo
2016-02-17 10:26 ` Arend van Spriel [this message]
2016-02-17 10:26 ` [PATCH 03/21] brcmfmac: check for wowl support before enumerating feature flag Arend van Spriel
2016-02-17 10:26 ` [PATCH 04/21] brcmfmac: Configure country code using device specific settings Arend van Spriel
2016-02-17 10:26 ` [PATCH 05/21] brcmfmac: Add length checks on firmware events Arend van Spriel
2016-02-17 10:26 ` [PATCH 06/21] brcmfmac: add neighbor discovery offload ip address table configuration Arend van Spriel
2016-02-17 10:26 ` [PATCH 07/21] brcmfmac: check return for ARP ip setting iovar Arend van Spriel
2016-02-17 10:26 ` [PATCH 08/21] brcmfmac: use device memsize config from fw if defined Arend van Spriel
2016-02-17 10:26 ` [PATCH 09/21] brcmfmac: use bar1 window size as provided by pci subsystem Arend van Spriel
2016-02-17 10:26 ` [PATCH 10/21] brcmfmac: add support for the PCIE 4366c0 chip Arend van Spriel
2016-02-17 10:27 ` [PATCH 11/21] brcmfmac: remove pcie gen1 support Arend van Spriel
2016-02-17 10:27 ` [PATCH 12/21] brcmfmac: increase timeout for tx eapol Arend van Spriel
2016-02-17 10:27 ` [PATCH 13/21] brcmfmac: move module init and exit to common Arend van Spriel
2016-02-17 10:27 ` [PATCH 14/21] brcmfmac: add wowl gtk rekeying offload support Arend van Spriel
2016-02-17 10:27 ` [PATCH 15/21] brcmfmac: move platform data retrieval code to common Arend van Spriel
2016-02-17 10:27 ` [PATCH 16/21] brcmfmac: keep ARP and ND offload enabled during WOWL Arend van Spriel
2016-02-17 10:27 ` [PATCH 17/21] brcmfmac: fix sdio sg table alloc crash Arend van Spriel
2016-02-17 10:27 ` [PATCH 18/21] brcmfmac: switch to new platform data Arend van Spriel
2016-03-04 14:49 ` Kalle Valo
2016-03-04 20:02 ` Arend Van Spriel
2016-02-17 10:27 ` [PATCH 19/21] brcmfmac: merge platform data and module paramaters Arend van Spriel
2016-02-17 10:27 ` [PATCH 20/21] brcmfmac: integrate add_keyext in add_key Arend van Spriel
2016-02-17 10:27 ` [PATCH 21/21] brcmfmac: add 802.11w management frame protection support Arend van Spriel
2016-02-25 22:26 ` [PATCH 00/21] brcmfmac: driver setting concept and other changes Rafał Miłecki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1455704830-10088-3-git-send-email-arend@broadcom.com \
--to=arend@broadcom.com \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=meuleman@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).