qca / open-ath9k-htc-firmware

The firmware for QCA AR7010/AR9271 802.11n USB NICs
Other
429 stars 182 forks source link

AR9271 stops receiving packets after several seconds to a several hours on monitor mode on any given channel, on every OS and card #126

Open melyux opened 7 years ago

melyux commented 7 years ago

Both the current and previous version seem to have the issue. After anywhere from 20 seconds to 3 hours or so of being in monitor mode, the interface stops receiving packets. It seems to die more quickly during busier times when it receives more packets. The ifconfig count stops increasing, and the driver debug debug_fs numbers also become static. The only way to get it to receive again is to change the channel (changing to another channel and then immediately switching back works; I don't know whether the card is slipping to a non-WiFi frequency or something, since iw still reports it as being on the same frequency as it was before, and it makes no changes to the frequency if it thinks the card is already on the channel that is specified). It doesn't seem to be able to stay on one channel for very long.

I've tried this with several Atheros AR9271 chipset cards, like the ALFA AWUS036NHA and TP-Link TL-WN722N. They all have the same issue. I've tried it on Debian, Kali, Raspbian, Raspbian Lite, and Arch, and I've gotten identical behavior. I've tried a powered USB hub, an unpowered hub, and no hub at all. I've tried it on a MacBook, a Virtual Machine, a Mac Mini, a Raspberry Pi, and a Pi Zero. I've tried it with all sorts of different antenna. I've tried power supplies of various amperages. I've tried it with all other processes killed. I've switched intermediary USB cables around and gotten rid of them altogether. Power save is off in both module parameters and in iw.

dmesg and syslog show no errors or events when this happens. The packets just silently stop coming in until the channel is changed. The activity LED on the cards stop blinking and turn solid. Other non-Atheros wireless adapters work fine on every system for weeks on an end without stopping packet reception.

To reproduce, put any AR9271 wireless card into monitor mode and take it into a relatively crowded area. Don't change the channel (or do it, it might die faster if you do, it's Russian roulette). It may take seconds or hours, but it is guaranteed to stop receiving packets indefinitely after a certain point within the day.

erikarn commented 7 years ago

heh, send me a diff :)

-adrian

On 8 May 2017 at 19:59, zimiao815 notifications@github.com wrote:

thank you all,I according to your explanation,Modify the code,The original short time is deaf。Can now listen to 10 hours more。 Have the effect !!! According to the following debug information I should do next???? thank you very mach

device:AR9271USB `

[321921.310000] ath: phy21: ath9k_htc_ani_work()----------debug for me [321921.310000] ath: phy21: shortcal @3216213 https://github.com/qca/open-ath9k-htc-firmware/commit/32162131 [321921.310000] ath: phy21: listenTime=22232025 OFDM:1 errs=99/s CCK:5 errs=150/s ofdm_turn=1 [321921.410000] ath: phy21: ath9k_htc_ani_work() [321921.410000] ath: phy21: listenTime=22232122 OFDM:1 errs=99/s CCK:5 errs=150/s ofdm_turn=1 [321921.510000] ath: phy21: ath9k_htc_ani_work() [321921.510000] ath: phy21: listenTime=22232219 OFDM:1 errs=99/s CCK:5 errs=150/s ofdm_turn=1 [321921.610000] ath: phy21: ath9k_htc_ani_work() [321921.610000] ath: phy21: listenTime=22232316 OFDM:1 errs=99/s CCK:5 errs=150/s ofdm_turn=1 [321921.710000] ath: phy21: ath9k_htc_ani_work() [321921.710000] ath: phy21: listenTime=22232413 OFDM:1 errs=99/s CCK:5 errs=150/s ofdm_turn=1 root@MARKNUM:~# ifconfig mon21 mon21 Link encap:UNSPEC HWaddr 00-12-7B-20-55-C8-7F-86-00-00- 00-00-00-00-00-00 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:34265001 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:8844607858 (8.2 GiB) TX bytes:0 (0.0 B)

root@MARKNUM:~# ifconfig mon21 mon21 Link encap:UNSPEC HWaddr 00-12-7B-20-55-C8-7F-BA-00-00- 00-00-00-00-00-00 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:34265001 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:8844607858 (8.2 GiB) TX bytes:0 (0.0 B) `

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/qca/open-ath9k-htc-firmware/issues/126#issuecomment-300048062, or mute the thread https://github.com/notifications/unsubscribe-auth/ABGl7WwbOVRejK_O104UuYiV7fKDGc01ks5r39aogaJpZM4MKxUF .

zimiao815 commented 7 years ago

/drivers/net/wireless/ath/ath9k/htc_drv_main.c

--- /drivers/net/wireless/ath/ath9k/htc_drv_main.c 2017-05-04 18:40:15.596674578 +0800 +++ /drivers/net/wireless/ath/ath9k/htc_drv_main.c 2017-05-05 19:04:01.286877126 +0800 @@ -421,7 +421,7 @@ priv->nstations++; priv->vif_sta_pos[priv->mon_vif_idx] = sta_idx; priv->ah->is_monitoring = true;

