Message ID | 20240613030241.5771-38-sean.wang@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Prerequisite Refactoring for Enabling MLO on MT7925 | expand |
On 13.06.24 05:02, sean.wang@kernel.org wrote: > From: Sean Wang <sean.wang@mediatek.com> > > 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: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> > Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> > Co-developed-by: Deren Wu <deren.wu@mediatek.com> > Signed-off-by: Deren Wu <deren.wu@mediatek.com> > Signed-off-by: Sean Wang <sean.wang@mediatek.com> This patch is broken on non-mt762x drivers, because the functions that call mt76_connac_mcu_sta_basic_tlv may be called with sta == NULL. I've seen it crash on mt7996 because of that, but mt7915 and mt7615 are likely equally affected. - Felix
On 24.06.24 19:44, Felix Fietkau wrote: > On 13.06.24 05:02, sean.wang@kernel.org wrote: >> From: Sean Wang <sean.wang@mediatek.com> >> >> 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: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> >> Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> >> Co-developed-by: Deren Wu <deren.wu@mediatek.com> >> Signed-off-by: Deren Wu <deren.wu@mediatek.com> >> Signed-off-by: Sean Wang <sean.wang@mediatek.com> > > This patch is broken on non-mt762x drivers, because the functions that > call mt76_connac_mcu_sta_basic_tlv may be called with sta == NULL. > > I've seen it crash on mt7996 because of that, but mt7915 and mt7615 are > likely equally affected. I've pushed a fixed version to my tree. Please check if it looks correct to you. Thanks, - Felix
Hi Felix, Thank you for making the changes. They look correct to me. I appreciate your help with this! Sean On Mon, Jun 24, 2024 at 12:03 PM Felix Fietkau <nbd@nbd.name> wrote: > > On 24.06.24 19:44, Felix Fietkau wrote: > > On 13.06.24 05:02, sean.wang@kernel.org wrote: > >> From: Sean Wang <sean.wang@mediatek.com> > >> > >> 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: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> > >> Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> > >> Co-developed-by: Deren Wu <deren.wu@mediatek.com> > >> Signed-off-by: Deren Wu <deren.wu@mediatek.com> > >> Signed-off-by: Sean Wang <sean.wang@mediatek.com> > > > > This patch is broken on non-mt762x drivers, because the functions that > > call mt76_connac_mcu_sta_basic_tlv may be called with sta == NULL. > > > > I've seen it crash on mt7996 because of that, but mt7915 and mt7615 are > > likely equally affected. > > I've pushed a fixed version to my tree. Please check if it looks correct > to you. > > Thanks, > > - Felix >
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c index 792ae41f7c69..25670eeaecb4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -861,8 +861,8 @@ mt7615_mcu_wtbl_sta_add(struct mt7615_phy *phy, struct ieee80211_vif *vif, else mvif->sta_added = true; } - mt76_connac_mcu_sta_basic_tlv(&dev->mt76, sskb, vif, sta, enable, - new_entry); + mt76_connac_mcu_sta_basic_tlv(&dev->mt76, sskb, vif, &sta->deflink, + enable, new_entry); if (enable && sta) mt76_connac_mcu_sta_tlv(phy->mt76, sskb, sta, vif, 0, MT76_STA_INFO_STATE_ASSOC); diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index 294f79ab7ca6..b8ad080ad2c3 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -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, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, + struct ieee80211_link_sta *link_sta, bool enable, bool newly) { struct sta_rec_basic *basic; @@ -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; } - if (!sta) { + if (!link_sta) { basic->conn_type = cpu_to_le32(CONNECTION_INFRA_BC); eth_broadcast_addr(basic->peer_addr); return; @@ -404,7 +404,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb, else conn_type = CONNECTION_INFRA_STA; 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; case NL80211_IFTYPE_STATION: if (vif->p2p && !is_mt7921(dev)) @@ -416,15 +416,15 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb, break; case NL80211_IFTYPE_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; default: WARN_ON(1); break; } - memcpy(basic->peer_addr, sta->addr, ETH_ALEN); - basic->qos = sta->wme; + memcpy(basic->peer_addr, link_sta->addr, ETH_ALEN); + basic->qos = link_sta->sta->wme; } EXPORT_SYMBOL_GPL(mt76_connac_mcu_sta_basic_tlv); @@ -1049,8 +1049,9 @@ int mt76_connac_mcu_sta_cmd(struct mt76_phy *phy, return PTR_ERR(skb); if (info->sta || !info->offload_fw) - mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif, info->sta, - info->enable, info->newly); + mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif, + &info->sta->deflink, info->enable, + info->newly); if (info->sta && info->enable) mt76_connac_mcu_sta_tlv(phy, skb, info->sta, info->vif, info->rcpi, diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h index 2c939468d141..4857c31cfb23 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -1879,8 +1879,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); void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, bool enable, - bool newly); + struct ieee80211_link_sta *link_sta, + bool enable, bool newly); void mt76_connac_mcu_wtbl_generic_tlv(struct mt76_dev *dev, struct sk_buff *skb, struct ieee80211_vif *vif, struct ieee80211_sta *sta, void *sta_wtbl, diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c index 0f50c6659802..7204866437ce 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -1668,7 +1668,7 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif, return PTR_ERR(skb); /* starec basic */ - mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, vif, sta, enable, + mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, vif, &sta->deflink, enable, !rcu_access_pointer(dev->mt76.wcid[msta->wcid.idx])); if (!enable) goto out; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 321a164a6e14..5a40979c0bba 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1645,7 +1645,7 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy, if (info->link_sta || !info->offload_fw) mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif, - info->link_sta->sta, + info->link_sta, info->enable, info->newly); if (info->link_sta && info->enable) { mt7925_mcu_sta_phy_tlv(skb, info->vif, info->link_sta); diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c index f4c59eafb537..038c4a140ec8 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c @@ -2152,7 +2152,7 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif, return PTR_ERR(skb); /* starec basic */ - mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, vif, sta, enable, + mt76_connac_mcu_sta_basic_tlv(&dev->mt76, skb, vif, &sta->deflink, enable, !rcu_access_pointer(dev->mt76.wcid[msta->wcid.idx])); if (!enable) goto out;