Commit c9137749 authored by Rafał Miłecki's avatar Rafał Miłecki Committed by Kalle Valo

brcmfmac: print firmware reported general status errors

Firmware may report general errors using a special message type. Add
basic support for it by simply decoding & printing an error number.

A sample situation in which firmware reports a buf error:
CONSOLE: 027084.733 no host response IOCTL buffer available..so fail the request
will now produce a "Firmware reported general error: 9" on the host.
Signed-off-by: default avatarRafał Miłecki <rafal@milecki.pl>
Acked-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 0c705161
...@@ -134,6 +134,14 @@ struct msgbuf_completion_hdr { ...@@ -134,6 +134,14 @@ struct msgbuf_completion_hdr {
__le16 flow_ring_id; __le16 flow_ring_id;
}; };
/* Data struct for the MSGBUF_TYPE_GEN_STATUS */
struct msgbuf_gen_status {
struct msgbuf_common_hdr msg;
struct msgbuf_completion_hdr compl_hdr;
__le16 write_idx;
__le32 rsvd0[3];
};
/* Data struct for the MSGBUF_TYPE_RING_STATUS */ /* Data struct for the MSGBUF_TYPE_RING_STATUS */
struct msgbuf_ring_status { struct msgbuf_ring_status {
struct msgbuf_common_hdr msg; struct msgbuf_common_hdr msg;
...@@ -1194,6 +1202,18 @@ brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf) ...@@ -1194,6 +1202,18 @@ brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf)
brcmf_netif_rx(ifp, skb); brcmf_netif_rx(ifp, skb);
} }
static void brcmf_msgbuf_process_gen_status(struct brcmf_msgbuf *msgbuf,
void *buf)
{
struct msgbuf_gen_status *gen_status = buf;
struct brcmf_pub *drvr = msgbuf->drvr;
int err;
err = le16_to_cpu(gen_status->compl_hdr.status);
if (err)
bphy_err(drvr, "Firmware reported general error: %d\n", err);
}
static void brcmf_msgbuf_process_ring_status(struct brcmf_msgbuf *msgbuf, static void brcmf_msgbuf_process_ring_status(struct brcmf_msgbuf *msgbuf,
void *buf) void *buf)
{ {
...@@ -1273,6 +1293,10 @@ static void brcmf_msgbuf_process_msgtype(struct brcmf_msgbuf *msgbuf, void *buf) ...@@ -1273,6 +1293,10 @@ static void brcmf_msgbuf_process_msgtype(struct brcmf_msgbuf *msgbuf, void *buf)
msg = (struct msgbuf_common_hdr *)buf; msg = (struct msgbuf_common_hdr *)buf;
switch (msg->msgtype) { switch (msg->msgtype) {
case MSGBUF_TYPE_GEN_STATUS:
brcmf_dbg(MSGBUF, "MSGBUF_TYPE_GEN_STATUS\n");
brcmf_msgbuf_process_gen_status(msgbuf, buf);
break;
case MSGBUF_TYPE_RING_STATUS: case MSGBUF_TYPE_RING_STATUS:
brcmf_dbg(MSGBUF, "MSGBUF_TYPE_RING_STATUS\n"); brcmf_dbg(MSGBUF, "MSGBUF_TYPE_RING_STATUS\n");
brcmf_msgbuf_process_ring_status(msgbuf, buf); brcmf_msgbuf_process_ring_status(msgbuf, buf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment