b41b9cebf40aa7945fe3c0593beeb421707eb2cc
[openwrt/staging/blocktrron.git] /
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
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
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
12 issues.
13
14 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
15 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
16 ---
17 .../broadcom/brcm80211/brcmfmac/msgbuf.c | 25 +++++++++++++++++++
18 1 file changed, 25 insertions(+)
19
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 {
23 __le16 flow_ring_id;
24 };
25
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;
30 + __le16 write_idx;
31 + __le32 rsvd0[5];
32 +};
33 +
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);
39 }
40
41 +static void brcmf_msgbuf_process_ring_status(struct brcmf_msgbuf *msgbuf,
42 + void *buf)
43 +{
44 + struct msgbuf_ring_status *ring_status = buf;
45 + int err;
46 +
47 + err = le16_to_cpu(ring_status->compl_hdr.status);
48 + if (err) {
49 + int ring = le16_to_cpu(ring_status->compl_hdr.flow_ring_id);
50 +
51 + brcmf_err("Firmware reported ring %d error: %d\n", ring, err);
52 + }
53 +}
54
55 static void
56 brcmf_msgbuf_process_flow_ring_create_response(struct brcmf_msgbuf *msgbuf,
57 @@ -1241,6 +1262,10 @@ static void brcmf_msgbuf_process_msgtype
58
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);
64 + break;
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);