Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 134220
b: refs/heads/master
c: f976376
h: refs/heads/master
v: v3
  • Loading branch information
Luis R. Rodriguez authored and John W. Linville committed Jan 29, 2009
1 parent 55c6918 commit c871478
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 716f9392e2b84cacc18cc11f7427cb98adeb1c3d
refs/heads/master: f976376de0d6a9697fb635369f12ae00251f4566
10 changes: 10 additions & 0 deletions trunk/include/net/wireless.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,15 @@ struct ieee80211_supported_band {
* ISO / IEC 3166 alpha2 it belongs to. When this is enabled
* we will disregard the first regulatory hint (when the
* initiator is %REGDOM_SET_BY_CORE).
* @strict_regulatory: tells us the driver for this device will ignore
* regulatory domain settings until it gets its own regulatory domain
* via its regulatory_hint(). After its gets its own regulatory domain
* it will only allow further regulatory domain settings to further
* enhance compliance. For example if channel 13 and 14 are disabled
* by this regulatory domain no user regulatory domain can enable these
* channels at a later time. This can be used for devices which do not
* have calibration information gauranteed for frequencies or settings
* outside of its regulatory domain.
* @reg_notifier: the driver's regulatory notification callback
* @regd: the driver's regulatory domain, if one was requested via
* the regulatory_hint() API. This can be used by the driver
Expand All @@ -202,6 +211,7 @@ struct wiphy {
u16 interface_modes;

bool custom_regulatory;
bool strict_regulatory;

/* If multiple wiphys are registered and you're handed e.g.
* a regular netdev with assigned ieee80211_ptr, you won't
Expand Down
28 changes: 27 additions & 1 deletion trunk/net/wireless/reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,22 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band,

power_rule = &reg_rule->power_rule;

if (last_request->initiator == REGDOM_SET_BY_DRIVER &&
last_request->wiphy && last_request->wiphy == wiphy &&
last_request->wiphy->strict_regulatory) {
/* This gaurantees the driver's requested regulatory domain
* will always be used as a base for further regulatory
* settings */
chan->flags = chan->orig_flags =
map_regdom_flags(reg_rule->flags);
chan->max_antenna_gain = chan->orig_mag =
(int) MBI_TO_DBI(power_rule->max_antenna_gain);
chan->max_bandwidth = KHZ_TO_MHZ(max_bandwidth);
chan->max_power = chan->orig_mpwr =
(int) MBM_TO_DBM(power_rule->max_eirp);
return;
}

chan->flags = flags | map_regdom_flags(reg_rule->flags);
chan->max_antenna_gain = min(chan->orig_mag,
(int) MBI_TO_DBI(power_rule->max_antenna_gain));
Expand Down Expand Up @@ -897,6 +913,11 @@ static bool ignore_reg_update(struct wiphy *wiphy, enum reg_set_by setby)
if (setby == REGDOM_SET_BY_CORE &&
wiphy->custom_regulatory)
return true;
/* wiphy->regd will be set once the device has its own
* desired regulatory domain set */
if (wiphy->strict_regulatory && !wiphy->regd &&
!is_world_regdom(last_request->alpha2))
return true;
return false;
}

Expand Down Expand Up @@ -1155,10 +1176,15 @@ int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by,

void regulatory_hint(struct wiphy *wiphy, const char *alpha2)
{
int r;
BUG_ON(!alpha2);

mutex_lock(&cfg80211_drv_mutex);
__regulatory_hint(wiphy, REGDOM_SET_BY_DRIVER, alpha2, 0, ENVIRON_ANY);
r = __regulatory_hint(wiphy, REGDOM_SET_BY_DRIVER,
alpha2, 0, ENVIRON_ANY);
/* This is required so that the orig_* parameters are saved */
if (r == -EALREADY && wiphy->strict_regulatory)
wiphy_update_regulatory(wiphy, REGDOM_SET_BY_DRIVER);
mutex_unlock(&cfg80211_drv_mutex);
}
EXPORT_SYMBOL(regulatory_hint);
Expand Down

0 comments on commit c871478

Please sign in to comment.