Commit 8e14130d authored by Johannes Berg's avatar Johannes Berg

wifi: mac80211: add per-link configuration pointer

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: default avatarJohannes Berg <johannes.berg@intel.com>
parent 7b7090b4
...@@ -1739,6 +1739,8 @@ struct ieee80211_vif_cfg { ...@@ -1739,6 +1739,8 @@ struct ieee80211_vif_cfg {
* @cfg: vif configuration, see &struct ieee80211_vif_cfg * @cfg: vif configuration, see &struct ieee80211_vif_cfg
* @bss_conf: BSS configuration for this interface, either our own * @bss_conf: BSS configuration for this interface, either our own
* or the BSS we're associated to * 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 * @addr: address of this interface
* @p2p: indicates whether this AP or STA interface is a p2p * @p2p: indicates whether this AP or STA interface is a p2p
* interface, i.e. a GO or p2p-sta respectively * interface, i.e. a GO or p2p-sta respectively
...@@ -1773,6 +1775,7 @@ struct ieee80211_vif { ...@@ -1773,6 +1775,7 @@ struct ieee80211_vif {
enum nl80211_iftype type; enum nl80211_iftype type;
struct ieee80211_vif_cfg cfg; struct ieee80211_vif_cfg cfg;
struct ieee80211_bss_conf bss_conf; struct ieee80211_bss_conf bss_conf;
struct ieee80211_bss_conf *link_conf[IEEE80211_MLD_MAX_NUM_LINKS];
u8 addr[ETH_ALEN] __aligned(2); u8 addr[ETH_ALEN] __aligned(2);
bool p2p; bool p2p;
......
...@@ -1031,6 +1031,7 @@ struct ieee80211_sub_if_data { ...@@ -1031,6 +1031,7 @@ struct ieee80211_sub_if_data {
} u; } u;
struct ieee80211_link_data deflink; struct ieee80211_link_data deflink;
struct ieee80211_link_data *link[IEEE80211_MLD_MAX_NUM_LINKS];
#ifdef CONFIG_MAC80211_DEBUGFS #ifdef CONFIG_MAC80211_DEBUGFS
struct { struct {
......
...@@ -1012,6 +1012,23 @@ static void ieee80211_set_default_queues(struct ieee80211_sub_if_data *sdata) ...@@ -1012,6 +1012,23 @@ static void ieee80211_set_default_queues(struct ieee80211_sub_if_data *sdata)
sdata->vif.cab_queue = IEEE80211_INVAL_HW_QUEUE; 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) int ieee80211_add_virtual_monitor(struct ieee80211_local *local)
{ {
struct ieee80211_sub_if_data *sdata; struct ieee80211_sub_if_data *sdata;
...@@ -1031,12 +1048,13 @@ int ieee80211_add_virtual_monitor(struct ieee80211_local *local) ...@@ -1031,12 +1048,13 @@ int ieee80211_add_virtual_monitor(struct ieee80211_local *local)
return -ENOMEM; return -ENOMEM;
/* set up data */ /* set up data */
sdata->local = local;
sdata->vif.type = NL80211_IFTYPE_MONITOR; sdata->vif.type = NL80211_IFTYPE_MONITOR;
snprintf(sdata->name, IFNAMSIZ, "%s-monitor", snprintf(sdata->name, IFNAMSIZ, "%s-monitor",
wiphy_name(local->hw.wiphy)); wiphy_name(local->hw.wiphy));
sdata->wdev.iftype = NL80211_IFTYPE_MONITOR; sdata->wdev.iftype = NL80211_IFTYPE_MONITOR;
ieee80211_sdata_init(local, sdata);
ieee80211_set_default_queues(sdata); ieee80211_set_default_queues(sdata);
ret = drv_add_interface(local, sdata); ret = drv_add_interface(local, sdata);
...@@ -2074,7 +2092,8 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, ...@@ -2074,7 +2092,8 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
/* initialise type-independent data */ /* initialise type-independent data */
sdata->wdev.wiphy = local->hw.wiphy; sdata->wdev.wiphy = local->hw.wiphy;
sdata->local = local;
ieee80211_sdata_init(local, sdata);
ieee80211_init_frag_cache(&sdata->frags); ieee80211_init_frag_cache(&sdata->frags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment