ath9k-workaround 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/sh
  2. check_stopped_queue(){
  3. local device=$1
  4. grep -q -E 'stopped: 1$' "${device}/queues"
  5. }
  6. get_tx_pkts() {
  7. local device=$1
  8. grep 'TX-Pkts-All' "${device}/xmit" \
  9. | sed -e 's/^TX-Pkts-All: *\([0-9]*\) .*$/\1/'
  10. }
  11. inc_fatal() {
  12. local qs=$(cat /tmp/ath9k_workaround_trigger 2>/dev/null || echo 0)
  13. expr ${qs} + 1 > /tmp/ath9k_workaround_trigger
  14. }
  15. check_ath9k_bug() {
  16. local device=$1
  17. check_stopped_queue $device && {
  18. local tx_first=$(get_tx_pkts $device)
  19. sleep 5
  20. check_stopped_queue $device && {
  21. local tx_second=$(get_tx_pkts $device)
  22. test $tx_first == $tx_second && {
  23. local hostname=$(uci get -q system.@system[0].hostname)
  24. echo "Hostname: ${hostname}"
  25. echo "------------ Trigger workaround: ${tx_first} -> ${tx_second} ----------------"
  26. echo "Model:"
  27. cat /tmp/sysinfo/model
  28. echo "Release:"
  29. cat /lib/gluon/release
  30. echo "Uptime:"
  31. uptime
  32. echo "Batctl Neighbours:"
  33. batctl o | grep wlan0-1
  34. echo "Queues:"
  35. cat $device/queues
  36. echo "Reset:"
  37. cat $device/reset
  38. echo "------------ Interupts #1 ---------------------------------------------------"
  39. cat $device/interrupt
  40. sleep 10
  41. echo "------------ Interupts #2 ---------------------------------------------------"
  42. cat $device/interrupt
  43. echo "Batctl Neighbours:"
  44. batctl o | grep wlan0-1
  45. #BE queue hangs
  46. inc_fatal
  47. wifi
  48. exit 1;
  49. }
  50. }
  51. }
  52. }
  53. for device in /sys/kernel/debug/ieee80211/phy*/ath9k ; do
  54. check_ath9k_bug $device
  55. done