1 From c988b78244df8216902e20de536434e2f474a37e Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Fri, 8 Feb 2019 15:24:39 +0100
4 Subject: [PATCH] brcmfmac: print firmware reported ring status errors
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Firmware is capable of reporting ring status. It's used e.g. to signal
10 some problem with a specific ring setup. This patch adds support for
11 printing ring & error number which may be useful for debugging setup
14 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
15 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
17 .../broadcom/brcm80211/brcmfmac/msgbuf.c | 25 +++++++++++++++++++
18 1 file changed, 25 insertions(+)
20 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
21 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
22 @@ -134,6 +134,14 @@ struct msgbuf_completion_hdr {
26 +/* Data struct for the MSGBUF_TYPE_RING_STATUS */
27 +struct msgbuf_ring_status {
28 + struct msgbuf_common_hdr msg;
29 + struct msgbuf_completion_hdr compl_hdr;
34 struct msgbuf_rx_event {
35 struct msgbuf_common_hdr msg;
36 struct msgbuf_completion_hdr compl_hdr;
37 @@ -1180,6 +1188,19 @@ brcmf_msgbuf_process_rx_complete(struct
38 brcmf_netif_rx(ifp, skb);
41 +static void brcmf_msgbuf_process_ring_status(struct brcmf_msgbuf *msgbuf,
44 + struct msgbuf_ring_status *ring_status = buf;
47 + err = le16_to_cpu(ring_status->compl_hdr.status);
49 + int ring = le16_to_cpu(ring_status->compl_hdr.flow_ring_id);
51 + brcmf_err("Firmware reported ring %d error: %d\n", ring, err);
56 brcmf_msgbuf_process_flow_ring_create_response(struct brcmf_msgbuf *msgbuf,
57 @@ -1241,6 +1262,10 @@ static void brcmf_msgbuf_process_msgtype
59 msg = (struct msgbuf_common_hdr *)buf;
60 switch (msg->msgtype) {
61 + case MSGBUF_TYPE_RING_STATUS:
62 + brcmf_dbg(MSGBUF, "MSGBUF_TYPE_RING_STATUS\n");
63 + brcmf_msgbuf_process_ring_status(msgbuf, buf);
65 case MSGBUF_TYPE_FLOW_RING_CREATE_CMPLT:
66 brcmf_dbg(MSGBUF, "MSGBUF_TYPE_FLOW_RING_CREATE_CMPLT\n");
67 brcmf_msgbuf_process_flow_ring_create_response(msgbuf, buf);