339-v5.1-0005-brcmfmac-print-firmware-reported-ring-status-errors.patch 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. Firmware is capable of reporting ring status. It's used e.g. to signal
  9. some problem with a specific ring setup. This patch adds support for
  10. printing ring & error number which may be useful for debugging setup
  11. issues.
  12. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  13. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14. ---
  15. .../broadcom/brcm80211/brcmfmac/msgbuf.c | 25 +++++++++++++++++++
  16. 1 file changed, 25 insertions(+)
  17. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  18. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  19. @@ -134,6 +134,14 @@ struct msgbuf_completion_hdr {
  20. __le16 flow_ring_id;
  21. };
  22. +/* Data struct for the MSGBUF_TYPE_RING_STATUS */
  23. +struct msgbuf_ring_status {
  24. + struct msgbuf_common_hdr msg;
  25. + struct msgbuf_completion_hdr compl_hdr;
  26. + __le16 write_idx;
  27. + __le32 rsvd0[5];
  28. +};
  29. +
  30. struct msgbuf_rx_event {
  31. struct msgbuf_common_hdr msg;
  32. struct msgbuf_completion_hdr compl_hdr;
  33. @@ -1178,6 +1186,19 @@ brcmf_msgbuf_process_rx_complete(struct
  34. brcmf_netif_rx(ifp, skb);
  35. }
  36. +static void brcmf_msgbuf_process_ring_status(struct brcmf_msgbuf *msgbuf,
  37. + void *buf)
  38. +{
  39. + struct msgbuf_ring_status *ring_status = buf;
  40. + int err;
  41. +
  42. + err = le16_to_cpu(ring_status->compl_hdr.status);
  43. + if (err) {
  44. + int ring = le16_to_cpu(ring_status->compl_hdr.flow_ring_id);
  45. +
  46. + brcmf_err("Firmware reported ring %d error: %d\n", ring, err);
  47. + }
  48. +}
  49. static void
  50. brcmf_msgbuf_process_flow_ring_create_response(struct brcmf_msgbuf *msgbuf,
  51. @@ -1239,6 +1260,10 @@ static void brcmf_msgbuf_process_msgtype
  52. msg = (struct msgbuf_common_hdr *)buf;
  53. switch (msg->msgtype) {
  54. + case MSGBUF_TYPE_RING_STATUS:
  55. + brcmf_dbg(MSGBUF, "MSGBUF_TYPE_RING_STATUS\n");
  56. + brcmf_msgbuf_process_ring_status(msgbuf, buf);
  57. + break;
  58. case MSGBUF_TYPE_FLOW_RING_CREATE_CMPLT:
  59. brcmf_dbg(MSGBUF, "MSGBUF_TYPE_FLOW_RING_CREATE_CMPLT\n");
  60. brcmf_msgbuf_process_flow_ring_create_response(msgbuf, buf);