void ath_ar_enable(struct ath_softc *sc) { struct ath_dfs *dfs=sc->sc_dfs; struct dfs_ar_state *ar; HAL_CHANNEL *chan= &sc->sc_curchan; HAL_PHYERR_PARAM pe; u_int32_t rfilt=0; if (dfs == NULL) { DFS_DPRINTK(sc, ATH_DEBUG_DFS, "%s: sc_dfs is NULL\n", __func__); return; } ar = (struct dfs_ar_state *) &dfs->dfs_ar_state; if (dfs->dfs_proc_phyerr & (DFS_RADAR_EN | DFS_AR_EN)) { if ((chan->channel_flags & CHANNEL_108G) == CHANNEL_108G) { /* We are in turbo G, so enable AR */ DFS_DPRINTK(sc, ATH_DEBUG_DFS, "%s: Enabling AR\n", __func__); dfs_reset_ar(sc); ar->ar_radarrssi = DFS_AR_RADAR_RSSI_THR; rfilt = ath_hal_getrxfilter(sc->sc_ah); pe.pe_firpwr = HAL_PHYERR_PARAM_NOVAL; pe.pe_height = HAL_PHYERR_PARAM_NOVAL; pe.pe_prssi = HAL_PHYERR_PARAM_NOVAL; pe.pe_inband = HAL_PHYERR_PARAM_NOVAL; pe.pe_relpwr = HAL_PHYERR_PARAM_NOVAL; pe.pe_maxlen = HAL_PHYERR_PARAM_NOVAL; pe.pe_relstep = HAL_PHYERR_PARAM_NOVAL; pe.pe_usefir128 = 0; pe.pe_blockradar = 0; pe.pe_enmaxrssi = 0; pe.pe_rrssi = ar->ar_radarrssi; ath_hal_enabledfs(sc->sc_ah, &pe); /* Enable strong signal fast antenna diversity since accurate * 1-2us radar * detection is not important for AR anyways. */ ath_hal_setcapability(sc->sc_ah, HAL_CAP_DIVERSITY, HAL_CAP_STRONG_DIV, dfs->dfs_rinfo.rn_fastdivGCval, NULL); rfilt |= HAL_RX_FILTER_PHYRADAR; ath_hal_setrxfilter(sc->sc_ah, rfilt); } } else { DFS_DPRINTK(sc, ATH_DEBUG_DFS, "%s: Disabling AR\n", __func__); rfilt = ath_hal_getrxfilter(sc->sc_ah); rfilt &= ~HAL_RX_FILTER_PHYRADAR; ath_hal_setrxfilter(sc->sc_ah,rfilt); /* Enable strong signal fast antenna diversity */ ath_hal_setcapability(sc->sc_ah, HAL_CAP_DIVERSITY, HAL_CAP_STRONG_DIV, dfs->dfs_rinfo.rn_fastdivGCval, NULL); } }
/* * Enable radar check. Return 1 if the driver should * enable radar PHY errors, or 0 if not. */ int ath_dfs_radar_enable(struct ath_softc *sc, struct ieee80211_channel *chan) { #if 0 HAL_PHYERR_PARAM pe; /* Check if the hardware supports radar reporting */ /* XXX TODO: migrate HAL_CAP_RADAR/HAL_CAP_AR to somewhere public! */ if (ath_hal_getcapability(sc->sc_ah, HAL_CAP_PHYDIAG, 0, NULL) != HAL_OK) return (0); /* Check if the current channel is radar-enabled */ if (! IEEE80211_IS_CHAN_DFS(chan)) return (0); /* Fetch the default parameters */ memset(&pe, '\0', sizeof(pe)); if (! ath_hal_getdfsdefaultthresh(sc->sc_ah, &pe)) return (0); /* Enable radar PHY error reporting */ sc->sc_dodfs = 1; /* Tell the hardware to enable radar reporting */ pe.pe_enabled = 1; /* Flip on extension channel events only if doing HT40 */ if (IEEE80211_IS_CHAN_HT40(chan)) pe.pe_extchannel = 1; else pe.pe_extchannel = 0; ath_hal_enabledfs(sc->sc_ah, &pe); /* * Disable strong signal fast diversity - needed for * AR5212 and similar PHYs for reliable short pulse * duration. */ (void) ath_hal_setcapability(sc->sc_ah, HAL_CAP_DIVERSITY, 2, 0, NULL); return (1); #else return (0); #endif }
void ath_ar_disable(struct ath_softc *sc) { u_int32_t rfilt; HAL_CHANNEL *chan=&sc->sc_curchan; struct ath_dfs *dfs=sc->sc_dfs; if (dfs == NULL) { DFS_DPRINTK(sc, ATH_DEBUG_DFS, "%s: sc_dfs is NULL\n", __func__); return; } if ((chan->channel_flags & CHANNEL_108G) == CHANNEL_108G) { /* Enable strong signal fast antenna diversity */ ath_hal_setcapability(sc->sc_ah, HAL_CAP_DIVERSITY, HAL_CAP_STRONG_DIV, dfs->dfs_rinfo.rn_fastdivGCval, NULL); rfilt = ath_hal_getrxfilter(sc->sc_ah); rfilt &= ~HAL_RX_FILTER_PHYERR; ath_hal_setrxfilter(sc->sc_ah, rfilt); dfs_reset_ar(sc); dfs_reset_arq(sc); } }
/* * This is called each time a channel change occurs, to (potentially) enable * the radar code. */ int dfs_radar_enable(struct ieee80211com *ic, struct ath_dfs_radar_tab_info *radar_info, int no_cac) { int is_ext_ch=IEEE80211_IS_CHAN_11N_HT40(ic->ic_curchan); int is_fastclk = 0; //u_int32_t rfilt; struct ath_dfs *dfs=(struct ath_dfs *)ic->ic_dfs; struct ieee80211_channel *chan=ic->ic_curchan, *ext_ch = NULL; if (dfs == NULL) { DFS_DPRINTK(dfs, ATH_DEBUG_DFS, "%s: ic_dfs is NULL\n", __func__); return -EIO; } ic->ic_dfs_disable(ic, no_cac); /* * Setting country code might change the DFS domain * so initialize the DFS Radar filters */ dfs_init_radar_filters(ic, radar_info); #if ATH_SUPPORT_DFS && ATH_SUPPORT_STA_DFS if ((ic->ic_opmode == IEEE80211_M_HOSTAP || ic->ic_opmode == IEEE80211_M_IBSS || (ic->ic_opmode == IEEE80211_M_STA && ieee80211com_has_cap_ext(dfs->ic,IEEE80211_CEXT_STADFS)))) { #else if ((ic->ic_opmode == IEEE80211_M_HOSTAP || ic->ic_opmode == IEEE80211_M_IBSS)) { #endif if (IEEE80211_IS_CHAN_DFS(chan)) { struct dfs_state *rs_pri=NULL, *rs_ext=NULL; u_int8_t index_pri, index_ext; #ifdef ATH_ENABLE_AR dfs->dfs_proc_phyerr |= DFS_AR_EN; #endif dfs->dfs_proc_phyerr |= DFS_RADAR_EN; //printk( "%s[%d]: ==== 0x%08x\n", __func__, __LINE__, dfs->dfs_proc_phyerr); if (is_ext_ch) { ext_ch = ieee80211_get_extchan(ic); } dfs_reset_alldelaylines(dfs); rs_pri = dfs_getchanstate(dfs, &index_pri, 0); if (ext_ch) { rs_ext = dfs_getchanstate(dfs, &index_ext, 1); } if (rs_pri != NULL && ((ext_ch==NULL)||(rs_ext != NULL))) { struct ath_dfs_phyerr_param pe; OS_MEMSET(&pe, '\0', sizeof(pe)); if (index_pri != dfs->dfs_curchan_radindex) dfs_reset_alldelaylines(dfs); dfs->dfs_curchan_radindex = (int16_t) index_pri; if (rs_ext) dfs->dfs_extchan_radindex = (int16_t) index_ext; ath_dfs_phyerr_param_copy(&pe, &rs_pri->rs_param); DFS_DPRINTK(dfs, ATH_DEBUG_DFS3, "%s: firpwr=%d, rssi=%d, height=%d, " "prssi=%d, inband=%d, relpwr=%d, " "relstep=%d, maxlen=%d\n", __func__, pe.pe_firpwr, pe.pe_rrssi, pe.pe_height, pe.pe_prssi, pe.pe_inband, pe.pe_relpwr, pe.pe_relstep, pe.pe_maxlen ); #if 0 //Not needed /* Disable strong signal fast antenna diversity */ ath_hal_setcapability(ah, HAL_CAP_DIVERSITY, HAL_CAP_STRONG_DIV, 1, NULL); #endif ic->ic_dfs_enable(ic, &is_fastclk, &pe); DFS_DPRINTK(dfs, ATH_DEBUG_DFS, "Enabled radar detection on channel %d\n", chan->ic_freq); dfs->dur_multiplier = is_fastclk ? DFS_FAST_CLOCK_MULTIPLIER : DFS_NO_FAST_CLOCK_MULTIPLIER; DFS_DPRINTK(dfs, ATH_DEBUG_DFS3, "%s: duration multiplier is %d\n", __func__, dfs->dur_multiplier); } else DFS_DPRINTK(dfs, ATH_DEBUG_DFS, "%s: No more radar states left\n", __func__); } } return 0; } int dfs_control(struct ieee80211com *ic, u_int id, void *indata, u_int32_t insize, void *outdata, u_int32_t *outsize) { int error = 0; struct ath_dfs_phyerr_param peout; struct ath_dfs *dfs = (struct ath_dfs *)ic->ic_dfs; struct dfs_ioctl_params *dfsparams; u_int32_t val=0; #ifndef ATH_DFS_RADAR_DETECTION_ONLY struct dfsreq_nolinfo *nol; u_int32_t *data = NULL; #endif /* ATH_DFS_RADAR_DETECTION_ONLY */ int i; if (dfs == NULL) { DFS_DPRINTK(dfs, ATH_DEBUG_DFS1, "%s DFS is null\n", __func__); /* Enable/Disable DFS can be done prior to attach, So handle here */ switch (id) { case DFS_DISABLE_DETECT: ic->ic_dfs_state.ignore_dfs = 1; DFS_PRINTK("%s enable detects, ignore_dfs %d\n", __func__, ic->ic_dfs_state.ignore_dfs ? 1:0); break; case DFS_ENABLE_DETECT: ic->ic_dfs_state.ignore_dfs = 0; DFS_PRINTK("%s enable detects, ignore_dfs %d\n", __func__, ic->ic_dfs_state.ignore_dfs ? 1:0); break; default: error = -EINVAL; break; } goto bad; } //printk("%s[%d] id =%d\n", __func__, __LINE__, id); switch (id) { case DFS_SET_THRESH: if (insize < sizeof(struct dfs_ioctl_params) || !indata) { DFS_DPRINTK(dfs, ATH_DEBUG_DFS1, "%s: insize=%d, expected=%d bytes, indata=%p\n", __func__, insize, sizeof(struct dfs_ioctl_params), indata); error = -EINVAL; break; } dfsparams = (struct dfs_ioctl_params *) indata; if (!dfs_set_thresholds(ic, DFS_PARAM_FIRPWR, dfsparams->dfs_firpwr)) error = -EINVAL; if (!dfs_set_thresholds(ic, DFS_PARAM_RRSSI, dfsparams->dfs_rrssi)) error = -EINVAL; if (!dfs_set_thresholds(ic, DFS_PARAM_HEIGHT, dfsparams->dfs_height)) error = -EINVAL; if (!dfs_set_thresholds(ic, DFS_PARAM_PRSSI, dfsparams->dfs_prssi)) error = -EINVAL; if (!dfs_set_thresholds(ic, DFS_PARAM_INBAND, dfsparams->dfs_inband)) error = -EINVAL; /* 5413 speicfic */ if (!dfs_set_thresholds(ic, DFS_PARAM_RELPWR, dfsparams->dfs_relpwr)) error = -EINVAL; if (!dfs_set_thresholds(ic, DFS_PARAM_RELSTEP, dfsparams->dfs_relstep)) error = -EINVAL; if (!dfs_set_thresholds(ic, DFS_PARAM_MAXLEN, dfsparams->dfs_maxlen)) error = -EINVAL; break; case DFS_GET_THRESH: if (!outdata || !outsize || *outsize <sizeof(struct dfs_ioctl_params)) { error = -EINVAL; break; } *outsize = sizeof(struct dfs_ioctl_params); dfsparams = (struct dfs_ioctl_params *) outdata; /* * Fetch the DFS thresholds using the internal representation. */ (void) dfs_get_thresholds(ic, &peout); /* * Convert them to the dfs IOCTL representation. */ ath_dfs_dfsparam_to_ioctlparam(&peout, dfsparams); break; case DFS_RADARDETECTS: if (!outdata || !outsize || *outsize < sizeof(u_int32_t)) { error = -EINVAL; break; } *outsize = sizeof (u_int32_t); *((u_int32_t *)outdata) = dfs->ath_dfs_stats.num_radar_detects; break; case DFS_DISABLE_DETECT: dfs->dfs_proc_phyerr &= ~DFS_RADAR_EN; dfs->ic->ic_dfs_state.ignore_dfs = 1; DFS_PRINTK("%s enable detects, ignore_dfs %d\n", __func__, dfs->ic->ic_dfs_state.ignore_dfs ? 1:0); break; case DFS_ENABLE_DETECT: dfs->dfs_proc_phyerr |= DFS_RADAR_EN; dfs->ic->ic_dfs_state.ignore_dfs = 0; DFS_PRINTK("%s enable detects, ignore_dfs %d\n", __func__, dfs->ic->ic_dfs_state.ignore_dfs ? 1:0); break; case DFS_DISABLE_FFT: //UMACDFS: TODO: val = ath_hal_dfs_config_fft(sc->sc_ah, false); DFS_PRINTK("%s TODO disable FFT val=0x%x \n", __func__, val); break; case DFS_ENABLE_FFT: //UMACDFS TODO: val = ath_hal_dfs_config_fft(sc->sc_ah, true); DFS_PRINTK("%s TODO enable FFT val=0x%x \n", __func__, val); break; case DFS_SET_DEBUG_LEVEL: if (insize < sizeof(u_int32_t) || !indata) { error = -EINVAL; break; } dfs->dfs_debug_mask= *(u_int32_t *)indata; DFS_PRINTK("%s debug level now = 0x%x \n", __func__, dfs->dfs_debug_mask); if (dfs->dfs_debug_mask & ATH_DEBUG_DFS3) { /* Enable debug Radar Event */ dfs->dfs_event_log_on = 1; } else { dfs->dfs_event_log_on = 0; } break; case DFS_SET_FALSE_RSSI_THRES: if (insize < sizeof(u_int32_t) || !indata) { error = -EINVAL; break; } dfs->ath_dfs_false_rssi_thres= *(u_int32_t *)indata; DFS_PRINTK("%s false RSSI threshold now = 0x%x \n", __func__, dfs->ath_dfs_false_rssi_thres); break; case DFS_SET_PEAK_MAG: if (insize < sizeof(u_int32_t) || !indata) { error = -EINVAL; break; } dfs->ath_dfs_peak_mag= *(u_int32_t *)indata; DFS_PRINTK("%s peak_mag now = 0x%x \n", __func__, dfs->ath_dfs_peak_mag); break; case DFS_GET_CAC_VALID_TIME: if (!outdata || !outsize || *outsize < sizeof(u_int32_t)) { error = -EINVAL; break; } *outsize = sizeof (u_int32_t); *((u_int32_t *)outdata) = dfs->ic->ic_dfs_state.cac_valid_time; break; case DFS_SET_CAC_VALID_TIME: if (insize < sizeof(u_int32_t) || !indata) { error = -EINVAL; break; } dfs->ic->ic_dfs_state.cac_valid_time = *(u_int32_t *)indata; DFS_PRINTK("%s dfs timeout = %d \n", __func__, dfs->ic->ic_dfs_state.cac_valid_time); break; case DFS_IGNORE_CAC: if (insize < sizeof(u_int32_t) || !indata) { error = -EINVAL; break; } if (*(u_int32_t *)indata) { dfs->ic->ic_dfs_state.ignore_cac= 1; } else { dfs->ic->ic_dfs_state.ignore_cac= 0; } DFS_PRINTK("%s ignore cac = 0x%x \n", __func__, dfs->ic->ic_dfs_state.ignore_cac); break; case DFS_SET_NOL_TIMEOUT: if (insize < sizeof(u_int32_t) || !indata) { error = -EINVAL; break; } if (*(int *)indata) { dfs->ath_dfs_nol_timeout= *(int *)indata; } else { dfs->ath_dfs_nol_timeout= DFS_NOL_TIMEOUT_S; } DFS_PRINTK("%s nol timeout = %d sec \n", __func__, dfs->ath_dfs_nol_timeout); break; #ifndef ATH_DFS_RADAR_DETECTION_ONLY case DFS_MUTE_TIME: if (insize < sizeof(u_int32_t) || !indata) { error = -EINVAL; break; } data = (u_int32_t *) indata; dfs->ath_dfstesttime = *data; dfs->ath_dfstesttime *= (1000); //convert sec into ms break; case DFS_GET_USENOL: if (!outdata || !outsize || *outsize < sizeof(u_int32_t)) { error = -EINVAL; break; } *outsize = sizeof(u_int32_t); *((u_int32_t *)outdata) = dfs->dfs_rinfo.rn_use_nol; printk("%s:#Phyerr=%d, #false detect=%d, #queued=%d\n", __func__,dfs->dfs_phyerr_count, dfs->dfs_phyerr_reject_count, dfs->dfs_phyerr_queued_count); printk("%s:dfs_phyerr_freq_min=%d, dfs_phyerr_freq_max=%d\n", __func__,dfs->dfs_phyerr_freq_min, dfs->dfs_phyerr_freq_max); printk("%s:Total radar events detected=%d, entries in the radar queue follows:\n", __func__,dfs->dfs_event_log_count); for (i = 0; (i < DFS_EVENT_LOG_SIZE) && (i < dfs->dfs_event_log_count); i++) { //DFS_DPRINTK(sc, ATH_DEBUG_DFS,"ts=%llu diff_ts=%u rssi=%u dur=%u\n", dfs->radar_log[i].ts, dfs->radar_log[i].diff_ts, dfs->radar_log[i].rssi, dfs->radar_log[i].dur); printk("ts=%llu diff_ts=%u rssi=%u dur=%u\n", dfs->radar_log[i].ts, dfs->radar_log[i].diff_ts, dfs->radar_log[i].rssi, dfs->radar_log[i].dur); } dfs->dfs_event_log_count = 0; dfs->dfs_phyerr_count = 0; dfs->dfs_phyerr_reject_count = 0; dfs->dfs_phyerr_queued_count = 0; dfs->dfs_phyerr_freq_min = 0x7fffffff; dfs->dfs_phyerr_freq_max = 0; break; case DFS_SET_USENOL: if (insize < sizeof(u_int32_t) || !indata) { error = -EINVAL; break; } dfs->dfs_rinfo.rn_use_nol = *(u_int32_t *)indata; /* iwpriv markdfs in linux can do the same thing... */ break; case DFS_GET_NOL: if (!outdata || !outsize || *outsize < sizeof(struct dfsreq_nolinfo)) { error = -EINVAL; break; } *outsize = sizeof(struct dfsreq_nolinfo); nol = (struct dfsreq_nolinfo *)outdata; dfs_get_nol(dfs, (struct dfsreq_nolelem *)nol->dfs_nol, &nol->ic_nchans); dfs_print_nol(dfs); break; case DFS_SET_NOL: if (insize < sizeof(struct dfsreq_nolinfo) || !indata) { error = -EINVAL; break; } nol = (struct dfsreq_nolinfo *) indata; dfs_set_nol(dfs, (struct dfsreq_nolelem *)nol->dfs_nol, nol->ic_nchans); break; case DFS_SHOW_NOL: dfs_print_nol(dfs); break; #if ATH_SUPPORT_DFS && ATH_SUPPORT_STA_DFS case DFS_SHOW_NOLHISTORY: dfs_print_nolhistory(ic,dfs); break; #endif case DFS_BANGRADAR: #if 0 //MERGE_TBD if(sc->sc_nostabeacons) { printk("No radar detection Enabled \n"); break; } #endif dfs->dfs_bangradar = 1; dfs->ath_radar_tasksched = 1; OS_SET_TIMER(&dfs->ath_dfs_task_timer, 0); break; #endif /* ATH_DFS_RADAR_DETECTION_ONLY */ default: error = -EINVAL; } bad: return error; }
void ath_phyerr_enable(struct ath_softc *sc, struct ieee80211_channel *chan) { u_int32_t rfilt; struct ieee80211com *ic = &sc->sc_ic; u_int32_t index; struct ath_phyerr_state *pe; enum ieee80211_phymode mode; pe = (struct ath_phyerr_state *) sc->sc_phyerr_state; mode = ieee80211_chan2mode(ic, chan); if ((sc->sc_phyerr_cap & (ATH_RADAR_AR_EN | ATH_RADAR_EN)) && (ic->ic_opmode == IEEE80211_M_HOSTAP) && ((mode == IEEE80211_MODE_11A) || (mode == IEEE80211_MODE_TURBO_A) || (mode == IEEE80211_MODE_TURBO_G))) { if (mode == IEEE80211_MODE_TURBO_G) { /* We are in turbo G, so enable AR*/ index = get_radar_chan_index(sc); pe->pe_curRadar = &pe->pe_radarState[index]; ath_reset_ar(sc); pe->pe_curRadar->rad_radarRssi = ATH_AR_RADAR_RSSI_THR; ath_hal_setcapability(sc->sc_ah, HAL_CAP_PHYDIAG, HAL_CAP_RADAR_RRSSI, pe->pe_curRadar->rad_radarRssi, NULL); } else { ath_reset_radar(sc); index = get_radar_chan_index(sc); pe->pe_curRadar = &pe->pe_radarState[index]; pe->pe_curRadar->rad_firpwr = ATH_RADAR_FIRPWR; ath_hal_setcapability(sc->sc_ah, HAL_CAP_PHYDIAG, HAL_CAP_RADAR_FIRPWR, (u_int32_t) pe->pe_curRadar->rad_firpwr, NULL); /* XXX - need to Set firpwr */ pe->pe_curRadar->rad_radarRssi = ATH_RADAR_RRSSI; ath_hal_setcapability(sc->sc_ah, HAL_CAP_PHYDIAG, HAL_CAP_RADAR_RRSSI, pe->pe_curRadar->rad_radarRssi, NULL); pe->pe_curRadar->rad_height = ATH_RADAR_HEIGHT; ath_hal_setcapability(sc->sc_ah, HAL_CAP_PHYDIAG, HAL_CAP_RADAR_HEIGHT, pe->pe_curRadar->rad_height, NULL); pe->pe_curRadar->rad_pulseRssi = ATH_RADAR_PRSSI; ath_hal_setcapability(sc->sc_ah, HAL_CAP_PHYDIAG, HAL_CAP_RADAR_PRSSI, pe->pe_curRadar->rad_pulseRssi, NULL); pe->pe_curRadar->rad_inband = ATH_RADAR_INBAND; ath_hal_setcapability(sc->sc_ah, HAL_CAP_PHYDIAG, HAL_CAP_RADAR_INBAND, pe->pe_curRadar->rad_inband, NULL); } rfilt = ath_hal_getrxfilter(sc->sc_ah); rfilt |= HAL_RX_FILTER_PHYRADAR; ath_hal_setrxfilter(sc->sc_ah,rfilt); ath_hal_enablePhyDiag(sc->sc_ah); } else { rfilt = ath_hal_getrxfilter(sc->sc_ah); rfilt &= ~HAL_RX_FILTER_PHYRADAR; ath_hal_setrxfilter(sc->sc_ah,rfilt); } }
int dfs_radar_enable(struct ath_softc *sc) { struct ath_dfs *dfs=sc->sc_dfs; u_int32_t rfilt; HAL_CHANNEL *chan=&sc->sc_curchan; struct ath_hal *ah = sc->sc_ah; HAL_CHANNEL *ext_ch=ath_hal_get_extension_channel(ah); if (dfs == NULL) { DFS_DPRINTK(sc, ATH_DEBUG_DFS, "%s: sc_dfs is NULL\n", __func__); return -EIO; } rfilt = ath_hal_getrxfilter(ah); if ((dfs->dfs_proc_phyerr & (DFS_RADAR_EN | DFS_AR_EN)) && (sc->sc_opmode == HAL_M_HOSTAP || sc->sc_opmode == HAL_M_IBSS)) { if (chan->privFlags & CHANNEL_DFS) { struct dfs_state *rs_pri=NULL, *rs_ext=NULL; u_int8_t index_pri, index_ext; HAL_PHYERR_PARAM pe; dfs->sc_dfs_cac_time = ATH_DFS_WAIT_MS; if (dfs->dfsdomain == DFS_ETSI_DOMAIN) { if(IS_CHANNEL_WEATHER_RADAR(chan->channel)) { dfs->sc_dfs_cac_time = ATH_DFS_WEATHER_CHANNEL_WAIT_MS; } else { if (ext_ch && IS_CHANNEL_WEATHER_RADAR(ext_ch->channel)) { dfs->sc_dfs_cac_time = ATH_DFS_WEATHER_CHANNEL_WAIT_MS; } } } if(dfs->sc_dfs_cac_time != ATH_DFS_WAIT_MS) printk("WARNING!!! 10 minute CAC period as channel is a weather radar channel\n"); /* Disable radar detection in case we need to setup * a new channel state and radars are somehow being * reported. Avoids locking problem. */ rfilt = ath_hal_getrxfilter(ah); rfilt &= ~HAL_RX_FILTER_PHYRADAR; ath_hal_setrxfilter(ah, rfilt); /* Enable strong signal fast antenna diversity */ ath_hal_setcapability(ah, HAL_CAP_DIVERSITY, HAL_CAP_STRONG_DIV, dfs->dfs_rinfo.rn_fastdivGCval, NULL); dfs_reset_alldelaylines(sc); rs_pri = dfs_getchanstate(sc, &index_pri, 0); if (ext_ch) { rs_ext = dfs_getchanstate(sc, &index_ext, 1); sc->sc_extchan = *ext_ch; } if (rs_pri != NULL && ((ext_ch==NULL)||(rs_ext != NULL))) { if (index_pri != dfs->dfs_curchan_radindex) dfs_reset_alldelaylines(sc); dfs->dfs_curchan_radindex = (int16_t) index_pri; if (rs_ext) dfs->dfs_extchan_radindex = (int16_t) index_ext; pe.pe_firpwr = rs_pri->rs_firpwr; pe.pe_rrssi = rs_pri->rs_radarrssi; pe.pe_height = rs_pri->rs_height; pe.pe_prssi = rs_pri->rs_pulserssi; pe.pe_inband = rs_pri->rs_inband; /* 5413 specific */ pe.pe_relpwr = rs_pri->rs_relpwr; pe.pe_relstep = rs_pri->rs_relstep; pe.pe_maxlen = rs_pri->rs_maxlen; /* Disable strong signal fast antenna diversity */ ath_hal_setcapability(ah, HAL_CAP_DIVERSITY, HAL_CAP_STRONG_DIV, 1, NULL); ath_hal_enabledfs(sc->sc_ah, &pe); rfilt |= HAL_RX_FILTER_PHYRADAR; ath_hal_setrxfilter(ah, rfilt); DFS_DPRINTK(sc, ATH_DEBUG_DFS, "Enabled radar detection on channel %d\n", chan->channel); dfs->dur_multiplier = (ath_hal_is_fast_clock_enabled(sc->sc_ah) ? (DFS_FAST_CLOCK_MULTIPLIER) : (DFS_NO_FAST_CLOCK_MULTIPLIER)); DFS_DPRINTK(sc, ATH_DEBUG_DFS3, "%s: duration multiplier is %d\n", __func__, dfs->dur_multiplier); /* * Fast antenna diversity for strong signals disturbs * radar detection of 1-2us pusles. Enable fast diveristy * but disable the strong signal aspect of it */ if (ath_hal_getcapability(ah, HAL_CAP_DIVERSITY, 1, NULL) == HAL_OK) { ath_hal_setcapability(ah, HAL_CAP_DIVERSITY, HAL_CAP_STRONG_DIV, 0, NULL); } } else DFS_DPRINTK(sc, ATH_DEBUG_DFS, "%s: No more radar states left\n", __func__); } else { if (!(chan->channelFlags & CHANNEL_2GHZ)) { /* Enable strong signal fast antenna diversity */ ath_hal_setcapability(ah, HAL_CAP_DIVERSITY, HAL_CAP_STRONG_DIV, dfs->dfs_rinfo.rn_fastdivGCval, NULL); /* Disable Radar if not 2GHZ channel and not DFS */ rfilt &= ~HAL_RX_FILTER_PHYRADAR; ath_hal_setrxfilter(ah, rfilt); } } } else { /* Enable strong signal fast antenna diversity */ ath_hal_setcapability(ah, HAL_CAP_DIVERSITY, HAL_CAP_STRONG_DIV, dfs->dfs_rinfo.rn_fastdivGCval, NULL); /* Disable Radar if RADAR or AR not enabled */ rfilt &= ~HAL_RX_FILTER_PHYRADAR; ath_hal_setrxfilter(ah, rfilt); } return 0; }