Search Linux Wireless

Re: [PATCH 1/2] wifi: mac80211: Create separate links for VLAN interfaces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2025-01-17 at 17:53 -0800, Muna Sinada wrote:
> Currently, MLD links for an AP_VLAN interface type is not fully
> supported.
> 
> Add allocation of separate links for each VLAN interface and copy
> chanctx and chandef of master AP to VLAN where necessary. Separate
> links are created because for Dynamic VLAN each link will have its own
> default_multicast_key.
> 
> Signed-off-by: Muna Sinada <quic_msinada@xxxxxxxxxxx>
> ---
>  net/mac80211/chan.c        |  3 ++
>  net/mac80211/ieee80211_i.h |  2 +
>  net/mac80211/iface.c       | 23 +++++++++-
>  net/mac80211/link.c        | 86 ++++++++++++++++++++++++++++++++++++--
>  4 files changed, 108 insertions(+), 6 deletions(-)
> 
> diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
> index a442cb667520..553fc998f5d0 100644
> --- a/net/mac80211/chan.c
> +++ b/net/mac80211/chan.c
> @@ -2124,6 +2124,9 @@ void ieee80211_link_release_channel(struct ieee80211_link_data *link)
>  {
>  	struct ieee80211_sub_if_data *sdata = link->sdata;
>  
> +	if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
> +		return;
> +
>  	lockdep_assert_wiphy(sdata->local->hw.wiphy);
>  
>  	if (rcu_access_pointer(link->conf->chanctx_conf))
> diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
> index 9f0db39b28ff..fdd2d422ac5e 100644
> --- a/net/mac80211/ieee80211_i.h
> +++ b/net/mac80211/ieee80211_i.h
> @@ -2057,6 +2057,8 @@ static inline void ieee80211_vif_clear_links(struct ieee80211_sub_if_data *sdata
>  	ieee80211_vif_set_links(sdata, 0, 0);
>  }
>  
> +void ieee80211_apvlan_link_setup(struct ieee80211_sub_if_data *sdata);
> +
>  /* tx handling */
>  void ieee80211_clear_tx_pending(struct ieee80211_local *local);
>  void ieee80211_tx_pending(struct tasklet_struct *t);
> diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
> index 806dffa48ef9..28aa45a9601c 100644
> --- a/net/mac80211/iface.c
> +++ b/net/mac80211/iface.c
> @@ -493,6 +493,10 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do
>  			break;
>  		list_del_rcu(&sdata->u.mntr.list);
>  		break;
> +	case NL80211_IFTYPE_AP_VLAN:
> +		sdata->wdev.valid_links = 0;
> +		ieee80211_vif_clear_links(sdata);
> +		break;

Would maybe make sense to move the wdev.valid_links elsewhere too, since
you have the other change to it also in link.c?
 
> +static void ieee80211_update_apvlan_links(struct ieee80211_sub_if_data *sdata)
> +{
> +	struct ieee80211_sub_if_data *vlan;
> +	struct ieee80211_link_data *link;
> +	u16 master_links = sdata->vif.valid_links;
> +	u16 new_links, vlan_links;
> +	unsigned long add;
> +
> +	list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) {
> +		int link_id;
> +
> +		if (!vlan)
> +			continue;
> +
> +		/* No support for 4addr with MLO yet */
> +		if (vlan->wdev.use_4addr)
> +			return;

That's weird, how would it happen that the vlan has 4-addr but you
cannot check the main 'sdata' value? We don't even let you set that, I
believe?

> @@ -31,6 +87,22 @@ void ieee80211_link_init(struct ieee80211_sub_if_data *sdata,
>  	rcu_assign_pointer(sdata->vif.link_conf[link_id], link_conf);
>  	rcu_assign_pointer(sdata->link[link_id], link);
>  
> +	if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
> +		struct ieee80211_sub_if_data *master;
> +		struct ieee80211_bss_conf *master_conf;
> +
> +		master = container_of(sdata->bss,
> +				      struct ieee80211_sub_if_data, u.ap);
> +		if (!master)
> +			goto skip_vlan_conf;
> +
> +		master_conf = sdata_dereference(master->vif.link_conf[link_id],
> +						master);
> +
> +		memcpy(link_conf, master_conf, sizeof(*link_conf));
> +	}
> +
> +skip_vlan_conf:

You can easily get rid of the goto, and please find better names then
'master'.

johannes





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux