| From 700547976605b447defd5492837cc123c97aba50 Mon Sep 17 00:00:00 2001 |
| From: Shayne Chen <shayne.chen@mediatek.com> |
| Date: Wed, 29 Nov 2023 11:04:50 +0800 |
| Subject: [PATCH 088/116] wifi: mt76: extend wcid and sta flow for MLO support |
| |
| Add link related info to wcid, and split sta connection flow of common |
| parts for MLO supported chipsets. |
| This is a preliminary patch to add MLO support for mt7996 chipsets. |
| |
| Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com> |
| Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com> |
| Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> |
| --- |
| mac80211.c | 12 +++++++++++- |
| mt76.h | 7 ++++++- |
| 2 files changed, 17 insertions(+), 2 deletions(-) |
| |
| diff --git a/mac80211.c b/mac80211.c |
| index 4fad03dd9..96fab2320 100644 |
| --- a/mac80211.c |
| +++ b/mac80211.c |
| @@ -1066,6 +1066,10 @@ mt76_rx_convert(struct mt76_dev *dev, struct sk_buff *skb, |
| sizeof(mstat.chain_signal)); |
| memcpy(status->chain_signal, mstat.chain_signal, |
| sizeof(mstat.chain_signal)); |
| + if (mstat.wcid) { |
| + status->link_valid = mstat.wcid->link_valid; |
| + status->link_id = mstat.wcid->link_id; |
| + } |
| |
| *sta = wcid_to_sta(mstat.wcid); |
| *hw = mt76_phy_hw(dev, mstat.phy_idx); |
| @@ -1374,6 +1378,9 @@ mt76_sta_add(struct mt76_phy *phy, struct ieee80211_vif *vif, |
| if (ret) |
| goto out; |
| |
| + if (phy->hw->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO) |
| + goto out; |
| + |
| for (i = 0; i < ARRAY_SIZE(sta->txq); i++) { |
| struct mt76_txq *mtxq; |
| |
| @@ -1403,12 +1410,15 @@ void __mt76_sta_remove(struct mt76_dev *dev, struct ieee80211_vif *vif, |
| struct mt76_wcid *wcid = (struct mt76_wcid *)sta->drv_priv; |
| int i, idx = wcid->idx; |
| |
| - for (i = 0; i < ARRAY_SIZE(wcid->aggr); i++) |
| + for (i = 0; !sta->valid_links && i < ARRAY_SIZE(wcid->aggr); i++) |
| mt76_rx_aggr_stop(dev, wcid, i); |
| |
| if (dev->drv->sta_remove) |
| dev->drv->sta_remove(dev, vif, sta); |
| |
| + if (sta->valid_links) |
| + return; |
| + |
| mt76_wcid_cleanup(dev, wcid); |
| |
| mt76_wcid_mask_clear(dev->wcid_mask, idx); |
| diff --git a/mt76.h b/mt76.h |
| index 0abb8ebf5..b60b5161b 100644 |
| --- a/mt76.h |
| +++ b/mt76.h |
| @@ -381,6 +381,9 @@ struct mt76_wcid { |
| u8 sta:1; |
| u8 amsdu:1; |
| u8 phy_idx:2; |
| + u8 link_id:4; |
| + bool link_valid; |
| + struct mt76_wcid *def_wcid; |
| |
| u8 rx_check_pn; |
| u8 rx_key_pn[IEEE80211_NUM_TIDS + 1][6]; |
| @@ -1366,11 +1369,13 @@ mtxq_to_txq(struct mt76_txq *mtxq) |
| static inline struct ieee80211_sta * |
| wcid_to_sta(struct mt76_wcid *wcid) |
| { |
| - void *ptr = wcid; |
| + void *ptr; |
| |
| if (!wcid || !wcid->sta) |
| return NULL; |
| |
| + ptr = wcid->def_wcid ?: wcid; |
| + |
| return container_of(ptr, struct ieee80211_sta, drv_priv); |
| } |
| |
| -- |
| 2.39.2 |
| |