diff mbox

[2/2] brcmfmac: fix debugging info for received hw messages with errors

Message ID 1431025661-8879-2-git-send-email-zajec5@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show

Commit Message

Rafał Miłecki May 7, 2015, 7:07 p.m. UTC
Code in function setting/querying device was treating every error as
Broadcom protocol specific one. It wasn't right thing to do as most of
subcalls return "normal" errors (errno-base.h). This resulted in e.g.:
brcmf_usb_rx_ctlpkt: rxctl wait timed out
brcmfmac: brcmf_fil_cmd_data Failed: BCME_NOTDOWN (-5)
which was misleading because of interpreting -EIO as BCME_NOTDOWN.

Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
 drivers/net/wireless/brcm80211/brcmfmac/bcdc.c | 5 ++++-
 drivers/net/wireless/brcm80211/brcmfmac/fwil.c | 3 +--
 2 files changed, 5 insertions(+), 3 deletions(-)

Comments

Arend van Spriel May 8, 2015, 10:29 a.m. UTC | #1
On 05/07/15 21:07, Rafa? Mi?ecki wrote:
> Code in function setting/querying device was treating every error as
> Broadcom protocol specific one. It wasn't right thing to do as most of
> subcalls return "normal" errors (errno-base.h). This resulted in e.g.:
> brcmf_usb_rx_ctlpkt: rxctl wait timed out
> brcmfmac: brcmf_fil_cmd_data Failed: BCME_NOTDOWN (-5)
> which was misleading because of interpreting -EIO as BCME_NOTDOWN.

So this is the reason for putting the error map in debug.c, but you are 
only addressing devices using bcdc protocol, ie. SDIO and USB. Also need 
to address PCIE. I would prefer to extend the query and set callbacks in 
struct brcmf_proto (proto.h) to pass firmware error code up so fwil can 
keep doing the mapping to string representation and have the callbacks 
return -EPROTO if firmware error code is not BCME_OK. Need to assure it 
can not get -EPROTO for other reasons.

Regards,
Arend

> Signed-off-by: Rafa? Mi?ecki<zajec5@gmail.com>
> ---
>   drivers/net/wireless/brcm80211/brcmfmac/bcdc.c | 5 ++++-
>   drivers/net/wireless/brcm80211/brcmfmac/fwil.c | 3 +--
>   2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
> index 8e0e91c..47941ab 100644
> --- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
> +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
> @@ -203,8 +203,11 @@ retry:
>   	}
>
>   	/* Check the ERROR flag */
> -	if (flags&  BCDC_DCMD_ERROR)
> +	if (flags&  BCDC_DCMD_ERROR) {
>   		ret = le32_to_cpu(msg->status);
> +		brcmf_dbg(BCDC, "received message with error %s (%d)\n",
> +			  brcmf_get_errstr((u32)(-ret)), ret);
> +	}
>
>   done:
>   	return ret;
> diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwil.c b/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
> index bdbdc9e..c86a522 100644
> --- a/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
> +++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
> @@ -53,8 +53,7 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp, u32 cmd, void *data, u32 len, bool set)
>   	if (err>= 0)
>   		return 0;
>
> -	brcmf_dbg(FIL, "Failed: %s (%d)\n",
> -		  brcmf_get_errstr((u32)(-err)), err);
> +	brcmf_dbg(FIL, "Failed: %d\n", err);
>   	return -EBADE;
>   }
>

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
index 8e0e91c..47941ab 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
@@ -203,8 +203,11 @@  retry:
 	}
 
 	/* Check the ERROR flag */
-	if (flags & BCDC_DCMD_ERROR)
+	if (flags & BCDC_DCMD_ERROR) {
 		ret = le32_to_cpu(msg->status);
+		brcmf_dbg(BCDC, "received message with error %s (%d)\n",
+			  brcmf_get_errstr((u32)(-ret)), ret);
+	}
 
 done:
 	return ret;
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwil.c b/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
index bdbdc9e..c86a522 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
@@ -53,8 +53,7 @@  brcmf_fil_cmd_data(struct brcmf_if *ifp, u32 cmd, void *data, u32 len, bool set)
 	if (err >= 0)
 		return 0;
 
-	brcmf_dbg(FIL, "Failed: %s (%d)\n",
-		  brcmf_get_errstr((u32)(-err)), err);
+	brcmf_dbg(FIL, "Failed: %d\n", err);
 	return -EBADE;
 }