wifi: mt76: mt7915: add WDS support when WED is enabled

The current WED only supports 256 wcid, whereas mt7986 can support up to
512 entries, so firmware provides a rule to get sta_info by DA when wcid
is set to 0x3ff by txd. Also, WED provides a register to overwrite txd
wcid, that is, wcid[9:8] can be overwritten by 0x3 and wcid[7:0] is set
to 0xff by host driver.

However, firmware is unable to get sta_info from DA as DA != RA for
4addr cases, so firmware and wifi host driver both use wcid (256 - 271)
and (768 ~ 783) for sync up to get correct sta_info.

Currently WDS+WED config is completely broken on MT7986/7981 devices if
without this patch.

Signed-off-by: Bo Jiao <[email protected]>
Signed-off-by: Sujuan Chen <[email protected]>
Signed-off-by: Shengyu Qu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Felix Fietkau
2025-10-20 16:09:22 +02:00
parent 2fe5bdbe7e
commit c63db0fcad
9 changed files with 122 additions and 33 deletions
+10 -3
View File
@@ -42,12 +42,19 @@ bool ____mt76_poll_msec(struct mt76_dev *dev, u32 offset, u32 mask, u32 val,
}
EXPORT_SYMBOL_GPL(____mt76_poll_msec);
int mt76_wcid_alloc(u32 *mask, int size)
int __mt76_wcid_alloc(u32 *mask, int min, int size)
{
u32 min_mask = ~0;
int i, idx = 0, cur;
mask += min / 32;
min %= 32;
if (min > 0)
min_mask = ~((1 << min) - 1);
for (i = 0; i < DIV_ROUND_UP(size, 32); i++) {
idx = ffs(~mask[i]);
idx = ffs(~mask[i] & min_mask);
min_mask = ~0;
if (!idx)
continue;
@@ -62,7 +69,7 @@ int mt76_wcid_alloc(u32 *mask, int size)
return -1;
}
EXPORT_SYMBOL_GPL(mt76_wcid_alloc);
EXPORT_SYMBOL_GPL(__mt76_wcid_alloc);
int mt76_get_min_avg_rssi(struct mt76_dev *dev, u8 phy_idx)
{