All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Arend van Spriel" <arend@broadcom.com>
To: "Seth Forshee" <seth.forshee@canonical.com>
Cc: linux-wireless@vger.kernel.org,
	"Luis R. Rodriguez" <rodrigue@qca.qualcomm.com>
Subject: Re: [RFC PATCH 5/8] brcm80211: smac: enable/disable radio on regulatory updates
Date: Sat, 26 May 2012 00:33:31 +0200	[thread overview]
Message-ID: <4FC008BB.1020606@broadcom.com> (raw)
In-Reply-To: <1334607462-5387-6-git-send-email-seth.forshee@canonical.com>

On 04/16/2012 10:17 PM, Seth Forshee wrote:
> Currently the radio disable state is only updated during initialization,
> and it's only checked against the internal world domain. This is
> unnecessary, as there are always valid channels against this domain.
> Instead, check whether any channels are enabled in the regulatory
> notifier and update the radio state accordingly.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
> Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
> ---
>  drivers/net/wireless/brcm80211/brcmsmac/channel.c |   66 ++++++++-------------
>  1 file changed, 25 insertions(+), 41 deletions(-)
> 
> diff --git a/drivers/net/wireless/brcm80211/brcmsmac/channel.c b/drivers/net/wireless/brcm80211/brcmsmac/channel.c
> index fd5b807..590e8c1 100644
> --- a/drivers/net/wireless/brcm80211/brcmsmac/channel.c
> +++ b/drivers/net/wireless/brcm80211/brcmsmac/channel.c
> @@ -681,46 +681,6 @@ brcms_c_channel_min_txpower_limits_with_local_constraint(
>  
>  }
>  
> -/* Update the radio state (enable/disable) and tx power targets
> - * based on a new set of channel/regulatory information
> - */
> -static void brcms_c_channels_commit(struct brcms_cm_info *wlc_cm)
> -{
> -	struct brcms_c_info *wlc = wlc_cm->wlc;
> -	uint chan;
> -
> -	/* search for the existence of any valid channel */
> -	for (chan = 0; chan < MAXCHANNEL; chan++) {
> -		if (brcms_c_valid_channel20_db(wlc->cmi, chan))
> -			break;
> -	}
> -	if (chan == MAXCHANNEL)
> -		chan = INVCHANNEL;
> -
> -	/*
> -	 * based on the channel search above, set or
> -	 * clear WL_RADIO_COUNTRY_DISABLE.
> -	 */
> -	if (chan == INVCHANNEL) {
> -		/*
> -		 * country/locale with no valid channels, set
> -		 * the radio disable bit
> -		 */
> -		mboolset(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE);
> -		wiphy_err(wlc->wiphy, "wl%d: %s: no valid channel for \"%s\" "
> -			  "nbands %d bandlocked %d\n", wlc->pub->unit,
> -			  __func__, wlc_cm->world_regd->regdomain->alpha2,
> -			  wlc->pub->_nbands, wlc->bandlocked);
> -	} else if (mboolisset(wlc->pub->radio_disabled,
> -			      WL_RADIO_COUNTRY_DISABLE)) {
> -		/*
> -		 * country/locale with valid channel, clear
> -		 * the radio disable bit
> -		 */
> -		mboolclr(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE);
> -	}
> -}
> -
>  static int
>  brcms_c_channels_init(struct brcms_cm_info *wlc_cm,
>  		      const struct country_info *country)
> @@ -766,7 +726,6 @@ brcms_c_channels_init(struct brcms_cm_info *wlc_cm,
>  	}
>  
>  	brcms_c_quiet_channels_reset(wlc_cm);
> -	brcms_c_channels_commit(wlc_cm);
>  
>  	return 0;
>  }
> @@ -1240,12 +1199,37 @@ static int brcms_reg_notifier(struct wiphy *wiphy,
>  	struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
>  	struct brcms_info *wl = hw->priv;
>  	struct brcms_c_info *wlc = wl->wlc;
> +	struct ieee80211_supported_band *sband;
> +	struct ieee80211_channel *ch;
> +	int band, i, n_channels = 0;
>  
>  	brcms_reg_apply_radar_flags(wiphy);
>  
>  	if (request && request->initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE)
>  		brcms_reg_apply_beaconing_flags(wiphy, request->initiator);
>  
> +	/* Disable radio if all channels disallowed by regulatory */

I think we need to validate the channels against our phy as well. See
brcms_c_channels_init().

> +	for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
> +		sband = wiphy->bands[band];
> +		if (!sband)
> +			continue;
> +
> +		for (i = 0; i < sband->n_channels; i++) {
> +			ch = &sband->channels[i];
> +
> +			if (!(ch->flags & IEEE80211_CHAN_DISABLED))
> +				n_channels++;

could break here when a valid channel is found.

> +		}
> +	}
> +
> +	if (n_channels == 0) {
> +		mboolset(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE);
> +		wiphy_err(wlc->wiphy, "wl%d: %s: no valid channel for \"%s\"\n",
> +			  wlc->pub->unit, __func__, request->alpha2);
> +	} else {
> +		mboolclr(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE);
> +	}
> +
>  	if (wlc->pub->_nbands > 1 || wlc->band->bandtype == BRCM_BAND_2G)
>  		wlc_phy_chanspec_ch14_widefilter_set(wlc->band->pi,
>  					brcms_c_japan_ccode(request->alpha2));

Gr. AvS


  reply	other threads:[~2012-05-25 22:33 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-16 20:17 [RFC PATCH 0/8] brcm80211: smac: rework regulatory support Seth Forshee
2012-04-16 20:17 ` [RFC PATCH 1/8] brcm80211: smac: don't set up tx power limits during initialization Seth Forshee
2012-05-25 22:32   ` Arend van Spriel
2012-04-16 20:17 ` [RFC PATCH 2/8] brcm80211: smac: always set channel specified by mac80211 Seth Forshee
2012-05-25 22:32   ` Arend van Spriel
2012-04-16 20:17 ` [RFC PATCH 3/8] brcm80211: smac: clean up channel.c Seth Forshee
2012-05-25 22:33   ` Arend van Spriel
2012-05-26 17:17     ` Seth Forshee
2012-05-27 11:51       ` Arend van Spriel
2012-05-27 11:53       ` Arend van Spriel
2012-05-29 12:46         ` Seth Forshee
2012-05-29 13:03           ` Arend van Spriel
2012-04-16 20:17 ` [RFC PATCH 4/8] brcm80211: smac: inform mac80211 of the X2 regulatory domain Seth Forshee
2012-05-25 22:33   ` Arend van Spriel
2012-05-26 17:18     ` Seth Forshee
2012-05-27 12:17       ` Arend van Spriel
2012-05-29 13:12         ` Seth Forshee
2012-05-29 16:44           ` Arend van Spriel
2012-05-31 14:46         ` Seth Forshee
2012-05-31 17:49           ` Arend van Spriel
2012-06-07 18:18       ` Luis R. Rodriguez
2012-04-16 20:17 ` [RFC PATCH 5/8] brcm80211: smac: enable/disable radio on regulatory updates Seth Forshee
2012-05-25 22:33   ` Arend van Spriel [this message]
2012-05-26 17:18     ` Seth Forshee
2012-05-27 12:18       ` Arend van Spriel
2012-04-16 20:17 ` [RFC PATCH 6/8] brcm80211: smac: use mac80211 channel data for tx power limits Seth Forshee
2012-05-25 22:33   ` Arend van Spriel
2012-04-16 20:17 ` [RFC PATCH 7/8] brcm80211: smac: don't validate channels against internal regulatory data Seth Forshee
2012-05-25 22:33   ` Arend van Spriel
2012-04-16 20:17 ` [RFC PATCH 8/8] brcm80211: smac: use current regulatory domain when checking whether OFDM is allowed Seth Forshee
2012-05-25 22:34   ` Arend van Spriel
2012-04-16 20:42 ` [RFC PATCH 0/8] brcm80211: smac: rework regulatory support Arend van Spriel
2012-04-16 20:53   ` Seth Forshee
2012-04-19 19:31 ` Arend van Spriel
2012-04-19 19:46   ` Seth Forshee
2012-04-30 17:12   ` Seth Forshee
2012-05-01 12:13     ` Arend van Spriel
2012-05-01 16:12       ` Seth Forshee
2012-05-25 22:31 ` Arend van Spriel
2012-05-25 22:51   ` Luis R. Rodriguez
2012-05-26  6:38     ` Arend van Spriel
2012-05-26  7:19       ` Luis R. Rodriguez
2012-05-26 17:17   ` Seth Forshee

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=4FC008BB.1020606@broadcom.com \
    --to=arend@broadcom.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=rodrigue@qca.qualcomm.com \
    --cc=seth.forshee@canonical.com \
    /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.