wifi: mac80211: add pointer from link STA to STA
authorBenjamin Berg <benjamin.berg@intel.com>
Tue, 6 Sep 2022 17:02:04 +0000 (19:02 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 7 Oct 2022 13:23:38 +0000 (15:23 +0200)
While often not needed, this considerably simplifies going from a link
to the STA. This helps in cases such as debugfs where a single pointer
should allow accessing a specific link and the STA.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/mac80211.h
net/mac80211/sta_info.c

index ac2bad57933f866dfad6c6cace1e5d1d3f08a93f..7778a92d958214fe3651866e09c7c04a5ca986e4 100644 (file)
@@ -2176,6 +2176,7 @@ struct ieee80211_sta_aggregates {
  * All link specific info for a STA link for a non MLD STA(single)
  * or a MLD STA(multiple entries) are stored here.
  *
+ * @sta: reference to owning STA
  * @addr: MAC address of the Link STA. For non-MLO STA this is same as the addr
  *     in ieee80211_sta. For MLO Link STA this addr can be same or different
  *     from addr in ieee80211_sta (representing MLD STA addr)
@@ -2196,6 +2197,8 @@ struct ieee80211_sta_aggregates {
  *
  */
 struct ieee80211_link_sta {
+       struct ieee80211_sta *sta;
+
        u8 addr[ETH_ALEN];
        u8 link_id;
        enum ieee80211_smps_mode smps_mode;
index cebfd148bb4066911ace9f749b72c8c53a6e3941..71b1488bd3900f1659bbdf702a9e04c4fff2c231 100644 (file)
@@ -511,6 +511,7 @@ static void sta_info_add_link(struct sta_info *sta,
        link_info->sta = sta;
        link_info->link_id = link_id;
        link_info->pub = link_sta;
+       link_info->pub->sta = &sta->sta;
        link_sta->link_id = link_id;
        rcu_assign_pointer(sta->link[link_id], link_info);
        rcu_assign_pointer(sta->sta.link[link_id], link_sta);