Commit 50298715 authored by Sean Wang's avatar Sean Wang Committed by Felix Fietkau

wifi: mt76: mt7925: add mt7925_mac_link_sta_add to create per-link STA

The mt7925_mac_link_sta_add function currently adds the per-link STA.
We will extend this function when we implement the MLO functionality.

This patch only includes structural changes and does not involve any
logic changes.
Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20240613030241.5771-43-sean.wang@kernel.orgSigned-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent c1c98696
...@@ -703,45 +703,46 @@ mt7925_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -703,45 +703,46 @@ mt7925_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
return mvif->basic_rates_idx; return mvif->basic_rates_idx;
} }
int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, static int mt7925_mac_link_sta_add(struct mt76_dev *mdev,
struct ieee80211_sta *sta) struct ieee80211_vif *vif,
struct ieee80211_link_sta *link_sta)
{ {
struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct ieee80211_bss_conf *link_conf; struct ieee80211_bss_conf *link_conf;
struct mt792x_link_sta *mlink;
struct mt792x_sta *msta;
int ret, idx; int ret, idx;
msta = (struct mt792x_sta *)link_sta->sta->drv_priv;
mlink = mt792x_sta_to_link(msta, link_sta->link_id);
idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT792x_WTBL_STA - 1); idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT792x_WTBL_STA - 1);
if (idx < 0) if (idx < 0)
return -ENOSPC; return -ENOSPC;
INIT_LIST_HEAD(&msta->deflink.wcid.poll_list); INIT_LIST_HEAD(&mlink->wcid.poll_list);
msta->vif = mvif; mlink->wcid.sta = 1;
msta->deflink.wcid.sta = 1; mlink->wcid.idx = idx;
msta->deflink.wcid.idx = idx; mlink->wcid.phy_idx = mvif->bss_conf.mt76.band_idx;
msta->deflink.wcid.phy_idx = mvif->bss_conf.mt76.band_idx; mlink->wcid.tx_info |= MT_WCID_TX_INFO_SET;
msta->deflink.wcid.tx_info |= MT_WCID_TX_INFO_SET; mlink->last_txs = jiffies;
msta->deflink.last_txs = jiffies;
ret = mt76_connac_pm_wake(&dev->mphy, &dev->pm); ret = mt76_connac_pm_wake(&dev->mphy, &dev->pm);
if (ret) if (ret)
return ret; return ret;
if (vif->type == NL80211_IFTYPE_STATION)
mvif->wep_sta = msta;
mt7925_mac_wtbl_update(dev, idx, mt7925_mac_wtbl_update(dev, idx,
MT_WTBL_UPDATE_ADM_COUNT_CLEAR); MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id); link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id);
/* should update bss info before STA add */ /* should update bss info before STA add */
if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) if (vif->type == NL80211_IFTYPE_STATION && !link_sta->sta->tdls)
mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx,
link_conf, &sta->deflink, false); link_conf, link_sta, false);
ret = mt7925_mcu_sta_update(dev, &sta->deflink, vif, true, ret = mt7925_mcu_sta_update(dev, link_sta, vif, true,
MT76_STA_INFO_STATE_NONE); MT76_STA_INFO_STATE_NONE);
if (ret) if (ret)
return ret; return ret;
...@@ -750,6 +751,20 @@ int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, ...@@ -750,6 +751,20 @@ int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
return 0; return 0;
} }
int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
msta->vif = mvif;
if (vif->type == NL80211_IFTYPE_STATION)
mvif->wep_sta = msta;
return mt7925_mac_link_sta_add(mdev, vif, &sta->deflink);
}
EXPORT_SYMBOL_GPL(mt7925_mac_sta_add); EXPORT_SYMBOL_GPL(mt7925_mac_sta_add);
void mt7925_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif, void mt7925_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment