Commit 905a0a6a authored by Ryder Lee's avatar Ryder Lee Committed by Felix Fietkau
Browse files

wifi: mt76: mt7615: enable BSS_CHANGED_MU_GROUPS support



The Group ID Management frame is an Action frame of category VHT.
It is transmitted by the AP to assign or change the user position
of a STA for one or more group IDs.

Also, sniffer can use a given group id to monitor STA that belongs
to that group.

Notify underlying driver of changes via BSS_CHANGED_MU_GROUPS.

Signed-off-by: default avatarRyder Lee <ryder.lee@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 68f1c3ea
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -397,6 +397,8 @@ mt7615_init_wiphy(struct ieee80211_hw *hw)
	wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_SET_SCAN_DWELL);
	wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
	wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0);
	if (!is_mt7622(&phy->dev->mt76))
		wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER);

	ieee80211_hw_set(hw, SINGLE_SCAN_ON_ALL_BANDS);
	ieee80211_hw_set(hw, TX_STATUS_NO_AMPDU_LEN);
+29 −0
Original line number Diff line number Diff line
@@ -552,6 +552,32 @@ static void mt7615_configure_filter(struct ieee80211_hw *hw,
	mt7615_mutex_release(dev);
}

static void
mt7615_update_mu_group(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
		       struct ieee80211_bss_conf *info)
{
	struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;
	struct mt7615_dev *dev = mt7615_hw_dev(hw);
	u8 i, band = mvif->mt76.band_idx;
	u32 *mu;

	mu = (u32 *)info->mu_group.membership;
	for (i = 0; i < WLAN_MEMBERSHIP_LEN / sizeof(*mu); i++) {
		if (is_mt7663(&dev->mt76))
			mt76_wr(dev, MT7663_WF_PHY_GID_TAB_VLD(band, i), mu[i]);
		else
			mt76_wr(dev, MT_WF_PHY_GID_TAB_VLD(band, i), mu[i]);
	}

	mu = (u32 *)info->mu_group.position;
	for (i = 0; i < WLAN_USER_POSITION_LEN / sizeof(*mu); i++) {
		if (is_mt7663(&dev->mt76))
			mt76_wr(dev, MT7663_WF_PHY_GID_TAB_POS(band, i), mu[i]);
		else
			mt76_wr(dev, MT_WF_PHY_GID_TAB_POS(band, i), mu[i]);
	}
}

static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
				    struct ieee80211_vif *vif,
				    struct ieee80211_bss_conf *info,
@@ -600,6 +626,9 @@ static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
	if (changed & BSS_CHANGED_ASSOC)
		mt7615_mac_set_beacon_filter(phy, vif, vif->cfg.assoc);

	if (changed & BSS_CHANGED_MU_GROUPS)
		 mt7615_update_mu_group(hw, vif, info);

	mt7615_mutex_release(dev);
}

+9 −0
Original line number Diff line number Diff line
@@ -212,6 +212,15 @@ enum mt7615_reg_base {

#define MT7663_WF_PHY_R0_PHYCTRL_STS5(_phy)	MT_WF_PHY(0x0224 + ((_phy) << 12))

#define MT_WF_PHY_GID_TAB_VLD(_phy, i)		MT_WF_PHY(0x0254 + (i) * 4 + \
							  ((_phy) << 9))
#define MT7663_WF_PHY_GID_TAB_VLD(_phy, i)	MT_WF_PHY(0x0254 + (i) * 4 + \
							  ((_phy) << 12))
#define MT_WF_PHY_GID_TAB_POS(_phy, i)		MT_WF_PHY(0x025c + (i) * 4 + \
							  ((_phy) << 9))
#define MT7663_WF_PHY_GID_TAB_POS(_phy, i)	MT_WF_PHY(0x025c + (i) * 4 + \
							  ((_phy) << 12))

#define MT_WF_PHY_MIN_PRI_PWR(_phy)	MT_WF_PHY((_phy) ? 0x084 : 0x229c)
#define MT_WF_PHY_PD_OFDM_MASK(_phy)	((_phy) ? GENMASK(24, 16) : \
					 GENMASK(28, 20))