brcmfmac: add console log support with configurable read size
PATCH v2 1/1 brcmfmac: add console log support with configurable read size
From: Jason Uy <[email protected]>
Add support for configurable read size so that older wifi chips that have size restrictions can be supported.
--- .../wireless/broadcom/brcm80211/brcmfmac/common.c | 5 +++ .../wireless/broadcom/brcm80211/brcmfmac/common.h | 2 ++ .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 39 ++++++++++++++++++++-- 3 files changed, 43 insertions(+), 3 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +5 -0
@@ -52,6 +52,10 @@ int brcmf_msg_level;module_param_named (debug, brcmf_msg_level, int,S_IRUSR |S_IWUSR );MODULE_PARM_DESC (debug,"Level of debug output" ); +static unsigned int brcmf_log_size; +module_param_named (logsize, brcmf_log_size, int,0000 ); +MODULE_PARM_DESC (logsize,"Size of log output to read each time" ); +static int brcmf_p2p_enable;module_param_named (p2pon, brcmf_p2p_enable, int,0 );MODULE_PARM_DESC (p2pon,"Enable legacy p2p management functionality" );
@@ -287,6 +291,7 @@ struct brcmf_mp_device *brcmf_get_module_param(struct device *dev, settings->feature_disable = brcmf_feature_disable; settings->fcmode = brcmf_fcmode; settings->roamoff = !!brcmf_roamoff; + settings->log_size = brcmf_log_size;#ifdef DEBUG settings->ignore_probe_fail = !!brcmf_ignore_probe_fail;#endif
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h +2 -0
@@ -51,6 +51,7 @@ extern struct brcmf_mp_global_t brcmf_mp_global;* @roamoff: Firmware roaming off? * @ignore_probe_fail: Ignore probe failure. * @country_codes: If available, pointer to struct for translating country codes +* @log_size: limit the read size when accessing log from wifi chip * @bus: Bus specific platform data. Only SDIO at the mmoment. */ struct brcmf_mp_device {
@@ -60,6 +61,7 @@ struct brcmf_mp_device {bool roamoff;bool ignore_probe_fail;struct brcmfmac_pd_cc *country_codes; +unsigned int log_size;union {struct brcmfmac_sdio_pd sdio; } bus;
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +36 -3
@@ -2790,6 +2790,10 @@ static int brcmf_sdio_readconsole(struct brcmf_sdio *bus)u8 line[CONSOLE_LINE_MAX ], ch;u32 n, idx, addr;int rv; +unsigned int left_to_read; +unsigned int offset; +unsigned int cur_read_size; +unsigned int log_size = bus->sdiodev->settings->log_size;/* Don't do anything until FWREADY updates console address */ if (bus->console_addr ==0 )
@@ -2823,9 +2827,38 @@ static int brcmf_sdio_readconsole(struct brcmf_sdio *bus)/* Read the console buffer */ addr =le32_to_cpu (c->log_le.buf); - rv =brcmf_sdiod_ramrw (bus->sdiodev, false, addr, c->buf, c->bufsize); -if (rv <0 ) -return rv; + +if (log_size >0 ) { +/* limit the amount of data to read in case wifi chip has +* restrictions +*/ + left_to_read = c->bufsize; + offset =0 ; +while (left_to_read) { + cur_read_size = (left_to_read > log_size) ? + log_size : + left_to_read; + + rv =brcmf_sdiod_ramrw (bus->sdiodev, + false, + addr + offset, + c->buf + offset, + cur_read_size); +if (rv <0 ) +return rv; + + left_to_read -= cur_read_size; + offset += cur_read_size; + } + }else { + rv =brcmf_sdiod_ramrw (bus->sdiodev, + false, + addr, + c->buf, + c->bufsize); +if (rv <0 ) +return rv; + }while (c->last != idx) {for (n =0 ; n <CONSOLE_LINE_MAX -2 ; n++) {
Signature · 1 line
2.7.4
Quoted 9 lines · Li Jin
From: Jason Uy <[email protected]>
Add support for configurable read size so that older wifi chips that have size restrictions can be supported.
Signed-off-by Jason Uy <[email protected]>Reviewed-by Ray Jui <[email protected]>Reviewed-by Scott Branden <[email protected]>Signed-off-by Li Jin <[email protected]>
Arend, am I supposed to apply this even if there's this "INTERNAL" tag in the Subject?
Signature · 1 line
Kalle Valo
Hi Kalle,
Apologies. The title of this patch should be EXTERNAL. I put down INTERNAL by mistake.
Thanks!
Li
-----Original Message-----
From: Kalle Valo [mailto:[email protected]]
Sent: Monday, December 4, 2017 7:15 AM
To: Li Jin
Cc: Wright Feng; Chi-Hsien Lin; Hante Meuleman; Franky Lin; Arend van
Spriel; [email protected]; [email protected]; brcm80211-dev-list-+wT8y+m8/[email protected]; brcm80211-dev-list.pdl-dY08KVG/lbpWk0Htik3J/[email protected]; [email protected]; Jason Uy
Subject: Re: [PATCH INTERNAL V2 1/1] brcmfmac: add console log support
with configurable read size
Quoted 9 lines · Li Jin
From: Jason Uy <jason.uy-dY08KVG/lbpWk0Htik3J/[email protected]>
Add support for configurable read size so that older wifi chips that have size restrictions can be supported.
Arend, am I supposed to apply this even if there's this "INTERNAL" tag in the Subject?
--
Kalle Valo