diff options
author | Felix Fietkau <nbd@nbd.name> | 2025-01-02 17:34:48 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2025-01-14 13:34:37 +0100 |
commit | e24646ef7eded74c68cdef20e3f0d48d14522a0b (patch) | |
tree | bfd46d19f07577fb64931ef60b753e5edc8e3bd1 /drivers/net/wireless/mediatek | |
parent | bf18f7172aa429ec6a68852984a2e9468560c066 (diff) |
wifi: mt76: add vif link specific data structure
Preparation for splitting link data from vif data for MLO support.
Link: https://patch.msgid.link/20250102163508.52945-4-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt76.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index 1782ebc7085e..669cbd63f403 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -766,6 +766,15 @@ struct mt76_vif_link { u8 beacon_rates_idx; struct ieee80211_chanctx_conf *ctx; struct mt76_wcid *wcid; + struct mt76_vif_data *mvif; + struct rcu_head rcu_head; +}; + +struct mt76_vif_data { + struct mt76_vif_link __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS]; + + u16 valid_links; + u8 deflink_id; }; struct mt76_phy { @@ -1168,6 +1177,10 @@ static inline int mt76_wed_dma_setup(struct mt76_dev *dev, struct mt76_queue *q, for (i = 0; i < ARRAY_SIZE((dev)->q_rx); i++) \ if ((dev)->q_rx[i].ndesc) + +#define mt76_dereference(p, dev) \ + rcu_dereference_protected(p, lockdep_is_held(&(dev)->mutex)) + struct mt76_dev *mt76_alloc_device(struct device *pdev, unsigned int size, const struct ieee80211_ops *ops, const struct mt76_driver_ops *drv_ops); @@ -1755,4 +1768,44 @@ void mt76_wcid_init(struct mt76_wcid *wcid); void mt76_wcid_cleanup(struct mt76_dev *dev, struct mt76_wcid *wcid); void mt76_wcid_add_poll(struct mt76_dev *dev, struct mt76_wcid *wcid); +static inline void +mt76_vif_init(struct ieee80211_vif *vif, struct mt76_vif_data *mvif) +{ + struct mt76_vif_link *mlink = (struct mt76_vif_link *)vif->drv_priv; + + mlink->mvif = mvif; + rcu_assign_pointer(mvif->link[0], mlink); +} + +static inline void +mt76_vif_cleanup(struct mt76_dev *dev, struct ieee80211_vif *vif) +{ + struct mt76_vif_link *mlink = (struct mt76_vif_link *)vif->drv_priv; + struct mt76_vif_data *mvif = mlink->mvif; + + rcu_assign_pointer(mvif->link[0], NULL); +} + +static inline struct mt76_vif_link * +mt76_vif_link(struct mt76_dev *dev, struct ieee80211_vif *vif, int link_id) +{ + struct mt76_vif_link *mlink = (struct mt76_vif_link *)vif->drv_priv; + struct mt76_vif_data *mvif = mlink->mvif; + + return mt76_dereference(mvif->link[link_id], dev); +} + +static inline struct mt76_vif_link * +mt76_vif_conf_link(struct mt76_dev *dev, struct ieee80211_vif *vif, + struct ieee80211_bss_conf *link_conf) +{ + struct mt76_vif_link *mlink = (struct mt76_vif_link *)vif->drv_priv; + struct mt76_vif_data *mvif = mlink->mvif; + + if (link_conf == &vif->bss_conf) + return mlink; + + return mt76_dereference(mvif->link[link_conf->link_id], dev); +} + #endif |