static int mt7925_mac_link_sta_add(struct mt76_dev *mdev,
struct ieee80211_vif *vif,
- struct ieee80211_link_sta *link_sta)
+ struct ieee80211_link_sta *link_sta,
+ struct mt792x_link_sta *mlink)
{
struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct ieee80211_bss_conf *link_conf;
struct mt792x_bss_conf *mconf;
u8 link_id = link_sta->link_id;
- struct mt792x_link_sta *mlink;
struct mt792x_sta *msta;
struct mt76_wcid *wcid;
int ret, idx;
msta = (struct mt792x_sta *)link_sta->sta->drv_priv;
- mlink = mt792x_sta_to_link(msta, link_id);
+
+ if (WARN_ON_ONCE(!mlink))
+ return -EINVAL;
idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT792x_WTBL_STA - 1);
if (idx < 0)
/* should update bss info before STA add */
if (vif->type == NL80211_IFTYPE_STATION && !link_sta->sta->tdls) {
- if (ieee80211_vif_is_mld(vif))
- mt7925_mcu_add_bss_info(&dev->phy, mconf->mt76.ctx,
- link_conf, link_sta, link_sta != mlink->pri_link);
- else
- mt7925_mcu_add_bss_info(&dev->phy, mconf->mt76.ctx,
- link_conf, link_sta, false);
+ struct mt792x_link_sta *mlink_bc;
+
+ mlink_bc = mt792x_sta_to_link(&mvif->sta, mconf->link_id);
+
+ if (ieee80211_vif_is_mld(vif)) {
+ mt7925_mcu_add_bss_info_sta(&dev->phy, mconf->mt76.ctx,
+ link_conf, link_sta,
+ mlink_bc->wcid.idx, mlink->wcid.idx,
+ link_sta != mlink->pri_link);
+ } else {
+ mt7925_mcu_add_bss_info_sta(&dev->phy, mconf->mt76.ctx,
+ link_conf, link_sta,
+ mlink_bc->wcid.idx, mlink->wcid.idx,
+ false);
+ }
}
if (ieee80211_vif_is_mld(vif) &&
mlink->wcid.def_wcid = &msta->deflink.wcid;
link_sta = mt792x_sta_to_link_sta(vif, sta, link_id);
- mt7925_mac_link_sta_add(&dev->mt76, vif, link_sta);
+ mt7925_mac_link_sta_add(&dev->mt76, vif, link_sta, mlink);
}
return err;
err = mt7925_mac_sta_add_links(dev, vif, sta, sta->valid_links);
} else {
- err = mt7925_mac_link_sta_add(mdev, vif, &sta->deflink);
+ err = mt7925_mac_link_sta_add(mdev, vif, &sta->deflink,
+ &msta->deflink);
}
return err;
struct ieee80211_bss_conf *link_conf,
struct ieee80211_link_sta *link_sta,
struct ieee80211_chanctx_conf *ctx,
- struct mt76_phy *phy, u16 wlan_idx,
+ struct mt76_phy *phy,
+ u16 bmc_tx_wlan_idx,
+ u16 sta_wlan_idx,
bool enable)
{
struct ieee80211_vif *vif = link_conf->vif;
&link_conf->chanreq.oper;
enum nl80211_band band = chandef->chan->band;
struct mt76_connac_bss_basic_tlv *basic_req;
- struct mt792x_link_sta *mlink;
struct tlv *tlv;
int conn_type;
u8 idx;
basic_req->phymode = mt76_connac_get_phy_mode(phy, vif, band, link_sta);
basic_req->bcn_interval = cpu_to_le16(link_conf->beacon_int);
basic_req->dtim_period = link_conf->dtim_period;
- basic_req->bmc_tx_wlan_idx = cpu_to_le16(wlan_idx);
+ basic_req->bmc_tx_wlan_idx = cpu_to_le16(bmc_tx_wlan_idx);
basic_req->link_idx = mconf->mt76.idx;
-
- if (link_sta) {
- struct mt792x_sta *msta;
-
- msta = (struct mt792x_sta *)link_sta->sta->drv_priv;
- mlink = mt792x_sta_to_link(msta, link_sta->link_id);
-
- } else {
- mlink = &mconf->vif->sta.deflink;
- }
-
- basic_req->sta_idx = cpu_to_le16(mlink->wcid.idx);
+ basic_req->sta_idx = cpu_to_le16(sta_wlan_idx);
basic_req->omac_idx = mconf->mt76.omac_idx;
basic_req->band_idx = mconf->mt76.band_idx;
basic_req->wmm_idx = mconf->mt76.wmm_idx;
&dev_req, sizeof(dev_req), true);
}
-int mt7925_mcu_add_bss_info(struct mt792x_phy *phy,
- struct ieee80211_chanctx_conf *ctx,
- struct ieee80211_bss_conf *link_conf,
- struct ieee80211_link_sta *link_sta,
- int enable)
+int mt7925_mcu_add_bss_info_sta(struct mt792x_phy *phy,
+ struct ieee80211_chanctx_conf *ctx,
+ struct ieee80211_bss_conf *link_conf,
+ struct ieee80211_link_sta *link_sta,
+ u16 bmc_tx_wlan_idx,
+ u16 sta_wlan_idx,
+ int enable)
{
- struct mt792x_vif *mvif = (struct mt792x_vif *)link_conf->vif->drv_priv;
struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf);
struct mt792x_dev *dev = phy->dev;
- struct mt792x_link_sta *mlink_bc;
struct sk_buff *skb;
skb = __mt7925_mcu_alloc_bss_req(&dev->mt76, &mconf->mt76,
if (IS_ERR(skb))
return PTR_ERR(skb);
- mlink_bc = mt792x_sta_to_link(&mvif->sta, mconf->link_id);
-
/* bss_basic must be first */
mt7925_mcu_bss_basic_tlv(skb, link_conf, link_sta, ctx, phy->mt76,
- mlink_bc->wcid.idx, enable);
+ bmc_tx_wlan_idx, sta_wlan_idx, enable);
mt7925_mcu_bss_sec_tlv(skb, link_conf);
mt7925_mcu_bss_bmc_tlv(skb, phy, ctx, link_conf);
mt7925_mcu_bss_qos_tlv(skb, link_conf);
MCU_UNI_CMD(BSS_INFO_UPDATE), true);
}
+int mt7925_mcu_add_bss_info(struct mt792x_phy *phy,
+ struct ieee80211_chanctx_conf *ctx,
+ struct ieee80211_bss_conf *link_conf,
+ struct ieee80211_link_sta *link_sta,
+ int enable)
+{
+ struct mt792x_vif *mvif = (struct mt792x_vif *)link_conf->vif->drv_priv;
+ struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf);
+ struct mt792x_link_sta *mlink_bc;
+ struct mt792x_link_sta *mlink;
+
+ mlink_bc = mt792x_sta_to_link(&mvif->sta, mconf->link_id);
+
+ if (link_sta) {
+ struct mt792x_sta *msta = (void *)link_sta->sta->drv_priv;
+
+ mlink = mt792x_sta_to_link(msta, link_sta->link_id);
+ if (WARN_ON(!mlink))
+ return -EINVAL;
+ } else {
+ mlink = &mconf->vif->sta.deflink;
+ }
+
+ return mt7925_mcu_add_bss_info_sta(phy, ctx, link_conf, link_sta,
+ mlink_bc->wcid.idx, mlink->wcid.idx, enable);
+}
+
int mt7925_mcu_set_dbdc(struct mt76_phy *phy, bool enable)
{
struct mt76_dev *mdev = phy->dev;