linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] wifi: mt76: mt7915: fix bounds checking for tx-free-done command
@ 2022-09-29 15:15 greearb
  2022-09-29 15:15 ` [PATCH 2/2] wifi: mt76: mt7915: add two additional errors to ack-failure mask greearb
  0 siblings, 1 reply; 3+ messages in thread
From: greearb @ 2022-09-29 15:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: nbd, Ben Greear

From: Ben Greear <greearb@candelatech.com>

According to the tx-free-done documentation, the DW4 can be repeated,
so have to be more careful about how we test for walking off the
end of the array.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
index 4e70f5d050ea..bbaa77af387c 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
@@ -1116,14 +1116,16 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
 	total = le16_get_bits(free->ctrl, MT_TX_FREE_MSDU_CNT);
 	/* NOTE: 'v3' actually is checking for API version 4 */
 	v3 = (FIELD_GET(MT_TX_FREE_VER, txd) == 0x4);
-	if (WARN_ON_ONCE((void *)&tx_info[total >> v3] > end))
-		return;
 
 	for (cur_info = tx_info; count < total; cur_info++) {
-		u32 msdu, info = le32_to_cpu(*cur_info);
+		u32 msdu, info;
 		u8 i;
 		u32 tx_cnt, tx_status, ampdu;
 
+		if (WARN_ON_ONCE((void*)cur_info > end))
+			return;
+
+		info = le32_to_cpu(*cur_info);
 		/*
 		 * 1'b1: new wcid pair.
 		 * 1'b0: msdu_id with the same 'wcid pair' as above.
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] wifi: mt76: mt7915: add two additional errors to ack-failure mask.
  2022-09-29 15:15 [PATCH 1/2] wifi: mt76: mt7915: fix bounds checking for tx-free-done command greearb
@ 2022-09-29 15:15 ` greearb
  2022-10-01 11:44   ` Felix Fietkau
  0 siblings, 1 reply; 3+ messages in thread
From: greearb @ 2022-09-29 15:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: nbd, Ben Greear

From: Ben Greear <greearb@candelatech.com>

These other two bits also indicate tx failure as far as I can tell from
reading the documents.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 drivers/net/wireless/mediatek/mt76/mt76_connac2_mac.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac2_mac.h b/drivers/net/wireless/mediatek/mt76/mt76_connac2_mac.h
index 67ce216fb564..075048ab784f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac2_mac.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac2_mac.h
@@ -133,10 +133,12 @@ enum {
 #define MT_TXS0_TXOP_TIMEOUT		BIT(20)
 #define MT_TXS0_BIP_ERROR		BIT(19)
 
+#define MT_TXS0_TXOP_LIMIT		BIT(20)
+#define MT_TXS0_BIP_OR_BF_ERROR		BIT(19)
 #define MT_TXS0_QUEUE_TIMEOUT		BIT(18)
 #define MT_TXS0_RTS_TIMEOUT		BIT(17)
 #define MT_TXS0_ACK_TIMEOUT		BIT(16)
-#define MT_TXS0_ACK_ERROR_MASK		GENMASK(18, 16)
+#define MT_TXS0_ACK_ERROR_MASK		GENMASK(20, 16)
 
 #define MT_TXS0_TX_STATUS_HOST		BIT(15)
 #define MT_TXS0_TX_STATUS_MCU		BIT(14)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] wifi: mt76: mt7915: add two additional errors to ack-failure mask.
  2022-09-29 15:15 ` [PATCH 2/2] wifi: mt76: mt7915: add two additional errors to ack-failure mask greearb
@ 2022-10-01 11:44   ` Felix Fietkau
  0 siblings, 0 replies; 3+ messages in thread
From: Felix Fietkau @ 2022-10-01 11:44 UTC (permalink / raw)
  To: greearb, linux-wireless

On 29.09.22 17:15, greearb@candelatech.com wrote:
> From: Ben Greear <greearb@candelatech.com>
> 
> These other two bits also indicate tx failure as far as I can tell from
> reading the documents.
> 
> Signed-off-by: Ben Greear <greearb@candelatech.com>
The bits seem to have overlapping meaning, not sure if they always 
reliably indicate an error. I think we should leave this patch out, as 
it could potentially cause regressions.

- Felix

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-01 11:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-29 15:15 [PATCH 1/2] wifi: mt76: mt7915: fix bounds checking for tx-free-done command greearb
2022-09-29 15:15 ` [PATCH 2/2] wifi: mt76: mt7915: add two additional errors to ack-failure mask greearb
2022-10-01 11:44   ` Felix Fietkau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).