1 From c91377495192cda096e52dc09c266b0d05f16d86 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Thu, 21 Feb 2019 11:33:25 +0100
4 Subject: [PATCH] brcmfmac: print firmware reported general status errors
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Firmware may report general errors using a special message type. Add
10 basic support for it by simply decoding & printing an error number.
12 A sample situation in which firmware reports a buf error:
13 CONSOLE: 027084.733 no host response IOCTL buffer available..so fail the request
14 will now produce a "Firmware reported general error: 9" on the host.
16 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
17 Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
18 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
20 .../broadcom/brcm80211/brcmfmac/msgbuf.c | 24 +++++++++++++++++++
21 1 file changed, 24 insertions(+)
23 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
24 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
25 @@ -134,6 +134,14 @@ struct msgbuf_completion_hdr {
29 +/* Data struct for the MSGBUF_TYPE_GEN_STATUS */
30 +struct msgbuf_gen_status {
31 + struct msgbuf_common_hdr msg;
32 + struct msgbuf_completion_hdr compl_hdr;
37 /* Data struct for the MSGBUF_TYPE_RING_STATUS */
38 struct msgbuf_ring_status {
39 struct msgbuf_common_hdr msg;
40 @@ -1194,6 +1202,18 @@ brcmf_msgbuf_process_rx_complete(struct
41 brcmf_netif_rx(ifp, skb);
44 +static void brcmf_msgbuf_process_gen_status(struct brcmf_msgbuf *msgbuf,
47 + struct msgbuf_gen_status *gen_status = buf;
48 + struct brcmf_pub *drvr = msgbuf->drvr;
51 + err = le16_to_cpu(gen_status->compl_hdr.status);
53 + bphy_err(drvr, "Firmware reported general error: %d\n", err);
56 static void brcmf_msgbuf_process_ring_status(struct brcmf_msgbuf *msgbuf,
59 @@ -1273,6 +1293,10 @@ static void brcmf_msgbuf_process_msgtype
61 msg = (struct msgbuf_common_hdr *)buf;
62 switch (msg->msgtype) {
63 + case MSGBUF_TYPE_GEN_STATUS:
64 + brcmf_dbg(MSGBUF, "MSGBUF_TYPE_GEN_STATUS\n");
65 + brcmf_msgbuf_process_gen_status(msgbuf, buf);
67 case MSGBUF_TYPE_RING_STATUS:
68 brcmf_dbg(MSGBUF, "MSGBUF_TYPE_RING_STATUS\n");
69 brcmf_msgbuf_process_ring_status(msgbuf, buf);