2023-04-23 22:27:03

by Ryder Lee

[permalink] [raw]
Subject: [PATCH 1/2] wifi: mt76: mt7996: fix endianness of MT_TXD6_TX_RATE

To avoid sparse warning:
sparse: warning: invalid assignment: |=
sparse: left side has type restricted __le32
sparse: right side has type unsigned lon

Fixes: 15ee62e73705 ("wifi: mt76: mt7996: enable BSS_CHANGED_BASIC_RATES support")
Signed-off-by: Ryder Lee <[email protected]>
---
drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
index 130eb7b4fd91..39a4a73ef8e6 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
@@ -1088,7 +1088,7 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
else if (beacon && mvif->beacon_rates_idx)
idx = mvif->beacon_rates_idx;

- txwi[6] |= FIELD_PREP(MT_TXD6_TX_RATE, idx);
+ txwi[6] |= cpu_to_le32(FIELD_PREP(MT_TXD6_TX_RATE, idx));
txwi[3] |= cpu_to_le32(MT_TXD3_BA_DISABLE);
}
}
--
2.18.0


2023-04-23 22:27:54

by Ryder Lee

[permalink] [raw]
Subject: [PATCH 2/2] wifi: mt76: connac: fix stats->tx_bytes calculation

The stats->tx_bytes shall subtract retry byte from tx byte.

Fixes: 43eaa3689507 (wifi: mt76: add PPDU based TxS support for WED device)
Signed-off-by: Ryder Lee <[email protected]>
---
drivers/net/wireless/mediatek/mt76/mt76_connac2_mac.h | 2 +-
drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac2_mac.h b/drivers/net/wireless/mediatek/mt76/mt76_connac2_mac.h
index a5ec0f631385..fabf637bdf7f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac2_mac.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac2_mac.h
@@ -173,7 +173,7 @@ enum {
#define MT_TXS5_MPDU_TX_CNT GENMASK(31, 23)

#define MT_TXS6_MPDU_FAIL_CNT GENMASK(31, 23)
-
+#define MT_TXS7_MPDU_RETRY_BYTE GENMASK(22, 0)
#define MT_TXS7_MPDU_RETRY_CNT GENMASK(31, 23)

/* RXD DW0 */
diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
index ee0fbfcd07d6..d39a3cc5e381 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
@@ -608,7 +608,8 @@ bool mt76_connac2_mac_fill_txs(struct mt76_dev *dev, struct mt76_wcid *wcid,
/* PPDU based reporting */
if (FIELD_GET(MT_TXS0_TXS_FORMAT, txs) > 1) {
stats->tx_bytes +=
- le32_get_bits(txs_data[5], MT_TXS5_MPDU_TX_BYTE);
+ le32_get_bits(txs_data[5], MT_TXS5_MPDU_TX_BYTE) -
+ le32_get_bits(txs_data[7], MT_TXS7_MPDU_RETRY_BYTE);
stats->tx_packets +=
le32_get_bits(txs_data[5], MT_TXS5_MPDU_TX_CNT);
stats->tx_failed +=
--
2.18.0

2023-04-28 05:15:06

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 1/2] wifi: mt76: mt7996: fix endianness of MT_TXD6_TX_RATE

Ryder Lee <[email protected]> writes:

> To avoid sparse warning:
> sparse: warning: invalid assignment: |=
> sparse: left side has type restricted __le32
> sparse: right side has type unsigned lon
>
> Fixes: 15ee62e73705 ("wifi: mt76: mt7996: enable BSS_CHANGED_BASIC_RATES support")
> Signed-off-by: Ryder Lee <[email protected]>

I guess this is the fix for Jakub's report? I should take it to wireless
then?

What about patch 2, should I also take it to wireless? Felix, ack?

--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

2023-04-28 08:57:37

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 1/2] wifi: mt76: mt7996: fix endianness of MT_TXD6_TX_RATE

On Mon, 2023-04-24 at 05:39 +0800, Ryder Lee wrote:
> To avoid sparse warning:
> sparse: warning: invalid assignment: |=
> sparse: left side has type restricted __le32
> sparse: right side has type unsigned lon
>
> Fixes: 15ee62e73705 ("wifi: mt76: mt7996: enable BSS_CHANGED_BASIC_RATES support")
> Signed-off-by: Ryder Lee <[email protected]>
> ---
> drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
> index 130eb7b4fd91..39a4a73ef8e6 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
> @@ -1088,7 +1088,7 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
> else if (beacon && mvif->beacon_rates_idx)
> idx = mvif->beacon_rates_idx;
>
> - txwi[6] |= FIELD_PREP(MT_TXD6_TX_RATE, idx);
> + txwi[6] |= cpu_to_le32(FIELD_PREP(MT_TXD6_TX_RATE, idx));

Btw, and no need to change anything as far as I'm concerned, but just in
case you weren't familiar with it; that kind of thing might be nicer as
le32_encode_bits(), i.e.

txwi[6] |= le32_encode_bits(idx, MT_TXD6_TX_RATE);

Personally, I also generally prefer the typed lower-case versions over
FIELD_GET/PREP etc. but YMMV.

johannes

2023-05-06 07:15:15

by Ryder Lee

[permalink] [raw]
Subject: Re: [PATCH 1/2] wifi: mt76: mt7996: fix endianness of MT_TXD6_TX_RATE

On Fri, 2023-04-28 at 08:03 +0300, Kalle Valo wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>
>
> Ryder Lee <[email protected]> writes:
>
> > To avoid sparse warning:
> > sparse: warning: invalid assignment: |=
> > sparse: left side has type restricted __le32
> > sparse: right side has type unsigned lon
> >
> > Fixes: 15ee62e73705 ("wifi: mt76: mt7996: enable
> > BSS_CHANGED_BASIC_RATES support")
> > Signed-off-by: Ryder Lee <[email protected]>
>
> I guess this is the fix for Jakub's report? I should take it to
> wireless
> then?

Yes, this is for that sparse fixup. You can take it.

Ryder

> What about patch 2, should I also take it to wireless? Felix, ack?
>

2023-05-12 08:25:58

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 2/2] wifi: mt76: connac: fix stats->tx_bytes calculation

Ryder Lee <[email protected]> wrote:

> The stats->tx_bytes shall subtract retry byte from tx byte.
>
> Fixes: 43eaa3689507 (wifi: mt76: add PPDU based TxS support for WED device)
> Signed-off-by: Ryder Lee <[email protected]>

The fixes tag is wrong, should be:

Fixes: 43eaa3689507 ("wifi: mt76: add PPDU based TxS support for WED device")

I can fix that.

--
https://patchwork.kernel.org/project/linux-wireless/patch/b3cd45596943cf5a06b2e08e2fe732ab0b51311b.1682285873.git.ryder.lee@mediatek.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


2023-05-12 08:29:00

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 1/2] wifi: mt76: mt7996: fix endianness of MT_TXD6_TX_RATE

Ryder Lee <[email protected]> wrote:

> To avoid sparse warning:
> sparse: warning: invalid assignment: |=
> sparse: left side has type restricted __le32
> sparse: right side has type unsigned lon
>
> Fixes: 15ee62e73705 ("wifi: mt76: mt7996: enable BSS_CHANGED_BASIC_RATES support")
> Signed-off-by: Ryder Lee <[email protected]>

2 patches applied to wireless.git, thanks.

cdc26ee89bdd wifi: mt76: mt7996: fix endianness of MT_TXD6_TX_RATE
c7ab7a29ef5c wifi: mt76: connac: fix stats->tx_bytes calculation

--
https://patchwork.kernel.org/project/linux-wireless/patch/16fa938373e3b145cb07a2c98d2428fea2abadba.1682285873.git.ryder.lee@mediatek.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches