diff mbox series

mt76: mt7915: fix MBSS index condition in DBDC mode

Message ID 20220309140249.10285-1-evelyn.tsai@mediatek.com (mailing list archive)
State Changes Requested
Delegated to: Felix Fietkau
Headers show
Series mt76: mt7915: fix MBSS index condition in DBDC mode | expand

Commit Message

Evelyn Tsai March 9, 2022, 2:02 p.m. UTC
MT7915_MAX_INTERFACES is per-band declartion.

Signed-off-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
Signed-off-by: Bo Jiao <bo.jiao@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/mt76.h        | 2 +-
 drivers/net/wireless/mediatek/mt76/mt7915/main.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Felix Fietkau March 14, 2022, 2:37 p.m. UTC | #1
On 09.03.22 15:02, Evelyn Tsai wrote:
> MT7915_MAX_INTERFACES is per-band declartion.
> 
> Signed-off-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
> Signed-off-by: Bo Jiao <bo.jiao@mediatek.com>
> ---
>   drivers/net/wireless/mediatek/mt76/mt76.h        | 2 +-
>   drivers/net/wireless/mediatek/mt76/mt7915/main.c | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
> index 5e10fe156926..c60af144f611 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt76.h
> @@ -727,7 +727,7 @@ struct mt76_dev {
>   	u32 wcid_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
>   	u32 wcid_phy_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
>   
> -	u32 vif_mask;
> +	u64 vif_mask;
>   
>   	struct mt76_wcid global_wcid;
>   	struct mt76_wcid __rcu *wcid[MT76_N_WCIDS];
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
> index c3f44d801e7f..9eefc132d77a 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
> @@ -205,7 +205,7 @@ static int mt7915_add_interface(struct ieee80211_hw *hw,
>   		phy->monitor_vif = vif;
>   
>   	mvif->mt76.idx = ffs(~dev->mt76.vif_mask) - 1;
> -	if (mvif->mt76.idx >= MT7915_MAX_INTERFACES) {
> +	if (mvif->mt76.idx >= (MT7915_MAX_INTERFACES << dev->dbdc_support)) {
This patch is incomplete. There are several other places in the code 
that are not prepared for vif_mask being 64 bits wide, including the ffs 
line above.

- Felix
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index 5e10fe156926..c60af144f611 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -727,7 +727,7 @@  struct mt76_dev {
 	u32 wcid_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
 	u32 wcid_phy_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
 
-	u32 vif_mask;
+	u64 vif_mask;
 
 	struct mt76_wcid global_wcid;
 	struct mt76_wcid __rcu *wcid[MT76_N_WCIDS];
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
index c3f44d801e7f..9eefc132d77a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
@@ -205,7 +205,7 @@  static int mt7915_add_interface(struct ieee80211_hw *hw,
 		phy->monitor_vif = vif;
 
 	mvif->mt76.idx = ffs(~dev->mt76.vif_mask) - 1;
-	if (mvif->mt76.idx >= MT7915_MAX_INTERFACES) {
+	if (mvif->mt76.idx >= (MT7915_MAX_INTERFACES << dev->dbdc_support)) {
 		ret = -ENOSPC;
 		goto out;
 	}