summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2011-08-08 17:33:35 +0000
committeradrian <adrian@FreeBSD.org>2011-08-08 17:33:35 +0000
commit2abb24d34f7b38304b4f85fd62f29b87a984577a (patch)
treec1b795ce3f0b5d10b575f0bf3e3bca1b4f95b3c6
parent085afcf6e35860a85a0c26fa2b4c69d346879ce9 (diff)
downloadFreeBSD-src-2abb24d34f7b38304b4f85fd62f29b87a984577a.zip
FreeBSD-src-2abb24d34f7b38304b4f85fd62f29b87a984577a.tar.gz
The older HAL code sets up the regulatory domain once; FreeBSD/net80211
allows it to be overridden at runtime. Thus, add a function which updates ah_dfsDomain after a channel set call to ath_hal_set_channels(). Approved by: re (kib, blanket)
-rw-r--r--sys/dev/ath/ath_hal/ah_regdomain.c55
1 files changed, 42 insertions, 13 deletions
diff --git a/sys/dev/ath/ath_hal/ah_regdomain.c b/sys/dev/ath/ath_hal/ah_regdomain.c
index 21bd2c8..64e11ca 100644
--- a/sys/dev/ath/ath_hal/ah_regdomain.c
+++ b/sys/dev/ath/ath_hal/ah_regdomain.c
@@ -125,6 +125,8 @@ static const struct cmode modes[] = {
IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D },
};
+static void ath_hal_update_dfsdomain(struct ath_hal *ah);
+
static OS_INLINE uint16_t
getEepromRD(struct ath_hal *ah)
{
@@ -687,9 +689,8 @@ ath_hal_init_channels(struct ath_hal *ah,
HAL_BOOL enableExtendedChannels)
{
COUNTRY_CODE_TO_ENUM_RD *country;
- REG_DOMAIN *rd5GHz = AH_NULL, *rd2GHz;
+ REG_DOMAIN *rd5GHz, *rd2GHz;
HAL_STATUS status;
- HAL_DFS_DOMAIN dfsDomain = HAL_DFS_UNINIT_DOMAIN;
status = getchannels(ah, chans, maxchans, nchans, modeSelect,
cc, regDmn, enableExtendedChannels, &country, &rd2GHz, &rd5GHz);
@@ -701,20 +702,12 @@ ath_hal_init_channels(struct ath_hal *ah,
ah->ah_countryCode = country->countryCode;
HALDEBUG(ah, HAL_DEBUG_REGDOMAIN, "%s: cc %u\n",
__func__, ah->ah_countryCode);
+
+ /* Update current DFS domain */
+ ath_hal_update_dfsdomain(ah);
} else
status = HAL_EINVAL;
- /* Update the DFS setting for the current regulatory domain */
- if (status == HAL_OK && rd5GHz != AH_NULL) {
- if (rd5GHz->dfsMask & DFS_FCC3)
- dfsDomain = HAL_DFS_FCC_DOMAIN;
- if (rd5GHz->dfsMask & DFS_ETSI)
- dfsDomain = HAL_DFS_ETSI_DOMAIN;
- if (rd5GHz->dfsMask & DFS_MKK4)
- dfsDomain = HAL_DFS_MKK4_DOMAIN;
- }
- AH_PRIVATE(ah)->ah_dfsDomain = dfsDomain;
-
return status;
}
@@ -759,6 +752,11 @@ ath_hal_set_channels(struct ath_hal *ah,
__func__, ah->ah_countryCode);
} else
status = HAL_EINVAL;
+
+ if (status == HAL_OK) {
+ /* Update current DFS domain */
+ (void) ath_hal_update_dfsdomain(ah);
+ }
return status;
}
@@ -824,6 +822,37 @@ ath_hal_getctl(struct ath_hal *ah, const struct ieee80211_channel *c)
return ctl;
}
+
+/*
+ * Update the current dfsDomain setting based on the given
+ * country code.
+ *
+ * Since FreeBSD/net80211 allows the channel set to change
+ * after the card has been setup (via ath_hal_init_channels())
+ * this function method is needed to update ah_dfsDomain.
+ */
+void
+ath_hal_update_dfsdomain(struct ath_hal *ah)
+{
+ const REG_DOMAIN *rd5GHz = AH_PRIVATE(ah)->ah_rd5GHz;
+ HAL_CTRY_CODE cc = ah->ah_countryCode;
+ HAL_DFS_DOMAIN dfsDomain = HAL_DFS_UNINIT_DOMAIN;
+ HAL_REG_DOMAIN regDmn = AH_PRIVATE(ah)->ah_currentRD;
+
+ HALDEBUG(ah, HAL_DEBUG_REGDOMAIN, "%s CC: %d, RegDmn: %d\n",__func__,
+ cc, regDmn);
+ if (rd5GHz->dfsMask & DFS_FCC3)
+ dfsDomain = HAL_DFS_FCC_DOMAIN;
+ if (rd5GHz->dfsMask & DFS_ETSI)
+ dfsDomain = HAL_DFS_ETSI_DOMAIN;
+ if (rd5GHz->dfsMask & DFS_MKK4)
+ dfsDomain = HAL_DFS_MKK4_DOMAIN;
+ AH_PRIVATE(ah)->ah_dfsDomain = dfsDomain;
+ HALDEBUG(ah, HAL_DEBUG_REGDOMAIN, "%s ah_dfsDomain: %d\n",
+ __func__, AH_PRIVATE(ah)->ah_dfsDomain);
+}
+
+
/*
* Return the max allowed antenna gain and apply any regulatory
* domain specific changes.
OpenPOWER on IntegriCloud