Skip to content

Commit 20da2ec

Browse files
Sergey MatyukevichKalle Valo
authored andcommitted
qtnfmac: lock access to h/w in tx path
Fix tx path regression. Lock should be held when queuing packets to h/w fifos in order to properly handle configurations with multiple enabled interfaces. Signed-off-by: Sergey Matyukevich <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent 35f6272 commit 20da2ec

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,14 +661,18 @@ static int qtnf_pcie_data_tx(struct qtnf_bus *bus, struct sk_buff *skb)
661661
struct qtnf_pcie_bus_priv *priv = (void *)get_bus_priv(bus);
662662
dma_addr_t txbd_paddr, skb_paddr;
663663
struct qtnf_tx_bd *txbd;
664+
unsigned long flags;
664665
int len, i;
665666
u32 info;
666667
int ret = 0;
667668

669+
spin_lock_irqsave(&priv->tx0_lock, flags);
670+
668671
if (!qtnf_tx_queue_ready(priv)) {
669672
if (skb->dev)
670673
netif_stop_queue(skb->dev);
671674

675+
spin_unlock_irqrestore(&priv->tx0_lock, flags);
672676
return NETDEV_TX_BUSY;
673677
}
674678

@@ -717,8 +721,10 @@ static int qtnf_pcie_data_tx(struct qtnf_bus *bus, struct sk_buff *skb)
717721
dev_kfree_skb_any(skb);
718722
}
719723

720-
qtnf_pcie_data_tx_reclaim(priv);
721724
priv->tx_done_count++;
725+
spin_unlock_irqrestore(&priv->tx0_lock, flags);
726+
727+
qtnf_pcie_data_tx_reclaim(priv);
722728

723729
return NETDEV_TX_OK;
724730
}
@@ -1247,6 +1253,7 @@ static int qtnf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
12471253
strcpy(bus->fwname, QTN_PCI_PEARL_FW_NAME);
12481254
init_completion(&bus->request_firmware_complete);
12491255
mutex_init(&bus->bus_lock);
1256+
spin_lock_init(&pcie_priv->tx0_lock);
12501257
spin_lock_init(&pcie_priv->irq_lock);
12511258
spin_lock_init(&pcie_priv->tx_reclaim_lock);
12521259

drivers/net/wireless/quantenna/qtnfmac/pearl/pcie_bus_priv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ struct qtnf_pcie_bus_priv {
3434

3535
/* lock for tx reclaim operations */
3636
spinlock_t tx_reclaim_lock;
37+
/* lock for tx0 operations */
38+
spinlock_t tx0_lock;
3739
u8 msi_enabled;
3840
int mps;
3941

0 commit comments

Comments
 (0)