linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: "Peter Große" <pegro@friiks.de>, linux-wireless@vger.kernel.org
Subject: Re: [PATCH] mac80211: Fix setting TX power on monitor interfaces
Date: Tue, 19 Dec 2017 10:53:30 +0100	[thread overview]
Message-ID: <1513677210.26145.10.camel@sipsolutions.net> (raw)
In-Reply-To: <20171213172946.19976-1-pegro@friiks.de>

Hi,

> Since monitor_sdata->vif.type is also NL80211_IFTYPE_MONITOR,
> the warning would still appear with the patch to cfg.c, so I excluded 
> that case from the WARN_ON_ONCE condition.
> 
> I hope that makes sense?!

Yeah, looks good.

>  	if (wdev) {
>  		sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
>  
> +		if (sdata->vif.type == NL80211_IFTYPE_MONITOR) {
> +			sdata = rtnl_dereference(local->monitor_sdata);
> +			if (!sdata)
> +				return -EOPNOTSUPP;
> +		}

This part makes perfect sense.

>  	mutex_lock(&local->iflist_mtx);
>  	list_for_each_entry(sdata, &local->interfaces, list) {
> +		if (sdata->vif.type == NL80211_IFTYPE_MONITOR) {
> +			has_monitor = true;
> +			continue;
> +		}
>  		sdata->user_power_level = local->user_power_level;
>  		if (txp_type != sdata->vif.bss_conf.txpower_type)
>  			update_txp_type = true;
>  		sdata->vif.bss_conf.txpower_type = txp_type;
>  	}
> -	list_for_each_entry(sdata, &local->interfaces, list)
> +	list_for_each_entry(sdata, &local->interfaces, list) {
> +		if (sdata->vif.type == NL80211_IFTYPE_MONITOR)
> +			continue;
>  		ieee80211_recalc_txpower(sdata, update_txp_type);
> +	}
>  	mutex_unlock(&local->iflist_mtx);
>  
> +	if (has_monitor) {
> +		sdata = rtnl_dereference(local->monitor_sdata);
> +		if (sdata) {
> +			sdata->user_power_level = local->user_power_level;
> +			if (txp_type != sdata->vif.bss_conf.txpower_type)
> +				update_txp_type = true;
> +			sdata->vif.bss_conf.txpower_type = txp_type;
> +
> +			ieee80211_recalc_txpower(sdata, update_txp_type);
> +		}
> +	}

But do we really need this? I think we can probably live with just not
having monitor handled here, i.e. only have the "if monitor continue;"
part?

johannes

  reply	other threads:[~2017-12-19  9:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-20 16:34 Setting TX power on a monitoring interface Peter Große
2017-11-27 11:43 ` Johannes Berg
2017-11-27 15:07   ` Peter Große
2017-12-01 14:49     ` Johannes Berg
2017-12-01 17:34       ` Peter Große
2017-12-09 19:53         ` Johannes Berg
2017-12-13 17:29           ` [PATCH] mac80211: Fix setting TX power on monitor interfaces Peter Große
2017-12-19  9:53             ` Johannes Berg [this message]
2017-12-19 19:25               ` Peter Große

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=1513677210.26145.10.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pegro@friiks.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).