339-v5.1-0012-brcmfmac-print-firmware-reported-general-status-erro.patch 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. Firmware may report general errors using a special message type. Add
  9. basic support for it by simply decoding & printing an error number.
  10. A sample situation in which firmware reports a buf error:
  11. CONSOLE: 027084.733 no host response IOCTL buffer available..so fail the request
  12. will now produce a "Firmware reported general error: 9" on the host.
  13. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  14. Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  15. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16. ---
  17. .../broadcom/brcm80211/brcmfmac/msgbuf.c | 24 +++++++++++++++++++
  18. 1 file changed, 24 insertions(+)
  19. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  20. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  21. @@ -134,6 +134,14 @@ struct msgbuf_completion_hdr {
  22. __le16 flow_ring_id;
  23. };
  24. +/* Data struct for the MSGBUF_TYPE_GEN_STATUS */
  25. +struct msgbuf_gen_status {
  26. + struct msgbuf_common_hdr msg;
  27. + struct msgbuf_completion_hdr compl_hdr;
  28. + __le16 write_idx;
  29. + __le32 rsvd0[3];
  30. +};
  31. +
  32. /* Data struct for the MSGBUF_TYPE_RING_STATUS */
  33. struct msgbuf_ring_status {
  34. struct msgbuf_common_hdr msg;
  35. @@ -1192,6 +1200,18 @@ brcmf_msgbuf_process_rx_complete(struct
  36. brcmf_netif_rx(ifp, skb);
  37. }
  38. +static void brcmf_msgbuf_process_gen_status(struct brcmf_msgbuf *msgbuf,
  39. + void *buf)
  40. +{
  41. + struct msgbuf_gen_status *gen_status = buf;
  42. + struct brcmf_pub *drvr = msgbuf->drvr;
  43. + int err;
  44. +
  45. + err = le16_to_cpu(gen_status->compl_hdr.status);
  46. + if (err)
  47. + bphy_err(drvr, "Firmware reported general error: %d\n", err);
  48. +}
  49. +
  50. static void brcmf_msgbuf_process_ring_status(struct brcmf_msgbuf *msgbuf,
  51. void *buf)
  52. {
  53. @@ -1271,6 +1291,10 @@ static void brcmf_msgbuf_process_msgtype
  54. msg = (struct msgbuf_common_hdr *)buf;
  55. switch (msg->msgtype) {
  56. + case MSGBUF_TYPE_GEN_STATUS:
  57. + brcmf_dbg(MSGBUF, "MSGBUF_TYPE_GEN_STATUS\n");
  58. + brcmf_msgbuf_process_gen_status(msgbuf, buf);
  59. + break;
  60. case MSGBUF_TYPE_RING_STATUS:
  61. brcmf_dbg(MSGBUF, "MSGBUF_TYPE_RING_STATUS\n");
  62. brcmf_msgbuf_process_ring_status(msgbuf, buf);