qtnfmac: modify full Tx queue recovery
authorSergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Mon, 30 Oct 2017 10:13:49 +0000 (13:13 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Mon, 30 Oct 2017 10:51:49 +0000 (12:51 +0200)
Current recovery approach is to wake s/w Tx queues for skb->dev netdevice.
However this approach doesn't cover the case when h/w queue is full of
packets from a single wireless interface. Suppose xmit attempt from the
second wireless interface fails due to failed reclaim. Then the second
interface will not have a chance to recover even if subsequent reclaims
succeed. Possible solution is to attempt to wake all the s/w queues
belonging to driver interfaces.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/quantenna/qtnfmac/core.c
drivers/net/wireless/quantenna/qtnfmac/core.h
drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c
drivers/net/wireless/quantenna/qtnfmac/pearl/pcie_bus_priv.h

index aa7f146278a7b45f4d09c9a852efc2bb6bb3ac36..6a6e5ffb0348f0d24e7b6b2d748070d64486331c 100644 (file)
@@ -618,6 +618,33 @@ out:
 }
 EXPORT_SYMBOL_GPL(qtnf_classify_skb);
 
+void qtnf_wake_all_queues(struct net_device *ndev)
+{
+       struct qtnf_vif *vif = qtnf_netdev_get_priv(ndev);
+       struct qtnf_wmac *mac;
+       struct qtnf_bus *bus;
+       int macid;
+       int i;
+
+       if (unlikely(!vif || !vif->mac || !vif->mac->bus))
+               return;
+
+       bus = vif->mac->bus;
+
+       for (macid = 0; macid < QTNF_MAX_MAC; macid++) {
+               if (!(bus->hw_info.mac_bitmap & BIT(macid)))
+                       continue;
+
+               mac = bus->mac[macid];
+               for (i = 0; i < QTNF_MAX_INTF; i++) {
+                       vif = &mac->iflist[i];
+                       if (vif->netdev && netif_queue_stopped(vif->netdev))
+                               netif_tx_wake_all_queues(vif->netdev);
+               }
+       }
+}
+EXPORT_SYMBOL_GPL(qtnf_wake_all_queues);
+
 MODULE_AUTHOR("Quantenna Communications");
 MODULE_DESCRIPTION("Quantenna 802.11 wireless LAN FullMAC driver.");
 MODULE_LICENSE("GPL");
index 49ae700f66f00eaffc35e56a8afd88c50b364d22..da2c24e2271da2619f145eb3f93043a0200c0f1f 100644 (file)
@@ -153,6 +153,7 @@ int qtnf_cmd_send_get_phy_params(struct qtnf_wmac *mac);
 
 struct qtnf_wmac *qtnf_core_get_mac(const struct qtnf_bus *bus, u8 macid);
 struct net_device *qtnf_classify_skb(struct qtnf_bus *bus, struct sk_buff *skb);
+void qtnf_wake_all_queues(struct net_device *ndev);
 void qtnf_virtual_intf_cleanup(struct net_device *ndev);
 
 void qtnf_netdev_updown(struct net_device *ndev, bool up);
index 146e42a132e726957610ee853006f930102b0a78..7e487622d87d35cf0f92c9ed90c2e49a1a12704c 100644 (file)
@@ -617,9 +617,10 @@ static void qtnf_pcie_data_tx_reclaim(struct qtnf_pcie_bus_priv *priv)
                        if (skb->dev) {
                                skb->dev->stats.tx_packets++;
                                skb->dev->stats.tx_bytes += skb->len;
-
-                               if (netif_queue_stopped(skb->dev))
-                                       netif_wake_queue(skb->dev);
+                               if (unlikely(priv->tx_stopped)) {
+                                       qtnf_wake_all_queues(skb->dev);
+                                       priv->tx_stopped = 0;
+                               }
                        }
 
                        dev_kfree_skb_any(skb);
@@ -669,8 +670,10 @@ static int qtnf_pcie_data_tx(struct qtnf_bus *bus, struct sk_buff *skb)
        spin_lock_irqsave(&priv->tx0_lock, flags);
 
        if (!qtnf_tx_queue_ready(priv)) {
-               if (skb->dev)
-                       netif_stop_queue(skb->dev);
+               if (skb->dev) {
+                       netif_tx_stop_all_queues(skb->dev);
+                       priv->tx_stopped = 1;
+               }
 
                spin_unlock_irqrestore(&priv->tx0_lock, flags);
                return NETDEV_TX_BUSY;
index 86ac1ccedb52fa1fa98620b25345f729bb244c69..397875a50fc2c3c73c7b722dfb6ff49c3c1d5222 100644 (file)
@@ -37,6 +37,7 @@ struct qtnf_pcie_bus_priv {
        /* lock for tx0 operations */
        spinlock_t tx0_lock;
        u8 msi_enabled;
+       u8 tx_stopped;
        int mps;
 
        struct workqueue_struct *workqueue;