mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
wifi: mt76: add vif link specific data structure
Preparation for splitting link data from vif data for MLO support. Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
@@ -771,6 +771,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 {
|
||||
@@ -1173,6 +1182,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);
|
||||
@@ -1760,4 +1773,44 @@ mt76_token_put(struct mt76_dev *dev, int token)
|
||||
void mt76_wcid_init(struct mt76_wcid *wcid);
|
||||
void mt76_wcid_cleanup(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
|
||||
|
||||
Reference in New Issue
Block a user