Skip to contentSkip to conversation

mt76: fix tx status timeout processing

PATCH In review Felix Fietkau 2 participants 5 messages Feb 18, 2019 – Feb 22, 2019

Subsystems (3)
lore
Share & tools
lore

Felix Fietkau

author maintainer
#0 lore raw

PATCH 1/4 mt76: fix tx status timeout processing

Remove bogus check for MT_PACKET_ID_NO_ACK in mt76_tx_status_skb_get, which is already handled in callers and turns timeout calls into no-ops Do not clean up pending status items on reordering of tx status information if the timeout is not reached yet

---
 drivers/net/wireless/mediatek/mt76/tx.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/tx.c +1 -4
index ef38e8626da9..5a349fe3e576 100644
@@ -205,9 +205,6 @@ mt76_tx_status_skb_get(struct mt76_dev *dev, struct mt76_wcid *wcid, int pktid,
 {
 	struct sk_buff *skb, *tmp;
 
-	if (pktid == MT_PACKET_ID_NO_ACK)
-		return NULL;
-
 	skb_queue_walk_safe(&dev->status_list, skb, tmp) {
 		struct mt76_tx_cb *cb = mt76_tx_skb_cb(skb);
 
@@ -217,7 +214,7 @@ mt76_tx_status_skb_get(struct mt76_dev *dev, struct mt76_wcid *wcid, int pktid,
 		if (cb->pktid == pktid)
 			return skb;
 
-		if (!pktid &&
+		if (pktid >= 0 &&
 		    !time_after(jiffies, cb->jiffies + MT_TX_STATUS_SKB_TIMEOUT))
 			continue;
 
Signature · 1 line
2.17.0
author maintainer
#1 lore raw

PATCH 2/4 mt76: fix corrupted software generated tx CCMP PN

Since ccmp_pn is u8 *, the second half needs to start at array index 4 instead of 0. Fixes a connection stall after a certain amount of traffic

Fixes 23405236460b9 ("mt76: fix transmission of encrypted management frames")
---
 drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +1 -1
index bf39624c9b98..eab713723b7e 100644
@@ -314,7 +314,7 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
 		ccmp_pn[6] = pn >> 32;
 		ccmp_pn[7] = pn >> 40;
 		txwi->iv = *((__le32 *)&ccmp_pn[0]);
-		txwi->eiv = *((__le32 *)&ccmp_pn[1]);
+		txwi->eiv = *((__le32 *)&ccmp_pn[4]);
 	}
 
 	spin_lock_bh(&dev->mt76.lock);
Signature · 1 line
2.17.0
maintainer
#2 lore raw

Re: [PATCH 2/4] mt76: fix corrupted software generated tx CCMP PN

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag, fixing commit: 23405236460b mt76: fix transmission of encrypted management frames.

The bot has tested the following trees: v4.20.11, v4.19.24.

v4.19.24: Failed to apply! Possible dependencies:

    047aed1c38cf ("mt76: unify mac_shared_key_setup")
    108a4861ef19 ("mt76: create new mt76x02-lib module for common mt76x{0,2} code")
    2735a6dd7df3 ("mt76: unify wait_for_mac")
    32bb405fe2bc ("mt76: unify mac_wcid_setup")
    427f9ebec682 ("mt76: move mt76x02_mac_write_txwi in mt76x02-lib module")
    46436b5ef9dd ("mt76: unify mac_wcid_set_key")
    516ea2a2a9d4 ("mt76: use mac_wcid_set_drop in mt76x0")
    797ea2407825 ("mt76: merge mt76x0/regs.h into mt76x02_regs.h")
    c378f2473466 ("mt76: unify mac_get_key_info")
    f5a7f126e5fe ("mt76: unify sta structure part 1")

How should we proceed with this patch?

--
Thanks,
Sasha

author maintainer
#3 lore raw

PATCH 3/4 mt76: fix resetting software IV flag on key delete

In reply to Felix Fietkau

It needs to be unset instead of set

Fixes 23405236460b9 ("mt76: fix transmission of encrypted management frames")
---
 drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt76x02_util.c +1 -1
index 87ed00768bc7..11b5f664f5b1 100644
@@ -431,7 +431,7 @@ int mt76x02_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 	} else {
 		if (idx == wcid->hw_key_idx) {
 			wcid->hw_key_idx = -1;
-			wcid->sw_iv = true;
+			wcid->sw_iv = false;
 		}
 
 		key = NULL;
Signature · 1 line
2.17.0
author maintainer
#4 lore raw

PATCH 4/4 mt76: mt76x2: simplify per-chain signal strength handling

In reply to Felix Fietkau

There is no need to use a for loop here, supported chips can only support up to 2 chains.

---
 drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +8 -7
index eab713723b7e..be2979f34f31 100644
@@ -608,7 +608,7 @@ int mt76x02_mac_process_rx(struct mt76x02_dev *dev, struct sk_buff *skb,
 	u16 rate = le16_to_cpu(rxwi->rate);
 	u16 tid_sn = le16_to_cpu(rxwi->tid_sn);
 	bool unicast = rxwi->rxinfo & cpu_to_le32(MT_RXINFO_UNICAST);
-	int i, pad_len = 0, nstreams = dev->mt76.chainmask & 0xf;
+	int pad_len = 0, nstreams = dev->mt76.chainmask & 0xf;
 	s8 signal;
 	u8 pn_len;
 	u8 wcid;
@@ -668,12 +668,13 @@ int mt76x02_mac_process_rx(struct mt76x02_dev *dev, struct sk_buff *skb,
 
 	status->chains = BIT(0);
 	signal = mt76x02_mac_get_rssi(dev, rxwi->rssi[0], 0);
-	for (i = 0; i < nstreams; i++) {
-		status->chains |= BIT(i);
-		status->chain_signal[i] = mt76x02_mac_get_rssi(dev,
-							       rxwi->rssi[i],
-							       i);
-		signal = max_t(s8, signal, status->chain_signal[i]);
+	status->chain_signal[0] = signal;
+	if (nstreams > 1) {
+		status->chains |= BIT(1);
+		status->chain_signal[1] = mt76x02_mac_get_rssi(dev,
+							       rxwi->rssi[1],
+							       1);
+		signal = max_t(s8, signal, status->chain_signal[1]);
 	}
 	status->signal = signal;
 	status->freq = dev->mt76.chandef.chan->center_freq;
Signature · 1 line
2.17.0