Linux Audio

Check our new training course

Linux debugging, profiling, tracing and performance analysis training

Apr 14-17, 2025
Register
Loading...
v6.13.7
  1
  2#ifndef __NET_REGULATORY_H
  3#define __NET_REGULATORY_H
  4/*
  5 * regulatory support structures
  6 *
  7 * Copyright 2008-2009	Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
  8 * Copyright (C) 2018 Intel Corporation
  9 *
 10 * Permission to use, copy, modify, and/or distribute this software for any
 11 * purpose with or without fee is hereby granted, provided that the above
 12 * copyright notice and this permission notice appear in all copies.
 13 *
 14 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 15 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 16 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 17 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 18 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 19 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 20 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 21 */
 22
 23#include <linux/ieee80211.h>
 24#include <linux/nl80211.h>
 25#include <linux/rcupdate.h>
 26
 27/**
 28 * enum environment_cap - Environment parsed from country IE
 29 * @ENVIRON_ANY: indicates country IE applies to both indoor and
 30 *	outdoor operation.
 31 * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation
 32 * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation
 33 */
 34enum environment_cap {
 35	ENVIRON_ANY,
 36	ENVIRON_INDOOR,
 37	ENVIRON_OUTDOOR,
 38};
 39
 40/**
 41 * struct regulatory_request - used to keep track of regulatory requests
 42 *
 43 * @rcu_head: RCU head struct used to free the request
 44 * @wiphy_idx: this is set if this request's initiator is
 45 *	%REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This
 46 *	can be used by the wireless core to deal with conflicts
 47 *	and potentially inform users of which devices specifically
 48 *	cased the conflicts.
 49 * @initiator: indicates who sent this request, could be any of
 50 *	those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*)
 51 * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested
 52 *	regulatory domain. We have a few special codes:
 53 *	00 - World regulatory domain
 54 *	99 - built by driver but a specific alpha2 cannot be determined
 55 *	98 - result of an intersection between two regulatory domains
 56 *	97 - regulatory domain has not yet been configured
 57 * @dfs_region: If CRDA responded with a regulatory domain that requires
 58 *	DFS master operation on a known DFS region (NL80211_DFS_*),
 59 *	dfs_region represents that region. Drivers can use this and the
 60 *	@alpha2 to adjust their device's DFS parameters as required.
 61 * @user_reg_hint_type: if the @initiator was of type
 62 *	%NL80211_REGDOM_SET_BY_USER, this classifies the type
 63 *	of hint passed. This could be any of the %NL80211_USER_REG_HINT_*
 64 *	types.
 65 * @intersect: indicates whether the wireless core should intersect
 66 *	the requested regulatory domain with the presently set regulatory
 67 *	domain.
 68 * @processed: indicates whether or not this requests has already been
 69 *	processed. When the last request is processed it means that the
 70 *	currently regulatory domain set on cfg80211 is updated from
 71 *	CRDA and can be used by other regulatory requests. When a
 72 *	the last request is not yet processed we must yield until it
 73 *	is processed before processing any new requests.
 
 
 74 * @country_ie_env: lets us know if the AP is telling us we are outdoor,
 75 *	indoor, or if it doesn't matter
 76 * @list: used to insert into the reg_requests_list linked list
 77 */
 78struct regulatory_request {
 79	struct rcu_head rcu_head;
 80	int wiphy_idx;
 81	enum nl80211_reg_initiator initiator;
 82	enum nl80211_user_reg_hint_type user_reg_hint_type;
 83	char alpha2[3];
 84	enum nl80211_dfs_regions dfs_region;
 85	bool intersect;
 86	bool processed;
 87	enum environment_cap country_ie_env;
 88	struct list_head list;
 89};
 90
 91/**
 92 * enum ieee80211_regulatory_flags - device regulatory flags
 93 *
 94 * @REGULATORY_CUSTOM_REG: tells us the driver for this device
 95 *	has its own custom regulatory domain and cannot identify the
 96 *	ISO / IEC 3166 alpha2 it belongs to. When this is enabled
 97 *	we will disregard the first regulatory hint (when the
 98 *	initiator is %REGDOM_SET_BY_CORE). Drivers that use
 99 *	wiphy_apply_custom_regulatory() should have this flag set
100 *	or the regulatory core will set it for the wiphy.
101 *	If you use regulatory_hint() *after* using
102 *	wiphy_apply_custom_regulatory() the wireless core will
103 *	clear the REGULATORY_CUSTOM_REG for your wiphy as it would be
104 *	implied that the device somehow gained knowledge of its region.
105 * @REGULATORY_STRICT_REG: tells us that the wiphy for this device
106 *	has regulatory domain that it wishes to be considered as the
107 *	superset for regulatory rules. After this device gets its regulatory
108 *	domain programmed further regulatory hints shall only be considered
109 *	for this device to enhance regulatory compliance, forcing the
110 *	device to only possibly use subsets of the original regulatory
111 *	rules. For example if channel 13 and 14 are disabled by this
112 *	device's regulatory domain no user specified regulatory hint which
113 *	has these channels enabled would enable them for this wiphy,
114 *	the device's original regulatory domain will be trusted as the
115 *	base. You can program the superset of regulatory rules for this
116 *	wiphy with regulatory_hint() for cards programmed with an
117 *	ISO3166-alpha2 country code. wiphys that use regulatory_hint()
118 *	will have their wiphy->regd programmed once the regulatory
119 *	domain is set, and all other regulatory hints will be ignored
120 *	until their own regulatory domain gets programmed.
121 * @REGULATORY_DISABLE_BEACON_HINTS: enable this if your driver needs to
122 *	ensure that passive scan flags and beaconing flags may not be lifted by
123 *	cfg80211 due to regulatory beacon hints. For more information on beacon
124 *	hints read the documentation for regulatory_hint_found_beacon()
125 * @REGULATORY_COUNTRY_IE_FOLLOW_POWER:  for devices that have a preference
126 *	that even though they may have programmed their own custom power
127 *	setting prior to wiphy registration, they want to ensure their channel
128 *	power settings are updated for this connection with the power settings
129 *	derived from the regulatory domain. The regulatory domain used will be
130 *	based on the ISO3166-alpha2 from country IE provided through
131 *	regulatory_hint_country_ie()
132 * @REGULATORY_COUNTRY_IE_IGNORE: for devices that have a preference to ignore
133 * 	all country IE information processed by the regulatory core. This will
134 * 	override %REGULATORY_COUNTRY_IE_FOLLOW_POWER as all country IEs will
135 * 	be ignored.
136 * @REGULATORY_ENABLE_RELAX_NO_IR: for devices that wish to allow the
137 *      NO_IR relaxation, which enables transmissions on channels on which
138 *      otherwise initiating radiation is not allowed. This will enable the
139 *      relaxations enabled under the CFG80211_REG_RELAX_NO_IR configuration
140 *      option
 
 
 
 
 
 
 
 
 
 
 
141 * @REGULATORY_WIPHY_SELF_MANAGED: for devices that employ wiphy-specific
142 *	regdom management. These devices will ignore all regdom changes not
143 *	originating from their own wiphy.
144 *	A self-managed wiphys only employs regulatory information obtained from
145 *	the FW and driver and does not use other cfg80211 sources like
146 *	beacon-hints, country-code IEs and hints from other devices on the same
147 *	system. Conversely, a self-managed wiphy does not share its regulatory
148 *	hints with other devices in the system. If a system contains several
149 *	devices, one or more of which are self-managed, there might be
150 *	contradictory regulatory settings between them. Usage of flag is
151 *	generally discouraged. Only use it if the FW/driver is incompatible
152 *	with non-locally originated hints.
153 *	This flag is incompatible with the flags: %REGULATORY_CUSTOM_REG,
154 *	%REGULATORY_STRICT_REG, %REGULATORY_COUNTRY_IE_FOLLOW_POWER,
155 *	%REGULATORY_COUNTRY_IE_IGNORE and %REGULATORY_DISABLE_BEACON_HINTS.
156 *	Mixing any of the above flags with this flag will result in a failure
157 *	to register the wiphy. This flag implies
158 *	%REGULATORY_DISABLE_BEACON_HINTS and %REGULATORY_COUNTRY_IE_IGNORE.
159 */
160enum ieee80211_regulatory_flags {
161	REGULATORY_CUSTOM_REG			= BIT(0),
162	REGULATORY_STRICT_REG			= BIT(1),
163	REGULATORY_DISABLE_BEACON_HINTS		= BIT(2),
164	REGULATORY_COUNTRY_IE_FOLLOW_POWER	= BIT(3),
165	REGULATORY_COUNTRY_IE_IGNORE		= BIT(4),
166	REGULATORY_ENABLE_RELAX_NO_IR           = BIT(5),
167	/* reuse bit 6 next time */
168	REGULATORY_WIPHY_SELF_MANAGED		= BIT(7),
169};
170
171struct ieee80211_freq_range {
172	u32 start_freq_khz;
173	u32 end_freq_khz;
174	u32 max_bandwidth_khz;
175};
176
177struct ieee80211_power_rule {
178	u32 max_antenna_gain;
179	u32 max_eirp;
180};
181
182/**
183 * struct ieee80211_wmm_ac - used to store per ac wmm regulatory limitation
184 *
185 * The information provided in this structure is required for QoS
186 * transmit queue configuration. Cf. IEEE 802.11 7.3.2.29.
187 *
188 * @cw_min: minimum contention window [a value of the form
189 *      2^n-1 in the range 1..32767]
190 * @cw_max: maximum contention window [like @cw_min]
191 * @cot: maximum burst time in units of 32 usecs, 0 meaning disabled
192 * @aifsn: arbitration interframe space [0..255]
193 *
194 */
195struct ieee80211_wmm_ac {
196	u16 cw_min;
197	u16 cw_max;
198	u16 cot;
199	u8 aifsn;
200};
201
202struct ieee80211_wmm_rule {
203	struct ieee80211_wmm_ac client[IEEE80211_NUM_ACS];
204	struct ieee80211_wmm_ac ap[IEEE80211_NUM_ACS];
205};
206
207struct ieee80211_reg_rule {
208	struct ieee80211_freq_range freq_range;
209	struct ieee80211_power_rule power_rule;
210	struct ieee80211_wmm_rule wmm_rule;
211	u32 flags;
212	u32 dfs_cac_ms;
213	bool has_wmm;
214	s8 psd;
215};
216
217struct ieee80211_regdomain {
218	struct rcu_head rcu_head;
219	u32 n_reg_rules;
220	char alpha2[3];
221	enum nl80211_dfs_regions dfs_region;
222	struct ieee80211_reg_rule reg_rules[];
223};
224
225#define REG_RULE_EXT(start, end, bw, gain, eirp, dfs_cac, reg_flags)	\
226{									\
227	.freq_range.start_freq_khz = MHZ_TO_KHZ(start),			\
228	.freq_range.end_freq_khz = MHZ_TO_KHZ(end),			\
229	.freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw),			\
230	.power_rule.max_antenna_gain = DBI_TO_MBI(gain),		\
231	.power_rule.max_eirp = DBM_TO_MBM(eirp),			\
232	.flags = reg_flags,						\
233	.dfs_cac_ms = dfs_cac,						\
234}
235
236#define REG_RULE(start, end, bw, gain, eirp, reg_flags) \
237	REG_RULE_EXT(start, end, bw, gain, eirp, 0, reg_flags)
238
239#endif
v6.2
  1
  2#ifndef __NET_REGULATORY_H
  3#define __NET_REGULATORY_H
  4/*
  5 * regulatory support structures
  6 *
  7 * Copyright 2008-2009	Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
  8 * Copyright (C) 2018 Intel Corporation
  9 *
 10 * Permission to use, copy, modify, and/or distribute this software for any
 11 * purpose with or without fee is hereby granted, provided that the above
 12 * copyright notice and this permission notice appear in all copies.
 13 *
 14 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 15 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 16 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 17 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 18 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 19 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 20 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 21 */
 22
 23#include <linux/ieee80211.h>
 24#include <linux/nl80211.h>
 25#include <linux/rcupdate.h>
 26
 27/**
 28 * enum environment_cap - Environment parsed from country IE
 29 * @ENVIRON_ANY: indicates country IE applies to both indoor and
 30 *	outdoor operation.
 31 * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation
 32 * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation
 33 */
 34enum environment_cap {
 35	ENVIRON_ANY,
 36	ENVIRON_INDOOR,
 37	ENVIRON_OUTDOOR,
 38};
 39
 40/**
 41 * struct regulatory_request - used to keep track of regulatory requests
 42 *
 43 * @rcu_head: RCU head struct used to free the request
 44 * @wiphy_idx: this is set if this request's initiator is
 45 *	%REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This
 46 *	can be used by the wireless core to deal with conflicts
 47 *	and potentially inform users of which devices specifically
 48 *	cased the conflicts.
 49 * @initiator: indicates who sent this request, could be any of
 50 *	those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*)
 51 * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested
 52 *	regulatory domain. We have a few special codes:
 53 *	00 - World regulatory domain
 54 *	99 - built by driver but a specific alpha2 cannot be determined
 55 *	98 - result of an intersection between two regulatory domains
 56 *	97 - regulatory domain has not yet been configured
 57 * @dfs_region: If CRDA responded with a regulatory domain that requires
 58 *	DFS master operation on a known DFS region (NL80211_DFS_*),
 59 *	dfs_region represents that region. Drivers can use this and the
 60 *	@alpha2 to adjust their device's DFS parameters as required.
 61 * @user_reg_hint_type: if the @initiator was of type
 62 *	%NL80211_REGDOM_SET_BY_USER, this classifies the type
 63 *	of hint passed. This could be any of the %NL80211_USER_REG_HINT_*
 64 *	types.
 65 * @intersect: indicates whether the wireless core should intersect
 66 *	the requested regulatory domain with the presently set regulatory
 67 *	domain.
 68 * @processed: indicates whether or not this requests has already been
 69 *	processed. When the last request is processed it means that the
 70 *	currently regulatory domain set on cfg80211 is updated from
 71 *	CRDA and can be used by other regulatory requests. When a
 72 *	the last request is not yet processed we must yield until it
 73 *	is processed before processing any new requests.
 74 * @country_ie_checksum: checksum of the last processed and accepted
 75 *	country IE
 76 * @country_ie_env: lets us know if the AP is telling us we are outdoor,
 77 *	indoor, or if it doesn't matter
 78 * @list: used to insert into the reg_requests_list linked list
 79 */
 80struct regulatory_request {
 81	struct rcu_head rcu_head;
 82	int wiphy_idx;
 83	enum nl80211_reg_initiator initiator;
 84	enum nl80211_user_reg_hint_type user_reg_hint_type;
 85	char alpha2[3];
 86	enum nl80211_dfs_regions dfs_region;
 87	bool intersect;
 88	bool processed;
 89	enum environment_cap country_ie_env;
 90	struct list_head list;
 91};
 92
 93/**
 94 * enum ieee80211_regulatory_flags - device regulatory flags
 95 *
 96 * @REGULATORY_CUSTOM_REG: tells us the driver for this device
 97 *	has its own custom regulatory domain and cannot identify the
 98 *	ISO / IEC 3166 alpha2 it belongs to. When this is enabled
 99 *	we will disregard the first regulatory hint (when the
100 *	initiator is %REGDOM_SET_BY_CORE). Drivers that use
101 *	wiphy_apply_custom_regulatory() should have this flag set
102 *	or the regulatory core will set it for the wiphy.
103 *	If you use regulatory_hint() *after* using
104 *	wiphy_apply_custom_regulatory() the wireless core will
105 *	clear the REGULATORY_CUSTOM_REG for your wiphy as it would be
106 *	implied that the device somehow gained knowledge of its region.
107 * @REGULATORY_STRICT_REG: tells us that the wiphy for this device
108 *	has regulatory domain that it wishes to be considered as the
109 *	superset for regulatory rules. After this device gets its regulatory
110 *	domain programmed further regulatory hints shall only be considered
111 *	for this device to enhance regulatory compliance, forcing the
112 *	device to only possibly use subsets of the original regulatory
113 *	rules. For example if channel 13 and 14 are disabled by this
114 *	device's regulatory domain no user specified regulatory hint which
115 *	has these channels enabled would enable them for this wiphy,
116 *	the device's original regulatory domain will be trusted as the
117 *	base. You can program the superset of regulatory rules for this
118 *	wiphy with regulatory_hint() for cards programmed with an
119 *	ISO3166-alpha2 country code. wiphys that use regulatory_hint()
120 *	will have their wiphy->regd programmed once the regulatory
121 *	domain is set, and all other regulatory hints will be ignored
122 *	until their own regulatory domain gets programmed.
123 * @REGULATORY_DISABLE_BEACON_HINTS: enable this if your driver needs to
124 *	ensure that passive scan flags and beaconing flags may not be lifted by
125 *	cfg80211 due to regulatory beacon hints. For more information on beacon
126 *	hints read the documenation for regulatory_hint_found_beacon()
127 * @REGULATORY_COUNTRY_IE_FOLLOW_POWER:  for devices that have a preference
128 *	that even though they may have programmed their own custom power
129 *	setting prior to wiphy registration, they want to ensure their channel
130 *	power settings are updated for this connection with the power settings
131 *	derived from the regulatory domain. The regulatory domain used will be
132 *	based on the ISO3166-alpha2 from country IE provided through
133 *	regulatory_hint_country_ie()
134 * @REGULATORY_COUNTRY_IE_IGNORE: for devices that have a preference to ignore
135 * 	all country IE information processed by the regulatory core. This will
136 * 	override %REGULATORY_COUNTRY_IE_FOLLOW_POWER as all country IEs will
137 * 	be ignored.
138 * @REGULATORY_ENABLE_RELAX_NO_IR: for devices that wish to allow the
139 *      NO_IR relaxation, which enables transmissions on channels on which
140 *      otherwise initiating radiation is not allowed. This will enable the
141 *      relaxations enabled under the CFG80211_REG_RELAX_NO_IR configuration
142 *      option
143 * @REGULATORY_IGNORE_STALE_KICKOFF: the regulatory core will _not_ make sure
144 *	all interfaces on this wiphy reside on allowed channels. If this flag
145 *	is not set, upon a regdomain change, the interfaces are given a grace
146 *	period (currently 60 seconds) to disconnect or move to an allowed
147 *	channel. Interfaces on forbidden channels are forcibly disconnected.
148 *	Currently these types of interfaces are supported for enforcement:
149 *	NL80211_IFTYPE_ADHOC, NL80211_IFTYPE_STATION, NL80211_IFTYPE_AP,
150 *	NL80211_IFTYPE_AP_VLAN, NL80211_IFTYPE_MONITOR,
151 *	NL80211_IFTYPE_P2P_CLIENT, NL80211_IFTYPE_P2P_GO,
152 *	NL80211_IFTYPE_P2P_DEVICE. The flag will be set by default if a device
153 *	includes any modes unsupported for enforcement checking.
154 * @REGULATORY_WIPHY_SELF_MANAGED: for devices that employ wiphy-specific
155 *	regdom management. These devices will ignore all regdom changes not
156 *	originating from their own wiphy.
157 *	A self-managed wiphys only employs regulatory information obtained from
158 *	the FW and driver and does not use other cfg80211 sources like
159 *	beacon-hints, country-code IEs and hints from other devices on the same
160 *	system. Conversely, a self-managed wiphy does not share its regulatory
161 *	hints with other devices in the system. If a system contains several
162 *	devices, one or more of which are self-managed, there might be
163 *	contradictory regulatory settings between them. Usage of flag is
164 *	generally discouraged. Only use it if the FW/driver is incompatible
165 *	with non-locally originated hints.
166 *	This flag is incompatible with the flags: %REGULATORY_CUSTOM_REG,
167 *	%REGULATORY_STRICT_REG, %REGULATORY_COUNTRY_IE_FOLLOW_POWER,
168 *	%REGULATORY_COUNTRY_IE_IGNORE and %REGULATORY_DISABLE_BEACON_HINTS.
169 *	Mixing any of the above flags with this flag will result in a failure
170 *	to register the wiphy. This flag implies
171 *	%REGULATORY_DISABLE_BEACON_HINTS and %REGULATORY_COUNTRY_IE_IGNORE.
172 */
173enum ieee80211_regulatory_flags {
174	REGULATORY_CUSTOM_REG			= BIT(0),
175	REGULATORY_STRICT_REG			= BIT(1),
176	REGULATORY_DISABLE_BEACON_HINTS		= BIT(2),
177	REGULATORY_COUNTRY_IE_FOLLOW_POWER	= BIT(3),
178	REGULATORY_COUNTRY_IE_IGNORE		= BIT(4),
179	REGULATORY_ENABLE_RELAX_NO_IR           = BIT(5),
180	REGULATORY_IGNORE_STALE_KICKOFF         = BIT(6),
181	REGULATORY_WIPHY_SELF_MANAGED		= BIT(7),
182};
183
184struct ieee80211_freq_range {
185	u32 start_freq_khz;
186	u32 end_freq_khz;
187	u32 max_bandwidth_khz;
188};
189
190struct ieee80211_power_rule {
191	u32 max_antenna_gain;
192	u32 max_eirp;
193};
194
195/**
196 * struct ieee80211_wmm_ac - used to store per ac wmm regulatory limitation
197 *
198 * The information provided in this structure is required for QoS
199 * transmit queue configuration. Cf. IEEE 802.11 7.3.2.29.
200 *
201 * @cw_min: minimum contention window [a value of the form
202 *      2^n-1 in the range 1..32767]
203 * @cw_max: maximum contention window [like @cw_min]
204 * @cot: maximum burst time in units of 32 usecs, 0 meaning disabled
205 * @aifsn: arbitration interframe space [0..255]
206 *
207 */
208struct ieee80211_wmm_ac {
209	u16 cw_min;
210	u16 cw_max;
211	u16 cot;
212	u8 aifsn;
213};
214
215struct ieee80211_wmm_rule {
216	struct ieee80211_wmm_ac client[IEEE80211_NUM_ACS];
217	struct ieee80211_wmm_ac ap[IEEE80211_NUM_ACS];
218};
219
220struct ieee80211_reg_rule {
221	struct ieee80211_freq_range freq_range;
222	struct ieee80211_power_rule power_rule;
223	struct ieee80211_wmm_rule wmm_rule;
224	u32 flags;
225	u32 dfs_cac_ms;
226	bool has_wmm;
 
227};
228
229struct ieee80211_regdomain {
230	struct rcu_head rcu_head;
231	u32 n_reg_rules;
232	char alpha2[3];
233	enum nl80211_dfs_regions dfs_region;
234	struct ieee80211_reg_rule reg_rules[];
235};
236
237#define REG_RULE_EXT(start, end, bw, gain, eirp, dfs_cac, reg_flags)	\
238{									\
239	.freq_range.start_freq_khz = MHZ_TO_KHZ(start),			\
240	.freq_range.end_freq_khz = MHZ_TO_KHZ(end),			\
241	.freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw),			\
242	.power_rule.max_antenna_gain = DBI_TO_MBI(gain),		\
243	.power_rule.max_eirp = DBM_TO_MBM(eirp),			\
244	.flags = reg_flags,						\
245	.dfs_cac_ms = dfs_cac,						\
246}
247
248#define REG_RULE(start, end, bw, gain, eirp, reg_flags) \
249	REG_RULE_EXT(start, end, bw, gain, eirp, 0, reg_flags)
250
251#endif