mt76: mt7921: introduce mt7921_mcu_sta_add routine
mt7921_mcu_sta_add will be used to add and remove wtbl entries. Create broadcast wtbl entry after AP association Co-developed-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
081b37aea5
commit
36fcc8cff5
@ -622,8 +622,10 @@ static void mt7921_bss_info_changed(struct ieee80211_hw *hw,
|
|||||||
if (changed & BSS_CHANGED_PS)
|
if (changed & BSS_CHANGED_PS)
|
||||||
mt7921_mcu_uni_bss_ps(dev, vif);
|
mt7921_mcu_uni_bss_ps(dev, vif);
|
||||||
|
|
||||||
if (changed & BSS_CHANGED_ASSOC)
|
if (changed & BSS_CHANGED_ASSOC) {
|
||||||
|
mt7921_mcu_sta_add(dev, NULL, vif, true);
|
||||||
mt7921_bss_bcnft_apply(dev, vif, info->assoc);
|
mt7921_bss_bcnft_apply(dev, vif, info->assoc);
|
||||||
|
}
|
||||||
|
|
||||||
if (changed & BSS_CHANGED_ARP_FILTER) {
|
if (changed & BSS_CHANGED_ARP_FILTER) {
|
||||||
struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
|
struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
|
||||||
@ -641,15 +643,6 @@ int mt7921_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
|
|||||||
struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
|
struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
|
||||||
struct mt7921_sta *msta = (struct mt7921_sta *)sta->drv_priv;
|
struct mt7921_sta *msta = (struct mt7921_sta *)sta->drv_priv;
|
||||||
struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
|
struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
|
||||||
int rssi = -ewma_rssi_read(&mvif->rssi);
|
|
||||||
struct mt76_sta_cmd_info info = {
|
|
||||||
.sta = sta,
|
|
||||||
.vif = vif,
|
|
||||||
.enable = true,
|
|
||||||
.cmd = MCU_UNI_CMD_STA_REC_UPDATE,
|
|
||||||
.wcid = &msta->wcid,
|
|
||||||
.rcpi = to_rcpi(rssi),
|
|
||||||
};
|
|
||||||
int ret, idx;
|
int ret, idx;
|
||||||
|
|
||||||
idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7921_WTBL_STA - 1);
|
idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7921_WTBL_STA - 1);
|
||||||
@ -676,7 +669,7 @@ int mt7921_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
|
|||||||
mt7921_mac_wtbl_update(dev, idx,
|
mt7921_mac_wtbl_update(dev, idx,
|
||||||
MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
|
MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
|
||||||
|
|
||||||
ret = mt76_connac_mcu_add_sta_cmd(&dev->mphy, &info);
|
ret = mt7921_mcu_sta_add(dev, sta, vif, true);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
@ -690,18 +683,11 @@ void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
|
|||||||
{
|
{
|
||||||
struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
|
struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
|
||||||
struct mt7921_sta *msta = (struct mt7921_sta *)sta->drv_priv;
|
struct mt7921_sta *msta = (struct mt7921_sta *)sta->drv_priv;
|
||||||
struct mt76_sta_cmd_info info = {
|
|
||||||
.sta = sta,
|
|
||||||
.vif = vif,
|
|
||||||
.cmd = MCU_UNI_CMD_STA_REC_UPDATE,
|
|
||||||
.wcid = &msta->wcid,
|
|
||||||
};
|
|
||||||
|
|
||||||
mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->wcid);
|
mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->wcid);
|
||||||
mt76_connac_pm_wake(&dev->mphy, &dev->pm);
|
mt76_connac_pm_wake(&dev->mphy, &dev->pm);
|
||||||
|
|
||||||
mt76_connac_mcu_add_sta_cmd(&dev->mphy, &info);
|
mt7921_mcu_sta_add(dev, sta, vif, false);
|
||||||
|
|
||||||
mt7921_mac_wtbl_update(dev, msta->wcid.idx,
|
mt7921_mac_wtbl_update(dev, msta->wcid.idx,
|
||||||
MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
|
MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
|
||||||
|
|
||||||
|
@ -1265,6 +1265,26 @@ int mt7921_mcu_set_bss_pm(struct mt7921_dev *dev, struct ieee80211_vif *vif,
|
|||||||
sizeof(req), false);
|
sizeof(req), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int mt7921_mcu_sta_add(struct mt7921_dev *dev, struct ieee80211_sta *sta,
|
||||||
|
struct ieee80211_vif *vif, bool enable)
|
||||||
|
{
|
||||||
|
struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
|
||||||
|
int rssi = -ewma_rssi_read(&mvif->rssi);
|
||||||
|
struct mt76_sta_cmd_info info = {
|
||||||
|
.sta = sta,
|
||||||
|
.vif = vif,
|
||||||
|
.enable = enable,
|
||||||
|
.cmd = MCU_UNI_CMD_STA_REC_UPDATE,
|
||||||
|
.rcpi = to_rcpi(rssi),
|
||||||
|
};
|
||||||
|
struct mt7921_sta *msta;
|
||||||
|
|
||||||
|
msta = sta ? (struct mt7921_sta *)sta->drv_priv : NULL;
|
||||||
|
info.wcid = msta ? &msta->wcid : &mvif->sta.wcid;
|
||||||
|
|
||||||
|
return mt76_connac_mcu_add_sta_cmd(&dev->mphy, &info);
|
||||||
|
}
|
||||||
|
|
||||||
int mt7921_mcu_drv_pmctrl(struct mt7921_dev *dev)
|
int mt7921_mcu_drv_pmctrl(struct mt7921_dev *dev)
|
||||||
{
|
{
|
||||||
struct mt76_phy *mphy = &dev->mt76.phy;
|
struct mt76_phy *mphy = &dev->mt76.phy;
|
||||||
|
@ -257,6 +257,8 @@ int mt7921_mcu_add_key(struct mt7921_dev *dev, struct ieee80211_vif *vif,
|
|||||||
struct mt7921_sta *msta, struct ieee80211_key_conf *key,
|
struct mt7921_sta *msta, struct ieee80211_key_conf *key,
|
||||||
enum set_key_cmd cmd);
|
enum set_key_cmd cmd);
|
||||||
int mt7921_set_channel(struct mt7921_phy *phy);
|
int mt7921_set_channel(struct mt7921_phy *phy);
|
||||||
|
int mt7921_mcu_sta_add(struct mt7921_dev *dev, struct ieee80211_sta *sta,
|
||||||
|
struct ieee80211_vif *vif, bool enable);
|
||||||
int mt7921_mcu_set_chan_info(struct mt7921_phy *phy, int cmd);
|
int mt7921_mcu_set_chan_info(struct mt7921_phy *phy, int cmd);
|
||||||
int mt7921_mcu_set_tx(struct mt7921_dev *dev, struct ieee80211_vif *vif);
|
int mt7921_mcu_set_tx(struct mt7921_dev *dev, struct ieee80211_vif *vif);
|
||||||
int mt7921_mcu_set_eeprom(struct mt7921_dev *dev);
|
int mt7921_mcu_set_eeprom(struct mt7921_dev *dev);
|
||||||
|
Loading…
Reference in New Issue
Block a user