@@ -766,6 +766,15 @@ struct mt76_vif_link {
766
766
u8 beacon_rates_idx ;
767
767
struct ieee80211_chanctx_conf * ctx ;
768
768
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 ;
769
778
};
770
779
771
780
struct mt76_phy {
@@ -1168,6 +1177,10 @@ static inline int mt76_wed_dma_setup(struct mt76_dev *dev, struct mt76_queue *q,
1168
1177
for (i = 0; i < ARRAY_SIZE((dev)->q_rx); i++) \
1169
1178
if ((dev)->q_rx[i].ndesc)
1170
1179
1180
+
1181
+ #define mt76_dereference (p , dev ) \
1182
+ rcu_dereference_protected(p, lockdep_is_held(&(dev)->mutex))
1183
+
1171
1184
struct mt76_dev * mt76_alloc_device (struct device * pdev , unsigned int size ,
1172
1185
const struct ieee80211_ops * ops ,
1173
1186
const struct mt76_driver_ops * drv_ops );
@@ -1755,4 +1768,44 @@ void mt76_wcid_init(struct mt76_wcid *wcid);
1755
1768
void mt76_wcid_cleanup (struct mt76_dev * dev , struct mt76_wcid * wcid );
1756
1769
void mt76_wcid_add_poll (struct mt76_dev * dev , struct mt76_wcid * wcid );
1757
1770
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
+
1758
1811
#endif
0 commit comments