Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Aug 2011 16:22:42 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r224716 - in head/sys/dev/ath: . ath_dfs/null ath_hal
Message-ID:  <201108081622.p78GMgk5054693@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Mon Aug  8 16:22:42 2011
New Revision: 224716
URL: http://svn.freebsd.org/changeset/base/224716

Log:
  Introduce some more DFS related hooks, inspired both by local work
  and the Atheros reference code.
  
  The radar detection code needs to know what the current DFS domain is.
  Since net80211 doesn't currently know this information, it's extracted
  from the HAL regulatory domain information.
  
  The specifics:
  
  * add a new ath_dfs API hook, ath_dfs_init_radar_filters(), which
    updates the radar filters whenever the regulatory domain changes.
  * add HAL_DFS_DOMAIN which describes the currently configured DFS domain .
  * add a new HAL internal variable which tracks the currently configured
    HAL DFS domain.
  * add a new HAL capability, HAL_CAP_DFS_DMN, which returns the currently
    configured HAL DFS domain setting.
  * update the HAL DFS domain setting whenever the channel setting is
    updated.
  
  Since this isn't currently used by any radar code, these should all
  be no-ops for existing users.
  
  Obtained from:	Atheros
  Submitted by:	KBC Networks, sibridge
  Approved by:	re (kib, blanket)

Modified:
  head/sys/dev/ath/ath_dfs/null/dfs_null.c
  head/sys/dev/ath/ath_hal/ah.c
  head/sys/dev/ath/ath_hal/ah.h
  head/sys/dev/ath/ath_hal/ah_internal.h
  head/sys/dev/ath/ath_hal/ah_regdomain.c
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_athdfs.h

Modified: head/sys/dev/ath/ath_dfs/null/dfs_null.c
==============================================================================
--- head/sys/dev/ath/ath_dfs/null/dfs_null.c	Mon Aug  8 15:42:37 2011	(r224715)
+++ head/sys/dev/ath/ath_dfs/null/dfs_null.c	Mon Aug  8 16:22:42 2011	(r224716)
@@ -226,3 +226,13 @@ ath_dfs_get_thresholds(struct ath_softc 
 	ath_hal_getdfsthresh(sc->sc_ah, param);
 	return 1;
 }
+
+/*
+ * Update the current radar patterns based on the
+ * current operating mode/regulatory domain.
+ */
+int
+ath_dfs_init_radar_filters(struct ath_softc *sc)
+{
+	return 1;
+}

Modified: head/sys/dev/ath/ath_hal/ah.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ah.c	Mon Aug  8 15:42:37 2011	(r224715)
+++ head/sys/dev/ath/ath_hal/ah.c	Mon Aug  8 16:22:42 2011	(r224716)
@@ -522,6 +522,9 @@ ath_hal_getcapability(struct ath_hal *ah
 	case HAL_CAP_REG_DMN:		/* regulatory domain */
 		*result = AH_PRIVATE(ah)->ah_currentRD;
 		return HAL_OK;
+	case HAL_CAP_DFS_DMN:		/* DFS Domain */
+		*result = AH_PRIVATE(ah)->ah_dfsDomain;
+		return HAL_OK;
 	case HAL_CAP_CIPHER:		/* cipher handled in hardware */
 	case HAL_CAP_TKIP_MIC:		/* handle TKIP MIC in hardware */
 		return HAL_ENOTSUPP;

Modified: head/sys/dev/ath/ath_hal/ah.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ah.h	Mon Aug  8 15:42:37 2011	(r224715)
+++ head/sys/dev/ath/ath_hal/ah.h	Mon Aug  8 16:22:42 2011	(r224716)
@@ -735,6 +735,15 @@ typedef struct {
 #define	HAL_PHYERR_PARAM_NOVAL	65535
 #define	HAL_PHYERR_PARAM_ENABLE	0x8000	/* Enable/Disable if applicable */
 
+/*
+ * DFS operating mode flags.
+ */
+typedef enum {
+	HAL_DFS_UNINIT_DOMAIN	= 0,	/* Uninitialized dfs domain */
+	HAL_DFS_FCC_DOMAIN	= 1,	/* FCC3 dfs domain */
+	HAL_DFS_ETSI_DOMAIN	= 2,	/* ETSI dfs domain */
+	HAL_DFS_MKK4_DOMAIN	= 3,	/* Japan dfs domain */
+} HAL_DFS_DOMAIN;
 
 /*
  * Flag for setting QUIET period

Modified: head/sys/dev/ath/ath_hal/ah_internal.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ah_internal.h	Mon Aug  8 15:42:37 2011	(r224715)
+++ head/sys/dev/ath/ath_hal/ah_internal.h	Mon Aug  8 16:22:42 2011	(r224716)
@@ -303,6 +303,7 @@ struct ath_hal_private {
 	 */
 	HAL_REG_DOMAIN	ah_currentRD;		/* EEPROM regulatory domain */
 	HAL_REG_DOMAIN	ah_currentRDext;	/* EEPROM extended regdomain flags */
+	HAL_DFS_DOMAIN	ah_dfsDomain;		/* current DFS domain */
 	HAL_CHANNEL_INTERNAL ah_channels[AH_MAXCHAN]; /* private chan state */
 	u_int		ah_nchan;		/* valid items in ah_channels */
 	const struct regDomain *ah_rd2GHz;	/* reg state for 2G band */

Modified: head/sys/dev/ath/ath_hal/ah_regdomain.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ah_regdomain.c	Mon Aug  8 15:42:37 2011	(r224715)
+++ head/sys/dev/ath/ath_hal/ah_regdomain.c	Mon Aug  8 16:22:42 2011	(r224716)
@@ -687,8 +687,9 @@ ath_hal_init_channels(struct ath_hal *ah
     HAL_BOOL enableExtendedChannels)
 {
 	COUNTRY_CODE_TO_ENUM_RD *country;
-	REG_DOMAIN *rd5GHz, *rd2GHz;
+	REG_DOMAIN *rd5GHz = AH_NULL, *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);
@@ -702,6 +703,18 @@ ath_hal_init_channels(struct ath_hal *ah
 		    __func__, ah->ah_countryCode);
 	} 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;
 }
 

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c	Mon Aug  8 15:42:37 2011	(r224715)
+++ head/sys/dev/ath/if_ath.c	Mon Aug  8 16:22:42 2011	(r224716)
@@ -5031,6 +5031,13 @@ ath_setregdomain(struct ieee80211com *ic
 		    __func__, status);
 		return EINVAL;		/* XXX */
 	}
+
+	/*
+	 * Setting country code might change the DFS domain
+	 * so initialize the DFS Radar filters
+	 */
+	ath_dfs_init_radar_filters(sc);
+
 	return 0;
 }
 

Modified: head/sys/dev/ath/if_athdfs.h
==============================================================================
--- head/sys/dev/ath/if_athdfs.h	Mon Aug  8 15:42:37 2011	(r224715)
+++ head/sys/dev/ath/if_athdfs.h	Mon Aug  8 16:22:42 2011	(r224716)
@@ -42,6 +42,8 @@ extern	int ath_dfs_process_radar_event(s
 extern	int ath_dfs_tasklet_needed(struct ath_softc *sc,
     struct ieee80211_channel *chan);
 extern	int ath_ioctl_phyerr(struct ath_softc *sc, struct ath_diag *ad);
-extern	int ath_dfs_get_thresholds(struct ath_softc *sc, HAL_PHYERR_PARAM *param);
+extern	int ath_dfs_get_thresholds(struct ath_softc *sc,
+    HAL_PHYERR_PARAM *param);
+extern	int ath_dfs_init_radar_filters(struct ath_softc *sc);
 
 #endif	/* __IF_ATHDFS_H__ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201108081622.p78GMgk5054693>