Search Linux Wireless

Re: [RFC v2 3/4] mac80211: use static keys for hw flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2015-11-10 at 09:52 +0100, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@xxxxxxxxx>
> 
> 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@xxxxxxxxx>
> ---
[...]

> 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux