From: <sean.wang@mediatek.com> To: <nbd@nbd.name>, <lorenzo.bianconi@redhat.com> Cc: <sean.wang@mediatek.com>, <Soul.Huang@mediatek.com>, <YN.Chen@mediatek.com>, <Leon.Yen@mediatek.com>, <Eric-SY.Chang@mediatek.com>, <Deren.Wu@mediatek.com>, <km.lin@mediatek.com>, <robin.chiu@mediatek.com>, <ch.yeh@mediatek.com>, <posh.sun@mediatek.com>, <Eric.Liang@mediatek.com>, <Stella.Chang@mediatek.com>, <jemele@google.com>, <yenlinlai@google.com>, <linux-wireless@vger.kernel.org>, <linux-mediatek@lists.infradead.org>, Deren Wu <deren.wu@mediatek.com>, YN Chen <yn.chen@mediatek.com> Subject: [PATCH 6/7] mt76: mt7921: fix OMAC idx usage Date: Thu, 20 May 2021 11:46:40 +0800 [thread overview] Message-ID: <1621482401-29025-6-git-send-email-sean.wang@mediatek.com> (raw) In-Reply-To: <1621482401-29025-1-git-send-email-sean.wang@mediatek.com> From: Sean Wang <sean.wang@mediatek.com> OMAC idx have to be same with BSS idx according to firmware usage. Fixes: e0f9fdda81bd ("mt76: mt7921: add ieee80211_ops") Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: YN Chen <yn.chen@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> --- .../net/wireless/mediatek/mt76/mt7921/main.c | 55 +------------------ 1 file changed, 1 insertion(+), 54 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index 5dbccbefe047..472afd4ea487 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -224,54 +224,6 @@ static void mt7921_stop(struct ieee80211_hw *hw) mt7921_mutex_release(dev); } -static inline int get_free_idx(u32 mask, u8 start, u8 end) -{ - return ffs(~mask & GENMASK(end, start)); -} - -static int get_omac_idx(enum nl80211_iftype type, u64 mask) -{ - int i; - - switch (type) { - case NL80211_IFTYPE_STATION: - /* prefer hw bssid slot 1-3 */ - i = get_free_idx(mask, HW_BSSID_1, HW_BSSID_3); - if (i) - return i - 1; - - /* next, try to find a free repeater entry for the sta */ - i = get_free_idx(mask >> REPEATER_BSSID_START, 0, - REPEATER_BSSID_MAX - REPEATER_BSSID_START); - if (i) - return i + 32 - 1; - - i = get_free_idx(mask, EXT_BSSID_1, EXT_BSSID_MAX); - if (i) - return i - 1; - - if (~mask & BIT(HW_BSSID_0)) - return HW_BSSID_0; - - break; - case NL80211_IFTYPE_MONITOR: - /* ap uses hw bssid 0 and ext bssid */ - if (~mask & BIT(HW_BSSID_0)) - return HW_BSSID_0; - - i = get_free_idx(mask, EXT_BSSID_1, EXT_BSSID_MAX); - if (i) - return i - 1; - - break; - default: - WARN_ON(1); - break; - } - - return -1; -} - static int mt7921_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { @@ -293,12 +245,7 @@ static int mt7921_add_interface(struct ieee80211_hw *hw, goto out; } - idx = get_omac_idx(vif->type, phy->omac_mask); - if (idx < 0) { - ret = -ENOSPC; - goto out; - } - mvif->mt76.omac_idx = idx; + mvif->mt76.omac_idx = mvif->mt76.idx; mvif->phy = phy; mvif->mt76.band_idx = 0; mvif->mt76.wmm_idx = mvif->mt76.idx % MT7921_MAX_WMM_SETS; -- 2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: <sean.wang@mediatek.com> To: <nbd@nbd.name>, <lorenzo.bianconi@redhat.com> Cc: <sean.wang@mediatek.com>, <Soul.Huang@mediatek.com>, <YN.Chen@mediatek.com>, <Leon.Yen@mediatek.com>, <Eric-SY.Chang@mediatek.com>, <Deren.Wu@mediatek.com>, <km.lin@mediatek.com>, <robin.chiu@mediatek.com>, <ch.yeh@mediatek.com>, <posh.sun@mediatek.com>, <Eric.Liang@mediatek.com>, <Stella.Chang@mediatek.com>, <jemele@google.com>, <yenlinlai@google.com>, <linux-wireless@vger.kernel.org>, <linux-mediatek@lists.infradead.org>, Deren Wu <deren.wu@mediatek.com>, "YN Chen" <yn.chen@mediatek.com> Subject: [PATCH 6/7] mt76: mt7921: fix OMAC idx usage Date: Thu, 20 May 2021 11:46:40 +0800 [thread overview] Message-ID: <1621482401-29025-6-git-send-email-sean.wang@mediatek.com> (raw) In-Reply-To: <1621482401-29025-1-git-send-email-sean.wang@mediatek.com> From: Sean Wang <sean.wang@mediatek.com> OMAC idx have to be same with BSS idx according to firmware usage. Fixes: e0f9fdda81bd ("mt76: mt7921: add ieee80211_ops") Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: YN Chen <yn.chen@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> --- .../net/wireless/mediatek/mt76/mt7921/main.c | 55 +------------------ 1 file changed, 1 insertion(+), 54 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index 5dbccbefe047..472afd4ea487 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -224,54 +224,6 @@ static void mt7921_stop(struct ieee80211_hw *hw) mt7921_mutex_release(dev); } -static inline int get_free_idx(u32 mask, u8 start, u8 end) -{ - return ffs(~mask & GENMASK(end, start)); -} - -static int get_omac_idx(enum nl80211_iftype type, u64 mask) -{ - int i; - - switch (type) { - case NL80211_IFTYPE_STATION: - /* prefer hw bssid slot 1-3 */ - i = get_free_idx(mask, HW_BSSID_1, HW_BSSID_3); - if (i) - return i - 1; - - /* next, try to find a free repeater entry for the sta */ - i = get_free_idx(mask >> REPEATER_BSSID_START, 0, - REPEATER_BSSID_MAX - REPEATER_BSSID_START); - if (i) - return i + 32 - 1; - - i = get_free_idx(mask, EXT_BSSID_1, EXT_BSSID_MAX); - if (i) - return i - 1; - - if (~mask & BIT(HW_BSSID_0)) - return HW_BSSID_0; - - break; - case NL80211_IFTYPE_MONITOR: - /* ap uses hw bssid 0 and ext bssid */ - if (~mask & BIT(HW_BSSID_0)) - return HW_BSSID_0; - - i = get_free_idx(mask, EXT_BSSID_1, EXT_BSSID_MAX); - if (i) - return i - 1; - - break; - default: - WARN_ON(1); - break; - } - - return -1; -} - static int mt7921_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { @@ -293,12 +245,7 @@ static int mt7921_add_interface(struct ieee80211_hw *hw, goto out; } - idx = get_omac_idx(vif->type, phy->omac_mask); - if (idx < 0) { - ret = -ENOSPC; - goto out; - } - mvif->mt76.omac_idx = idx; + mvif->mt76.omac_idx = mvif->mt76.idx; mvif->phy = phy; mvif->mt76.band_idx = 0; mvif->mt76.wmm_idx = mvif->mt76.idx % MT7921_MAX_WMM_SETS; -- 2.25.1 _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek
next prev parent reply other threads:[~2021-05-20 3:47 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-20 3:46 [PATCH RESEND 1/7] mt76: connac: add bss color support for sta mode sean.wang 2021-05-20 3:46 ` [PATCH 2/7] mt76: connac: update BA win size in Rx direction sean.wang 2021-05-20 3:46 ` sean.wang 2021-05-20 3:46 ` [PATCH 3/7] mt76: mt7921: fix reset under the deep sleep is enabled sean.wang 2021-05-20 3:46 ` sean.wang 2021-05-23 21:14 ` Lorenzo Bianconi 2021-05-23 21:14 ` Lorenzo Bianconi 2021-05-20 3:46 ` [PATCH 4/7] mt76: mt7921: avoid unnecessary consecutive WiFi resets sean.wang 2021-05-20 3:46 ` sean.wang 2021-05-20 3:46 ` [PATCH 5/7] mt76: mt7921: fix invalid register access in wake_work sean.wang 2021-05-20 3:46 ` sean.wang 2021-05-20 3:46 ` sean.wang [this message] 2021-05-20 3:46 ` [PATCH 6/7] mt76: mt7921: fix OMAC idx usage sean.wang 2021-05-20 3:46 ` [PATCH 7/7] mt76: mt7921: enable runtime pm by default sean.wang 2021-05-20 3:46 ` sean.wang
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1621482401-29025-6-git-send-email-sean.wang@mediatek.com \ --to=sean.wang@mediatek.com \ --cc=Deren.Wu@mediatek.com \ --cc=Eric-SY.Chang@mediatek.com \ --cc=Eric.Liang@mediatek.com \ --cc=Leon.Yen@mediatek.com \ --cc=Soul.Huang@mediatek.com \ --cc=Stella.Chang@mediatek.com \ --cc=YN.Chen@mediatek.com \ --cc=ch.yeh@mediatek.com \ --cc=jemele@google.com \ --cc=km.lin@mediatek.com \ --cc=linux-mediatek@lists.infradead.org \ --cc=linux-wireless@vger.kernel.org \ --cc=lorenzo.bianconi@redhat.com \ --cc=nbd@nbd.name \ --cc=posh.sun@mediatek.com \ --cc=robin.chiu@mediatek.com \ --cc=yenlinlai@google.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.