e6486160fc08b16b7ac7d515a3f6a2a39152e3ee
[openwrt/staging/mans0n.git] /
1 From 933897342d0714ae1c10729cbaeecea0c6178db5 Mon Sep 17 00:00:00 2001
2 From: Arend Van Spriel <arend.vanspriel@broadcom.com>
3 Date: Wed, 28 Feb 2018 21:15:19 +0100
4 Subject: [PATCH] brcmfmac: add possibility to obtain firmware error
5
6 The feature module needs to evaluate the actual firmware error return
7 upon a control command. This adds a flag to struct brcmf_if that the
8 caller can set. This flag is checked to determine the error code that
9 needs to be returned.
10
11 Fixes: b69c1df47281 ("brcmfmac: separate firmware errors from i/o errors")
12 Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
13 Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
14 Reviewed-by: Franky Lin <franky.lin@broadcom.com>
15 Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
16 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
17 ---
18 drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h | 2 ++
19 drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c | 10 ++++++++++
20 drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c | 3 +++
21 3 files changed, 15 insertions(+)
22
23 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
24 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
25 @@ -181,6 +181,7 @@ enum brcmf_netif_stop_reason {
26 * @netif_stop_lock: spinlock for update netif_stop from multiple sources.
27 * @pend_8021x_cnt: tracks outstanding number of 802.1x frames.
28 * @pend_8021x_wait: used for signalling change in count.
29 + * @fwil_fwerr: flag indicating fwil layer should return firmware error codes.
30 */
31 struct brcmf_if {
32 struct brcmf_pub *drvr;
33 @@ -198,6 +199,7 @@ struct brcmf_if {
34 wait_queue_head_t pend_8021x_wait;
35 struct in6_addr ipv6_addr_tbl[NDOL_MAX_ENTRIES];
36 u8 ipv6addr_idx;
37 + bool fwil_fwerr;
38 };
39
40 int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp);
41 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
42 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
43 @@ -104,6 +104,9 @@ static void brcmf_feat_iovar_int_get(str
44 u32 data;
45 int err;
46
47 + /* we need to know firmware error */
48 + ifp->fwil_fwerr = true;
49 +
50 err = brcmf_fil_iovar_int_get(ifp, name, &data);
51 if (err == 0) {
52 brcmf_dbg(INFO, "enabling feature: %s\n", brcmf_feat_names[id]);
53 @@ -112,6 +115,8 @@ static void brcmf_feat_iovar_int_get(str
54 brcmf_dbg(TRACE, "%s feature check failed: %d\n",
55 brcmf_feat_names[id], err);
56 }
57 +
58 + ifp->fwil_fwerr = false;
59 }
60
61 static void brcmf_feat_iovar_data_set(struct brcmf_if *ifp,
62 @@ -120,6 +125,9 @@ static void brcmf_feat_iovar_data_set(st
63 {
64 int err;
65
66 + /* we need to know firmware error */
67 + ifp->fwil_fwerr = true;
68 +
69 err = brcmf_fil_iovar_data_set(ifp, name, data, len);
70 if (err != -BRCMF_FW_UNSUPPORTED) {
71 brcmf_dbg(INFO, "enabling feature: %s\n", brcmf_feat_names[id]);
72 @@ -128,6 +136,8 @@ static void brcmf_feat_iovar_data_set(st
73 brcmf_dbg(TRACE, "%s feature check failed: %d\n",
74 brcmf_feat_names[id], err);
75 }
76 +
77 + ifp->fwil_fwerr = false;
78 }
79
80 #define MAX_CAPS_BUFFER_SIZE 512
81 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c
82 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c
83 @@ -131,6 +131,9 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp,
84 brcmf_fil_get_errstr((u32)(-fwerr)), fwerr);
85 err = -EBADE;
86 }
87 + if (ifp->fwil_fwerr)
88 + return fwerr;
89 +
90 return err;
91 }
92