Opennet Firmware
always-enable-dfs.patch
gehe zur Dokumentation dieser Datei
1 Fix für defektes DFS von https://patchwork.kernel.org/patch/10986957/
2 Ermögliche selektiv das Aktivieren von DFS auch im Monitor Mode.
3 
4 Aktivieren
5 echo 1 > /sys/module/ath9k_hw/parameters/always_dfs
6 echo 1 > /sys/module/ath9k/parameters/always_dfs
7 
8 Deaktivieren
9 echo 0 > /sys/module/ath9k/parameters/always_dfs
10 echo 0 > /sys/module/ath9k_hw/parameters/always_dfs
11 
12 
13 Credits: Till und Kai-Uwe
14 
15 Index: on_firmware/openwrt/package/kernel/mac80211/patches/ath/498_always_enable_dfs.patch
16 ===================================================================
17 --- /dev/null
18 +++ on_firmware/openwrt/package/kernel/mac80211/patches/ath/498_always_enable_dfs.patch
19 @@ -0,0 +1,116 @@
20 +--- a/drivers/net/wireless/ath/ath9k/channel.c 2016-01-15 13:00:08.000000000 +0100
21 ++++ b/drivers/net/wireless/ath/ath9k/channel.c 2017-01-02 00:29:17.023553203 +0100
22 +@@ -80,7 +80,8 @@
23 + /* Enable radar pulse detection if on a DFS channel. Spectral
24 + * scanning and radar detection can not be used concurrently.
25 + */
26 +- if (hw->conf.radar_enabled) {
27 ++ if (hw->conf.radar_enabled || (ath9k_always_dfs == 1)) {
28 ++ ath_dbg(common, DFS, "RADAR detection enabled (" __FILE__ ", l. %d)\n", __LINE__);
29 + u32 rxfilter;
30 +
31 + rxfilter = ath9k_hw_getrxfilter(ah);
32 +--- a/drivers/net/wireless/ath/ath9k/dfs.c 2016-01-15 13:00:08.000000000 +0100
33 ++++ b/drivers/net/wireless/ath/ath9k/dfs.c 2017-01-02 00:30:52.159530173 +0100
34 +@@ -275,6 +275,9 @@
35 + static void
36 + ath9k_dfs_process_radar_pulse(struct ath_softc *sc, struct pulse_event *pe)
37 + {
38 ++ struct ath_hw *ah = sc->sc_ah;
39 ++ struct ath_common *common = ath9k_hw_common(ah);
40 ++
41 + struct dfs_pattern_detector *pd = sc->dfs_detector;
42 + DFS_STAT_INC(sc, pulses_processed);
43 + if (pd == NULL)
44 +@@ -282,7 +285,11 @@
45 + if (!pd->add_pulse(pd, pe))
46 + return;
47 + DFS_STAT_INC(sc, radar_detected);
48 ++if (ath9k_always_dfs == 0) {
49 + ieee80211_radar_detected(sc->hw);
50 ++} else {
51 ++ ath_dbg(common, DFS, "RADAR detection enabled, radar_detected suppressed (" __FILE__ ", l. %d)\n", __LINE__);
52 ++}
53 + }
54 +
55 + /*
56 +--- a/drivers/net/wireless/ath/ath9k/hw.c 2017-01-10 17:13:57.801668156 +0100
57 ++++ b/drivers/net/wireless/ath/ath9k/hw.c 2017-01-10 17:15:50.755896588 +0100
58 +@@ -37,6 +37,11 @@
59 + MODULE_SUPPORTED_DEVICE("Atheros 802.11n WLAN cards");
60 + MODULE_LICENSE("Dual BSD/GPL");
61 +
62 ++static int ath9k_hw_always_dfs = 0;
63 ++module_param_named(always_dfs, ath9k_hw_always_dfs, int, 0644);
64 ++MODULE_PARM_DESC(always_dfs, "Enable DFS messages in all modes");
65 ++
66 ++
67 + static void ath9k_hw_set_clockrate(struct ath_hw *ah)
68 + {
69 + struct ath_common *common = ath9k_hw_common(ah);
70 +@@ -2071,7 +2076,8 @@
71 + if (AR_SREV_9565(ah) && common->bt_ant_diversity)
72 + REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV, AR_BTCOEX_WL_LNADIV_FORCE_ON);
73 +
74 +- if (ah->hw->conf.radar_enabled) {
75 ++ if (ah->hw->conf.radar_enabled || (ath9k_hw_always_dfs == 1)) {
76 ++ ath_dbg(common, DFS, "RADAR detection enabled (" __FILE__ ", l. %d)\n", __LINE__);
77 + /* set HW specific DFS configuration */
78 + ah->radar_conf.ext_channel = IS_CHAN_HT40(chan);
79 + ath9k_hw_set_radar_params(ah);
80 +--- a/drivers/net/wireless/ath/ath9k/recv.c 2016-01-15 13:00:08.000000000 +0100
81 ++++ b/drivers/net/wireless/ath/ath9k/recv.c 2017-01-02 00:32:21.347509158 +0100
82 +@@ -384,8 +384,10 @@
83 + | ATH9K_RX_FILTER_MCAST;
84 +
85 + /* if operating on a DFS channel, enable radar pulse detection */
86 +- if (sc->hw->conf.radar_enabled)
87 ++ if (sc->hw->conf.radar_enabled || (ath9k_always_dfs == 1)) {
88 ++ ath_dbg(common, DFS, "RADAR detection enabled (" __FILE__ ", l. %d)\n", __LINE__);
89 + rfilt |= ATH9K_RX_FILTER_PHYRADAR | ATH9K_RX_FILTER_PHYERR;
90 ++ }
91 +
92 + spin_lock_bh(&sc->chan_lock);
93 +
94 +@@ -815,6 +817,7 @@
95 + struct ath_common *common = ath9k_hw_common(ah);
96 + struct ieee80211_hdr *hdr;
97 + bool discard_current = sc->rx.discard_next;
98 ++ bool is_phyerr;
99 +
100 + /*
101 + * Discard corrupt descriptors which are marked in
102 +@@ -827,8 +830,11 @@
103 +
104 + /*
105 + * Discard zero-length packets and packets smaller than an ACK
106 ++ * which are not PHY_ERROR (short radar pulses have a length of 3)
107 + */
108 +- if (rx_stats->rs_datalen < 10) {
109 ++ is_phyerr = rx_stats->rs_status & ATH9K_RXERR_PHY;
110 ++ if (!rx_stats->rs_datalen ||
111 ++ (rx_stats->rs_datalen < 10 && !is_phyerr)) {
112 + RX_STAT_INC(rx_len_err);
113 + goto corrupt;
114 + }
115 +--- a/drivers/net/wireless/ath/ath9k/init.c 2017-01-06 22:11:58.251673645 +0100
116 ++++ b/drivers/net/wireless/ath/ath9k/init.c 2017-01-06 22:36:34.600625015 +0100
117 +@@ -45,6 +45,10 @@
118 + module_param_named(nohwcrypt, ath9k_modparam_nohwcrypt, int, 0444);
119 + MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption");
120 +
121 ++int ath9k_always_dfs = 0;
122 ++module_param_named(always_dfs, ath9k_always_dfs, int, 0644);
123 ++MODULE_PARM_DESC(always_dfs, "Enforce RADAR detection on all channels, disrupt DFS");
124 ++
125 + int ath9k_led_blink = 1;
126 + module_param_named(blink, ath9k_led_blink, int, 0444);
127 + MODULE_PARM_DESC(blink, "Enable LED blink on activity");
128 +--- a/drivers/net/wireless/ath/ath9k/ath9k.h 2017-01-06 22:11:00.163648461 +0100
129 ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h 2017-01-06 22:11:49.267669620 +0100
130 +@@ -38,6 +38,7 @@
131 + extern int led_blink;
132 + extern bool is_ath9k_unloaded;
133 + extern int ath9k_use_chanctx;
134 ++extern int ath9k_always_dfs;
135 +
136 + /*************************/