* [PATCH] brcmfmac: return -EPERM when getting error in vendor command handler
@ 2017-09-04 7:34 Wright Feng
2017-09-05 20:02 ` Franky Lin
0 siblings, 1 reply; 3+ messages in thread
From: Wright Feng @ 2017-09-04 7:34 UTC (permalink / raw)
To: arend.vanspriel, franky.lin, hante.meuleman, kvalo, chi-hsien.lin
Cc: wright.feng, linux-wireless, brcm80211-dev-list.pdl
Firmware returns proprietary error code when getting error in
fil_cmd_data_set or fil_cmd_data_get. The vendor tools or
utilities which uses libnl may stuck in some commands when wl is down.
For example, issue "scan" command after issuing "down" command, the
"scan" command will be the blocking call and stuck as no response from
libnl. It is caused by that firmware returns BCME_NOTUP(-4) when wl
is down, but the -4 is -EINTR in Linux kernel, so libnl catches the error
and not passes to upper layer.
Because of that, the driver should return Linux error code instead of the
proprietary error code, and the tools or utilities need to get the real
firmware error code by command "bcmerror" or "bcmerrorstr" after receiving
the error.
Signed-off-by: Wright Feng <wright.feng@cypress.com>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c
index 8eff275..2b88ba1 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c
@@ -80,8 +80,12 @@ static int brcmf_cfg80211_vndr_cmds_dcmd_handler(struct wiphy *wiphy,
else
ret = brcmf_fil_cmd_data_get(ifp, cmdhdr->cmd, dcmd_buf,
ret_len);
- if (ret != 0)
+
+ if (ret != 0) {
+ brcmf_dbg(INFO, "error(%d), return -EPERM\n", ret);
+ ret = -EPERM;
goto exit;
+ }
wr_pointer = dcmd_buf;
while (ret_len > 0) {
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] brcmfmac: return -EPERM when getting error in vendor command handler
2017-09-04 7:34 [PATCH] brcmfmac: return -EPERM when getting error in vendor command handler Wright Feng
@ 2017-09-05 20:02 ` Franky Lin
2017-09-29 6:18 ` Wright Feng
0 siblings, 1 reply; 3+ messages in thread
From: Franky Lin @ 2017-09-05 20:02 UTC (permalink / raw)
To: Wright Feng
Cc: Arend Van Spriel, Hante Meuleman, Kalle Valo, Chi-Hsien Lin,
open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER,
open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER
On Mon, Sep 4, 2017 at 12:34 AM, Wright Feng <wright.feng@cypress.com> wrote:
> Firmware returns proprietary error code when getting error in
> fil_cmd_data_set or fil_cmd_data_get. The vendor tools or
> utilities which uses libnl may stuck in some commands when wl is down.
> For example, issue "scan" command after issuing "down" command, the
> "scan" command will be the blocking call and stuck as no response from
> libnl. It is caused by that firmware returns BCME_NOTUP(-4) when wl
> is down, but the -4 is -EINTR in Linux kernel, so libnl catches the error
> and not passes to upper layer.
> Because of that, the driver should return Linux error code instead of the
> proprietary error code, and the tools or utilities need to get the real
> firmware error code by command "bcmerror" or "bcmerrorstr" after receiving
> the error.
>
> Signed-off-by: Wright Feng <wright.feng@cypress.com>
> ---
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c
> index 8eff275..2b88ba1 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c
> @@ -80,8 +80,12 @@ static int brcmf_cfg80211_vndr_cmds_dcmd_handler(struct wiphy *wiphy,
> else
> ret = brcmf_fil_cmd_data_get(ifp, cmdhdr->cmd, dcmd_buf,
> ret_len);
> - if (ret != 0)
> +
> + if (ret != 0) {
> + brcmf_dbg(INFO, "error(%d), return -EPERM\n", ret);
> + ret = -EPERM;
> goto exit;
> + }
It would be better to handle the conversion in brcmf_fil_cmd_data so
everyone can benefit. Also please try to assign an appropriate error
code when possible to provide more information to the upper layer. For
this case "ENETDOWN" seems to be a better fit for BCME_NOTUP.
Thanks,
Franky
> wr_pointer = dcmd_buf;
> while (ret_len > 0) {
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] brcmfmac: return -EPERM when getting error in vendor command handler
2017-09-05 20:02 ` Franky Lin
@ 2017-09-29 6:18 ` Wright Feng
0 siblings, 0 replies; 3+ messages in thread
From: Wright Feng @ 2017-09-29 6:18 UTC (permalink / raw)
To: Franky Lin
Cc: Arend Van Spriel, Hante Meuleman, Kalle Valo, Chi-Hsien Lin,
open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER,
open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER
Hi Franky,
On 2017/9/6 上午 04:02, Franky Lin wrote:
> On Mon, Sep 4, 2017 at 12:34 AM, Wright Feng <wright.feng@cypress.com> wrote:
>> Firmware returns proprietary error code when getting error in
>> fil_cmd_data_set or fil_cmd_data_get. The vendor tools or
>> utilities which uses libnl may stuck in some commands when wl is down.
>> For example, issue "scan" command after issuing "down" command, the
>> "scan" command will be the blocking call and stuck as no response from
>> libnl. It is caused by that firmware returns BCME_NOTUP(-4) when wl
>> is down, but the -4 is -EINTR in Linux kernel, so libnl catches the error
>> and not passes to upper layer.
>> Because of that, the driver should return Linux error code instead of the
>> proprietary error code, and the tools or utilities need to get the real
>> firmware error code by command "bcmerror" or "bcmerrorstr" after receiving
>> the error.
>>
>> Signed-off-by: Wright Feng <wright.feng@cypress.com>
>> ---
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c
>> index 8eff275..2b88ba1 100644
>> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c
>> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c
>> @@ -80,8 +80,12 @@ static int brcmf_cfg80211_vndr_cmds_dcmd_handler(struct wiphy *wiphy,
>> else
>> ret = brcmf_fil_cmd_data_get(ifp, cmdhdr->cmd, dcmd_buf,
>> ret_len);
>> - if (ret != 0)
>> +
>> + if (ret != 0) {
>> + brcmf_dbg(INFO, "error(%d), return -EPERM\n", ret);
>> + ret = -EPERM;
>> goto exit;
>> + }
>
> It would be better to handle the conversion in brcmf_fil_cmd_data so
> everyone can benefit. Also please try to assign an appropriate error
Thanks for the suggestion and sorry for replying the mail lately.(We got
some mail server issue a couple days ago.)
I will move the conversion to
brcmf_proto_bcdc_query_dcmd/brcmf_proto_bcdc_set_dcmd for bcdc
and
brcmf_msgbuf_query_dcmd for msgbuf.
> code when possible to provide more information to the upper layer. For
> this case "ENETDOWN" seems to be a better fit for BCME_NOTUP.
One more thing I need your suggestion.
Some of firmware error codes do not have proper error code mapping to
Linux, like "BCME_NOTUP", "BCME_ERROR", "BCME_NOTAP", "BCME_NOTSTA",
"BCME_ASSOCIATED"...
Is that okay using -EIO for those errors which do have proper mapping
error code? Or do you know the error code for the generic error?
Regards,
Wright
>
> Thanks,
> Franky
>
>> wr_pointer = dcmd_buf;
>> while (ret_len > 0) {
>> --
>> 1.9.1
>>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-09-29 6:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-04 7:34 [PATCH] brcmfmac: return -EPERM when getting error in vendor command handler Wright Feng
2017-09-05 20:02 ` Franky Lin
2017-09-29 6:18 ` Wright Feng
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).