How to enable debug print
-------------------------

Let dyndbgdir be /sys/kernel/debug/dynamic_debug. Do following:
$ sudo sh -c "echo 'module cfg80211 +p' > ${dyndbgdir}/control"
$ sudo sh -c "echo 'module mac80211 +p' > ${dyndbgdir}/control"
$ sudo sh -c "echo 'module scm80211 +p' > ${dyndbgdir}/control"

See Documentation/admin-guide/dynamic-debug-howto.rst


How to change printk loglevel
-----------------------------

$ sudo sh -c "echo 7 > /proc/sys/kernel/printk"

See https://elinux.org/Debugging_by_printing for more detail.


Wireshark
---------

For wiphy phy#X, wireshark creates phyX.mon, which can be used to monitor
frames.

Please note that wireshark gives more information if the capture
is made on the interface "hwsim0", because mac80211 monitor simplifies
the radiotap headers.

The hwsim0 can be enabled by either of the following:
$ sudo ifconfig hwsim0 up
$ sudo ip link set dev hwsim0 up

Wireshark can be invoked from the command line as follows:
$ wireshark -i hwsim0 -kn


dmesg
-----

$ dmesg -w


Kernel oops
-----------

https://opensourceforu.com/2011/01/understanding-a-kernel-oops


Kernel ftrace
-------------

$ trace-cmd record -e mac80211 -e cfg80211
$ kernelshark


Disable/enable wpa_supplicant
-----------------------------

$ sudo systemctl disable wpa_supplicant
$ sudo systemctl enable wpa_supplicant
This did not work. Instead, the following file is renamed
/usr/share/dbus-1/system-services/fi.w1.wpa_supplicant1.service

I haven't tried it myself, but the following command is worth trying
$ sudo service NetworkManager stop


How to get Ubuntu kernel source
-------------------------------

git clone git://kernel.ubuntu.com/ubuntu/ubuntu-disco.git


How to extract the list of functions that include wiphy_dbg()

$ insmod scm80211.ko dyndbg=+p
$ sudo sh -c "cat /sys/kernel/debug/dynamic_debug/control | grep mac80211\/main.c | cut -d ' ' -f2,2 | cut -d ']' -f2,2 | uniq"

