Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+53
+53
drivers/net/wireless/mediatek/mt76/mt76.h
··· 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 { ··· 1176 1167 #define mt76_for_each_q_rx(dev, i) \ 1177 1168 for (i = 0; i < ARRAY_SIZE((dev)->q_rx); i++) \ 1178 1169 if ((dev)->q_rx[i].ndesc) 1170 + 1171 + 1172 + #define mt76_dereference(p, dev) \ 1173 + rcu_dereference_protected(p, lockdep_is_held(&(dev)->mutex)) 1179 1174 1180 1175 struct mt76_dev *mt76_alloc_device(struct device *pdev, unsigned int size, 1181 1176 const struct ieee80211_ops *ops, ··· 1767 1754 void mt76_wcid_init(struct mt76_wcid *wcid); 1768 1755 void mt76_wcid_cleanup(struct mt76_dev *dev, struct mt76_wcid *wcid); 1769 1756 void mt76_wcid_add_poll(struct mt76_dev *dev, struct mt76_wcid *wcid); 1757 + 1758 + static inline void 1759 + mt76_vif_init(struct ieee80211_vif *vif, struct mt76_vif_data *mvif) 1760 + { 1761 + struct mt76_vif_link *mlink = (struct mt76_vif_link *)vif->drv_priv; 1762 + 1763 + mlink->mvif = mvif; 1764 + rcu_assign_pointer(mvif->link[0], mlink); 1765 + } 1766 + 1767 + static inline void 1768 + mt76_vif_cleanup(struct mt76_dev *dev, struct ieee80211_vif *vif) 1769 + { 1770 + struct mt76_vif_link *mlink = (struct mt76_vif_link *)vif->drv_priv; 1771 + struct mt76_vif_data *mvif = mlink->mvif; 1772 + 1773 + rcu_assign_pointer(mvif->link[0], NULL); 1774 + } 1775 + 1776 + static inline struct mt76_vif_link * 1777 + mt76_vif_link(struct mt76_dev *dev, struct ieee80211_vif *vif, int link_id) 1778 + { 1779 + struct mt76_vif_link *mlink = (struct mt76_vif_link *)vif->drv_priv; 1780 + struct mt76_vif_data *mvif = mlink->mvif; 1781 + 1782 + return mt76_dereference(mvif->link[link_id], dev); 1783 + } 1784 + 1785 + static inline struct mt76_vif_link * 1786 + mt76_vif_conf_link(struct mt76_dev *dev, struct ieee80211_vif *vif, 1787 + struct ieee80211_bss_conf *link_conf) 1788 + { 1789 + struct mt76_vif_link *mlink = (struct mt76_vif_link *)vif->drv_priv; 1790 + struct mt76_vif_data *mvif = mlink->mvif; 1791 + 1792 + if (link_conf == &vif->bss_conf) 1793 + return mlink; 1794 + 1795 + return mt76_dereference(mvif->link[link_conf->link_id], dev); 1796 + } 1770 1797 1771 1798 #endif