aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>2014-05-29 11:37:52 -0400
committerJohn W. Linville <linville@tuxdriver.com>2014-05-30 13:49:34 -0400
commita715c7ddd65a1a3b2839b8ebd759bb2d361f7675 (patch)
tree924d72a530e06341971515b67e5c0425e0a9bad3
parent8f1e5d31cf92b037506d5222fc713f27b5d46718 (diff)
wil6210: improve debug for WMI receive
Print message if no events received. This should not happen. If it is, it points to the problem in firmware. Track also cases when multiple events processed in one IRQ Print information as soon as possible - mbox pointers and event header right after reading it. This helps to identify potential problem with memory allocation for the event buffer. Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/wil6210/wmi.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c
index 037993544764..6cc0e182cc70 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.c
+++ b/drivers/net/wireless/ath/wil6210/wmi.c
@@ -659,21 +659,27 @@ void wmi_recv_cmd(struct wil6210_priv *wil)
659 u8 *cmd; 659 u8 *cmd;
660 void __iomem *src; 660 void __iomem *src;
661 ulong flags; 661 ulong flags;
662 unsigned n;
662 663
663 if (!test_bit(wil_status_reset_done, &wil->status)) { 664 if (!test_bit(wil_status_reset_done, &wil->status)) {
664 wil_err(wil, "Reset not completed\n"); 665 wil_err(wil, "Reset not completed\n");
665 return; 666 return;
666 } 667 }
667 668
668 for (;;) { 669 for (n = 0;; n++) {
669 u16 len; 670 u16 len;
670 671
671 r->head = ioread32(wil->csr + HOST_MBOX + 672 r->head = ioread32(wil->csr + HOST_MBOX +
672 offsetof(struct wil6210_mbox_ctl, rx.head)); 673 offsetof(struct wil6210_mbox_ctl, rx.head));
673 if (r->tail == r->head) 674 if (r->tail == r->head) {
675 if (n == 0)
676 wil_dbg_wmi(wil, "No events?\n");
674 return; 677 return;
678 }
675 679
676 /* read cmd from tail */ 680 wil_dbg_wmi(wil, "Mbox head %08x tail %08x\n",
681 r->head, r->tail);
682 /* read cmd descriptor from tail */
677 wil_memcpy_fromio_32(&d_tail, wil->csr + HOSTADDR(r->tail), 683 wil_memcpy_fromio_32(&d_tail, wil->csr + HOSTADDR(r->tail),
678 sizeof(struct wil6210_mbox_ring_desc)); 684 sizeof(struct wil6210_mbox_ring_desc));
679 if (d_tail.sync == 0) { 685 if (d_tail.sync == 0) {
@@ -681,13 +687,18 @@ void wmi_recv_cmd(struct wil6210_priv *wil)
681 return; 687 return;
682 } 688 }
683 689
690 /* read cmd header from descriptor */
684 if (0 != wmi_read_hdr(wil, d_tail.addr, &hdr)) { 691 if (0 != wmi_read_hdr(wil, d_tail.addr, &hdr)) {
685 wil_err(wil, "Mbox evt at 0x%08x?\n", 692 wil_err(wil, "Mbox evt at 0x%08x?\n",
686 le32_to_cpu(d_tail.addr)); 693 le32_to_cpu(d_tail.addr));
687 return; 694 return;
688 } 695 }
689
690 len = le16_to_cpu(hdr.len); 696 len = le16_to_cpu(hdr.len);
697 wil_dbg_wmi(wil, "Mbox evt %04x %04x %04x %02x\n",
698 le16_to_cpu(hdr.seq), len, le16_to_cpu(hdr.type),
699 hdr.flags);
700
701 /* read cmd buffer from descriptor */
691 src = wmi_buffer(wil, d_tail.addr) + 702 src = wmi_buffer(wil, d_tail.addr) +
692 sizeof(struct wil6210_mbox_hdr); 703 sizeof(struct wil6210_mbox_hdr);
693 evt = kmalloc(ALIGN(offsetof(struct pending_wmi_event, 704 evt = kmalloc(ALIGN(offsetof(struct pending_wmi_event,
@@ -703,9 +714,6 @@ void wmi_recv_cmd(struct wil6210_priv *wil)
703 iowrite32(0, wil->csr + HOSTADDR(r->tail) + 714 iowrite32(0, wil->csr + HOSTADDR(r->tail) +
704 offsetof(struct wil6210_mbox_ring_desc, sync)); 715 offsetof(struct wil6210_mbox_ring_desc, sync));
705 /* indicate */ 716 /* indicate */
706 wil_dbg_wmi(wil, "Mbox evt %04x %04x %04x %02x\n",
707 le16_to_cpu(hdr.seq), len, le16_to_cpu(hdr.type),
708 hdr.flags);
709 if ((hdr.type == WIL_MBOX_HDR_TYPE_WMI) && 717 if ((hdr.type == WIL_MBOX_HDR_TYPE_WMI) &&
710 (len >= sizeof(struct wil6210_mbox_hdr_wmi))) { 718 (len >= sizeof(struct wil6210_mbox_hdr_wmi))) {
711 struct wil6210_mbox_hdr_wmi *wmi = &evt->event.wmi; 719 struct wil6210_mbox_hdr_wmi *wmi = &evt->event.wmi;
@@ -735,6 +743,8 @@ void wmi_recv_cmd(struct wil6210_priv *wil)
735 wil_dbg_wmi(wil, "queue_work -> %d\n", q); 743 wil_dbg_wmi(wil, "queue_work -> %d\n", q);
736 } 744 }
737 } 745 }
746 if (n > 1)
747 wil_dbg_wmi(wil, "%s -> %d events processed\n", __func__, n);
738} 748}
739 749
740int wmi_call(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len, 750int wmi_call(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len,