Skip to content

Commit e24646e

Browse files
committed
wifi: mt76: add vif link specific data structure
Preparation for splitting link data from vif data for MLO support. Link: https://patch.msgid.link/[email protected] Signed-off-by: Felix Fietkau <[email protected]>
1 parent bf18f71 commit e24646e

File tree

1 file changed

+53
-0
lines changed
  • drivers/net/wireless/mediatek/mt76

1 file changed

+53
-0
lines changed

drivers/net/wireless/mediatek/mt76/mt76.h

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,15 @@ struct mt76_vif_link {
766766
u8 beacon_rates_idx;
767767
struct ieee80211_chanctx_conf *ctx;
768768
struct mt76_wcid *wcid;
769+
struct mt76_vif_data *mvif;
770+
struct rcu_head rcu_head;
771+
};
772+
773+
struct mt76_vif_data {
774+
struct mt76_vif_link __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
775+
776+
u16 valid_links;
777+
u8 deflink_id;
769778
};
770779

771780
struct mt76_phy {
@@ -1168,6 +1177,10 @@ static inline int mt76_wed_dma_setup(struct mt76_dev *dev, struct mt76_queue *q,
11681177
for (i = 0; i < ARRAY_SIZE((dev)->q_rx); i++) \
11691178
if ((dev)->q_rx[i].ndesc)
11701179

1180+
1181+
#define mt76_dereference(p, dev) \
1182+
rcu_dereference_protected(p, lockdep_is_held(&(dev)->mutex))
1183+
11711184
struct mt76_dev *mt76_alloc_device(struct device *pdev, unsigned int size,
11721185
const struct ieee80211_ops *ops,
11731186
const struct mt76_driver_ops *drv_ops);
@@ -1755,4 +1768,44 @@ void mt76_wcid_init(struct mt76_wcid *wcid);
17551768
void mt76_wcid_cleanup(struct mt76_dev *dev, struct mt76_wcid *wcid);
17561769
void mt76_wcid_add_poll(struct mt76_dev *dev, struct mt76_wcid *wcid);
17571770

1771+
static inline void
1772+
mt76_vif_init(struct ieee80211_vif *vif, struct mt76_vif_data *mvif)
1773+
{
1774+
struct mt76_vif_link *mlink = (struct mt76_vif_link *)vif->drv_priv;
1775+
1776+
mlink->mvif = mvif;
1777+
rcu_assign_pointer(mvif->link[0], mlink);
1778+
}
1779+
1780+
static inline void
1781+
mt76_vif_cleanup(struct mt76_dev *dev, struct ieee80211_vif *vif)
1782+
{
1783+
struct mt76_vif_link *mlink = (struct mt76_vif_link *)vif->drv_priv;
1784+
struct mt76_vif_data *mvif = mlink->mvif;
1785+
1786+
rcu_assign_pointer(mvif->link[0], NULL);
1787+
}
1788+
1789+
static inline struct mt76_vif_link *
1790+
mt76_vif_link(struct mt76_dev *dev, struct ieee80211_vif *vif, int link_id)
1791+
{
1792+
struct mt76_vif_link *mlink = (struct mt76_vif_link *)vif->drv_priv;
1793+
struct mt76_vif_data *mvif = mlink->mvif;
1794+
1795+
return mt76_dereference(mvif->link[link_id], dev);
1796+
}
1797+
1798+
static inline struct mt76_vif_link *
1799+
mt76_vif_conf_link(struct mt76_dev *dev, struct ieee80211_vif *vif,
1800+
struct ieee80211_bss_conf *link_conf)
1801+
{
1802+
struct mt76_vif_link *mlink = (struct mt76_vif_link *)vif->drv_priv;
1803+
struct mt76_vif_data *mvif = mlink->mvif;
1804+
1805+
if (link_conf == &vif->bss_conf)
1806+
return mlink;
1807+
1808+
return mt76_dereference(mvif->link[link_conf->link_id], dev);
1809+
}
1810+
17581811
#endif

0 commit comments

Comments
 (0)