linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: Johannes Berg <johannes@sipsolutions.net>,
	linux-wireless@vger.kernel.org
Cc: Jason Baron <jbaron@akamai.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Johannes Berg <johannes.berg@intel.com>
Subject: Re: [RFC v2 3/4] mac80211: use static keys for hw flags
Date: Wed, 11 Nov 2015 02:22:25 +0200	[thread overview]
Message-ID: <1447201345.2475.15.camel@coelho.fi> (raw)
In-Reply-To: <1447145549-27376-4-git-send-email-johannes@sipsolutions.net>

On Tue, 2015-11-10 at 09:52 +0100, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> There are many drivers with different behaviour, but in a lot of
> systems only a single driver will ever be built. In that case we
> could practically get rid of the code for the paths that this
> driver/device doesn't need. Doing that, however, would be rather
> dangerous.
> 
> As a decent alternative, use static keys to simply get into the
> required code path for the single built driver.
> 
> To achieve this associate with each flag an _ON and _OFF Kconfig
> symbol. Selecting this symbol in a driver will cause the system
> to take this as the default state (if both are selected, there's
> no optimisation at all.)
> 
> If, for example, the Kconfig selection said that a given flag is
> expected to always be turned off, then the code depending on it
> would be placed out-of-line and the jump to it NOPed out. If a
> different driver that actually requires the code contrary to the
> Kconfig selection is loaded, the jump will be patched in and the
> first thing in the out-of-line section will be to check the real
> hardware flag (since multiple drivers can be loaded.)
> 
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
[...]

> diff --git a/net/mac80211/Kconfig.hwflags
> b/net/mac80211/Kconfig.hwflags
> new file mode 100644
> index 000000000000..06f6ba12c86e
> --- /dev/null
> +++ b/net/mac80211/Kconfig.hwflags
> @@ -0,0 +1,192 @@
> +config MAC80211_HW_HAS_RATE_CONTROL_ON
> +	bool
> +	depends on MAC80211
> +config MAC80211_HW_HAS_RATE_CONTROL_OFF
> +	bool
> +	depends on MAC80211
> +config MAC80211_HW_RX_INCLUDES_FCS_ON
> +	bool
> +	depends on MAC80211
> +config MAC80211_HW_RX_INCLUDES_FCS_OFF
> +	bool
> +	depends on MAC80211
[...]

Now that you have all these options in Kconfig, wouldn't it be possible
to remove the calls to the "static" ieee80211_hw_set() in the drivers
and somehow set all the flags that are defined in Kconfig
automatically?

The driver could still call ieee80211_hw_clear() and ieee80211_hw_set()
if it needs to change dynamically.

--
Luca.

  reply	other threads:[~2015-11-11  0:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-10  8:52 [RFC v2 0/4] mac80211: jump labels for hw flags Johannes Berg
2015-11-10  8:52 ` [RFC v2 1/4] mac80211: add ieee80211_hw_clear() Johannes Berg
2015-11-10  8:52 ` [RFC v2 2/4] mac80211: introduce ieee80211_local_check() Johannes Berg
2015-11-10  8:52 ` [RFC v2 3/4] mac80211: use static keys for hw flags Johannes Berg
2015-11-11  0:22   ` Luca Coelho [this message]
2015-11-11  7:37     ` Johannes Berg
2015-11-11 13:34       ` Steven Rostedt
2015-11-11 13:39         ` Johannes Berg
2015-11-11 14:18           ` Steven Rostedt
2015-11-11 14:29             ` Johannes Berg
2015-11-11 14:45               ` Steven Rostedt
2015-11-11 15:05                 ` Johannes Berg
2015-11-10  8:52 ` [RFC v2 4/4] mac80211: test the static key code Johannes Berg
2015-11-10  9:11 ` [RFC v2 5/4] mac80211: generate hw flags from include file 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=1447201345.2475.15.camel@coelho.fi \
    --to=luca@coelho.fi \
    --cc=jbaron@akamai.com \
    --cc=johannes.berg@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    /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).