Commit 6e226666 authored by Sean Wang's avatar Sean Wang Committed by Felix Fietkau

wifi: mt76: mt762x: extend mt76_connac_mcu_sta_basic_tlv for per-link STA

Extend mt76_connac_mcu_sta_basic_tlv with the per-link STA configuration.

The patch we created is a prerequisite to enable the MLO function in the
driver. It is purely a refactoring patch so the functionality should
remain unchanged.
Co-developed-by: default avatarMing Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: default avatarMing Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: default avatarDeren Wu <deren.wu@mediatek.com>
Signed-off-by: default avatarDeren Wu <deren.wu@mediatek.com>
Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20240613030241.5771-38-sean.wang@kernel.orgSigned-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 45020d10
...@@ -842,6 +842,7 @@ mt7615_mcu_wtbl_sta_add(struct mt7615_phy *phy, struct ieee80211_vif *vif, ...@@ -842,6 +842,7 @@ mt7615_mcu_wtbl_sta_add(struct mt7615_phy *phy, struct ieee80211_vif *vif,
{ {
struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv; struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;
struct sk_buff *skb, *sskb, *wskb = NULL; struct sk_buff *skb, *sskb, *wskb = NULL;
struct ieee80211_link_sta *link_sta;
struct mt7615_dev *dev = phy->dev; struct mt7615_dev *dev = phy->dev;
struct wtbl_req_hdr *wtbl_hdr; struct wtbl_req_hdr *wtbl_hdr;
struct mt7615_sta *msta; struct mt7615_sta *msta;
...@@ -849,6 +850,7 @@ mt7615_mcu_wtbl_sta_add(struct mt7615_phy *phy, struct ieee80211_vif *vif, ...@@ -849,6 +850,7 @@ mt7615_mcu_wtbl_sta_add(struct mt7615_phy *phy, struct ieee80211_vif *vif,
int cmd, err; int cmd, err;
msta = sta ? (struct mt7615_sta *)sta->drv_priv : &mvif->sta; msta = sta ? (struct mt7615_sta *)sta->drv_priv : &mvif->sta;
link_sta = sta ? &sta->deflink : NULL;
sskb = mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76, sskb = mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76,
&msta->wcid); &msta->wcid);
...@@ -861,8 +863,8 @@ mt7615_mcu_wtbl_sta_add(struct mt7615_phy *phy, struct ieee80211_vif *vif, ...@@ -861,8 +863,8 @@ mt7615_mcu_wtbl_sta_add(struct mt7615_phy *phy, struct ieee80211_vif *vif,
else else
mvif->sta_added = true; mvif->sta_added = true;
} }
mt76_connac_mcu_sta_basic_tlv(&dev->mt76, sskb, vif, sta, enable, mt76_connac_mcu_sta_basic_tlv(&dev->mt76, sskb, vif, link_sta,
new_entry); enable, new_entry);
if (enable && sta) if (enable && sta)
mt76_connac_mcu_sta_tlv(phy->mt76, sskb, sta, vif, 0, mt76_connac_mcu_sta_tlv(phy->mt76, sskb, sta, vif, 0,
MT76_STA_INFO_STATE_ASSOC); MT76_STA_INFO_STATE_ASSOC);
......
...@@ -370,7 +370,7 @@ EXPORT_SYMBOL_GPL(mt76_connac_mcu_bss_omac_tlv); ...@@ -370,7 +370,7 @@ EXPORT_SYMBOL_GPL(mt76_connac_mcu_bss_omac_tlv);
void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb, void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
struct ieee80211_vif *vif, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, struct ieee80211_link_sta *link_sta,
bool enable, bool newly) bool enable, bool newly)
{ {
struct sta_rec_basic *basic; struct sta_rec_basic *basic;
...@@ -390,7 +390,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb, ...@@ -390,7 +390,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
basic->conn_state = CONN_STATE_DISCONNECT; basic->conn_state = CONN_STATE_DISCONNECT;
} }
if (!sta) { if (!link_sta) {
basic->conn_type = cpu_to_le32(CONNECTION_INFRA_BC); basic->conn_type = cpu_to_le32(CONNECTION_INFRA_BC);
if (vif->type == NL80211_IFTYPE_STATION && if (vif->type == NL80211_IFTYPE_STATION &&
...@@ -411,7 +411,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb, ...@@ -411,7 +411,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
else else
conn_type = CONNECTION_INFRA_STA; conn_type = CONNECTION_INFRA_STA;
basic->conn_type = cpu_to_le32(conn_type); basic->conn_type = cpu_to_le32(conn_type);
basic->aid = cpu_to_le16(sta->aid); basic->aid = cpu_to_le16(link_sta->sta->aid);
break; break;
case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_STATION:
if (vif->p2p && !is_mt7921(dev)) if (vif->p2p && !is_mt7921(dev))
...@@ -423,15 +423,15 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb, ...@@ -423,15 +423,15 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
break; break;
case NL80211_IFTYPE_ADHOC: case NL80211_IFTYPE_ADHOC:
basic->conn_type = cpu_to_le32(CONNECTION_IBSS_ADHOC); basic->conn_type = cpu_to_le32(CONNECTION_IBSS_ADHOC);
basic->aid = cpu_to_le16(sta->aid); basic->aid = cpu_to_le16(link_sta->sta->aid);
break; break;
default: default:
WARN_ON(1); WARN_ON(1);
break; break;
} }
memcpy(basic->peer_addr, sta->addr, ETH_ALEN); memcpy(basic->peer_addr, link_sta->addr, ETH_ALEN);
basic->qos = sta->wme; basic->qos = link_sta->sta->wme;
} }
EXPORT_SYMBOL_GPL(mt76_connac_mcu_sta_basic_tlv); EXPORT_SYMBOL_GPL(mt76_connac_mcu_sta_basic_tlv);
...@@ -1046,6 +1046,7 @@ int mt76_connac_mcu_sta_cmd(struct mt76_phy *phy, ...@@ -1046,6 +1046,7 @@ int mt76_connac_mcu_sta_cmd(struct mt76_phy *phy,
struct mt76_sta_cmd_info *info) struct mt76_sta_cmd_info *info)
{ {
struct mt76_vif *mvif = (struct mt76_vif *)info->vif->drv_priv; struct mt76_vif *mvif = (struct mt76_vif *)info->vif->drv_priv;
struct ieee80211_link_sta *link_sta;
struct mt76_dev *dev = phy->dev; struct mt76_dev *dev = phy->dev;
struct wtbl_req_hdr *wtbl_hdr; struct wtbl_req_hdr *wtbl_hdr;
struct tlv *sta_wtbl; struct tlv *sta_wtbl;
...@@ -1055,9 +1056,11 @@ int mt76_connac_mcu_sta_cmd(struct mt76_phy *phy, ...@@ -1055,9 +1056,11 @@ int mt76_connac_mcu_sta_cmd(struct mt76_phy *phy,
if (IS_ERR(skb)) if (IS_ERR(skb))
return PTR_ERR(skb); return PTR_ERR(skb);
link_sta = info->sta ? &info->sta->deflink : NULL;
if (info->sta || !info->offload_fw) if (info->sta || !info->offload_fw)
mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif, info->sta, mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif,
info->enable, info->newly); link_sta, info->enable,
info->newly);
if (info->sta && info->enable) if (info->sta && info->enable)
mt76_connac_mcu_sta_tlv(phy, skb, info->sta, mt76_connac_mcu_sta_tlv(phy, skb, info->sta,
info->vif, info->rcpi, info->vif, info->rcpi,
......
...@@ -1886,8 +1886,8 @@ int mt76_connac_mcu_set_channel_domain(struct mt76_phy *phy); ...@@ -1886,8 +1886,8 @@ int mt76_connac_mcu_set_channel_domain(struct mt76_phy *phy);
int mt76_connac_mcu_set_vif_ps(struct mt76_dev *dev, struct ieee80211_vif *vif); int mt76_connac_mcu_set_vif_ps(struct mt76_dev *dev, struct ieee80211_vif *vif);
void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb, void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
struct ieee80211_vif *vif, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, bool enable, struct ieee80211_link_sta *link_sta,
bool newly); bool enable, bool newly);
void mt76_connac_mcu_wtbl_generic_tlv(struct mt76_dev *dev, struct sk_buff *skb, void mt76_connac_mcu_wtbl_generic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
struct ieee80211_vif *vif, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, void *sta_wtbl, struct ieee80211_sta *sta, void *sta_wtbl,
......
...@@ -1656,11 +1656,13 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif, ...@@ -1656,11 +1656,13 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, bool enable) struct ieee80211_sta *sta, bool enable)
{ {
struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
struct ieee80211_link_sta *link_sta;
struct mt7915_sta *msta; struct mt7915_sta *msta;
struct sk_buff *skb; struct sk_buff *skb;
int ret; int ret;
msta = sta ? (struct mt7915_sta *)sta->drv_priv : &mvif->sta; msta = sta ? (struct mt7915_sta *)sta->drv_priv : &mvif->sta;
link_sta = sta ? &sta->deflink : NULL;
skb = mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76, skb = mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76,
&msta->wcid); &msta->wcid);
...@@ -1668,7 +1670,7 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif, ...@@ -1668,7 +1670,7 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif,
return PTR_ERR(skb); return PTR_ERR(skb);
/* starec basic */ /* starec basic */
mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, vif, sta, enable, mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, vif, link_sta, enable,
!rcu_access_pointer(dev->mt76.wcid[msta->wcid.idx])); !rcu_access_pointer(dev->mt76.wcid[msta->wcid.idx]));
if (!enable) if (!enable)
goto out; goto out;
......
...@@ -1645,7 +1645,7 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy, ...@@ -1645,7 +1645,7 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy,
if (info->link_sta || !info->offload_fw) if (info->link_sta || !info->offload_fw)
mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif, mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif,
info->link_sta->sta, info->link_sta,
info->enable, info->newly); info->enable, info->newly);
if (info->link_sta && info->enable) { if (info->link_sta && info->enable) {
mt7925_mcu_sta_phy_tlv(skb, info->vif, info->link_sta); mt7925_mcu_sta_phy_tlv(skb, info->vif, info->link_sta);
......
...@@ -2157,11 +2157,13 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif, ...@@ -2157,11 +2157,13 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, bool enable, bool newly) struct ieee80211_sta *sta, bool enable, bool newly)
{ {
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct ieee80211_link_sta *link_sta;
struct mt7996_sta *msta; struct mt7996_sta *msta;
struct sk_buff *skb; struct sk_buff *skb;
int ret; int ret;
msta = sta ? (struct mt7996_sta *)sta->drv_priv : &mvif->sta; msta = sta ? (struct mt7996_sta *)sta->drv_priv : &mvif->sta;
link_sta = sta ? &sta->deflink : NULL;
skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76, skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76,
&msta->wcid, &msta->wcid,
...@@ -2170,7 +2172,8 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif, ...@@ -2170,7 +2172,8 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
return PTR_ERR(skb); return PTR_ERR(skb);
/* starec basic */ /* starec basic */
mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, vif, sta, enable, newly); mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, vif, link_sta,
enable, newly);
if (!enable) if (!enable)
goto out; goto out;
......
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