linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: linux-wireless@vger.kernel.org,
	"Grzegorz Duszyński" <gfduszynski@gmail.com>
Subject: Re: [RFC] cfg80211: let's wmm_rule be part of reg_rule structure
Date: Tue, 21 Aug 2018 11:23:04 +0200	[thread overview]
Message-ID: <1534843384.25523.7.camel@sipsolutions.net> (raw)
In-Reply-To: <20180821074020.GA28952@redhat.com>

Given the code simplification, and that we even allocate n_channels *
WMM rule anyway in e.g. iwlwifi, this seems like a good idea. I think I
was initially against it because of the duplication, but for the most
part we have few rules, and if we have many like in iwlwifi we already
don't take advantage of it to save memory ...

I think, however, that we should get away without doing a userspace API
modification:

> --- a/include/uapi/linux/nl80211.h
> +++ b/include/uapi/linux/nl80211.h
> @@ -3598,6 +3598,7 @@ enum nl80211_reg_rule_flags {
>  	NL80211_RRF_NO_HT40PLUS		= 1<<14,
>  	NL80211_RRF_NO_80MHZ		= 1<<15,
>  	NL80211_RRF_NO_160MHZ		= 1<<16,
> +	NL80211_RRF_HAS_WMM		= 1<<17,
>  };

We can store this flag in a kernel-only boolean instead?

> -	if (IS_ERR_OR_NULL(rrule) || !rrule->wmm_rule) {
> +	if (IS_ERR_OR_NULL(rrule) || !(rrule->flags & NL80211_RRF_HAS_WMM)) {

and then just use "rrule->has_wmm" or so here (and in other places that
check).

>  	for (i = 0; i < src_regd->n_reg_rules; i++) {
>  		memcpy(&regd->reg_rules[i], &src_regd->reg_rules[i],
>  		       sizeof(struct ieee80211_reg_rule));
> -		if (!src_regd->reg_rules[i].wmm_rule)
> -			continue;
> -
> -		regd->reg_rules[i].wmm_rule = d_wmm +
> -			(src_regd->reg_rules[i].wmm_rule - s_wmm) /
> -			sizeof(struct ieee80211_wmm_rule);
>  	}

could drop the braces now

johannes

      parent reply	other threads:[~2018-08-21 12:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-21  7:40 [RFC] cfg80211: let's wmm_rule be part of reg_rule structure Stanislaw Gruszka
2018-08-21  8:57 ` Grzegorz Duszyński
2018-08-21  8:58   ` Johannes Berg
2018-08-21  9:03     ` Grzegorz Duszyński
2018-08-21  9:18     ` Stanislaw Gruszka
2018-08-21  9:24       ` Johannes Berg
2018-08-21  9:23 ` Johannes Berg [this message]

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=1534843384.25523.7.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=gfduszynski@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=sgruszka@redhat.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;
as well as URLs for NNTP newsgroup(s).