OSDN Git Service

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 aa7f146..6a6e5ff 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 49ae700..da2c24e 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 146e42a..7e48762 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 86ac1cc..397875a 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;