Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3b377ea9 authored by John W. Linville's avatar John W. Linville
Browse files

wireless: support internal statically compiled regulatory database



This patch provides infrastructure for machine translation of the
regulatory rules database used by CRDA into a C data structure.
It includes code for searching that database as an alternative
to dynamic regulatory rules updates via CRDA.  Most people should
use CRDA instead of this infrastructure, but it provides a better
alternative than the WIRELESS_OLD_REGULATORY infrastructure (which
can now be removed).

Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 59d9cb07
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -188,3 +188,27 @@ Then in some part of your code after your wiphy has been registered:
		       &mydriver_jp_regdom.reg_rules[i],
		       sizeof(struct ieee80211_reg_rule));
	regulatory_struct_hint(rd);

Statically compiled regulatory database
---------------------------------------

In most situations the userland solution using CRDA as described
above is the preferred solution.  However in some cases a set of
rules built into the kernel itself may be desirable.  To account
for this situation, a configuration option has been provided
(i.e. CONFIG_CFG80211_INTERNAL_REGDB).  With this option enabled,
the wireless database information contained in net/wireless/db.txt is
used to generate a data structure encoded in net/wireless/regdb.c.
That option also enables code in net/wireless/reg.c which queries
the data in regdb.c as an alternative to using CRDA.

The file net/wireless/db.txt should be kept up-to-date with the db.txt
file available in the git repository here:

    git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-regdb.git

Again, most users in most situations should be using the CRDA package
provided with their distribution, and in most other situations users
should be building and using CRDA on their own rather than using
this option.  If you are not absolutely sure that you should be using
CONFIG_CFG80211_INTERNAL_REGDB then _DO_NOT_USE_IT_.
+1 −0
Original line number Diff line number Diff line
regdb.c
+16 −0
Original line number Diff line number Diff line
@@ -109,6 +109,22 @@ config WIRELESS_OLD_REGULATORY

	  Say N and if you say Y, please tell us why. The default is N.

config CFG80211_INTERNAL_REGDB
	bool "use statically compiled regulatory rules database" if EMBEDDED
	default n
	depends on CFG80211
	---help---
	  This option generates an internal data structure representing
	  the wireless regulatory rules described in net/wireless/db.txt
	  and includes code to query that database.  This is an alternative
	  to using CRDA for defining regulatory rules for the kernel.

	  For details see:

	  http://wireless.kernel.org/en/developers/Regulatory

	  Most distributions have a CRDA package.  So if unsure, say N.

config CFG80211_WEXT
	bool "cfg80211 wireless extensions compatibility"
	depends on CFG80211
+6 −0
Original line number Diff line number Diff line
@@ -13,5 +13,11 @@ cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o
cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o
cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o
cfg80211-$(CONFIG_CFG80211_WEXT) += wext-compat.o wext-sme.o
cfg80211-$(CONFIG_CFG80211_INTERNAL_REGDB) += regdb.o

ccflags-y += -D__CHECK_ENDIAN__

$(obj)/regdb.c: $(src)/db.txt $(src)/genregdb.awk
	@$(AWK) -f $(srctree)/$(src)/genregdb.awk < $< > $@

clean-files := regdb.c

net/wireless/db.txt

0 → 100644
+17 −0
Original line number Diff line number Diff line
#
# This file is a placeholder to prevent accidental build breakage if someone
# enables CONFIG_CFG80211_INTERNAL_REGDB.  Almost no one actually needs to
# enable that build option.
#
# You should be using CRDA instead.  It is even better if you use the CRDA
# package provided by your distribution, since they will probably keep it
# up-to-date on your behalf.
#
# If you _really_ intend to use CONFIG_CFG80211_INTERNAL_REGDB then you will
# need to replace this file with one containing appropriately formatted
# regulatory rules that cover the regulatory domains you will be using.  Your
# best option is to extract the db.txt file from the wireless-regdb git
# repository:
#
#   git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-regdb.git
#
Loading