2023-11-20 12:40:09

by Mingyen Hsieh

[permalink] [raw]
Subject: [PATCH v3 0/3] wifi: mt76: mt7921: series with CLC patches

From: Ming Yen Hsieh <[email protected]>

Sync internal mt7921 patches for CLC.

---

Ming Yen Hsieh (3):
wifi: mt76: mt7921: fix country count limitation for CLC
wifi: mt76: mt7921: fix CLC command timeout when suspend/resume
wifi: mt76: mt7921: fix wrong 6Ghz power type

v2:
- Convert wrong variable type to correct.
v3:
- Due to the lack of patch version's subject-prefix in v2, v3
is updated to include the patch version's subject-prefix.

.../net/wireless/mediatek/mt76/mt7921/init.c | 23 ++++++++---
.../net/wireless/mediatek/mt76/mt7921/main.c | 38 +++++++++++++++++--
.../net/wireless/mediatek/mt76/mt7921/mcu.c | 11 ++++--
.../wireless/mediatek/mt76/mt7921/mt7921.h | 1 +
.../net/wireless/mediatek/mt76/mt7921/pci.c | 3 ++
5 files changed, 65 insertions(+), 11 deletions(-)

--
2.18.0


2023-11-20 12:40:10

by Mingyen Hsieh

[permalink] [raw]
Subject: [PATCH v3 1/3] wifi: mt76: mt7921: fix country count limitation for CLC

From: Ming Yen Hsieh <[email protected]>

Due to the increase in the number of power tables on CLC, the variable
nr_country is no longer sufficient to represent the total quantity.
Therefore, we have switched to calculating the length of clc buf to
obtain the correct power table. Additionally, the version number has
been incremented to 1.

Fixes: 23bdc5d8cadf ("wifi: mt76: mt7921: introduce Country Location Control support")
Signed-off-by: Ming Yen Hsieh <[email protected]>

v2:
- Convert type of buf_len from "__le16" to "u16".

---
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
index 753a4fc45c70..36ac004e1ec9 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
@@ -1264,6 +1264,7 @@ int __mt7921_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2,
u8 mtcl_conf;
u8 rsvd[62];
} __packed req = {
+ .ver = 1,
.idx = idx,
.env = env_cap,
.env_6g = dev->phy.power_type,
@@ -1271,7 +1272,8 @@ int __mt7921_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2,
.mtcl_conf = mt792x_acpi_get_mtcl_conf(&dev->phy, alpha2),
};
int ret, valid_cnt = 0;
- u8 i, *pos;
+ u16 buf_len = 0;
+ u8 *pos;

if (!clc)
return 0;
@@ -1281,12 +1283,15 @@ int __mt7921_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2,
if (mt76_find_power_limits_node(&dev->mt76))
req.cap |= CLC_CAP_DTS_EN;

+ buf_len = le16_to_cpu(clc->len) - sizeof(*clc);
pos = clc->data;
- for (i = 0; i < clc->nr_country; i++) {
+ while (buf_len > 16) {
struct mt7921_clc_rule *rule = (struct mt7921_clc_rule *)pos;
u16 len = le16_to_cpu(rule->len);
+ u16 offset = len + sizeof(*rule);

- pos += len + sizeof(*rule);
+ pos += offset;
+ buf_len -= offset;
if (rule->alpha2[0] != alpha2[0] ||
rule->alpha2[1] != alpha2[1])
continue;
--
2.18.0

2023-11-21 12:49:03

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] wifi: mt76: mt7921: fix country count limitation for CLC

Mingyen Hsieh <[email protected]> writes:

> From: Ming Yen Hsieh <[email protected]>
>
> Due to the increase in the number of power tables on CLC, the variable
> nr_country is no longer sufficient to represent the total quantity.
> Therefore, we have switched to calculating the length of clc buf to
> obtain the correct power table. Additionally, the version number has
> been incremented to 1.
>
> Fixes: 23bdc5d8cadf ("wifi: mt76: mt7921: introduce Country Location Control support")
> Signed-off-by: Ming Yen Hsieh <[email protected]>
>
> v2:
> - Convert type of buf_len from "__le16" to "u16".

Like in v2 this should be after "---" line.

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

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