Linux wireless drivers development
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Arik Nemtsov <arik@wizery.com>
Cc: linux-wireless@vger.kernel.org,
	"Luis R. Rodriguez" <mcgrof@suse.com>,
	Jonathan Doron <jond@wizery.com>
Subject: Re: [PATCH v5 3/4] cfg80211: allow wiphy specific regdomain management
Date: Fri, 28 Nov 2014 14:53:23 +0100	[thread overview]
Message-ID: <1417182803.27562.10.camel@sipsolutions.net> (raw)
In-Reply-To: <1417074298-12254-3-git-send-email-arik@wizery.com> (sfid-20141127_084501_289050_7C295FB8)

On Thu, 2014-11-27 at 09:44 +0200, Arik Nemtsov wrote:
> @@ -3183,6 +3187,8 @@ struct wiphy {
>  
>  	const struct ieee80211_regdomain __rcu *regd;
>  
> +	const struct ieee80211_regdomain *requested_regd;

It's passed to the function:

>  /**
> + * regulatory_set_wiphy_regd - set regdom info for self managed drivers
> + * @wiphy: the wireless device we want to process the regulatory domain on
> + * @rd: the regulatory domain informatoin to use for this wiphy
> + *
> + * Set the regulatory domain information for self-managed wiphys, only they
> + * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
> + * information.
> + *
> + * Return: 0 on success. -EINVAL, -EPERM
> + */
> +int regulatory_set_wiphy_regd(struct wiphy *wiphy,
> +			      struct ieee80211_regdomain *rd);

so why should it be stored in the publically visible wiphy, rather than
the rdev struct?

> + * @NL80211_CMD_WIPHY_REG_CHANGE: Similar to %NL80211_CMD_REG_CHANGE, but used
> + *	for indicating changes for devices with wiphy-specific regdom management

... but used as an event to indicate ... ?


> +++ b/net/wireless/core.c
> @@ -557,6 +557,14 @@ int wiphy_register(struct wiphy *wiphy)
>  	    BIT(NL80211_IFTYPE_MONITOR)))
>  		wiphy->regulatory_flags |= REGULATORY_IGNORE_STALE_KICKOFF;
>  
> +	if (WARN_ON((wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) &&
> +		    (wiphy->regulatory_flags &
> +		     (REGULATORY_CUSTOM_REG | REGULATORY_STRICT_REG |
> +		      REGULATORY_COUNTRY_IE_FOLLOW_POWER |
> +		      REGULATORY_COUNTRY_IE_IGNORE |
> +		      REGULATORY_DISABLE_BEACON_HINTS))))
> +		return -EINVAL;

I think you could align all of those under each other

wiphy->regulatory_flags & (... |
                           ... |
                           ...

etc to show clearly the nesting of the condition

> +void nl80211_send_reg_change_event(struct regulatory_request *request)
> +void nl80211_send_wiphy_reg_change_event(struct regulatory_request *request)

Seems like you could share more between these functions by just passing
the nl80211 cmd ID as well as the regdomain?

> @@ -1370,6 +1373,9 @@ static void handle_reg_beacon(struct wiphy *wiphy, unsigned int chan_idx,
>  	sband = wiphy->bands[reg_beacon->chan.band];
>  	chan = &sband->channels[chan_idx];
>  
> +	if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED)
> +		return;

Isn't there already a flag - you said in the docs that this flag implied
the "ignore beacons" flag so why not just set that flag?


> @@ -2432,6 +2479,9 @@ static void restore_regulatory_settings(bool reset_user)
>  	world_alpha2[1] = cfg80211_world_regdom->alpha2[1];
>  
>  	list_for_each_entry(rdev, &cfg80211_rdev_list, list) {
> +		if (rdev->wiphy.regulatory_flags &
> +						REGULATORY_WIPHY_SELF_MANAGED)
> +			continue;

I don't think that's any better than going >80 cols here :)

johannes


  reply	other threads:[~2014-11-28 13:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-27  7:44 [PATCH v5 1/4] cfg80211: leave invalid channels on regdomain change Arik Nemtsov
2014-11-27  7:44 ` [PATCH v5 2/4] cfg80211: allow usermode to query wiphy specific regdom Arik Nemtsov
2014-11-28 13:46   ` Johannes Berg
2014-11-28 22:00     ` Luis R. Rodriguez
2014-11-30 12:26       ` Arik Nemtsov
2014-11-30 12:32         ` Johannes Berg
2014-11-30 12:36           ` Arik Nemtsov
2014-11-28 22:03   ` Luis R. Rodriguez
2014-11-27  7:44 ` [PATCH v5 3/4] cfg80211: allow wiphy specific regdomain management Arik Nemtsov
2014-11-28 13:53   ` Johannes Berg [this message]
2014-11-27  7:44 ` [PATCH v5 4/4] cfg80211: return private regdom for self-managed devices Arik Nemtsov
2014-11-28 13:57   ` Johannes Berg
2014-11-28 13:44 ` [PATCH v5 1/4] cfg80211: leave invalid channels on regdomain change 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=1417182803.27562.10.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=arik@wizery.com \
    --cc=jond@wizery.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mcgrof@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox