Lines Matching refs:dpd

157 static void channel_detector_reset(struct dfs_pattern_detector *dpd,  in channel_detector_reset()  argument
163 for (i = 0; i < dpd->num_radar_types; i++) in channel_detector_reset()
164 cd->detectors[i]->reset(cd->detectors[i], dpd->last_pulse_ts); in channel_detector_reset()
168 static void channel_detector_exit(struct dfs_pattern_detector *dpd, in channel_detector_exit() argument
175 for (i = 0; i < dpd->num_radar_types; i++) { in channel_detector_exit()
185 channel_detector_create(struct dfs_pattern_detector *dpd, u16 freq) in channel_detector_create() argument
196 sz = sizeof(cd->detectors) * dpd->num_radar_types; in channel_detector_create()
201 for (i = 0; i < dpd->num_radar_types; i++) { in channel_detector_create()
202 const struct radar_detector_specs *rs = &dpd->radar_spec[i]; in channel_detector_create()
208 list_add(&cd->head, &dpd->channel_detectors); in channel_detector_create()
212 ath_dbg(dpd->common, DFS, in channel_detector_create()
214 channel_detector_exit(dpd, cd); in channel_detector_create()
228 channel_detector_get(struct dfs_pattern_detector *dpd, u16 freq) in channel_detector_get() argument
231 list_for_each_entry(cd, &dpd->channel_detectors, head) { in channel_detector_get()
235 return channel_detector_create(dpd, freq); in channel_detector_get()
243 static void dpd_reset(struct dfs_pattern_detector *dpd) in dpd_reset() argument
246 if (!list_empty(&dpd->channel_detectors)) in dpd_reset()
247 list_for_each_entry(cd, &dpd->channel_detectors, head) in dpd_reset()
248 channel_detector_reset(dpd, cd); in dpd_reset()
251 static void dpd_exit(struct dfs_pattern_detector *dpd) in dpd_exit() argument
254 if (!list_empty(&dpd->channel_detectors)) in dpd_exit()
255 list_for_each_entry_safe(cd, cd0, &dpd->channel_detectors, head) in dpd_exit()
256 channel_detector_exit(dpd, cd); in dpd_exit()
257 kfree(dpd); in dpd_exit()
261 dpd_add_pulse(struct dfs_pattern_detector *dpd, struct pulse_event *event) in dpd_add_pulse() argument
270 if (dpd->region == NL80211_DFS_UNSET) in dpd_add_pulse()
273 cd = channel_detector_get(dpd, event->freq); in dpd_add_pulse()
277 dpd->last_pulse_ts = event->ts; in dpd_add_pulse()
279 if (event->ts < dpd->last_pulse_ts) in dpd_add_pulse()
280 dpd_reset(dpd); in dpd_add_pulse()
283 for (i = 0; i < dpd->num_radar_types; i++) { in dpd_add_pulse()
287 ath_dbg(dpd->common, DFS, in dpd_add_pulse()
292 pd->reset(pd, dpd->last_pulse_ts); in dpd_add_pulse()
300 dpd_get_stats(struct dfs_pattern_detector *dpd) in dpd_get_stats() argument
305 static bool dpd_set_domain(struct dfs_pattern_detector *dpd, in dpd_set_domain() argument
311 if (dpd->region == region) in dpd_set_domain()
314 dpd->region = NL80211_DFS_UNSET; in dpd_set_domain()
321 if (!list_empty(&dpd->channel_detectors)) in dpd_set_domain()
322 list_for_each_entry_safe(cd, cd0, &dpd->channel_detectors, head) in dpd_set_domain()
323 channel_detector_exit(dpd, cd); in dpd_set_domain()
324 dpd->radar_spec = rt->radar_types; in dpd_set_domain()
325 dpd->num_radar_types = rt->num_radar_types; in dpd_set_domain()
327 dpd->region = region; in dpd_set_domain()
343 struct dfs_pattern_detector *dpd; in dfs_pattern_detector_init() local
348 dpd = kmalloc(sizeof(*dpd), GFP_KERNEL); in dfs_pattern_detector_init()
349 if (dpd == NULL) in dfs_pattern_detector_init()
352 *dpd = default_dpd; in dfs_pattern_detector_init()
353 INIT_LIST_HEAD(&dpd->channel_detectors); in dfs_pattern_detector_init()
355 dpd->common = common; in dfs_pattern_detector_init()
356 if (dpd->set_dfs_domain(dpd, region)) in dfs_pattern_detector_init()
357 return dpd; in dfs_pattern_detector_init()
360 kfree(dpd); in dfs_pattern_detector_init()