wil6210: track Tx queue state
authorVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Mon, 16 Jun 2014 16:37:23 +0000 (19:37 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 19 Jun 2014 19:49:27 +0000 (15:49 -0400)
Provide both event (netif_tx_[stop|wake]) tracking via printk;
and state via debugfs 'info'

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/wil6210/debugfs.c
drivers/net/wireless/ath/wil6210/main.c
drivers/net/wireless/ath/wil6210/txrx.c

index 94ac69a380b85a72e8578071a3d6bf7452a5dc43..7d1ef4eea0d8b9a456441981996d4531b20e71c5 100644 (file)
@@ -859,6 +859,7 @@ static int wil_info_debugfs_show(struct seq_file *s, void *data)
        static ulong rxf_old, txf_old;
        ulong rxf = ndev->stats.rx_packets;
        ulong txf = ndev->stats.tx_packets;
+       unsigned int i;
 
        /* >0 : AC; 0 : battery; <0 : error */
        seq_printf(s, "AC powered : %d\n", is_ac);
@@ -867,6 +868,21 @@ static int wil_info_debugfs_show(struct seq_file *s, void *data)
        rxf_old = rxf;
        txf_old = txf;
 
+
+#define CHECK_QSTATE(x) (state & BIT(__QUEUE_STATE_ ## x)) ? \
+       " " __stringify(x) : ""
+
+       for (i = 0; i < ndev->num_tx_queues; i++) {
+               struct netdev_queue *txq = netdev_get_tx_queue(ndev, i);
+               unsigned long state = txq->state;
+
+               seq_printf(s, "Tx queue[%i] state : 0x%lx%s%s%s\n", i, state,
+                          CHECK_QSTATE(DRV_XOFF),
+                          CHECK_QSTATE(STACK_XOFF),
+                          CHECK_QSTATE(FROZEN)
+                         );
+       }
+#undef CHECK_QSTATE
        return 0;
 }
 
index 6cc4791d6022703941db80724929b40f43de90da..53a689ed7c7d0ba053d652c4b696639639b617d7 100644 (file)
@@ -473,6 +473,7 @@ void wil_link_on(struct wil6210_priv *wil)
        wil_dbg_misc(wil, "%s()\n", __func__);
 
        netif_carrier_on(ndev);
+       wil_dbg_misc(wil, "netif_tx_wake : link on\n");
        netif_tx_wake_all_queues(ndev);
 }
 
@@ -483,6 +484,7 @@ void wil_link_off(struct wil6210_priv *wil)
        wil_dbg_misc(wil, "%s()\n", __func__);
 
        netif_tx_stop_all_queues(ndev);
+       wil_dbg_misc(wil, "netif_tx_stop : link off\n");
        netif_carrier_off(ndev);
 }
 
index c06d74adb3fc5f4a8cd666a2bed6ef70c2946511..af4b93e4beb5e80e9412785d60a17ebbe95e790a 100644 (file)
@@ -1038,8 +1038,10 @@ netdev_tx_t wil_start_xmit(struct sk_buff *skb, struct net_device *ndev)
        rc = wil_tx_vring(wil, vring, skb);
 
        /* do we still have enough room in the vring? */
-       if (wil_vring_avail_tx(vring) < wil_vring_wmark_low(vring))
+       if (wil_vring_avail_tx(vring) < wil_vring_wmark_low(vring)) {
                netif_tx_stop_all_queues(wil_to_ndev(wil));
+               wil_dbg_txrx(wil, "netif_tx_stop : ring full\n");
+       }
 
        switch (rc) {
        case 0:
@@ -1153,8 +1155,10 @@ int wil_tx_complete(struct wil6210_priv *wil, int ringid)
                txdata->last_idle = get_cycles();
        }
 
-       if (wil_vring_avail_tx(vring) > wil_vring_wmark_high(vring))
+       if (wil_vring_avail_tx(vring) > wil_vring_wmark_high(vring)) {
+               wil_dbg_txrx(wil, "netif_tx_wake : ring not full\n");
                netif_tx_wake_all_queues(wil_to_ndev(wil));
+       }
 
        return done;
 }