Skip to contentSkip to conversation

mt76: tx: check return value of tx_queue_skb in mt76_tx

PATCH In review Lorenzo Bianconi 2 participants 2 messages Mar 21, 2019 – Mar 23, 2019 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Lorenzo Bianconi

author maintainer
#1 lore raw

PATCH 1/1 mt76: tx: check return value of tx_queue_skb in mt76_tx

Do not kick the queue if tx_queue_skb fails in mt76_tx

---
 drivers/net/wireless/mediatek/mt76/tx.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/tx.c +6 -2
index 60bbb6561d8f..833c414cea83 100644
@@ -258,8 +258,8 @@ mt76_tx(struct mt76_dev *dev, struct ieee80211_sta *sta,
 {
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+	int err, qid = skb_get_queue_mapping(skb);
 	struct mt76_queue *q;
-	int qid = skb_get_queue_mapping(skb);
 
 	if (WARN_ON(qid >= MT_TXQ_PSD)) {
 		qid = MT_TXQ_BE;
@@ -286,7 +286,10 @@ mt76_tx(struct mt76_dev *dev, struct ieee80211_sta *sta,
 	q = dev->q_tx[qid].q;
 
 	spin_lock_bh(&q->lock);
-	dev->queue_ops->tx_queue_skb(dev, qid, skb, wcid, sta);
+	err = dev->queue_ops->tx_queue_skb(dev, qid, skb, wcid, sta);
+	if (err < 0)
+		goto out;
+
 	dev->queue_ops->kick(dev, q);
 
 	if (q->queued > q->ndesc - 8 && !q->stopped) {
@@ -294,6 +297,7 @@ mt76_tx(struct mt76_dev *dev, struct ieee80211_sta *sta,
 		q->stopped = true;
 	}
 
+out:
 	spin_unlock_bh(&q->lock);
 }
 EXPORT_SYMBOL_GPL(mt76_tx);
Signature · 1 line
2.20.1
maintainer
#2 lore raw
Quoted 3 lines · Lorenzo Bianconi

Do not kick the queue if tx_queue_skb fails in mt76_tx

tx_queue_skb will fail only in rare corner cases, and kicking the queue without adding extra packets is harmless.
Because of that, I think this patch is unnecessary.

- Felix