All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: linux-wireless@vger.kernel.org
Cc: Johannes Berg <johannes.berg@intel.com>
Subject: [PATCH 02/15] mac80211: add per-link configuration pointer
Date: Wed,  1 Jun 2022 09:39:45 +0200	[thread overview]
Message-ID: <20220601093922.bd2184733906.I673f0eb1514e7d3ef749401f7ee6220276a63ec7@changeid> (raw)
In-Reply-To: <20220601073958.8345-1-johannes@sipsolutions.net>

From: Johannes Berg <johannes.berg@intel.com>

Add pointers so we can start using link_id throughout the
code, even if for now only link ID 0 is valid, pointing
to the "built-in" bss_conf, which is used by drivers that
are not aware of MLD.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 include/net/mac80211.h     |  3 +++
 net/mac80211/ieee80211_i.h |  1 +
 net/mac80211/iface.c       | 23 +++++++++++++++++++++--
 3 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 831f14b7ca69..e4868bccb446 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1739,6 +1739,8 @@ struct ieee80211_vif_cfg {
  * @cfg: vif configuration, see &struct ieee80211_vif_cfg
  * @bss_conf: BSS configuration for this interface, either our own
  *	or the BSS we're associated to
+ * @link_conf: in case of MLD, the per-link BSS configuration,
+ *	indexed by link ID
  * @addr: address of this interface
  * @p2p: indicates whether this AP or STA interface is a p2p
  *	interface, i.e. a GO or p2p-sta respectively
@@ -1773,6 +1775,7 @@ struct ieee80211_vif {
 	enum nl80211_iftype type;
 	struct ieee80211_vif_cfg cfg;
 	struct ieee80211_bss_conf bss_conf;
+	struct ieee80211_bss_conf *link_conf[IEEE80211_MLD_MAX_NUM_LINKS];
 	u8 addr[ETH_ALEN] __aligned(2);
 	bool p2p;
 
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 20153957cdee..397b111f006d 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1031,6 +1031,7 @@ struct ieee80211_sub_if_data {
 	} u;
 
 	struct ieee80211_link_data deflink;
+	struct ieee80211_link_data *link[IEEE80211_MLD_MAX_NUM_LINKS];
 
 #ifdef CONFIG_MAC80211_DEBUGFS
 	struct {
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 978dfa48e098..04ee525394e9 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1012,6 +1012,23 @@ static void ieee80211_set_default_queues(struct ieee80211_sub_if_data *sdata)
 	sdata->vif.cab_queue = IEEE80211_INVAL_HW_QUEUE;
 }
 
+static void ieee80211_sdata_init(struct ieee80211_local *local,
+				 struct ieee80211_sub_if_data *sdata)
+{
+	sdata->local = local;
+
+	/*
+	 * Initialize the default link, so we can use link_id 0 for non-MLD,
+	 * and that continues to work for non-MLD-aware drivers that use just
+	 * vif.bss_conf instead of vif.link_conf.
+	 *
+	 * Note that we never change this, so if link ID 0 isn't used in an
+	 * MLD connection, we get a separate allocation for it.
+	 */
+	sdata->vif.link_conf[0] = &sdata->vif.bss_conf;
+	sdata->link[0] = &sdata->deflink;
+}
+
 int ieee80211_add_virtual_monitor(struct ieee80211_local *local)
 {
 	struct ieee80211_sub_if_data *sdata;
@@ -1031,12 +1048,13 @@ int ieee80211_add_virtual_monitor(struct ieee80211_local *local)
 		return -ENOMEM;
 
 	/* set up data */
-	sdata->local = local;
 	sdata->vif.type = NL80211_IFTYPE_MONITOR;
 	snprintf(sdata->name, IFNAMSIZ, "%s-monitor",
 		 wiphy_name(local->hw.wiphy));
 	sdata->wdev.iftype = NL80211_IFTYPE_MONITOR;
 
+	ieee80211_sdata_init(local, sdata);
+
 	ieee80211_set_default_queues(sdata);
 
 	ret = drv_add_interface(local, sdata);
@@ -2074,7 +2092,8 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
 
 	/* initialise type-independent data */
 	sdata->wdev.wiphy = local->hw.wiphy;
-	sdata->local = local;
+
+	ieee80211_sdata_init(local, sdata);
 
 	ieee80211_init_frag_cache(&sdata->frags);
 
-- 
2.36.1


  parent reply	other threads:[~2022-06-01  7:40 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-01  7:39 [PATCH 00/15] mac80211 MLO updates Johannes Berg
2022-06-01  7:39 ` [PATCH 01/15] mac80211: split bss_info_changed method Johannes Berg
2022-06-01 19:31   ` Jeff Johnson
2022-06-01 19:39     ` Johannes Berg
2022-10-18  8:47   ` Wen Gong
2022-10-18  8:47     ` Wen Gong
2022-10-18  8:47     ` Wen Gong
2022-10-18  8:50     ` Johannes Berg
2022-10-18  8:50       ` Johannes Berg
2022-10-18  8:50       ` Johannes Berg
2022-10-18  8:52       ` Wen Gong
2022-10-18  8:52         ` Wen Gong
2022-10-18  8:52         ` Wen Gong
2022-10-18  8:53         ` Johannes Berg
2022-10-18  8:53           ` Johannes Berg
2022-10-18  8:53           ` Johannes Berg
2022-10-18  9:50           ` Wen Gong
2022-10-18  9:50             ` Wen Gong
2022-10-18  9:50             ` Wen Gong
2022-10-18  9:51             ` Johannes Berg
2022-10-18  9:51               ` Johannes Berg
2022-10-18  9:51               ` Johannes Berg
2022-10-18 10:10               ` Wen Gong
2022-10-18 10:10                 ` Wen Gong
2022-10-18 10:10                 ` Wen Gong
2022-10-19  4:32                 ` Wen Gong
2022-10-19  4:32                   ` Wen Gong
2022-10-19  4:32                   ` Wen Gong
2022-12-15 15:04                   ` Wen Gong
2022-12-15 15:04                     ` Wen Gong
2022-12-15 15:04                     ` Wen Gong
2022-06-01  7:39 ` Johannes Berg [this message]
2022-06-01  7:39 ` [PATCH 03/15] mac80211: pass link ID where already present Johannes Berg
2022-06-01  7:39 ` [PATCH 04/15] mac80211: make channel context code MLO-aware Johannes Berg
2023-02-14  7:57   ` Wen Gong
2023-02-14  7:57     ` Wen Gong
2023-02-14  8:04     ` Johannes Berg
2023-02-14  8:04       ` Johannes Berg
2023-02-14  8:09       ` Wen Gong
2023-02-14  8:09         ` Wen Gong
2023-02-14  8:13         ` Johannes Berg
2023-02-14  8:13           ` Johannes Berg
2022-06-01  7:39 ` [PATCH 05/15] mac80211: remove sta_info_tx_streams() Johannes Berg
2022-06-01  7:39 ` [PATCH 06/15] mac80211: refactor some sta_info link handling Johannes Berg
2022-06-01  7:39 ` [PATCH 07/15] mac80211: use IEEE80211_MLD_MAX_NUM_LINKS Johannes Berg
2022-06-01  7:39 ` [PATCH 08/15] mac80211: validate some driver features for MLO Johannes Berg
2022-06-01  7:39 ` [PATCH 09/15] mac80211: refactor some link setup code Johannes Berg
2022-06-01  7:39 ` [PATCH 10/15] mac80211: add link_id to vht.c code for MLO Johannes Berg
2022-06-01  7:39 ` [PATCH 11/15] mac80211: add link_id to eht.c " Johannes Berg
2022-06-01  7:39 ` [PATCH 12/15] mac80211: HT: make ieee80211_ht_cap_ie_to_sta_ht_cap() MLO-aware Johannes Berg
2022-06-01  7:39 ` [PATCH 13/15] mac80211: make some SMPS code MLD-aware Johannes Berg
2022-06-01  7:39 ` [PATCH 14/15] mac80211: make ieee80211_he_cap_ie_to_sta_he_cap() MLO-aware Johannes Berg
2022-06-01  7:39 ` [PATCH 15/15] mac80211: correct link config data in tracing Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220601093922.bd2184733906.I673f0eb1514e7d3ef749401f7ee6220276a63ec7@changeid \
    --to=johannes@sipsolutions.net \
    --cc=johannes.berg@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.