zimiao815 commented 7 years ago

@erikarn but a long time will still be in the future is deaf。should do ?
I will not use GitHub,patch format is not correct point is + Please let me know if you need more dmesg information

[ 3140.990000] ath: phy4: shortcal @284099 [ 3140.990000] ath: phy4: listenTime=97 OFDM:0 errs=0/s CCK:0 errs=0/s ofdm_turn=1 [ 3140.990000] ath: phy4: Calibration @284099 finished: ani, caldone: 0 [ 3140.990000] ath: phy4: Calibration HTC caldone_false_count: 0

[ 3141.090000] ath: phy4: listenTime=194 OFDM:0 errs=0/s CCK:0 errs=0/s ofdm_turn=1 [ 3141.090000] ath: phy4: Calibration @284109 finished: ani, caldone: 0 [ 3141.090000] ath: phy4: Calibration HTC caldone_false_count: 0

[ 3141.190000] ath: phy4: listenTime=291 OFDM:0 errs=0/s CCK:0 errs=0/s ofdm_turn=1 [ 3141.190000] ath: phy4: Calibration @284119 finished: ani, caldone: 0 [ 3141.190000] ath: phy4: Calibration HTC caldone_false_count: 0

[ 3141.290000] ath: phy4: listenTime=388 OFDM:0 errs=0/s CCK:0 errs=0/s ofdm_turn=1 [ 3141.290000] ath: phy4: Calibration @284129 finished: ani, caldone: 0 [ 3141.290000] ath: phy4: Calibration HTC caldone_false_count: 0

[ 3141.390000] ath: phy4: listenTime=97 OFDM:0 errs=0/s CCK:0 errs=0/s ofdm_turn=0 [ 3141.390000] ath: phy4: Calibration @284139 finished: ani, caldone: 0 [ 3141.390000] ath: phy4: Calibration HTC caldone_false_count: 0

[ 3141.490000] ath: phy4: listenTime=194 OFDM:0 errs=0/s CCK:0 errs=0/s ofdm_turn=0 [ 3141.490000] ath: phy4: Calibration @284149 finished: ani, caldone: 0 [ 3141.490000] ath: phy4: Calibration HTC caldone_false_count: 0

[ 3141.590000] ath: phy4: listenTime=291 OFDM:0 errs=0/s CCK:0 errs=0/s ofdm_turn=0 [ 3141.590000] ath: phy4: Calibration @284159 finished: ani, caldone: 0 [ 3141.590000] ath: phy4: Calibration HTC caldone_false_count: 0

[ 3141.690000] ath: phy4: listenTime=389 OFDM:0 errs=0/s CCK:0 errs=0/s ofdm_turn=0 [ 3141.690000] ath: phy4: Calibration @284169 finished: ani, caldone: 0 [ 3141.690000] ath: phy4: Calibration HTC caldone_false_count: 0

rodizio1 commented 7 years ago

I've tried this now, seems to work. That is, ANI seems to be enabled, I get periodic log messages when debug is enabled. Haven't had time yet to do any real-world testing though.

I've tried creating a patch using this commandline:

diff -u drivers/net/wireless/ath/ath9k/htc_drv_main.c drivers/net/wireless/ath/ath9k/htc_drv_main.c.ani 
--- drivers/net/wireless/ath/ath9k/htc_drv_main.c   2017-06-18 15:46:27.000000000 +0200
+++ drivers/net/wireless/ath/ath9k/htc_drv_main.c.ani   2017-06-18 15:58:22.763173760 +0200
@@ -771,6 +771,8 @@

    ieee80211_queue_delayed_work(common->hw, &priv->ani_work,
                     msecs_to_jiffies(ATH_ANI_POLLINTERVAL));
+   schedule_work(&priv->ani_work);
+   ath_dbg(common, ANI, "ath9k_htc_start_ani()\n");
 }

 void ath9k_htc_stop_ani(struct ath9k_htc_priv *priv)
@@ -1260,6 +1262,9 @@
                       priv->txpowlimit, &priv->curtxpow);
    }

+   ath_dbg(common, ANI,"ath_htc: MONITOR is start\n");
+   ath9k_htc_start_ani(priv);
+
 out:
    ath9k_htc_ps_restore(priv);
    mutex_unlock(&priv->mutex);

However, when I try to apply it, I get this:

patch -p0 < ani.patch 
patching file drivers/net/wireless/ath/ath9k/htc_drv_main.c
Hunk #1 FAILED at 771.
Hunk #2 succeeded at 1260 with fuzz 2.
1 out of 2 hunks FAILED -- saving rejects to file drivers/net/wireless/ath/ath9k/htc_drv_main.c.rej

Sorry, don't have time to bother with this 1970ies unix software weirdness now, maybe somebody else can create a proper patch.